Fix some L2GW test cases for existing connections
[integration/test.git] / csit / suites / l2gw / 01_Configure_verify_l2gateway.robot
1 *** Settings ***
2 Documentation     Test Suite for verification of HWVTEP usecases
3 Suite Setup       Basic Suite Setup
4 Suite Teardown    Basic Suite Teardown
5 Test Teardown     Get L2gw Debug Info
6 Resource          ../../libraries/L2GatewayOperations.robot
7 Resource          ../../libraries/CompareStream.robot
8
9 *** Test Cases ***
10 TC01 Configure Hwvtep Manager OVS Manager Controller And Verify
11     [Documentation]    Configure ODL at ${ODL_IP} as manager for HWVTEP
12     L2GatewayOperations.Add Vtep Manager And Verify    ${ODL_IP}
13
14 TC02 Create First Set Of Network Subnet And Ports
15     [Documentation]    Create Networks and Ports
16     OpenStackOperations.Create Network    ${NET_1}    ${NET_ADDT_ARG} ${NET_1_SEGID}
17     ${output}=    OpenStackOperations.List Networks
18     Should Contain    ${output}    ${NET_1}
19     OpenStackOperations.Create SubNet    ${NET_1}    ${SUBNET_1}    ${SUBNET_RANGE1}    ${SUBNET_ADDT_ARG}
20     ${output}=    OpenStackOperations.List Subnets
21     Should Contain    ${output}    ${SUBNET_1}
22     OpenStackOperations.Create And Configure Security Group    ${SECURITY_GROUP_L2GW}
23     OpenStackOperations.Create Port    ${NET_1}    ${OVS_PORT_1}    sg=${SECURITY_GROUP_L2GW}
24     OpenStackOperations.Create Neutron Port With Additional Params    ${NET_1}    ${HWVTEP_PORT_1}    ${SECURITY_GROUP_L2GW_NONE}
25     ${port_mac}=    Get Port Mac    ${OVS_PORT_1}    #port_mac[0]
26     ${port_ip}=    Get Port Ip    ${OVS_PORT_1}    #port_ip[0]
27     Append To List    ${port_mac_list}    ${port_mac}
28     Append To List    ${port_ip_list}    ${port_ip}
29     ${port_mac}=    Get Port Mac    ${HWVTEP_PORT_1}    #port_mac[1]
30     ${port_ip}=    Get Port Ip    ${HWVTEP_PORT_1}    #port_ip[1]
31     Append To List    ${port_mac_list}    ${port_mac}
32     Append To List    ${port_ip_list}    ${port_ip}
33
34 TC03 Update Port For Hwvtep And Attach Port To Namespace
35     [Documentation]    Update the Neutron Ports for required to connect to HWVTEP and attach that port to tap port in namespace
36     L2GatewayOperations.Update Port For Hwvtep    ${HWVTEP_PORT_1}
37     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Attach Port To Hwvtep Namespace    ${port_mac_list[1]}    ${HWVTEP_NS1}    ${NS_TAP1}
38
39 TC04 Create Vms On Compute Node
40     [Documentation]    Create VM on compute node and verify that VM got IP address
41     # FIXME! Don't need this in queens, but do in earlier releases
42     OpenStackOperations.Create Nano Flavor
43     OpenStackOperations.Create Vm Instance With Port On Compute Node    ${OVS_PORT_1}    ${OVS_VM1_NAME}    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP_L2GW}
44     ${vm_ip}=    Wait Until Keyword Succeeds    60s    2s    L2GatewayOperations.Verify Nova VM IP    ${OVS_VM1_NAME}
45     Log    ${vm_ip}
46     Should Contain    ${vm_ip}    ${port_ip_list[0]}
47
48 TC05 Create L2Gateway And Connection And Verify
49     [Documentation]    Create L2GW and Connection using Neutron CLI. Verify info in hardware_vtep db in HWVTEP emulator.
50     ${output}=    L2GatewayOperations.Create Verify L2Gateway    ${HWVTEP_BRIDGE}    ${NS_PORT1}    ${L2GW_NAME1}
51     Log    ${output}
52     ${output}=    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Create Verify L2Gateway Connection    ${L2GW_NAME1}    ${NET_1}
53     Log    ${output}
54     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify Ovs Tunnel    ${HWVTEP_IP}    ${OVS_IP}
55     ${output}=    ITM Get Tunnels
56     Log    ${output}
57     Should Contain    ${output}    physicalswitch/${HWVTEP_BRIDGE}
58     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${TUNNEL_TABLE}    enable="true"
59     ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
60     Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    1
61     ${list}=    Create List    ${OVS_IP}    ${HWVTEP_IP}
62     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${PHYSICAL_LOCATOR_TABLE}    @{list}
63     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[0]}
64
65 TC06 Dhcp Ip Allocation For Hwvtep Tap Port
66     [Documentation]    Verify that HWVTEP port gets an IP address
67     Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS1}    ${NS_TAP1}    ${port_ip_list[1]}
68
69 TC07 Verify Ping From Compute Node Vm To Hwvtep
70     [Documentation]    Verify that VM on Compute Node can ping HWVTEP port
71     ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_1}    ${port_ip_list[0]}
72     ...    ping -c 3 ${port_ip_list[1]}
73     Log    ${output}
74     Should Not Contain    ${output}    ${PACKET_LOSS}
75     ${src_mac_list}=    Create List    ${port_mac_list[0]}
76     ${dst_mac_list}=    Create List    ${port_mac_list[1]}
77     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
78
79 TC08 Ping Verification From Namespace Tap To Ovs Vm
80     [Documentation]    Verify that HWVTEP port can ping VM on compute node
81     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS1}    ${port_mac_list[1]}    ${port_ip_list[0]}
82
83 TC09 Additional Network Subnet Port Creation
84     [Documentation]    Create 2nd network and ports
85     OpenStackOperations.Create Network    ${NET_2}    ${NET_ADDT_ARG} ${NET_2_SEGID}
86     ${output}=    OpenStackOperations.List Networks
87     Should Contain    ${output}    ${NET_2}
88     OpenStackOperations.Create SubNet    ${NET_2}    ${SUBNET_2}    ${SUBNET_RANGE2}    ${SUBNET_ADDT_ARG}
89     ${output}=    OpenStackOperations.List Subnets
90     Should Contain    ${output}    ${SUBNET_2}
91     OpenStackOperations.Create Port    ${NET_2}    ${OVS_PORT_2}    sg=${SECURITY_GROUP_L2GW}
92     OpenStackOperations.Create Neutron Port With Additional Params    ${NET_2}    ${HWVTEP_PORT_2}    ${SECURITY_GROUP_L2GW_NONE}
93     ${port_mac}=    Get Port Mac    ${OVS_PORT_2}    #port_mac[2]
94     ${port_ip}=    Get Port Ip    ${OVS_PORT_2}    #port_ip[2]
95     Append To List    ${port_mac_list}    ${port_mac}
96     Append To List    ${port_ip_list}    ${port_ip}
97     ${port_mac}=    Get Port Mac    ${HWVTEP_PORT_2}    #port_mac[3]
98     ${port_ip}=    Get Port Ip    ${HWVTEP_PORT_2}    #port_ip[3]
99     Append To List    ${port_mac_list}    ${port_mac}
100     Append To List    ${port_ip_list}    ${port_ip}
101
102 TC10 Update And Attach Second Port To Hwvtep Create L2gw Connection
103     [Documentation]    Update ports in Neutron so they can be connected to HWVTEP, create 2nd L2GW and Connection, and Verify
104     L2GatewayOperations.Update Port For Hwvtep    ${HWVTEP_PORT_2}
105     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Attach Port To Hwvtep Namespace    ${port_mac_list[3]}    ${HWVTEP_NS2}    ${NS2_TAP1}
106     OpenStackOperations.Create Vm Instance With Port On Compute Node    ${OVS_PORT_2}    ${OVS_VM2_NAME}    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP_L2GW}
107     ${vm_ip}=    Wait Until Keyword Succeeds    60s    2s    L2GatewayOperations.Verify Nova VM IP    ${OVS_VM2_NAME}
108     Log    ${vm_ip}
109     Should Contain    ${vm_ip}    ${port_ip_list[2]}
110     ${output}=    L2GatewayOperations.Create Verify L2Gateway    ${HWVTEP_BRIDGE}    ${NS_PORT2}    ${L2GW_NAME2}
111     Log    ${output}
112     ${output}=    L2GatewayOperations.Create Verify L2Gateway Connection    ${L2GW_NAME2}    ${NET_2}
113     Log    ${output}
114     ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
115     Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    2
116
117 TC11 Dhcp Ip Allocation And Ping Validation Within Second Network
118     [Documentation]    Verify that port in namespace got an IP. Verify flow entries, verify IP connectivity between HWVTEP port and VM
119     Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS2}    ${NS2_TAP1}    ${port_ip_list[3]}
120     ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_2}    ${port_ip_list[2]}
121     ...    ping -c 3 ${port_ip_list[3]}
122     Log    ${output}
123     Should Not Contain    ${output}    ${PACKET_LOSS}
124     ${src_mac_list}=    Create List    ${port_mac_list[2]}
125     ${dst_mac_list}=    Create List    ${port_mac_list[3]}
126     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
127     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS2}    ${port_mac_list[3]}    ${port_ip_list[2]}
128
129 TC12 Ping Between Vm In Second Network To Namespace In First Network
130     [Documentation]    Verify IP Connectivity between VM in 2nd network to NS in 1st network
131     ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_2}    ${port_ip_list[2]}
132     ...    ping -c 3 ${port_ip_list[1]}
133     Log    ${output}
134     Should Contain    ${output}    ${PACKET_LOSS}
135
136 TC13 Ping Between Namespace In Second Network To Vm In First Network
137     [Documentation]    Verify IP Connectivity between port in NS in 2nd network to VM in 1st network
138     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping Fails In Namespace    ${HWVTEP_NS2}    ${port_mac_list[3]}    ${port_ip_list[0]}
139
140 TC14 Create, Update And Attach 2nd Neutron Port to Hwvtep Namespace 1
141     [Documentation]    Create and attach 2nd port to HWVTEP in network 1
142     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
143     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
144     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
145     OpenStackOperations.Create Neutron Port With Additional Params    ${NET_1}    ${HWVTEP_PORT_3}    ${SECURITY_GROUP_L2GW_NONE}
146     ${port_mac}=    Get Port Mac    ${HWVTEP_PORT_3}    #port_mac[4]
147     ${port_ip}=    Get Port Ip    ${HWVTEP_PORT_3}    #port_ip[4]
148     Append To List    ${port_mac_list}    ${port_mac}
149     Append To List    ${port_ip_list}    ${port_ip}
150     Namespace Add Port Hwvtep1
151     L2GatewayOperations.Update Port For Hwvtep    ${HWVTEP_PORT_3}
152     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Attach Port To Hwvtep Namespace    ${port_mac_list[4]}    ${HWVTEP_NS1}    ${NS_TAP1}
153
154 TC15 Update Existing L2Gateway With 2nd Port And Verify
155     [Documentation]    Add the new port ${NS_PORT3} to existing L2GW ${L2GW_NAME1} that has an existing connection. ${NS_PORT1} is already attached, adding ${NS_PORT3}
156     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
157     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
158     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
159     ${output}=    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Update And Verify L2Gateway    ${HWVTEP_BRIDGE}    ${L2GW_NAME1}
160     ...    ${NS_PORT1}    ${NS_PORT3}
161
162 TC16 Verify L2Gateway Connection
163     [Documentation]    Verify the L2GW connection has the 2nd port. Verify db in hardware vtep emulator tables.
164     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
165     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
166     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
167     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify L2Gateway Connection    ${L2GW_NAME1}    ${NET_1}
168     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify Ovs Tunnel    ${HWVTEP_IP}    ${OVS_IP}
169     ${output}=    ITM Get Tunnels
170     Log    ${output}
171     Should Contain    ${output}    physicalswitch/${HWVTEP_BRIDGE}
172     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${TUNNEL_TABLE}    enable="true"
173     ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
174     Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    1
175     ${list}=    Create List    ${OVS_IP}    ${HWVTEP_IP}
176     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${PHYSICAL_LOCATOR_TABLE}    @{list}
177     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[0]}
178     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[4]}
179
180 TC17 Dhcp Ip Allocation For Hwvtep Tap Port
181     [Documentation]    Verify the 2nd HWVTEP port was able to get an IP address
182     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
183     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
184     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
185     Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS1}    ${NS_TAP1}    ${port_ip_list[4]}
186
187 TC18 Verify Ping From Compute Node Vm To Hwvtep Port 2
188     [Documentation]    Verify IP connectivity between VM in net1 and 2nd HWVTEP port in net 1
189     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
190     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
191     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
192     ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_1}    ${port_ip_list[0]}
193     ...    ping -c 3 ${port_ip_list[4]}
194     Log    ${output}
195     Should Not Contain    ${output}    ${PACKET_LOSS}
196     ${src_mac_list}=    Create List    ${port_mac_list[0]}
197     ${dst_mac_list}=    Create List    ${port_mac_list[4]}
198     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
199
200 TC19 Ping Verification From Namespace Tap To Ovs Vm
201     [Documentation]    Verify IP connectivity between 2nd HWVTEP port and VM in compute node
202     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
203     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
204     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
205     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS1}    ${port_mac_list[4]}    ${port_ip_list[0]}
206
207 TC99 Cleanup L2Gateway Connection Itm Tunnel Port Subnet And Network
208     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
209     L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME1}
210     L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME2}
211     L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME1}
212     L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME2}
213     OpenStackOperations.Delete Vm Instance    ${OVS_VM1_NAME}
214     OpenStackOperations.Delete Vm Instance    ${OVS_VM2_NAME}
215     OpenStackOperations.Delete Port    ${OVS_PORT_1}
216     OpenStackOperations.Delete Port    ${OVS_PORT_2}
217     OpenStackOperations.Delete Port    ${HWVTEP_PORT_1}
218     OpenStackOperations.Delete Port    ${HWVTEP_PORT_2}
219     Cleanup L2GW Optional Resources
220     OpenStackOperations.Delete SubNet    ${SUBNET_1}
221     OpenStackOperations.Delete SubNet    ${SUBNET_2}
222     OpenStackOperations.Delete Network    ${NET_1}
223     OpenStackOperations.Delete Network    ${NET_2}
224
225 *** Keywords ***
226 Basic Suite Setup
227     [Documentation]    Basic Suite Setup required for the HWVTEP Test Suite
228     OpenStackOperations.OpenStack Suite Setup
229     OpenStackOperations.Get ControlNode Connection
230     Write Commands Until Prompt    cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin    30s
231     ${port_mac_list}=    Create List
232     Set Suite Variable    ${port_mac_list}
233     ${port_ip_list}=    Create List
234     Set Suite Variable    ${port_ip_list}
235     Start Suite
236
237 Basic Suite Teardown
238     Stop Suite
239     OpenStackOperations.OpenStack Suite Teardown
240
241 Start Suite
242     [Documentation]    Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
243     ${hwvtep_conn_id}=    Create And Set Hwvtep Connection Id    ${HWVTEP_IP}
244     Set Suite Variable    ${hwvtep_conn_id}
245     Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
246     Namespace Cleanup
247     Hwvtep Initiate    ${hwvtep_conn_id}    ${HWVTEP_IP}    ${HWVTEP_BRIDGE}
248     Namespace Intiate Hwvtep1
249     Wait Until Keyword Succeeds    30s    1s    Hwvtep Validation
250
251 Stop Suite
252     [Documentation]    Stop Suite to cleanup Hwvtep configuration
253     Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
254     Namespace Cleanup
255
256 Hwvtep Cleanup
257     [Arguments]    ${conn_id}    ${hwvtep_bridge}
258     [Documentation]    Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
259     Switch Connection    ${conn_id}
260     Write Commands Until Prompt    ${DEL_OVS_BRIDGE} ${hwvtep_bridge}    30s
261     Write Commands Until Prompt    ${KILL_VTEP_PROC}    30s
262     Write Commands Until Prompt    ${KILL_VSWITCHD_PROC}    30s
263     Write Commands Until Prompt    ${KILL_OVSDB_PROC}    30s
264     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
265     Log    ${stdout}
266     Write Commands Until Prompt    ${REM_OVSDB}    30s
267     Write Commands Until Prompt    ${REM_VTEPDB}    30s
268
269 Namespace Cleanup
270     [Documentation]    Cleanup the existing namespaces and ports.
271     Switch Connection    ${hwvtep_conn_id}
272     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
273     Log    ${stdout}
274     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT1}    30s
275     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT2}    30s
276     ${stdout}=    Write Commands Until Prompt    ${NETNS}    30s
277     Log    ${stdout}
278     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS1}    30s
279     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS2}    30s
280     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
281     Log    ${stdout}
282
283 Hwvtep Initiate
284     [Arguments]    ${conn_id}    ${hwvtep_ip}    ${hwvtep_bridge}
285     [Documentation]    Configure the Hwvtep Emulation
286     Switch Connection    ${conn_id}
287     Write Commands Until Prompt    ${CREATE_OVSDB}    30s
288     Write Commands Until Prompt    ${CREATE VTEP}    30s
289     Write Commands Until Prompt    ${START_OVSDB_SERVER}    30s
290     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
291     Log    ${stdout}
292     Write Commands Until Prompt    ${INIT_VSCTL}    30s
293     Write Commands Until Prompt    ${DETACH_VSWITCHD}    30s
294     Write Commands Until Prompt    ${CREATE_OVS_BRIDGE} ${hwvtep_bridge}    30s
295     ${stdout}=    Write Commands Until Prompt    ${OVS_SHOW}    30s
296     Log    ${stdout}
297     Write Commands Until Prompt    ${ADD_VTEP_PS} ${hwvtep_bridge}    30s
298     Write Commands Until Prompt    ${SET_VTEP_PS} ${hwvtep_bridge} tunnel_ips=${hwvtep_ip}    30s
299     Write Commands Until Prompt    ${START_OVSVTEP} ${hwvtep_bridge}    30s
300     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
301     Log    ${stdout}
302
303 Namespace Intiate Hwvtep1
304     [Documentation]    Create and configure the namespace, bridges and ports.
305     Switch Connection    ${hwvtep_conn_id}
306     Create Configure Namespace    ${HWVTEP_NS1}    ${NS_PORT1}    ${NS_TAP1}    ${HWVTEP_BRIDGE}
307     Create Configure Namespace    ${HWVTEP_NS2}    ${NS_PORT2}    ${NS2_TAP1}    ${HWVTEP_BRIDGE}
308
309 Namespace Add Port Hwvtep1
310     [Documentation]    Configure the namespace, bridges and ports.
311     Switch Connection    ${hwvtep_conn_id}
312     Configure Namespace    ${HWVTEP_NS1}    ${NS_PORT3}    ${NS_TAP3}    ${HWVTEP_BRIDGE}
313
314 Create Configure Namespace
315     [Arguments]    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
316     Write Commands Until Prompt    ${NETNS_ADD} ${ns_name}    30s
317     Configure Namespace    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
318
319 Configure Namespace
320     [Arguments]    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
321     Write Commands Until Prompt    ${IP_LINK_ADD} ${tap_port_name} type veth peer name ${ns_port_name}    30s
322     Write Commands Until Prompt    ${CREATE_OVS_PORT} ${hwvtep_bridge} ${ns_port_name}    30s
323     Write Commands Until Prompt    ${IP_LINK_SET} ${tap_port_name} netns ${ns_name}    30s
324     Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IPLINK_SET} ${tap_port_name} up    30s
325     Write Commands Until Prompt    sudo ${IPLINK_SET} ${ns_port_name} up    30s
326     ${stdout}=    Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IFCONF}    30s
327     Log    ${stdout}
328
329 Hwvtep Validation
330     [Documentation]    Initial validation of the Hwvtep Configuration to confirm Physical_Switch table entries
331     Switch Connection    ${hwvtep_conn_id}
332     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_SWITCH_TABLE}    30s
333     Should Contain    ${stdout}    ${HWVTEP_BRIDGE}
334     Should Contain    ${stdout}    ${HWVTEP_IP}
335     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_PORT_TABLE}    30s
336     Should Contain    ${stdout}    ${NS_PORT1}
337     Should Contain    ${stdout}    ${NS_PORT2}
338
339 Create And Set Hwvtep Connection Id
340     [Arguments]    ${hwvtep_ip}
341     [Documentation]    To create connection and return connection id for hwvtep_ip received
342     ${conn_id}=    SSHLibrary.Open Connection    ${hwvtep_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
343     Log    ${conn_id}
344     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
345     [Return]    ${conn_id}