Second Network Addition For Suite1 69/55869/5
authorabbas <abbas.pareedkunju@tcs.com>
Mon, 24 Apr 2017 07:13:55 +0000 (00:13 -0700)
committerJamo Luhrsen <jluhrsen@redhat.com>
Wed, 26 Apr 2017 00:10:19 +0000 (00:10 +0000)
Change-Id: I928016d62df8b5d3c725216fb8efb71aebe432eb
Signed-off-by: abbas <abbas.pareedkunju@tcs.com>
csit/libraries/L2GatewayOperations.robot
csit/suites/l2gw/01_Configure_verify_l2gateway.robot [moved from csit/suites/l2gw/Configure_verify_l2gateway.robot with 60% similarity]
csit/suites/l2gw/__init__.robot
csit/variables/l2gw/Variables.robot

index ccfdaa3b564688dabc4ebb18df97350a9451122d..4af6d06362013d6609742f0129b809104a68e558 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation     L2Gateway Operations Library. This library has useful keywords for various actions on Hwvtep and Ovs connectivity. Most of the keywords expects that ovs_conn_id, hwvtep_conn_id and devstack_conn_id are available.
+Documentation     L2Gateway Operations Library. This library has useful keywords for various actions on Hwvtep and Ovs connectivity. Most of the keywords expects that ovs_conn_id,ovs2_conn_id, hwvtep_conn_id, hwvtep2_conn_id and devstack_conn_id are available.
 Library           SSHLibrary
 Library           Collections
 Library           RequestsLibrary
@@ -17,30 +17,31 @@ ${L2GW_VAR_BASE}    ${CURDIR}/../variables/l2gw
 
 *** Keywords ***
 Add Ovs Bridge Manager Controller And Verify
-    [Documentation]    Keyword to set OVS manager and controller to ${ODL_IP} for the OVS IP connected in ${ovs_conn_id} and verify the entries in OVSDB NETWORK TOPOLOGY and NETSTAT results.
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_RESTART}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_DEL_MGR}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_DEL_CTRLR} ${OVS_BRIDGE}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${DEL_OVS_BRIDGE} ${OVS_BRIDGE}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_SHOW}
+    [Arguments]    ${conn_id}=${ovs_conn_id}    ${hwvtep_bridge}=${HWVTEP_BRIDGE}
+    [Documentation]    Keyword to set OVS manager and controller to ${ODL_IP} for the OVS IP connected in ${conn_id} and verify the entries in OVSDB NETWORK TOPOLOGY and NETSTAT results.
+    ${output}=    Exec Command    ${conn_id}    ${OVS_RESTART}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_DEL_MGR}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_DEL_CTRLR} ${OVS_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${DEL_OVS_BRIDGE} ${OVS_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_SHOW}
     Should Not Contain    ${output}    Manager
     Should Not Contain    ${output}    Controller
-    ${output}=    Exec Command    ${ovs_conn_id}    ${CREATE_OVS_BRIDGE} ${OVS_BRIDGE}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${SET_FAIL_MODE} ${OVS_BRIDGE} secure
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_SET_MGR}:${ODL_IP}:${OVSDBPORT}
-    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_SET_CTRLR} ${OVS_BRIDGE} tcp:${ODL_IP}:${ODL_OF_PORT}
-    Wait Until Keyword Succeeds    60s    2s    Verify Strings In Command Output    ${ovs_conn_id}    ${OVS_SHOW}    Manager "tcp:${ODL_IP}:${OVSDBPORT}"
+    ${output}=    Exec Command    ${conn_id}    ${CREATE_OVS_BRIDGE} ${OVS_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${SET_FAIL_MODE} ${OVS_BRIDGE} secure
+    ${output}=    Exec Command    ${conn_id}    ${OVS_SET_MGR}:${ODL_IP}:${OVSDBPORT}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_SET_CTRLR} ${OVS_BRIDGE} tcp:${ODL_IP}:${ODL_OF_PORT}
+    Wait Until Keyword Succeeds    60s    2s    Verify Strings In Command Output    ${conn_id}    ${OVS_SHOW}    Manager "tcp:${ODL_IP}:${OVSDBPORT}"
     ...    Controller "tcp:${ODL_IP}:${ODL_OF_PORT}"
