Fix L2GW cleanup test case
[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     ${output}=    Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Create Verify L2Gateway Connection    ${L2GW_NAME1}    ${NET_1}
168     Log    ${output}
169     Wait Until Keyword Succeeds    30s    2s    L2GatewayOperations.Verify Ovs Tunnel    ${HWVTEP_IP}    ${OVS_IP}
170     ${output}=    ITM Get Tunnels
171     Log    ${output}
172     Should Contain    ${output}    physicalswitch/${HWVTEP_BRIDGE}
173     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${TUNNEL_TABLE}    enable="true"
174     ${phy_port_out}=    Get Vtep List    ${PHYSICAL_PORT_TABLE}
175     Validate Regexp In String    ${phy_port_out}    ${VLAN_BINDING_REGEX}    1
176     ${list}=    Create List    ${OVS_IP}    ${HWVTEP_IP}
177     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${PHYSICAL_LOCATOR_TABLE}    @{list}
178     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[0]}
179     Wait Until Keyword Succeeds    30s    1s    L2GatewayOperations.Verify Vtep List    ${hwvtep_conn_id}    ${UCAST_MACS_REMOTE_TABLE}    ${port_mac_list[4]}
180
181 TC17 Dhcp Ip Allocation For Hwvtep Tap Port
182     [Documentation]    Verify the 2nd HWVTEP port was able to get an IP address
183     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
184     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
185     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
186     Wait Until Keyword Succeeds    180s    10s    L2GatewayOperations.Namespace Dhclient Verify    ${HWVTEP_NS1}    ${NS_TAP1}    ${port_ip_list[4]}
187
188 TC18 Verify Ping From Compute Node Vm To Hwvtep Port 2
189     [Documentation]    Verify IP connectivity between VM in net1 and 2nd HWVTEP port in net 1
190     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
191     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
192     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
193     ${output}=    Wait Until Keyword Succeeds    60s    10s    Execute Command on VM Instance    ${NET_1}    ${port_ip_list[4]}
194     ...    ping -c 3 ${port_ip_list[4]}
195     Log    ${output}
196     Should Not Contain    ${output}    ${PACKET_LOSS}
197     ${src_mac_list}=    Create List    ${port_mac_list[0]}
198     ${dst_mac_list}=    Create List    ${port_mac_list[4]}
199     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Elan Flow Entries    ${OVS_IP}    ${src_mac_list}    ${dst_mac_list}
200
201 TC19 Ping Verification From Namespace Tap To Ovs Vm
202     [Documentation]    Verify IP connectivity between 2nd HWVTEP port and VM in compute node
203     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
204     BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
205     CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
206     Wait Until Keyword Succeeds    30s    5s    L2GatewayOperations.Verify Ping In Namespace Extra Timeout    ${HWVTEP_NS1}    ${port_mac_list[4]}    ${port_ip_list[0]}
207
208 TC99 Cleanup L2Gateway Connection Itm Tunnel Port Subnet And Network
209     [Tags]    skip_if_stable/ocata    skip_if_stable/pike
210     L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME1}
211     L2GatewayOperations.Delete L2Gateway Connection    ${L2GW_NAME2}
212     L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME1}
213     L2GatewayOperations.Delete L2Gateway    ${L2GW_NAME2}
214     OpenStackOperations.Delete Vm Instance    ${OVS_VM1_NAME}
215     OpenStackOperations.Delete Vm Instance    ${OVS_VM2_NAME}
216     OpenStackOperations.Delete Port    ${OVS_PORT_1}
217     OpenStackOperations.Delete Port    ${OVS_PORT_2}
218     OpenStackOperations.Delete Port    ${HWVTEP_PORT_1}
219     OpenStackOperations.Delete Port    ${HWVTEP_PORT_2}
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     Cleanup L2GW Optional Resources
225
226 *** Keywords ***
227 Basic Suite Setup
228     [Documentation]    Basic Suite Setup required for the HWVTEP Test Suite
229     OpenStackOperations.OpenStack Suite Setup
230     OpenStackOperations.Get ControlNode Connection
231     Write Commands Until Prompt    cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin    30s
232     ${port_mac_list}=    Create List
233     Set Suite Variable    ${port_mac_list}
234     ${port_ip_list}=    Create List
235     Set Suite Variable    ${port_ip_list}
236     Start Suite
237
238 Basic Suite Teardown
239     Stop Suite
240     OpenStackOperations.OpenStack Suite Teardown
241
242 Start Suite
243     [Documentation]    Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
244     ${hwvtep_conn_id}=    Create And Set Hwvtep Connection Id    ${HWVTEP_IP}
245     Set Suite Variable    ${hwvtep_conn_id}
246     Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
247     Namespace Cleanup
248     Hwvtep Initiate    ${hwvtep_conn_id}    ${HWVTEP_IP}    ${HWVTEP_BRIDGE}
249     Namespace Intiate Hwvtep1
250     Wait Until Keyword Succeeds    30s    1s    Hwvtep Validation
251
252 Stop Suite
253     [Documentation]    Stop Suite to cleanup Hwvtep configuration
254     Hwvtep Cleanup    ${hwvtep_conn_id}    ${HWVTEP_BRIDGE}
255     Namespace Cleanup
256
257 Hwvtep Cleanup
258     [Arguments]    ${conn_id}    ${hwvtep_bridge}
259     [Documentation]    Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
260     Switch Connection    ${conn_id}
261     Write Commands Until Prompt    ${DEL_OVS_BRIDGE} ${hwvtep_bridge}    30s
262     Write Commands Until Prompt    ${KILL_VTEP_PROC}    30s
263     Write Commands Until Prompt    ${KILL_VSWITCHD_PROC}    30s
264     Write Commands Until Prompt    ${KILL_OVSDB_PROC}    30s
265     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
266     Log    ${stdout}
267     Write Commands Until Prompt    ${REM_OVSDB}    30s
268     Write Commands Until Prompt    ${REM_VTEPDB}    30s
269
270 Namespace Cleanup
271     [Documentation]    Cleanup the existing namespaces and ports.
272     Switch Connection    ${hwvtep_conn_id}
273     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
274     Log    ${stdout}
275     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT1}    30s
276     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT2}    30s
277     ${stdout}=    Write Commands Until Prompt    ${NETNS}    30s
278     Log    ${stdout}
279     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS1}    30s
280     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS2}    30s
281     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
282     Log    ${stdout}
283
284 Hwvtep Initiate
285     [Arguments]    ${conn_id}    ${hwvtep_ip}    ${hwvtep_bridge}
286     [Documentation]    Configure the Hwvtep Emulation
287     Switch Connection    ${conn_id}
288     Write Commands Until Prompt    ${CREATE_OVSDB}    30s
289     Write Commands Until Prompt    ${CREATE VTEP}    30s
290     Write Commands Until Prompt    ${START_OVSDB_SERVER}    30s
291     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
292     Log    ${stdout}
293     Write Commands Until Prompt    ${INIT_VSCTL}    30s
294     Write Commands Until Prompt    ${DETACH_VSWITCHD}    30s
295     Write Commands Until Prompt    ${CREATE_OVS_BRIDGE} ${hwvtep_bridge}    30s
296     ${stdout}=    Write Commands Until Prompt    ${OVS_SHOW}    30s
297     Log    ${stdout}
298     Write Commands Until Prompt    ${ADD_VTEP_PS} ${hwvtep_bridge}    30s
299     Write Commands Until Prompt    ${SET_VTEP_PS} ${hwvtep_bridge} tunnel_ips=${hwvtep_ip}    30s
300     Write Commands Until Prompt    ${START_OVSVTEP} ${hwvtep_bridge}    30s
301     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
302     Log    ${stdout}
303
304 Namespace Intiate Hwvtep1
305     [Documentation]    Create and configure the namespace, bridges and ports.
306     Switch Connection    ${hwvtep_conn_id}
307     Create Configure Namespace    ${HWVTEP_NS1}    ${NS_PORT1}    ${NS_TAP1}    ${HWVTEP_BRIDGE}
308     Create Configure Namespace    ${HWVTEP_NS2}    ${NS_PORT2}    ${NS2_TAP1}    ${HWVTEP_BRIDGE}
309
310 Namespace Add Port Hwvtep1
311     [Documentation]    Configure the namespace, bridges and ports.
312     Switch Connection    ${hwvtep_conn_id}
313     Configure Namespace    ${HWVTEP_NS1}    ${NS_PORT3}    ${NS_TAP3}    ${HWVTEP_BRIDGE}
314
315 Create Configure Namespace
316     [Arguments]    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
317     Write Commands Until Prompt    ${NETNS_ADD} ${ns_name}    30s
318     Configure Namespace    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
319
320 Configure Namespace
321     [Arguments]    ${ns_name}    ${ns_port_name}    ${tap_port_name}    ${hwvtep_bridge}
322     Write Commands Until Prompt    ${IP_LINK_ADD} ${tap_port_name} type veth peer name ${ns_port_name}    30s
323     Write Commands Until Prompt    ${CREATE_OVS_PORT} ${hwvtep_bridge} ${ns_port_name}    30s
324     Write Commands Until Prompt    ${IP_LINK_SET} ${tap_port_name} netns ${ns_name}    30s
325     Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IPLINK_SET} ${tap_port_name} up    30s
326     Write Commands Until Prompt    sudo ${IPLINK_SET} ${ns_port_name} up    30s
327     ${stdout}=    Write Commands Until Prompt    ${NETNS_EXEC} ${ns_name} ${IFCONF}    30s
328     Log    ${stdout}
329
330 Hwvtep Validation
331     [Documentation]    Initial validation of the Hwvtep Configuration to confirm Physical_Switch table entries
332     Switch Connection    ${hwvtep_conn_id}
333     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_SWITCH_TABLE}    30s
334     Should Contain    ${stdout}    ${HWVTEP_BRIDGE}
335     Should Contain    ${stdout}    ${HWVTEP_IP}
336     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_PORT_TABLE}    30s
337     Should Contain    ${stdout}    ${NS_PORT1}
338     Should Contain    ${stdout}    ${NS_PORT2}
339
340 Create And Set Hwvtep Connection Id
341     [Arguments]    ${hwvtep_ip}
342     [Documentation]    To create connection and return connection id for hwvtep_ip received
343     ${conn_id}=    SSHLibrary.Open Connection    ${hwvtep_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
344     Log    ${conn_id}
345     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
346     [Return]    ${conn_id}