L2Gw Test Cases Suite1 52/52152/10
authorabbas <abbas.pareedkunju@tcs.com>
Wed, 22 Feb 2017 09:01:35 +0000 (01:01 -0800)
committerJamo Luhrsen <jluhrsen@redhat.com>
Thu, 16 Mar 2017 01:13:50 +0000 (01:13 +0000)
Change-Id: I9a2067d8ebe4a54385115be93a3f065148a55083
Signed-off-by: abbas <abbas.pareedkunju@tcs.com>
csit/libraries/DevstackUtils.robot
csit/libraries/L2GatewayOperations.robot [new file with mode: 0644]
csit/libraries/OpenStackOperations.robot
csit/suites/l2gw/Configure_verify_l2gateway.robot [new file with mode: 0644]
csit/suites/l2gw/__init__.robot [new file with mode: 0644]
csit/testplans/netvirt-1node-l2gw-openstack.txt [new file with mode: 0644]
csit/testplans/netvirt-3node-l2gw-openstack.txt [new file with mode: 0644]
csit/variables/l2gw/Variables.robot [new file with mode: 0644]
csit/variables/l2gw/itm_create/location.uri [new file with mode: 0644]
csit/variables/l2gw/itm_create/post_data.json [new file with mode: 0644]

index 2913e6f302dba5a39abf86634a78f3bdb9b75a63..d3bc916100c09be65e2cb73d559dee849dcff208 100644 (file)
@@ -57,6 +57,7 @@ Devstack Suite Setup
 Write Commands Until Prompt
     [Arguments]    ${cmd}    ${timeout}=${default_devstack_prompt_timeout}
     [Documentation]    quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
+    Log    ${cmd}
     SSHLibrary.Set Client Configuration    timeout=${timeout}
     SSHLibrary.Read
     SSHLibrary.Write    ${cmd}