-    ${output}=    Exec Command    ${ovs_conn_id}    ${NETSTAT}
+    ${output}=    Exec Command    ${conn_id}    ${NETSTAT}
     Wait Until Keyword Succeeds    30s    2s    Validate Regexp In String    ${output}    ${NETSTAT_OVSDB_REGEX}
     Wait Until Keyword Succeeds    30s    2s    Validate Regexp In String    ${output}    ${NETSTAT_OF_REGEX}
-    @{list_to_check}=    Create List    bridge/${OVS_BRIDGE}    bridge/${HWVTEP_BRIDGE}
+    @{list_to_check}=    Create List    bridge/${OVS_BRIDGE}    bridge/${hwvtep_bridge}
     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${OVSDB_NETWORK_TOPOLOGY}    ${list_to_check}    session
 
 Create Itm Tunnel Between Hwvtep and Ovs
-    [Arguments]    ${ovs_ip}
-    [Documentation]    Keyword to create ITM Tunnel Between HWVTEP and OVS connection in ${ovs_conn_id}.
-    ${dpn_id}=    Get Dpnid Decimal    ${ovs_conn_id}
+    [Arguments]    ${ovs_id}    ${ovs_ip}
+    [Documentation]    Keyword to create ITM Tunnel Between HWVTEP and OVS connection in ${ovs_id}.
+    ${dpn_id}=    Get Dpnid Decimal    ${ovs_id}
     ${first_two_octets}    ${third_octet}    ${last_octet}=    Split String From Right    ${ovs_ip}    .    2
     ${prefix} =    Set Variable    ${first_two_octets}.0.0/24
     TemplatedRequests.Post_As_Json_Templated    folder=${L2GW_VAR_BASE}/itm_create    mapping={"dpnid":"${dpn_id}","ip":"${ovs_ip}","prefix":"${prefix}"}    session=session
@@ -48,14 +49,14 @@ Create Itm Tunnel Between Hwvtep and Ovs
     Log    ${output}
 
 Add Vtep Manager And Verify
-    [Arguments]    ${odl_ip}
-    [Documentation]    Keyword to add vtep manager for HWVTEP connected in ${hwvtep_conn_id} as ${odl_ip} received in argument and verify the entries in NETSTAT and HWVTEP NETWORK TOPOLOGY.
+    [Arguments]    ${odl_ip}    ${conn_id}=${hwvtep_conn_id}
+    [Documentation]    Keyword to add vtep manager for HWVTEP connected in ${conn_id} as ${odl_ip} received in argument and verify the entries in NETSTAT and HWVTEP NETWORK TOPOLOGY.
     ${set_manager_command}=    Set Variable    ${VTEP_ADD_MGR}:${odl_ip}:${OVSDBPORT}
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${set_manager_command}
+    ${output}=    Exec Command    ${conn_id}    ${set_manager_command}
     Log    ${output}
     @{list_to_verify}=    Create List    ${odl_ip}    state=ACTIVE
-    Wait Until Keyword Succeeds    60s    2s    Verify Vtep List    ${MANAGER_TABLE}    @{list_to_verify}
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETSTAT}
+    Wait Until Keyword Succeeds    60s    2s    Verify Vtep List    ${conn_id}    ${MANAGER_TABLE}    @{list_to_verify}
+    ${output}=    Exec Command    ${conn_id}    ${NETSTAT}
     Should Contain    ${output}    ${OVSDBPORT}
     @{list_to_check}=    Create List    ${odl_ip}
     Utils.Check For Elements At URI    ${HWVTEP_NETWORK_TOPOLOGY}    ${list_to_check}    session
@@ -122,23 +123,17 @@ Update Port For Hwvtep
     [Return]    ${return}
 
 Attach Port To Hwvtep Namespace
-    [Arguments]    ${port_mac}    ${ns_name}    ${tap_name}
+    [Arguments]    ${port_mac}    ${ns_name}    ${tap_name}    ${conn_id}=${hwvtep_conn_id}
     [Documentation]    Keyword to assign the ${port_mac} to the tap port ${tap_name} in namespace ${ns_name}
-    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF} ${tap_name} ${HW_ETHER} ${port_mac}
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}
+    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF} ${tap_name} ${HW_ETHER} ${port_mac}
+    ${output}=    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}
     Should Contain    ${output}    ${port_mac}
 
 Namespace Dhclient Verify
