Testing Data Flows of VTN Manager in CSIT. 47/27947/12
authorpriya.ramasubbu <priya.ramasubbu@hcl.com>
Tue, 6 Oct 2015 12:34:17 +0000 (18:04 +0530)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 13 Oct 2015 17:10:27 +0000 (17:10 +0000)
    * Add new robot files to test portmapping data flow functionality
    * Add new robot files to test vlanmapping data flow functionality

Change-Id: I958eba37c41cb79f0e3f583b1221e7badd57dd6d
Signed-off-by: priya.ramasubbu <priya.ramasubbu@hcl.com>
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
Signed-off-by: priya.ramasubbu <priya.ramasubbu@hcl.com>
csit/libraries/VtnMaKeywords.robot
csit/suites/vtn/VTN_Mgr_OF13/010__vtn_manager_dataflow.robot [new file with mode: 0644]
csit/suites/vtn/VTN_Mgr_OF13/010__vtn_vlanmap_dataflow.robot [new file with mode: 0644]

index 5ed9fc65d8e606a07bf442674d8a14c0e79a2151..dd53a0a83b45c8d812d0372210a341325b5bf470 100644 (file)
@@ -17,8 +17,12 @@ ${VTN_INVENTORY}    restconf/operational/vtn-inventory:vtn-nodes
 ${DUMPFLOWS}      dpctl dump-flows -O OpenFlow13
 ${index}          7
 @{FLOWELMENTS}    nw_src=10.0.0.1    nw_dst=10.0.0.3    actions=drop
+@{BRIDGE1_DATAFLOW}    "reason":"PORTMAPPED"    "path":{"tenant":"Tenant1","bridge":"vBridge1","interface":"if2"}
+@{BRIDGE2_DATAFLOW}    "reason":"PORTMAPPED"    "path":{"tenant":"Tenant1","bridge":"vBridge2","interface":"if3"}
 ${vlanmap_bridge1}    {"vlan": "200"}
 ${vlanmap_bridge2}    {"vlan": "300"}
+@{VLANMAP_BRIDGE1_DATAFLOW}    "reason":"VLANMAPPED"    "path":{"tenant":"Tenant1","bridge":"vBridge1_vlan"}
+@{VLANMAP_BRIDGE2_DATAFLOW}    "reason":"VLANMAPPED"    "path":{"tenant":"Tenant1","bridge":"vBridge2_vlan"}
 ${pathpolicy_topo}    sudo mn --controller=remote,ip=${CONTROLLER} --custom topo-3sw-2host_multipath.py --topo pathpolicytopo --switch ovsk,protocols=OpenFlow13
 @{PATHMAP_ATTR}    "index":"1"    "condition":"flowcond_path"    "policy":"1"
 ${policy_id}      1
@@ -87,6 +91,21 @@ Add a portmap
     ${resp}=    RequestsLibrary.Put    session    ${REST_CONTEXT_VTNS}/${vtn_name}/vbridges/${vBridge_name}/interfaces/${interface_name}/portmap    data=${json_data}    headers=${HEADERS}
     Should Be Equal As Strings    ${resp.status_code}    200
 
+Verify Data Flows
+    [Arguments]    ${vtn_name}    ${vBridge_name}
+    [Documentation]    Verify the reason and physical data flows for the specified vtn and vbridge
+    ${resp}=    RequestsLibrary.Get   session    ${REST_CONTEXT_VTNS}/${vtn_name}/flows/detail
+    Run Keyword If    '${vBridge_name}' == 'vBridge1'    DataFlowsForBridge    ${resp}    @{BRIDGE1_DATAFLOW}
+    ...    ELSE IF    '${vBridge_name}' == 'vBridge2'    DataFlowsForBridge    ${resp}    @{BRIDGE2_DATAFLOW}
+    ...    ELSE IF    '${vBridge_name}' == 'vBridge1_vlan'    DataFlowsForBridge    ${resp}    @{VLANMAP_BRIDGE1_DATAFLOW}
+    ...    ELSE    DataFlowsForBridge    ${resp}    @{VLANMAP_BRIDGE2_DATAFLOW}
+
+DataFlowsForBridge
+    [Documentation]    Verify whether the required attributes exists.
+    [Arguments]   ${resp}    @{BRIDGE_DATAFLOW}
+    : FOR    ${dataflowElement}    IN    @{BRIDGE_DATAFLOW}
+    \    should Contain    ${resp.content}    ${dataflowElement}
+
 Add a pathmap
     [Arguments]    ${pathmap_data}
     [Documentation]    Create a pathmap for a vtn
