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