-    [Arguments]    ${ns_name}    ${ns_tap}    ${ns_port_ip}
+    [Arguments]    ${ns_name}    ${ns_tap}    ${ns_port_ip}    ${conn_id}=${hwvtep_conn_id}    ${hwvtep_ip}=${HWVTEP_IP}
     [Documentation]    Keyword to run dhclient for the tap port ${ns_tap} and verify if it has got assigned with ${ns_port_ip}.
-    Start Command In Hwvtep    ${NETNS_EXEC} ${ns_name} dhclient ${ns_tap}
-    Wait Until Keyword Succeeds    60s    2s    Verify Strings In Command Output    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}    ${ns_port_ip}
-
-Namespace Static Ip Assign
-    [Arguments]    ${ns_name}    ${ns_tap}    ${ns_port_ip}
-    [Documentation]    Keyword to assign IP address to TAP port manually
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF} ${ns_tap} ${ns_port_ip}/24 UP
-    Log    ${output}
+    Start Command In Hwvtep    ${NETNS_EXEC} ${ns_name} dhclient ${ns_tap}    ${hwvtep_ip}
+    Wait Until Keyword Succeeds    60s    2s    Verify Strings In Command Output    ${conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}    ${ns_port_ip}
 
 Verify Strings In Command Output
     [Arguments]    ${conn_id}    ${command}    @{string_list}
@@ -147,28 +142,27 @@ Verify Strings In Command Output
     : FOR    ${item}    IN    @{string_list}
     \    Should Contain    ${output}    ${item}
 
-Verify Ping In Namespace Background
-    [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}
-    [Documentation]    Keyword to ping the IP ${vm_ip} from ${ns_name} and verify MCAS Local Table contains ${ns_port_mac}.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}
-    Log    ${output}
-    Start Command In Hwvtep    ${NETNS_EXEC} ${ns_name} ping ${vm_ip}
-    Wait Until Keyword Succeeds    30s    2s    Verify Mcas Local Table While Ping    ${ns_port_mac}
-
 Verify Ping In Namespace Extra Timeout
-    [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}
+    [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}    ${conn_id}=${hwvtep_conn_id}    ${hwvtep_ip}=${HWVTEP_IP}
     [Documentation]    Keyword to ping the IP ${vm_ip} from ${ns_name} and verify MCAS Local Table contains ${ns_port_mac}.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}
+    ${output}=    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ${IFCONF}
     Log    ${output}
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${NETNS_EXEC} ${ns_name} ping -c3 ${vm_ip}    30s
+    ${output}=    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ping -c3 ${vm_ip}    30s
     Log    ${output}
     Should Not Contain    ${output}    ${PACKET_LOSS}
-    Wait Until Keyword Succeeds    30s    2s    Verify Mcas Local Table While Ping    ${ns_port_mac}
+    Wait Until Keyword Succeeds    30s    2s    Verify Mcas Local Table While Ping    ${ns_port_mac}    ${conn_id}
+
+Verify Ping Fails In Namespace
+    [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}    ${conn_id}=${hwvtep_conn_id}    ${hwvtep_ip}=${HWVTEP_IP}
+    [Documentation]    Keyword to ping the IP ${vm_ip} from ${ns_name} and should verify that it fails
+    ${output}=    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ping -c3 ${vm_ip}    30s
+    Log    ${output}
+    Should Contain    ${output}    ${PACKET_LOSS}
 
 Verify Mcas Local Table While Ping
-    [Arguments]    ${mac}
+    [Arguments]    ${mac}    ${conn_id}
     [Documentation]    Keyword to check if ${mac} is available under UCAST_MACS_LOCALE_TABLE of HWVTEP dump table.
-    Verify Vtep List    ${UCAST_MACS_LOCALE_TABLE}    ${mac}
+    Verify Vtep List    ${conn_id}    ${UCAST_MACS_LOCALE_TABLE}    ${mac}
 
 Verify Nova VM IP
     [Arguments]    ${vm_name}
@@ -181,9 +175,6 @@ Verify Nova VM IP
 Get L2gw Debug Info
     [Documentation]    Keyword to collect the general debug information required for HWVTEP Test Suite.
     Exec Command    ${hwvtep_conn_id}    ${OVSDB_CLIENT_DUMP}
-    Exec Command    ${devstack_conn_id}    cat /etc/neutron/neutron.conf
-    Exec Command    ${devstack_conn_id}    cat /etc/neutron/l2gw_plugin.ini
-    Exec Command    ${devstack_conn_id}    ps -ef | grep neutron-server
     OpenStackOperations.Get Test Teardown Debugs
     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_API}/itm-state:external-tunnel-list/
     Log    ${resp.content}