diff --git a/csit/suites/vtn/VTN_Mgr_OF13/010__vtn_manager_dataflow.robot b/csit/suites/vtn/VTN_Mgr_OF13/010__vtn_manager_dataflow.robot
new file mode 100644 (file)
index 0000000..90ca2be
--- /dev/null
@@ -0,0 +1,110 @@
+*** Settings ***
+Documentation     Test suite for VTN Manager Data Flow using OF13
+Suite Setup       Start SuiteVtnMaTest
+Suite Teardown    Stop SuiteVtnMaTest
+Resource          ../../../libraries/VtnMaKeywords.robot
+
+*** Test Cases ***
+Check if switch1 detected
+    [Documentation]    Check if openflow:1 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    12     3    Fetch vtn switch inventory     openflow:1
+
+Check if switch2 detected
+    [Documentation]    Check if openflow:2 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:2
+
+Check if switch3 detected
+    [Documentation]    Check if openflow:3 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:3
+
+Add a vtn Tenant1
+    [Documentation]    Add a vtn Tenant1
+    Add a vtn    Tenant1    {"idleTimeout": "200","hardTimeout": "600","description": "Virtual Tenant1 for Hackfest network"}
+
+Add a vBridge vBridge1
+    [Documentation]    Add a vBridge vBridge1 in vtn Tenant1
+    Add a vBridge    Tenant1    vBridge1    {"ageInterval": "300","description": "vBridge1 for Tenant1"}
+
+Add a interface If1
+    [Documentation]    Add a interface if1 into vBridge vBridge1
+    Add a interface    Tenant1    vBridge1    if1    {"enabled": "true","description": "Interface1 for vBridge1 for Tenant1"}
+
+Add a interface if2
+    [Documentation]    Add a interface if2 into vBridge vBridge1
+    Add a interface    Tenant1    vBridge1    if2    {"enabled": "true","description": "Interface2 for vBridge1 for Tenant1"}
+
+Add a portmap for interface if1
+    [Documentation]    Create a portmap on Interface if1 of vBridge1
+    ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:02
+    ${port}    Create Dictionary    name=s2-eth1
+    ${portmap_data}    Create Dictionary    node=${node}    port=${port}
+    Add a portmap    Tenant1    vBridge1    if1    ${portmap_data}
+
+Add a portmap for interface if2
+    [Documentation]    Create a portmap on Interface if2 of vBridge1
+    ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:03
+    ${port}    Create Dictionary    name=s3-eth1
+    ${portmap_data}    Create Dictionary    node=${node}    port=${port}
+    Add a portmap    Tenant1    vBridge1    if2    ${portmap_data}
+
+Ping h1 to h3
+    [Documentation]    Ping h1 to h3, verify no packet loss
+    Mininet Ping Should Succeed     h1     h3
+
+Verify data flow details For vBridge1
+    [Documentation]    Verify the data flows for the specified tenant and bridge
+    Verify Data Flows    Tenant1    vBridge1
+
+Add a vBridge vBridge2
+    [Documentation]    Add a vBridge vBridge2 in vtn Tenant1
+    Add a vBridge    Tenant1    vBridge2    {}
+
+Add a interface If3
+    [Documentation]    Add a interface if3 into vBrdige vBridge1
+    Add a interface    Tenant1    vBridge2    if3    {}
+
+Add a interface if4
+    [Documentation]    Add a interface if4 into vBrdige vBridge1
+    Add a interface    Tenant1    vBridge2    if4    {}
+
+Add a portmap for interface if3
+    [Documentation]    Create a portmap on Interface if3 of vBridge1
+    ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:02
+    ${port}    Create Dictionary    name=s2-eth2
+    ${portmap_data}    Create Dictionary    node=${node}    port=${port}
+    Add a portmap    Tenant1    vBridge2    if3    ${portmap_data}
+
+Add a portmap for interface if4
+    [Documentation]    Create a portmap on Interface if4 of vBridge1
+    ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:03
+    ${port}    Create Dictionary    name=s3-eth2
+    ${portmap_data}    Create Dictionary    node=${node}    port=${port}
+    Add a portmap    Tenant1    vBridge2    if4    ${portmap_data}
+
+Ping h2 to h4
+    [Documentation]    Ping h2 to h4, verify no packet loss
+    Mininet Ping Should Succeed     h2     h4
+
+Verify data flow details for vBridge2
+    [Documentation]    Verify the data flows for the specified tenant and bridge
+    Verify Data Flows    Tenant1    vBridge2
+
+Verify FlowMacAddress
+    [Documentation]    Checking Flows on switch
+    [Tags]    Switch
+    Verify FlowMacAddress    h2    h4
+
+Remove Portmap for If1
+    [Documentation]    Remove portmap for the interface If1
+    ${node}    Create Dictionary    type=OF    id=00:00:00:00:00:00:00:02
+    ${port}    Create Dictionary    name=s2-eth1
+    ${portmap_data}    Create Dictionary    node=${node}    port=${port}
+    Remove a portmap    Tenant1    vBridge1    if1    ${portmap_data}
+
+Verify RemovedFlowMacAddress
+    [Documentation]    flows will be deleted after the port map is removed
+    Verify RemovedFlowMacAddress    h1    h3
+
+Delete a vtn Tenant1
+    [Documentation]    Delete a vtn Tenant1
+    Delete a vtn    Tenant1
diff --git a/csit/suites/vtn/VTN_Mgr_OF13/010__vtn_vlanmap_dataflow.robot b/csit/suites/vtn/VTN_Mgr_OF13/010__vtn_vlanmap_dataflow.robot
new file mode 100644 (file)
index 0000000..33a8488
--- /dev/null
@@ -0,0 +1,74 @@
+*** Settings ***
+Documentation     Test suite for VTN Manager Data Flows using OF13
+Suite Setup       Start SuiteVtnMaTest
+Suite Teardown    Stop SuiteVtnMaTest
+Resource          ../../../libraries/VtnMaKeywords.robot
+
+*** Test Cases ***
+Start topology
+    [Documentation]    Add a vlan topology
+     Start vlan_topo
+
+Check if switch1 detected
+    [Documentation]    Check if openflow:1 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    12     3    Fetch vtn switch inventory     openflow:1
+
+Check if switch2 detected
+    [Documentation]    Check if openflow:2 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:2
+
+Check if switch3 detected
+    [Documentation]    Check if openflow:3 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3     1    Fetch vtn switch inventory     openflow:3
+
+Add a vtn Tenant1
+    [Documentation]    Add a vtn Tenant1
+    Add a vtn    Tenant1    {}
+
+Add a vBridge vBridge1_vlan
+    [Documentation]    Add a vBridge vBridge1_vlan in vtn Tenant1
+    Add a vBridge    Tenant1    vBridge1_vlan    {}
+
+Add a vlanmap for vBridge1_vlan
+    [Documentation]    Add a Vlanmap for vBridge1_vlan in vtn Tenant1
+    Add a vlanmap    Tenant1    vBridge1_vlan    ${vlanmap_bridge1}
+
+Add a vBridge vBridge2_vlan
+    [Documentation]    Add a vBridge vBridge2_vlan in vtn Tenant1
+    Add a vBridge    Tenant1    vBridge2_vlan    {}
+
+Add a vlanmap for vBridge2_vlan
+    [Documentation]    Add a Vlanmap for vBridge2_vlan in vtn Tenant1
+    Add a vlanmap    Tenant1    vBridge2_vlan    ${vlanmap_bridge2}
+
+Get vlanflow h1 h3
+    [Documentation]    ping h1 to h3
+    Wait Until Keyword Succeeds    10s    2s    Mininet Ping Should Succeed    h1    h3
+
+Get vlanflow h1 h5
+    [Documentation]    ping h1 to h5
+    Wait Until Keyword Succeeds    10s    2s    Mininet Ping Should Succeed    h1    h5
+
+Verify data flow details for vlanmap vBridge1_vlan
+    [Documentation]    Verify the data flows for the specified tenant and vBridge1_vlan
+    Verify Data Flows    Tenant1    vBridge1_vlan
+
+Get vlanflow h2 h4
+    [Documentation]    ping h2 to h4
+    Wait Until Keyword Succeeds    10s    2s    Mininet Ping Should Succeed    h2    h4
+
+Get vlanflow h2 h6
+    [Documentation]    ping h2 to h6
+    Wait Until Keyword Succeeds    10s    2s    Mininet Ping Should Succeed    h2    h6
+
+Verify data flow details for vlanmap vBridge2_vlan
+    [Documentation]    Verify the data flows for the specified tenant and vBridge2_vlan
+    Verify Data Flows    Tenant1    vBridge2_vlan
+
+Get vlanflow h2 h5
+   [Documentation]    ping h2 to h5
+    Mininet Ping Should Not Succeed    h2    h5
+
+Delete a vtn Tenant1
+    [Documentation]    Delete a vtn Tenant1
+    Delete a vtn    Tenant1