diff --git a/csit/libraries/L2GatewayOperations.robot b/csit/libraries/L2GatewayOperations.robot
new file mode 100644 (file)
index 0000000..6116f37
--- /dev/null
@@ -0,0 +1,278 @@
+*** 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.
+Library           SSHLibrary
+Library           Collections
+Library           RequestsLibrary
+Resource          OVSDB.robot
+Resource          Utils.robot
+Resource          MininetKeywords.robot
+Resource          VpnOperations.robot
+Resource          OpenStackOperations.robot
+Resource          DevstackUtils.robot
+Resource          ../variables/l2gw/Variables.robot
+Resource          ../variables/netvirt/Variables.robot
+
+*** Variables ***
+${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}
+    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}"
+    ...    Controller "tcp:${ODL_IP}:${ODL_OF_PORT}"
+    ${output}=    Exec Command    ${ovs_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}
+    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}
+    ${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
+    ${output}=    ITM Get Tunnels
+    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.
+    ${set_manager_command}=    Set Variable    ${VTEP_ADD_MGR}:${odl_ip}:${OVSDBPORT}
+    ${output}=    Exec Command    ${hwvtep_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}
+    Should Contain    ${output}    ${OVSDBPORT}
+    @{list_to_check}=    Create List    ${odl_ip}
+    Utils.Check For Elements At URI    ${HWVTEP_NETWORK_TOPOLOGY}    ${list_to_check}    session
+
+Create Verify L2Gateway
+    [Arguments]    ${bridge_name}    ${intf_name}    ${gw_name}
+    [Documentation]    Keyword to create an L2 Gateway ${gw_name} for bridge ${bridge_name} connected to interface ${intf_name} (Using Neutron CLI).
+    ${l2gw_output}=    OpenStackOperations.Create L2Gateway    ${bridge_name}    ${intf_name}    ${gw_name}
+    Log    ${l2gw_output}
+    ${output}=    OpenStackOperations.Get All L2Gateway
+    Log    ${output}
+    Should Contain    ${output}    ${gw_name}
+    @{list_to_check}=    Create List    ${gw_name}
+    Utils.Check For Elements At URI    ${L2GW_LIST_REST_URL}    ${list_to_check}    session
+    [Return]    ${l2gw_output}
+
+Delete L2Gateway
+    [Arguments]    ${gw_name}
+    [Documentation]    Keyword to delete the L2 Gateway ${gw_name} received in argument.
+    ${output}=    Exec Command    ${devstack_conn_id}    ${L2GW_DELETE} ${gw_name}
+    @{list_to_check}=    Create List    ${gw_name}
+    Utils.Check For Elements Not At URI    ${L2GW_LIST_REST_URL}    ${list_to_check}    session
+    Log    ${output}
+
+Create Verify L2Gateway Connection
+    [Arguments]    ${gw_name}    ${net_name}
+    [Documentation]    Keyword to create a new L2 Gateway Connection for ${gw_name} to ${net_name} (Using Neutron CLI).
+    ${l2gw_output}=    OpenStackOperations.Create L2Gateway Connection    ${gw_name}    ${net_name}
+    Log    ${l2gw_output}
+    ${l2gw_id}=    OpenStackOperations.Get L2gw Id    ${gw_name}
+    ${output}=    OpenStackOperations.Get All L2Gateway Connection
+    Log    ${output}
+    Should Contain    ${output}    ${l2gw_id}
+    @{list_to_check}=    Create List    ${l2gw_id}
+    Utils.Check For Elements At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
+    [Return]    ${l2gw_output}
+
+Delete L2Gateway Connection
+    [Arguments]    ${gw_name}
+    [Documentation]    Delete the L2 Gateway connection existing for Gateway ${gw_name} received in argument (Using Neutron CLI).
+    ${l2gw_conn_id}=    OpenStackOperations.Get L2gw Connection Id    ${gw_name}
+    ${output}=    Exec Command    ${devstack_conn_id}    ${L2GW_CONN_DELETE} ${l2gw_conn_id}
+    @{list_to_check}=    Create List    ${l2gw_conn_id}
+    Utils.Check For Elements Not At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
+    Log    ${output}
+
+Update Port For Hwvtep
+    [Arguments]    ${port_name}
+    [Documentation]    Keyword to update the Neutron Ports for specific configuration required to connect to HWVTEP (Using REST).
+    ${port_id}=    Get Port Id    ${port_name}    ${devstack_conn_id}
+    Log    ${port_id}
+    ${json_data}=    Get Neutron Port Rest    ${port_id}
+    Should Contain    ${json_data}    ${STR_VIF_TYPE}
+    Should Contain    ${json_data}    ${STR_VNIC_TYPE}
+    ${json_data}=    Replace String    ${json_data}    ${STR_VIF_TYPE}    ${STR_VIF_REPLACE}
+    ${json_data}=    Replace String    ${json_data}    ${STR_VNIC_TYPE}    ${STR_VNIC_REPLACE}
+    ${return}=    OpenStackOperations.Update Port Rest    ${port_id}    ${json_data}
+    ${output}=    OpenStackOperations.Get Neutron Port Rest    ${port_id}
+    Log    ${output}
+    Should Contain    ${output}    ${STR_VIF_REPLACE}
+    Should Contain    ${output}    ${STR_VNIC_REPLACE}
+    Should Not Contain    ${output}    ${STR_VIF_TYPE}
+    Should Not Contain    ${output}    ${STR_VNIC_TYPE}
+    [Return]    ${return}
+
+Attach Port To Hwvtep Namespace
+    [Arguments]    ${port_mac}    ${ns_name}    ${tap_name}
+    [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}
+    Should Contain    ${output}    ${port_mac}
+
+Namespace Dhclient Verify
+    [Arguments]    ${ns_name}    ${ns_tap}    ${ns_port_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}
+
+Verify Strings In Command Output
+    [Arguments]    ${conn_id}    ${command}    @{string_list}
+    [Documentation]    Keyword to run the ${command} in ${conn_id} and verify if the output contains the list @{string_list}.
+    ${output}=    Exec Command    ${conn_id}    ${command}
+    : 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}
+    [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}
+    ${output}=    Exec Command    ${hwvtep_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}
+
+Verify Mcas Local Table While Ping
+    [Arguments]    ${mac}
+    [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 Nova VM IP
+    [Arguments]    ${vm_name}
+    [Documentation]    Keyword to verify if the VM has received IP, and to vefiry it is not null.
+    ${vm_ip}    ${dhcp_ip}    Verify VMs Received DHCP Lease    ${vm_name}
+    Log    ${vm_ip}
+    Should Not Contain    ${vm_ip}    None
+    [Return]    ${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}
+    ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_API}/network-topology:network-topology/topology/hwvtep:1
+    Log    ${resp.content}
+    ${resp} =    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/network-topology:network-topology/topology/hwvtep:1
+    Log    ${resp.content}
+
+Start Command In Hwvtep
+    [Arguments]    ${command}
+    [Documentation]    Keyword to execute Start Command in HWVTEP IP.
+    ${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}
+    ${output}=    Exec Command    ${conn_id}    sudo ovs-ofctl dump-flows br-int -O Openflow13
+    Log    ${output}
+    close connection
+
+Verify Vtep List
+    [Arguments]    ${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}
+    : FOR    ${item}    IN    @{list}
+    \    Should Contain    ${output}    ${item}
+
+Get Vtep List
+    [Arguments]    ${table_name}
+    [Documentation]    Keyword to return the contents of vtep-ctl list for table ${table_name}.
+    ${output}=    Exec Command    ${hwvtep_conn_id}    ${VTEP LIST} ${table_name}
+    [Return]    ${output}
+
+Get Dpnid Decimal
+    [Arguments]    ${conn_id}
+    [Documentation]    Keyword to return DPN ID in decimal for the br-int in IP connected via ${conn_id}.
+    ${output}=    Exec Command    ${conn_id}    ${GET_DPNID}
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${dpn_id}=    Get from List    ${splitted_output}    0
+    Log    ${dpn_id}
+    [Return]    ${dpn_id}
+
+Verify Ovs Tunnel
+    [Arguments]    ${hwvtep_ip}    ${ovs_ip}    ${seg_id}=${NET_1_SEGID}
+    [Documentation]    Keyword to verify that the OVS tunnel entries are configured for OVS and HWVTEP.
+    ${output}=    Exec Command    ${hwvtep_conn_id}    ${OVS_SHOW}
+    Log    ${output}
+    Should Contain    ${output}    key="${seg_id}", remote_ip="${ovs_ip}"
+    ${output}=    Exec Command    ${ovs_conn_id}    ${OVS_SHOW}
+    Log    ${output}
+    Should Contain    ${output}    key=flow, local_ip="${ovs_ip}", remote_ip="${hwvtep_ip}"
+
+Get Vtep Field Values From Table
+    [Arguments]    ${table_name}    ${column_name}
+    [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}'
+    Log    ${output}
+    @{keys}=    Split String    ${output}
+    Log    ${keys}
+    [Return]    ${keys}
+
+Validate Regexp In String
+    [Arguments]    ${string}    ${regexp}    ${verify_count}=1
+    @{occr}=    Get Regexp Matches    ${string}    ${regexp}
+    ${count}=    Get Length    ${occr}
+    Should Be Equal As Integers    ${count}    ${verify_count}
+
+Exec Command
+    [Arguments]    ${conn_id}    ${command}    ${timeout}=10s
+    Switch Connection    ${conn_id}
+    ${output}=    DevstackUtils.Write Commands Until Prompt    ${command}    ${timeout}
+    Log    ${output}
+    [Return]    ${output}
+
+Verify Elan Flow Entries
+    [Arguments]    ${ip}    ${srcMacAddrs}    ${destMacAddrs}
+    [Documentation]    Verify Flows Are Present For ELAN service
+    ${flow_output} =    Run Command On Remote System    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
+    Log    ${flow_output}
+    Should Contain    ${flow_output}    table=50
+    ${sMac_output} =    Get Lines Containing String    ${flow_output}    table=50
+    Log    ${sMac_output}
+    : FOR    ${sMacAddr}    IN    @{srcMacAddrs}
+    \    ${resp}=    Should Contain    ${sMac_output}    dl_src=${sMacAddr}
+    Should Contain    ${flow_output}    table=51
+    ${dMac_output} =    Get Lines Containing String    ${flow_output}    table=51
+    Log    ${dMac_output}
+    : FOR    ${dMacAddr}    IN    @{destMacAddrs}
+    \    ${resp}=    Should Contain    ${dMac_output}    dl_dst=${dMacAddr}
+    Should Contain    ${flow_output}    table=52
+    ${sMac_output} =    Get Lines Containing String    ${flow_output}    table=52
+    Log    ${sMac_output}
index bab2598fa78f07e89aeae2e36dabb7ab9d2f7b74..e680fbc13fa118128bc0546b952097fa9749c068 100644 (file)
@@ -3,6 +3,7 @@ Documentation     Openstack library. This library is useful for tests to create
 Library           SSHLibrary
 Resource          Netvirt.robot
 Resource          Utils.robot