@@ -191,11 +182,14 @@ Get L2gw Debug Info
     Log    ${resp.content}
     ${resp} =    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/network-topology:network-topology/topology/hwvtep:1
     Log    ${resp.content}
+    Exec Command    ${devstack_conn_id}    cat /etc/neutron/neutron.conf
+    Exec Command    ${devstack_conn_id}    cat /etc/neutron/l2gw_plugin.ini
+    Exec Command    ${devstack_conn_id}    ps -ef | grep neutron-server
 
 Start Command In Hwvtep
-    [Arguments]    ${command}
+    [Arguments]    ${command}    ${hwvtep_ip}
     [Documentation]    Keyword to execute Start Command in HWVTEP IP.
-    ${conn_id}=    SSHLibrary.Open Connection    ${HWVTEP_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
+    ${conn_id}=    SSHLibrary.Open Connection    ${hwvtep_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
     Log    ${conn_id}
     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
     Start Command    ${command}
@@ -204,16 +198,16 @@ Start Command In Hwvtep
     close connection
 
 Verify Vtep List
-    [Arguments]    ${table_name}    @{list}
+    [Arguments]    ${conn_id}    ${table_name}    @{list}
     [Documentation]    Keyword to run vtep-ctl list for the table ${table_name} and verify the list @{list} contents exists in output.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${VTEP LIST} ${table_name}
+    ${output}=    Exec Command    ${conn_id}    ${VTEP LIST} ${table_name}
     : FOR    ${item}    IN    @{list}
     \    Should Contain    ${output}    ${item}
 
 Get Vtep List
-    [Arguments]    ${table_name}
+    [Arguments]    ${table_name}    ${conn_id}=${hwvtep_conn_id}
     [Documentation]    Keyword to return the contents of vtep-ctl list for table ${table_name}.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${VTEP LIST} ${table_name}
+    ${output}=    Exec Command    ${conn_id}    ${VTEP LIST} ${table_name}
     [Return]    ${output}
 
 Get Dpnid Decimal
@@ -227,9 +221,9 @@ Get Dpnid Decimal
     [Return]    ${dpn_id}
 
 Verify Ovs Tunnel
-    [Arguments]    ${hwvtep_ip}    ${ovs_ip}    ${seg_id}=${NET_1_SEGID}
+    [Arguments]    ${hwvtep_ip}    ${ovs_ip}    ${seg_id}=${NET_1_SEGID}    ${conn_id}=${hwvtep_conn_id}
     [Documentation]    Keyword to verify that the OVS tunnel entries are configured for OVS and HWVTEP.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${OVS_SHOW}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_SHOW}
     Log    ${output}
     Should Contain    ${output}    key="${seg_id}", remote_ip="${ovs_ip}"
     ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_SHOW}
@@ -237,9 +231,9 @@ Verify Ovs Tunnel
     Should Contain    ${output}    key=flow, local_ip="${ovs_ip}", remote_ip="${hwvtep_ip}"
 
 Get Vtep Field Values From Table
-    [Arguments]    ${table_name}    ${column_name}
+    [Arguments]    ${table_name}    ${column_name}    ${conn_id}=${hwvtep_conn_id}
     [Documentation]    Keyword to return specific field value received in ${column_name} from the vtep-ctl list for ${table_name}.
-    ${output}=    Exec Command    ${hwvtep_conn_id}    ${VTEP_LIST_COLUMN}${column_name} list ${table_name} | awk '{print $3}'
+    ${output}=    Exec Command    ${conn_id}    ${VTEP_LIST_COLUMN}${column_name} list ${table_name} | awk '{print $3}'
     Log    ${output}
     @{keys}=    Split String    ${output}
     Log    ${keys}
similarity index 60%
rename from csit/suites/l2gw/Configure_verify_l2gateway.robot
rename to csit/suites/l2gw/01_Configure_verify_l2gateway.robot
index 5690a3651b0cb2494f6631eeb3917ff835bc0b9d..8b0a09ffa9c7c9e7906a5c9514357cda6569b21b 100644 (file)
@@ -48,12 +48,12 @@ TC05 Create L2Gateway And Connection And Verify
     ${output}=    ITM Get Tunnels
     Log    ${output}
     Should Contain    ${output}    physicalswitch/${HWVTEP_BRIDGE}
-    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${TUNNEL_TABLE}    enable="true"
+    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${TUNNEL_TABLE}    enable="true"
     ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
     Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    1
     ${list}=    Create List    ${OVS_IP}    ${HWVTEP_IP}
-    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${PHYSICAL_LOCATOR_TABLE}    @{list}
-    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[0]}
+    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${PHYSICAL_LOCATOR_TABLE}    @{list}
+    Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[0]}
 
 TC06 Dhcp Ip Allocation For Hwvtep Tap Port
     Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS1}    ${NS_TAP1}    ${port_ip_list[1]}
@@ -70,14 +70,73 @@ TC07 Verify Ping From Compute Node Vm To Hwvtep
 TC08 Ping Verification From Namespace Tap To Ovs Vm
     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS1}    ${port_mac_list[1]}    ${port_ip_list[0]}
 
+TC09 Additional Network Subnet Port Creation
+    OpenStackOperations.Create Network    ${NET_2}    ${NET_ADDT_ARG}${NET_2_SEGID}
+    ${output}=    OpenStackOperations.List Networks
+    Should Contain    ${output}    ${NET_2}
+    OpenStackOperations.Create SubNet    ${NET_2}    ${SUBNET_2}    ${SUBNET_RANGE2}    ${SUBNET_ADDT_ARG}
+    ${output}=    OpenStackOperations.List Subnets
+    Should Contain    ${output}    ${SUBNET_2}
+    OpenStackOperations.Create Port    ${NET_2}    ${OVS_PORT_2}    sg=${SECURITY_GROUP_L2GW}
+    OpenStackOperations.Create Port    ${NET_2}    ${HWVTEP_PORT_2}    sg=${SECURITY_GROUP_L2GW}
+    ${port_mac}=    Get Port Mac    ${OVS_PORT_2}    #port_mac[2]
+    ${port_ip}=    Get Port Ip    ${OVS_PORT_2}    #port_ip[2]
+    Append To List    ${port_mac_list}    ${port_mac}
+    Append To List    ${port_ip_list}    ${port_ip}
+    ${port_mac}=    Get Port Mac    ${HWVTEP_PORT_2}    #port_mac[3]
+    ${port_ip}=    Get Port Ip    ${HWVTEP_PORT_2}    #port_ip[3]
+    Append To List    ${port_mac_list}    ${port_mac}
+    Append To List    ${port_ip_list}    ${port_ip}
+
+TC10 Update And Attach Second Port To Hwvtep Create L2gw Connection
+    L2GatewayOperations.Update Port For Hwvtep    ${HWVTEP_PORT_2}
+    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Attach Port To Hwvtep Namespace    ${port_mac_list[3]}    ${HWVTEP_NS2}    ${NS2_TAP1}
+    OpenStackOperations.Create Vm Instance With Port On Compute Node    ${OVS_PORT_2}    ${OVS_VM2_NAME}    ${OVS_IP}
+    ${vm_ip}=    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify Nova VM IP    ${OVS_VM2_NAME}
+    Log    ${vm_ip}
+    Should Contain    ${vm_ip[0]}    ${port_ip_list[2]}
+    ${output}=    L2GatewayOperations.Create Verify L2Gateway    ${HWVTEP_BRIDGE}    ${NS_PORT2}    ${L2GW_NAME2}
+    Log    ${output}
+    ${output}=    L2GatewayOperations.Create Verify L2Gateway Connection    ${L2GW_NAME2}    ${NET_2}
+    Log    ${output}
+    ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
+    Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    2
+
+TC11 Dhcp Ip Allocation And Ping Validation Within Second Network
+    Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS2}    ${NS2_TAP1}    ${port_ip_list[3]}
+    ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_2}    ${port_ip_list[2]}
+    ...    ping -c 3 ${port_ip_list[3]}
+    Log    ${output}
+    Should Not Contain    ${output}    ${PACKET_LOSS}
+    ${src_mac_list}=    Create List    ${port_mac_list[2]}
+    ${dst_mac_list}=    Create List    ${port_mac_list[3]}
+    Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
+    Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS2}    ${port_mac_list[3]}    ${port_ip_list[2]}
+
+TC12 Ping Between Vm In Second Network To Namespace In First Network
+    ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_2}    ${port_ip_list[2]}
+    ...    ping -c 3 ${port_ip_list[1]}
+    Log    ${output}
+    Should Contain    ${output}    ${PACKET_LOSS}
+
+TC13 Ping Between Namespace In Second Network To Vm In First Network
+    Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping Fails In Namespace    ${HWVTEP_NS2}    ${port_mac_list[3]}    ${port_ip_list[0]}
+
 TC99 Cleanup L2Gateway Connection Itm Tunnel Port Subnet And Network
     L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME1}