+Resource          L2GatewayOperations.robot
 Resource          ../variables/Variables.robot
 
 *** Keywords ***
@@ -737,10 +738,121 @@ Get Ports MacAddr
     Switch Connection    ${devstack_conn_id}
     ${MacAddr-list}    Create List
     : FOR    ${portName}    IN    @{portName_list}
-    \    ${output} =    Write Commands Until Prompt    neutron port-list | grep "${portName}" | awk '{print $6}'    30s
-    \    Log    ${output}
-    \    ${splitted_output}=    Split String    ${output}    ${EMPTY}
-    \    ${macAddr}=    Get from List    ${splitted_output}    0
-    \    Log    ${macAddr}
+    \    ${macAddr}=    OpenStackOperations.Get Port Mac    ${portName}    ${devstack_conn_id}
     \    Append To List    ${MacAddr-list}    ${macAddr}
     [Return]    ${MacAddr-list}
+
+Get Port Ip
+    [Arguments]    ${port_name}
+    [Documentation]    Keyword would return the IP of the ${port_name} received.
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $11}' | awk -F "\\"" '{print $2}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${port_ip}=    Get from List    ${splitted_output}    0
+    Log    ${port_ip}
+    [Return]    ${port_ip}
+
+Get Port Mac
+    [Arguments]    ${port_name}    ${conn_id}=${devstack_conn_id}
+    [Documentation]    Keyword would return the MAC ID of the ${port_name} received.
+    Switch Connection    ${conn_id}
+    ${output}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $6}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${port_mac}=    Get from List    ${splitted_output}    0
+    Log    ${port_mac}
+    [Return]    ${port_mac}
+
+Create L2Gateway
+    [Arguments]    ${bridge_name}    ${intf_name}    ${gw_name}
+    [Documentation]    Keyword to create an L2 Gateway ${gw_name} for bridge ${bridge_name} connected to interface ${intf_name} (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${l2gw_output}=    Write Commands Until Prompt    ${L2GW_CREATE} name=${bridge_name},interface_names=${intf_name} ${gw_name}    30s
+    Log    ${l2gw_output}
+    [Return]    ${l2gw_output}
+
+Create L2Gateway Connection
+    [Arguments]    ${gw_name}    ${net_name}
+    [Documentation]    Keyword would create a new L2 Gateway Connection for ${gw_name} to ${net_name} (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${l2gw_output}=    Write Commands Until Prompt    ${L2GW_CONN_CREATE} ${gw_name} ${net_name}    30s
+    Log    ${l2gw_output}
+    [Return]    ${l2gw_output}
+
+Get All L2Gateway
+    [Documentation]    Keyword to return all the L2 Gateways available (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ${L2GW_GET_YAML}    30s
+    [Return]    ${output}
+
+Get All L2Gateway Connection
+    [Documentation]    Keyword to return all the L2 Gateway connections available (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ${L2GW_GET_CONN_YAML}    30s
+    [Return]    ${output}
+
+Get L2Gateway
+    [Arguments]    ${gw_id}
+    [Documentation]    Keyword to check if the ${gw_id} is available in the L2 Gateway list (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ${L2GW_SHOW} ${gw_id}    30s
+    Log    ${output}
+    [Return]    ${output}
+
+Get L2gw Id
+    [Arguments]    ${l2gw_name}
+    [Documentation]    Keyword to retrieve the L2 Gateway ID for the ${l2gw_name} (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ${L2GW_GET} | grep "${l2gw_name}" | awk '{print $2}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${l2gw_id}=    Get from List    ${splitted_output}    0
+    Log    ${l2gw_id}
+    [Return]    ${l2gw_id}
+
+Get L2gw Connection Id
+    [Arguments]    ${l2gw_name}
+    [Documentation]    Keyword to retrieve the L2 Gateway Connection ID for the ${l2gw_name} (Using Neutron CLI).
+    Switch Connection    ${devstack_conn_id}
+    ${l2gw_id}=    OpenStackOperations.Get L2gw Id    ${l2gw_name}
+    ${output}=    Write Commands Until Prompt    ${L2GW_GET_CONN} | grep "${l2gw_id}" | awk '{print $2}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${l2gw_conn_id}=    Get from List    ${splitted_output}    0
+    Log    ${l2gw_conn_id}
+    [Return]    ${l2gw_conn_id}
+
+Neutron Port List Rest
+    [Documentation]    Keyword to get all ports details in Neutron (Using REST).
+    ${resp} =    RequestsLibrary.Get Request    session    ${PORT_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    [Return]    ${resp.content}
+
+Get Neutron Port Rest
+    [Arguments]    ${port_id}
+    [Documentation]    Keyword to get the specific port details in Neutron (Using REST).
+    ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_API}/${GET_PORT_URL}/${port_id}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    [Return]    ${resp.content}
+
+Update Port Rest
+    [Arguments]    ${port_id}    ${json_data}
+    [Documentation]    Keyword to update ${port_id} with json data received in ${json_data} (Using REST).
+    Log    ${json_data}
+    ${resp} =    RequestsLibrary.Put Request    session    ${CONFIG_API}/${GET_PORT_URL}/${port_id}    ${json_data}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    [Return]    ${resp.content}
+
+Create And Configure Security Group
+    [Arguments]    ${sg-name}
+    Neutron Security Group Create    ${sg-name}
+    Neutron Security Group Rule Create    ${sg-name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg-name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg-name}    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg-name}    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg-name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg-name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
diff --git a/csit/suites/l2gw/Configure_verify_l2gateway.robot b/csit/suites/l2gw/Configure_verify_l2gateway.robot
new file mode 100644 (file)
index 0000000..543b3fd
--- /dev/null
@@ -0,0 +1,115 @@
+*** Settings ***
+Documentation     Test Suite for verification of HWVTEP usecases
+Suite Setup       BuiltIn.Run Keywords    Basic Suite Setup
+Suite Teardown    Basic Suite Teardown
+Test Teardown     Get L2gw Debug Info
+Resource          ../../libraries/L2GatewayOperations.robot
+
+*** Test Cases ***
+TC01 Configure Hwvtep Manager OVS Manager Controller And Verify
+    L2GatewayOperations.Add Vtep Manager And Verify    ${ODL_IP}
+    L2GatewayOperations.Add Ovs Bridge Manager Controller And Verify
+
+TC02 Create First Set Of Network Subnet And Ports
+    OpenStackOperations.Create Network    ${NET_1}    ${NET_ADDT_ARG}${NET_1_SEGID}
+    ${output}=    OpenStackOperations.List Networks
+    Should Contain    ${output}    ${NET_1}
+    OpenStackOperations.Create SubNet    ${NET_1}    ${SUBNET_1}    ${SUBNET_RANGE1}    ${SUBNET_ADDT_ARG}
+    ${output}=    OpenStackOperations.List Subnets
+    Should Contain    ${output}    ${SUBNET_1}
+    OpenStackOperations.Create And Configure Security Group    ${SECURITY_GROUP_L2GW}
+    OpenStackOperations.Create Port    ${NET_1}    ${OVS_PORT_1}    sg=${SECURITY_GROUP_L2GW}
+    OpenStackOperations.Create Port    ${NET_1}    ${HWVTEP_PORT_1}    sg=${SECURITY_GROUP_L2GW}
+    ${port_mac}=    Get Port Mac    ${OVS_PORT_1}    #port_mac[0]
+    ${port_ip}=    Get Port Ip    ${OVS_PORT_1}    #port_ip[0]
+    Append To List    ${port_mac_list}    ${port_mac}
+    Append To List    ${port_ip_list}    ${port_ip}
+    ${port_mac}=    Get Port Mac    ${HWVTEP_PORT_1}    #port_mac[1]
+    ${port_ip}=    Get Port Ip    ${HWVTEP_PORT_1}    #port_ip[1]
+    Append To List    ${port_mac_list}    ${port_mac}
+    Append To List    ${port_ip_list}    ${port_ip}
+
+TC03 Update Port For Hwvtep And Attach Port To Namespace
+    L2GatewayOperations.Update Port For Hwvtep    ${HWVTEP_PORT_1}
+    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Attach Port To Hwvtep Namespace    ${port_mac_list[1]}    ${HWVTEP_NS1}    ${NS_TAP1}
+
+TC04 Create Vms On Compute Node
+    OpenStackOperations.Create Vm Instance With Port On Compute Node    ${OVS_PORT_1}    ${OVS_VM1_NAME}    ${OVS_IP}
+    ${vm_ip}=    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify Nova VM IP    ${OVS_VM1_NAME}
+    Log    ${vm_ip}
+    Should Contain    ${vm_ip[0]}    ${port_ip_list[0]}
+
+TC05 Create L2Gateway And Connection And Verify
+    ${output}=    L2GatewayOperations.Create Verify L2Gateway    ${HWVTEP_BRIDGE}    ${NS_PORT1}    ${L2GW_NAME1}
+    Log    ${output}
+    ${output}=    L2GatewayOperations.Create Verify L2Gateway Connection    ${L2GW_NAME1}    ${NET_1}
+    Log    ${output}
+    L2GatewayOperations.Verify Ovs Tunnel    ${HWVTEP_IP}    ${OVS_IP}
+    ${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"
+    ${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]}
+
+TC06 Dhcp Ip Allocation For Hwvtep Tap Port
+    Wait Until Keyword Succeeds    30s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS1}    ${NS_TAP1}    ${port_ip_list[1]}
+
+TC07 Verify Ping From Compute Node Vm To Hwvtep
+    ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_1}    ${port_ip_list[0]}
+    ...    ping -c 3 ${port_ip_list[1]}
+    Log    ${output}
+    Should Not Contain    ${output}    ${PACKET_LOSS}
+    ${src_mac_list}=    Create List    ${port_mac_list[0]}
+    ${dst_mac_list}=    Create List    ${port_mac_list[1]}
+    Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
+
+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]}
+
+TC99 Cleanup L2Gateway Connection Itm Tunnel Port Subnet And Network
+    L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME1}
+    L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME1}
+    OpenStackOperations.Delete Vm Instance    ${OVS_VM1_NAME}
+    OpenStackOperations.Delete Port    ${OVS_PORT_1}
+    OpenStackOperations.Delete Port    ${HWVTEP_PORT_1}
+    OpenStackOperations.Delete SubNet    ${SUBNET_1}
+    OpenStackOperations.Delete Network    ${NET_1}
+
+*** Keywords ***
+Basic Suite Setup
+    [Documentation]    Basic Suite Setup required for the HWVTEP Test Suite
+    RequestsLibrary.Create Session    alias=session    url=http://${ODL_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    ${devstack_conn_id}=    SSHLibrary.Open Connection    ${OS_IP}    prompt=${DEFAULT_LINUX_PROMPT}
+    Log    ${devstack_conn_id}
+    Set Suite Variable    ${devstack_conn_id}
+    Log    ${OS_IP}
+    Log    ${OS_USER}
+    Log    ${OS_PASSWORD}
+    Wait Until Keyword Succeeds    30s    5s    Flexible SSH Login    ${OS_USER}    ${OS_PASSWORD}
+    Write Commands Until Prompt    cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin    30s
+    ${hwvtep_conn_id}=    SSHLibrary.Open Connection    ${HWVTEP_IP}    prompt=${DEFAULT_LINUX_PROMPT}
+    Log    ${hwvtep_conn_id}
+    Set Suite Variable    ${hwvtep_conn_id}
+    Log    ${DEFAULT_USER}
+    Log    ${DEFAULT_PASSWORD}
+    Wait Until Keyword Succeeds    30s    5s    Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
+    ${ovs_conn_id}=    SSHLibrary.Open Connection    ${OVS_IP}    prompt=${DEFAULT_LINUX_PROMPT}
+    Log    ${ovs_conn_id}
+    Set Suite Variable    ${ovs_conn_id}
+    Wait Until Keyword Succeeds    30s    5s    Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
+    ${port_mac_list}=    Create List
+    Set Suite Variable    ${port_mac_list}
+    ${port_ip_list}=    Create List
+    Set Suite Variable    ${port_ip_list}
+
+Basic Suite Teardown
+    Switch Connection    ${devstack_conn_id}
+    close connection
+    Switch Connection    ${hwvtep_conn_id}
+    close connection
+    Switch Connection    ${ovs_conn_id}
+    close connection
diff --git a/csit/suites/l2gw/__init__.robot b/csit/suites/l2gw/__init__.robot
new file mode 100644 (file)
index 0000000..24359d0
--- /dev/null
@@ -0,0 +1,102 @@
+*** Settings ***
+Documentation     Test suite for HWVTEP Setup
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library           SSHLibrary
+Library           Collections
+Resource          ../../variables/Variables.robot
+Resource          ../../libraries/Utils.robot
+Resource          ../../libraries/DevstackUtils.robot
+Resource          ../../libraries/KarafKeywords.robot
+Resource          ../../variables/l2gw/Variables.robot
+
+*** Variables ***
+
+*** Keywords ***
+Start Suite
+    [Documentation]    Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
+    Create And Set Hwvtep Connection Id
+    Hwvtep Cleanup
+    Namespace Cleanup
+    Hwvtep Initiate
+    Namespace Intiate
+    Wait Until Keyword Succeeds    30s    1s    Hwvtep Validation
+
+Stop Suite
+    [Documentation]    Stop Suite to cleanup Hwvtep configuration
+    Hwvtep Cleanup
+    Namespace Cleanup
+    Switch Connection    ${hwvtep_conn_id}
+    close connection
+
+Hwvtep Cleanup
+    [Documentation]    Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
+    Switch Connection    ${hwvtep_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
+    ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
+    Log    ${stdout}
+    Write Commands Until Prompt    ${REM_OVSDB}    30s
+    Write Commands Until Prompt    ${REM_VTEPDB}    30s
+
+Namespace Cleanup
+    [Documentation]    Cleanup the existing namespaces and ports.
+    Switch Connection    ${hwvtep_conn_id}
+    ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
+    Log    ${stdout}
+    Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT1}    30s
+    Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT2}    30s
+    ${stdout}=    Write Commands Until Prompt    ${NETNS}    30s
+    Log    ${stdout}
+    Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS1}    30s
+    ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
+    Log    ${stdout}
+
+Hwvtep Initiate
+    [Documentation]    Configure the Hwvtep Emulation
+    Switch Connection    ${hwvtep_conn_id}
+    Write Commands Until Prompt    ${CREATE_OVSDB}    30s
+    Write Commands Until Prompt    ${CREATE VTEP}    30s
+    Write Commands Until Prompt    ${START_OVSDB_SERVER}    30s
+    ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
+    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
+    ${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
+    ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
+    Log    ${stdout}
+
+Namespace Intiate
+    [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
+    Log    ${stdout}
+
+Hwvtep Validation
+    [Documentation]    Initial validation of the Hwvtep Configuration to confirm Phyisical_Switch table entries
+    Switch Connection    ${hwvtep_conn_id}
+    ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_SWITCH_TABLE}    30s
+    Should Contain    ${stdout}    ${HWVTEP_BRIDGE}
+    Should Contain    ${stdout}    ${HWVTEP_IP}
+    ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_PORT_TABLE}    30s
+    Should Contain    ${stdout}    ${NS_PORT1}
+
+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}
+    Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
diff --git a/csit/testplans/netvirt-1node-l2gw-openstack.txt b/csit/testplans/netvirt-1node-l2gw-openstack.txt
new file mode 100644 (file)
index 0000000..bd04a80
--- /dev/null
@@ -0,0 +1 @@
+integration/test/csit/suites/l2gw/
diff --git a/csit/testplans/netvirt-3node-l2gw-openstack.txt b/csit/testplans/netvirt-3node-l2gw-openstack.txt
new file mode 100644 (file)
index 0000000..bd04a80
--- /dev/null
@@ -0,0 +1 @@
+integration/test/csit/suites/l2gw/
diff --git a/csit/variables/l2gw/Variables.robot b/csit/variables/l2gw/Variables.robot
new file mode 100644 (file)
index 0000000..fe2456a
--- /dev/null
@@ -0,0 +1,119 @@
+*** Variables ***
+#Configurable Variables
+${OS_IP}          ${OS_CONTROL_NODE_IP}
+${OVS_IP}         ${OS_COMPUTE_1_IP}
+${HWVTEP_IP}      ${TOOLS_SYSTEM_1_IP}
+${ODL_IP}         ${ODL_SYSTEM_1_IP}
+${OS_PASSWORD}    ${EMPTY}
+${HWVTEP_BRIDGE}    br-ovs
+${DEVSTACK_DEPLOY_PATH}    /home/stack/devstack
+${HWVTEP_NS1}     NS1
+${HWVTEP_NS2}     NS2
+${HWVTEP_PORT_1}    HWVPORT1
+${HWVTEP_PORT_2}    HWVPORT2
+${L2GW_NAME1}     GW1
+${L2GW_NAME2}     GW2
+${NET_1_SEGID}    1063
+${NET_1}          NETHWV1
+${NET_2_SEGID}    1064
+${NET_2}          NETHWV2
+${NS_PORT1}       PORT1
+${NS_PORT2}       PORT2
+${NS_TAP1}        TAP1
+${NS_TAP2}        TAP2
+${OVS_BRIDGE}     br-int
+${OVS_PORT_1}     OVSPORT1
+${OVS_PORT_2}     OVSPORT2
+${OVS_VM1_NAME}    VM1
+${OVS_VM2_NAME}    VM2
+${SECURITY_GROUP_L2GW}    sg-l2gateway
+${SUBNET_1}       HWV-SUB1
+${SUBNET_2}       HWV-SUB2
+${SUBNET_RANGE1}    13.0.0.0/24
+${SUBNET_RANGE2}    14.0.0.0/24
+#Dont Change The Below Entries
+${GREP_OVSDB_DUMP_PHYSICAL_SWITCH}    sudo ovsdb-client dump hardware_vtep -f csv | grep -A2 "Physical_Switch table"
+${ADD_VTEP_PS}    sudo vtep-ctl add-ps
+${CREATE VTEP}    sudo ovsdb-tool create /etc/openvswitch/vtep.db ${OVS_HOME}/vtep.ovsschema
+${CREATE_OVS_BRIDGE}    sudo ovs-vsctl add-br
+${CREATE_OVS_PORT}    sudo ovs-vsctl add-port
+${CREATE_OVSDB}    sudo ovsdb-tool create /etc/openvswitch/ovs.db ${OVS_HOME}/vswitch.ovsschema
+${DEL_OVS_BRIDGE}    sudo ovs-vsctl del-br
+${DETACH_VSWITCHD}    sudo ovs-vswitchd --pidfile --detach
+${GET_DPNID}      printf "%d\\n" 0x`sudo ovs-ofctl show -O Openflow13 br-int | head -1 | awk -F "dpid:" '{print $2}'`
+${GET_PORT_URL}    neutron:neutron/ports/port
+${GREP_OVS}       ps -ef | grep ovs
+${GREP_OVSDB_DUMP_MANAGER_TABLE}    sudo ovsdb-client dump hardware_vtep -f csv | grep -A2 "Manager table"
+${HW_ETHER}       hw ether
+${HWVTEP_NETWORK_TOPOLOGY}    /restconf/operational/network-topology:network-topology/topology/hwvtep:1/
+${IFCONF}         ifconfig
+${INIT_VSCTL}     sudo ovs-vsctl --no-wait init
+${IP_LINK_ADD}    ${IP_LINK} add
+${IP_LINK_DEL}    ${IP_LINK} del
+${IP_LINK_SET}    ${IP_LINK} set
+${IP_LINK}        sudo ip link
+${IPLINK_SET}     ip link set dev
+${KILL_OVSDB_PROC}    sudo killall -9 ovsdb-server
+${KILL_VSWITCHD_PROC}    sudo killall -9 ovs-vswitchd
+${KILL_VTEP_PROC}    sudo killall -9 python
+${L2GW_CONN_CREATE}    neutron l2-gateway-connection-create --default-segmentation-id 0
+${L2GW_CONN_DELETE}    neutron l2-gateway-connection-delete
+${L2GW_LIST_REST_URL}    /restconf/config/neutron:neutron/l2gateways/
+${L2GW_CONN_LIST_REST_URL}    /restconf/config/neutron:neutron/l2gatewayConnections/
+${L2GW_CREATE}    neutron l2-gateway-create --device
+${L2GW_DELETE}    neutron l2-gateway-delete
+${L2GW_GET_CONN_YAML}    neutron l2-gateway-connection-list -f yaml
+${L2GW_GET_CONN}    neutron l2-gateway-connection-list
+${L2GW_GET_YAML}    neutron l2-gateway-list -f yaml
+${L2GW_GET}       neutron l2-gateway-list
+${L2GW_SHOW}      neutron l2-gateway-show
+${NET_ADDT_ARG}    --provider:network_type vxlan --provider:segmentation_id=
+${NETNS_ADD}      ${NETNS} add
+${NETNS_DEL}      ${NETNS} del
+${NETNS_EXEC}     ${NETNS} exec
+${NETNS}          sudo ip netns
+${NETSTAT}        sudo netstat -nap
+${PACKET_LOSS}    , 100% packet loss
+${ODL_STREAM}     dummy
+${OVS_DEL_CTRLR}    sudo ovs-vsctl del-controller
+${OVS_DEL_MGR}    sudo ovs-vsctl del-manager
+${OVS_HOME}       /usr/share/openvswitch/
+${OVS_RESTART}    sudo service openvswitch-switch restart
+${OVS_SET_CTRLR}    sudo ovs-vsctl set-controller
+${OVS_SET_MGR}    sudo ovs-vsctl set-manager tcp
+${OVS_SHOW}       sudo ovs-vsctl show
+${OVSDB_CLIENT_DUMP}    sudo ovsdb-client dump hardware_vtep
+${OVSDB_NETWORK_TOPOLOGY}    /restconf/operational/network-topology:network-topology/topology/ovsdb:1/
+${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=
+${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}
+${STR_VIF_REPLACE}    "neutron-binding:vif-type":"ovs"
+${STR_VIF_TYPE}    "neutron-binding:vif-type":"unbound"
+${STR_VNIC_REPLACE}    "neutron-binding:vnic-type":"direct"
+${STR_VNIC_TYPE}    "neutron-binding:vnic-type":"normal"
+${SUBNET_ADDT_ARG}    --enable-dhcp
+${UUID_COL_NAME}    _uuid
+${VTEP LIST}      sudo vtep-ctl list
+${VTEP_ADD_MGR}    sudo vtep-ctl set-manager tcp
+${VTEP_DEL_MGR}    sudo vtep-ctl del-manager
+${VTEP_LIST_COLUMN}    sudo vtep-ctl --columns=
+#HWVTEP Table Names
+${LOGICAL_SWITCH_TABLE}    Logical_Switch
+${GLOBAL_TABLE}    Global
+${MANAGER_TABLE}    Manager
+${MCAST_MACS_LOCAL_TABLE}    Mcast_Macs_Local
+${MCAST_MACS_REMOTE_TABLE}    Mcast_Macs_Remote
+${PHYSICAL_LOCATOR_TABLE}    Physical_Locator
+${PHYSICAL_PORT_TABLE}    Physical_Port
+${PHYSICAL_SWITCH_TABLE}    Physical_Switch
+${TUNNEL_TABLE}    Tunnel
+${UCAST_MACS_LOCALE_TABLE}    Ucast_Macs_Local
+${UCAST_MACS_REMOTE_TABLE}    Ucast_Macs_Remote
+#Regular Expressions
+${VLAN_BINDING_REGEX}    vlan_bindings+\\s+:\\s+[{]0[=]
+${NETSTAT_OVSDB_REGEX}    ${ODL_SYSTEM_IP}:${OVSDBPORT}\\s+ESTABLISHED\\s
+${NETSTAT_OF_REGEX}    ${ODL_SYSTEM_IP}:${ODL_OF_PORT}\\s+ESTABLISHED\\s
diff --git a/csit/variables/l2gw/itm_create/location.uri b/csit/variables/l2gw/itm_create/location.uri
new file mode 100644 (file)
index 0000000..8a95992
--- /dev/null
@@ -0,0 +1 @@
+/restconf/config/itm:transport-zones/
diff --git a/csit/variables/l2gw/itm_create/post_data.json b/csit/variables/l2gw/itm_create/post_data.json
new file mode 100644 (file)
index 0000000..65f5472
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "transport-zone": [
+    {
+      "zone-name": "TZA",
+      "tunnel-type": "odl-interface:tunnel-type-vxlan",
+      "subnets": [
+        {
+          "vlan-id": "0",
+          "prefix": "$prefix",
+          "vteps": [
+            {
+              "ip-address": "$ip",
+              "dpn-id": $dpnid,
+              "portname": "phy0"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}