+    L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME2}
     L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME1}
+    L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME2}
     OpenStackOperations.Delete Vm Instance    ${OVS_VM1_NAME}
+    OpenStackOperations.Delete Vm Instance    ${OVS_VM2_NAME}
     OpenStackOperations.Delete Port    ${OVS_PORT_1}
+    OpenStackOperations.Delete Port    ${OVS_PORT_2}
     OpenStackOperations.Delete Port    ${HWVTEP_PORT_1}
+    OpenStackOperations.Delete Port    ${HWVTEP_PORT_2}
     OpenStackOperations.Delete SubNet    ${SUBNET_1}
+    OpenStackOperations.Delete SubNet    ${SUBNET_2}
     OpenStackOperations.Delete Network    ${NET_1}
+    OpenStackOperations.Delete Network    ${NET_2}
 
 *** Keywords ***
 Basic Suite Setup
index 24359d0cee8146cb6d8ae8ecde384ebfe7d9a6a9..f32e088a78ea2deca0469b06ffa988db35730f21 100644 (file)
@@ -15,24 +15,26 @@ Resource          ../../variables/l2gw/Variables.robot
 *** Keywords ***
 Start Suite
     [Documentation]    Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
-    Create And Set Hwvtep Connection Id
-    Hwvtep Cleanup
+    ${hwvtep_conn_id}=    Create And Set Hwvtep Connection Id    ${HWVTEP_IP}
+    Set Suite Variable    ${hwvtep_conn_id}
+    Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
     Namespace Cleanup
-    Hwvtep Initiate
-    Namespace Intiate
+    Hwvtep Initiate    ${hwvtep_conn_id}    ${HWVTEP_IP}    ${HWVTEP_BRIDGE}
+    Namespace Intiate Hwvtep1
     Wait Until Keyword Succeeds    30s    1s    Hwvtep Validation
 
 Stop Suite
     [Documentation]    Stop Suite to cleanup Hwvtep configuration
-    Hwvtep Cleanup
+    Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
     Namespace Cleanup
     Switch Connection    ${hwvtep_conn_id}
-    close connection
+    Close Connection
 
 Hwvtep Cleanup
+    [Arguments]    ${conn_id}    ${hwvtep_bridge}
     [Documentation]    Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
-    Switch Connection    ${hwvtep_conn_id}
-    Write Commands Until Prompt    ${DEL_OVS_BRIDGE} ${HWVTEP_BRIDGE}    30s
+    Switch Connection    ${conn_id}
+    Write Commands Until Prompt    ${DEL_OVS_BRIDGE} ${hwvtep_bridge}    30s
     Write Commands Until Prompt    ${KILL_VTEP_PROC}    30s
     Write Commands Until Prompt    ${KILL_VSWITCHD_PROC}    30s
     Write Commands Until Prompt    ${KILL_OVSDB_PROC}    30s
@@ -51,12 +53,14 @@ Namespace Cleanup
     ${stdout}=    Write Commands Until Prompt    ${NETNS}    30s
     Log    ${stdout}
     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS1}    30s
+    Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS2}    30s
     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
     Log    ${stdout}
 
 Hwvtep Initiate
+    [Arguments]    ${conn_id}    ${hwvtep_ip}    ${hwvtep_bridge}
     [Documentation]    Configure the Hwvtep Emulation
-    Switch Connection    ${hwvtep_conn_id}
+    Switch Connection    ${conn_id}
     Write Commands Until Prompt    ${CREATE_OVSDB}    30s
     Write Commands Until Prompt    ${CREATE VTEP}    30s
     Write Commands Until Prompt    ${START_OVSDB_SERVER}    30s
@@ -64,25 +68,30 @@ Hwvtep Initiate
     Log    ${stdout}
     Write Commands Until Prompt    ${INIT_VSCTL}    30s
     Write Commands Until Prompt    ${DETACH_VSWITCHD}    30s
-    Write Commands Until Prompt    ${CREATE_OVS_BRIDGE} ${HWVTEP_BRIDGE}    30s
+    Write Commands Until Prompt    ${CREATE_OVS_BRIDGE} ${hwvtep_bridge}    30s
     ${stdout}=    Write Commands Until Prompt    ${OVS_SHOW}    30s
     Log    ${stdout}
-    Write Commands Until Prompt    ${ADD_VTEP_PS} ${HWVTEP_BRIDGE}    30s
-    Write Commands Until Prompt    ${SET_VTEP_PS}${HWVTEP_IP}    30s
-    Write Commands Until Prompt    ${START_OVSVTEP}    30s
+    Write Commands Until Prompt    ${ADD_VTEP_PS} ${hwvtep_bridge}    30s
+    Write Commands Until Prompt    ${SET_VTEP_PS} ${hwvtep_bridge} tunnel_ips=${hwvtep_ip}    30s
+    Write Commands Until Prompt    ${START_OVSVTEP} ${hwvtep_bridge}    30s
     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
     Log    ${stdout}
 
-Namespace Intiate
+Namespace Intiate Hwvtep1
     [Documentation]    Create and configure the namespace, bridges and ports.
     Switch Connection    ${hwvtep_conn_id}
-    Write Commands Until Prompt    ${NETNS_ADD} ${HWVTEP_NS1}    30s
-    Write Commands Until Prompt    ${IP_LINK_ADD} ${NS_TAP1} type veth peer name ${NS_PORT1}    30s
-    Write Commands Until Prompt    ${CREATE_OVS_PORT} ${HWVTEP_BRIDGE} ${NS_PORT1}    30s
-    Write Commands Until Prompt    ${IP_LINK_SET} ${NS_TAP1} netns ${HWVTEP_NS1}    30s
-    Write Commands Until Prompt    ${NETNS_EXEC} ${HWVTEP_NS1} ${IPLINK_SET} ${NS_TAP1} up    30s
-    Write Commands Until Prompt    sudo ${IPLINK_SET} ${NS_PORT1} up    30s
-    ${stdout}=    Write Commands Until Prompt    ${NETNS_EXEC} ${HWVTEP_NS1} ${IFCONF}    30s
+    Create Configure Namespace    ${HWVTEP_NS1}    ${NS_PORT1}    ${NS_TAP1}    ${HWVTEP_BRIDGE}
+    Create Configure Namespace    ${HWVTEP_NS2}    ${NS_PORT2}    ${NS2_TAP1}    ${HWVTEP_BRIDGE}
+
+Create Configure Namespace
+    [Arguments]    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
+    Write Commands Until Prompt    ${NETNS_ADD} ${ns_name}    30s
+    Write Commands Until Prompt    ${IP_LINK_ADD} ${tap_port_name} type veth peer name ${ns_port_name}    30s
+    Write Commands Until Prompt    ${CREATE_OVS_PORT} ${hwvtep_bridge} ${ns_port_name}    30s
+    Write Commands Until Prompt    ${IP_LINK_SET} ${tap_port_name} netns ${ns_name}    30s
+    Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IPLINK_SET} ${tap_port_name} up    30s
+    Write Commands Until Prompt    sudo ${IPLINK_SET} ${ns_port_name} up    30s
+    ${stdout}=    Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IFCONF}    30s
     Log    ${stdout}
 
 Hwvtep Validation
@@ -93,10 +102,12 @@ Hwvtep Validation
     Should Contain    ${stdout}    ${HWVTEP_IP}
     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_PORT_TABLE}    30s
     Should Contain    ${stdout}    ${NS_PORT1}
+    Should Contain    ${stdout}    ${NS_PORT2}
 
 Create And Set Hwvtep Connection Id
-    [Documentation]    To create Hwvtep connection id for the suite
-    ${hwvtep_conn_id}=    SSHLibrary.Open Connection    ${HWVTEP_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
-    Set Suite Variable    ${hwvtep_conn_id}
-    Log    ${hwvtep_conn_id}
+    [Arguments]    ${hwvtep_ip}
+    [Documentation]    To create connection and return connection id for hwvtep_ip received
+    ${conn_id}=    SSHLibrary.Open Connection    ${hwvtep_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
+    Log    ${conn_id}
     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
+    [Return]    ${conn_id}
index fe2456a0cf3a9ac1a604ec20b367a6532612f1e5..2c002c8faf9fbe69f687091e1ebabec5a97ef10b 100644 (file)
@@ -2,30 +2,47 @@
 #Configurable Variables
 ${OS_IP}          ${OS_CONTROL_NODE_IP}
 ${OVS_IP}         ${OS_COMPUTE_1_IP}
+${OVS2_IP}        ${OS_COMPUTE_2_IP}
 ${HWVTEP_IP}      ${TOOLS_SYSTEM_1_IP}
+${HWVTEP2_IP}     ${TOOLS_SYSTEM_2_IP}
 ${ODL_IP}         ${ODL_SYSTEM_1_IP}
 ${OS_PASSWORD}    ${EMPTY}
 ${HWVTEP_BRIDGE}    br-ovs
+${HWVTEP2_BRIDGE}    br-ovs2
 ${DEVSTACK_DEPLOY_PATH}    /home/stack/devstack
 ${HWVTEP_NS1}     NS1
 ${HWVTEP_NS2}     NS2
+${HWVTEP2_NS1}    NS3
+${HWVTEP2_NS2}    NS4
 ${HWVTEP_PORT_1}    HWVPORT1
 ${HWVTEP_PORT_2}    HWVPORT2
+${HWVTEP2_PORT_1}    HWVPORT3
+${HWVTEP2_PORT_2}    HWVPORT4
 ${L2GW_NAME1}     GW1
 ${L2GW_NAME2}     GW2
+${L2GW_NAME3}     GW3
+${L2GW_NAME4}     GW4
 ${NET_1_SEGID}    1063
 ${NET_1}          NETHWV1
 ${NET_2_SEGID}    1064
 ${NET_2}          NETHWV2
 ${NS_PORT1}       PORT1
 ${NS_PORT2}       PORT2
+${NS2_PORT1}      PORT3
+${NS2_PORT2}      PORT4
 ${NS_TAP1}        TAP1
-${NS_TAP2}        TAP2
+${NS2_TAP1}       TAP2
+${NS3_TAP1}       TAP3
+${NS4_TAP1}       TAP4
 ${OVS_BRIDGE}     br-int
 ${OVS_PORT_1}     OVSPORT1
 ${OVS_PORT_2}     OVSPORT2
+${OVS2_PORT_1}    OVSPORT3
+${OVS2_PORT_2}    OVSPORT4
 ${OVS_VM1_NAME}    VM1
 ${OVS_VM2_NAME}    VM2
+${OVS2_VM1_NAME}    VM3
+${OVS_VM2_NAME}    VM4
 ${SECURITY_GROUP_L2GW}    sg-l2gateway
 ${SUBNET_1}       HWV-SUB1
 ${SUBNET_2}       HWV-SUB2
@@ -87,10 +104,10 @@ ${OVSDB_NETWORK_TOPOLOGY}    /restconf/operational/network-topology:network-topo
 ${REM_OVSDB}      sudo rm /etc/openvswitch/ovs.db
 ${REM_VTEPDB}     sudo rm /etc/openvswitch/vtep.db
 ${SET_FAIL_MODE}    sudo ovs-vsctl set-fail-mode
-${SET_VTEP_PS}    sudo vtep-ctl set ${PHYSICAL_SWITCH_TABLE} ${HWVTEP_BRIDGE} tunnel_ips=
+${SET_VTEP_PS}    sudo vtep-ctl set ${PHYSICAL_SWITCH_TABLE}
 ${SLEEP1S}        sleep 1
 ${START_OVSDB_SERVER}    sudo ovsdb-server --pidfile --detach --log-file --remote punix:/var/run/openvswitch/db.sock --remote=db:hardware_vtep,Global,managers /etc/openvswitch/ovs.db /etc/openvswitch/vtep.db
-${START_OVSVTEP}    sudo /usr/share/openvswitch/scripts/ovs-vtep --log-file=/var/log/openvswitch/ovs-vtep.log --pidfile=/var/run/openvswitch/ovs-vtep.pid --detach ${HWVTEP_BRIDGE}
+${START_OVSVTEP}    sudo /usr/share/openvswitch/scripts/ovs-vtep --log-file=/var/log/openvswitch/ovs-vtep.log --pidfile=/var/run/openvswitch/ovs-vtep.pid --detach
 ${STR_VIF_REPLACE}    "neutron-binding:vif-type":"ovs"
 ${STR_VIF_TYPE}    "neutron-binding:vif-type":"unbound"
 ${STR_VNIC_REPLACE}    "neutron-binding:vnic-type":"direct"