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
9 TC01 Configure Hwvtep Manager OVS Manager Controller And Verify
10 L2GatewayOperations.Add Vtep Manager And Verify ${ODL_IP}
12 TC02 Create First Set Of Network Subnet And Ports
13 OpenStackOperations.Create Network ${NET_1} ${NET_ADDT_ARG} ${NET_1_SEGID}
14 ${output}= OpenStackOperations.List Networks
15 Should Contain ${output} ${NET_1}
16 OpenStackOperations.Create SubNet ${NET_1} ${SUBNET_1} ${SUBNET_RANGE1} ${SUBNET_ADDT_ARG}
17 ${output}= OpenStackOperations.List Subnets
18 Should Contain ${output} ${SUBNET_1}
19 OpenStackOperations.Create And Configure Security Group ${SECURITY_GROUP_L2GW}
20 OpenStackOperations.Create Port ${NET_1} ${OVS_PORT_1} sg=${SECURITY_GROUP_L2GW}
21 OpenStackOperations.Create Neutron Port With Additional Params ${NET_1} ${HWVTEP_PORT_1} ${SECURITY_GROUP_L2GW_NONE}
22 ${port_mac}= Get Port Mac ${OVS_PORT_1} #port_mac[0]
23 ${port_ip}= Get Port Ip ${OVS_PORT_1} #port_ip[0]
24 Append To List ${port_mac_list} ${port_mac}
25 Append To List ${port_ip_list} ${port_ip}
26 ${port_mac}= Get Port Mac ${HWVTEP_PORT_1} #port_mac[1]
27 ${port_ip}= Get Port Ip ${HWVTEP_PORT_1} #port_ip[1]
28 Append To List ${port_mac_list} ${port_mac}
29 Append To List ${port_ip_list} ${port_ip}
31 TC03 Update Port For Hwvtep And Attach Port To Namespace
32 L2GatewayOperations.Update Port For Hwvtep ${HWVTEP_PORT_1}
33 Wait Until Keyword Succeeds 30s 2s L2GatewayOperations.Attach Port To Hwvtep Namespace ${port_mac_list[1]} ${HWVTEP_NS1} ${NS_TAP1}
35 TC04 Create Vms On Compute Node
36 OpenStackOperations.Create Nano Flavor
37 ${hostname_compute_node}= Get Hypervisor Hostname From IP ${OVS_IP}
38 OpenStackOperations.Create Vm Instance With Port On Compute Node ${OVS_PORT_1} ${OVS_VM1_NAME} ${hostname_compute_node}
39 ${vm_ip}= Wait Until Keyword Succeeds 60s 2s L2GatewayOperations.Verify Nova VM IP ${OVS_VM1_NAME}
41 Should Contain ${vm_ip} ${port_ip_list[0]}
43 TC05 Create L2Gateway And Connection And Verify
44 ${output}= L2GatewayOperations.Create Verify L2Gateway ${HWVTEP_BRIDGE} ${NS_PORT1} ${L2GW_NAME1}
46 ${output}= Wait Until Keyword Succeeds 30s 2s L2GatewayOperations.Create Verify L2Gateway Connection ${L2GW_NAME1} ${NET_1}
48 Wait Until Keyword Succeeds 30s 2s L2GatewayOperations.Verify Ovs Tunnel ${HWVTEP_IP} ${OVS_IP}
49 ${output}= ITM Get Tunnels
51 Should Contain ${output} physicalswitch/${HWVTEP_BRIDGE}
52 Wait Until Keyword Succeeds 30s 1s L2GatewayOperations.Verify Vtep List ${hwvtep_conn_id} ${TUNNEL_TABLE} enable="true"
53 ${phy_port_out}= Get Vtep List ${PHYSICAL_PORT_TABLE}
54 Validate Regexp In String ${phy_port_out} ${VLAN_BINDING_REGEX} 1
55 ${list}= Create List ${OVS_IP} ${HWVTEP_IP}
56 Wait Until Keyword Succeeds 30s 1s L2GatewayOperations.Verify Vtep List ${hwvtep_conn_id} ${PHYSICAL_LOCATOR_TABLE} @{list}
57 Wait Until Keyword Succeeds 30s 1s L2GatewayOperations.Verify Vtep List ${hwvtep_conn_id} ${UCAST_MACS_REMOTE_TABLE} ${port_mac_list[0]}
59 TC06 Dhcp Ip Allocation For Hwvtep Tap Port
60 Wait Until Keyword Succeeds 180s 10s L2GatewayOperations.Namespace Dhclient Verify ${HWVTEP_NS1} ${NS_TAP1} ${port_ip_list[1]}
62 TC07 Verify Ping From Compute Node Vm To Hwvtep
63 ${output}= Wait Until Keyword Succeeds 60s 10s Execute Command on VM Instance ${NET_1} ${port_ip_list[0]}
64 ... ping -c 3 ${port_ip_list[1]}
66 Should Not Contain ${output} ${PACKET_LOSS}
67 ${src_mac_list}= Create List ${port_mac_list[0]}
68 ${dst_mac_list}= Create List ${port_mac_list[1]}
69 Wait Until Keyword Succeeds 30s 5s L2GatewayOperations.Verify Elan Flow Entries ${OVS_IP} ${src_mac_list} ${dst_mac_list}
71 TC08 Ping Verification From Namespace Tap To Ovs Vm
72 Wait Until Keyword Succeeds 30s 5s L2GatewayOperations.Verify Ping In Namespace Extra Timeout ${HWVTEP_NS1} ${port_mac_list[1]} ${port_ip_list[0]}
74 TC09 Additional Network Subnet Port Creation
75 OpenStackOperations.Create Network ${NET_2} ${NET_ADDT_ARG} ${NET_2_SEGID}
76 ${output}= OpenStackOperations.List Networks
77 Should Contain ${output} ${NET_2}
78 OpenStackOperations.Create SubNet ${NET_2} ${SUBNET_2} ${SUBNET_RANGE2} ${SUBNET_ADDT_ARG}
79 ${output}= OpenStackOperations.List Subnets
80 Should Contain ${output} ${SUBNET_2}
81 OpenStackOperations.Create Port ${NET_2} ${OVS_PORT_2} sg=${SECURITY_GROUP_L2GW}
82 OpenStackOperations.Create Neutron Port With Additional Params ${NET_2} ${HWVTEP_PORT_2} ${SECURITY_GROUP_L2GW_NONE}
83 ${port_mac}= Get Port Mac ${OVS_PORT_2} #port_mac[2]
84 ${port_ip}= Get Port Ip ${OVS_PORT_2} #port_ip[2]
85 Append To List ${port_mac_list} ${port_mac}
86 Append To List ${port_ip_list} ${port_ip}
87 ${port_mac}= Get Port Mac ${HWVTEP_PORT_2} #port_mac[3]
88 ${port_ip}= Get Port Ip ${HWVTEP_PORT_2} #port_ip[3]
89 Append To List ${port_mac_list} ${port_mac}
90 Append To List ${port_ip_list} ${port_ip}
92 TC10 Update And Attach Second Port To Hwvtep Create L2gw Connection
93 L2GatewayOperations.Update Port For Hwvtep ${HWVTEP_PORT_2}
94 Wait Until Keyword Succeeds 30s 2s L2GatewayOperations.Attach Port To Hwvtep Namespace ${port_mac_list[3]} ${HWVTEP_NS2} ${NS2_TAP1}
95 ${hostname_compute_node}= Get Hypervisor Hostname From IP ${OVS_IP}
96 OpenStackOperations.Create Vm Instance With Port On Compute Node ${OVS_PORT_2} ${OVS_VM2_NAME} ${hostname_compute_node}
97 ${vm_ip}= Wait Until Keyword Succeeds 60s 2s L2GatewayOperations.Verify Nova VM IP ${OVS_VM2_NAME}
99 Should Contain ${vm_ip} ${port_ip_list[2]}
100 ${output}= L2GatewayOperations.Create Verify L2Gateway ${HWVTEP_BRIDGE} ${NS_PORT2} ${L2GW_NAME2}
102 ${output}= L2GatewayOperations.Create Verify L2Gateway Connection ${L2GW_NAME2} ${NET_2}
104 ${phy_port_out}= Get Vtep List ${PHYSICAL_PORT_TABLE}
105 Validate Regexp In String ${phy_port_out} ${VLAN_BINDING_REGEX} 2
107 TC11 Dhcp Ip Allocation And Ping Validation Within Second Network
108 Wait Until Keyword Succeeds 180s 10s L2GatewayOperations.Namespace Dhclient Verify ${HWVTEP_NS2} ${NS2_TAP1} ${port_ip_list[3]}
109 ${output}= Wait Until Keyword Succeeds 60s 10s Execute Command on VM Instance ${NET_2} ${port_ip_list[2]}
110 ... ping -c 3 ${port_ip_list[3]}
112 Should Not Contain ${output} ${PACKET_LOSS}
113 ${src_mac_list}= Create List ${port_mac_list[2]}
114 ${dst_mac_list}= Create List ${port_mac_list[3]}
115 Wait Until Keyword Succeeds 30s 5s L2GatewayOperations.Verify Elan Flow Entries ${OVS_IP} ${src_mac_list} ${dst_mac_list}
116 Wait Until Keyword Succeeds 30s 5s L2GatewayOperations.Verify Ping In Namespace Extra Timeout ${HWVTEP_NS2} ${port_mac_list[3]} ${port_ip_list[2]}
118 TC12 Ping Between Vm In Second Network To Namespace In First Network
119 ${output}= Wait Until Keyword Succeeds 60s 10s Execute Command on VM Instance ${NET_2} ${port_ip_list[2]}
120 ... ping -c 3 ${port_ip_list[1]}
122 Should Contain ${output} ${PACKET_LOSS}
124 TC13 Ping Between Namespace In Second Network To Vm In First Network
125 Wait Until Keyword Succeeds 30s 5s L2GatewayOperations.Verify Ping Fails In Namespace ${HWVTEP_NS2} ${port_mac_list[3]} ${port_ip_list[0]}
127 TC99 Cleanup L2Gateway Connection Itm Tunnel Port Subnet And Network
128 L2GatewayOperations.Delete L2Gateway Connection ${L2GW_NAME1}
129 L2GatewayOperations.Delete L2Gateway Connection ${L2GW_NAME2}
130 L2GatewayOperations.Delete L2Gateway ${L2GW_NAME1}
131 L2GatewayOperations.Delete L2Gateway ${L2GW_NAME2}
132 OpenStackOperations.Delete Vm Instance ${OVS_VM1_NAME}
133 OpenStackOperations.Delete Vm Instance ${OVS_VM2_NAME}
134 OpenStackOperations.Delete Port ${OVS_PORT_1}
135 OpenStackOperations.Delete Port ${OVS_PORT_2}
136 OpenStackOperations.Delete Port ${HWVTEP_PORT_1}
137 OpenStackOperations.Delete Port ${HWVTEP_PORT_2}
138 OpenStackOperations.Delete SubNet ${SUBNET_1}
139 OpenStackOperations.Delete SubNet ${SUBNET_2}
140 OpenStackOperations.Delete Network ${NET_1}
141 OpenStackOperations.Delete Network ${NET_2}
145 [Documentation] Basic Suite Setup required for the HWVTEP Test Suite
146 OpenStackOperations.OpenStack Suite Setup
147 OpenStackOperations.Get ControlNode Connection
148 Write Commands Until Prompt cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin 30s
149 ${port_mac_list}= Create List
150 Set Suite Variable ${port_mac_list}
151 ${port_ip_list}= Create List
152 Set Suite Variable ${port_ip_list}
157 OpenStackOperations.OpenStack Suite Teardown
160 [Documentation] Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
161 ${hwvtep_conn_id}= Create And Set Hwvtep Connection Id ${HWVTEP_IP}
162 Set Suite Variable ${hwvtep_conn_id}
163 Hwvtep Cleanup ${hwvtep_conn_id} ${HWVTEP_BRIDGE}
165 Hwvtep Initiate ${hwvtep_conn_id} ${HWVTEP_IP} ${HWVTEP_BRIDGE}
166 Namespace Intiate Hwvtep1
167 Wait Until Keyword Succeeds 30s 1s Hwvtep Validation
170 [Documentation] Stop Suite to cleanup Hwvtep configuration
171 Hwvtep Cleanup ${hwvtep_conn_id} ${HWVTEP_BRIDGE}
175 [Arguments] ${conn_id} ${hwvtep_bridge}
176 [Documentation] Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
177 Switch Connection ${conn_id}
178 Write Commands Until Prompt ${DEL_OVS_BRIDGE} ${hwvtep_bridge} 30s
179 Write Commands Until Prompt ${KILL_VTEP_PROC} 30s
180 Write Commands Until Prompt ${KILL_VSWITCHD_PROC} 30s
181 Write Commands Until Prompt ${KILL_OVSDB_PROC} 30s
182 ${stdout}= Write Commands Until Prompt ${GREP_OVS} 30s
184 Write Commands Until Prompt ${REM_OVSDB} 30s
185 Write Commands Until Prompt ${REM_VTEPDB} 30s
188 [Documentation] Cleanup the existing namespaces and ports.
189 Switch Connection ${hwvtep_conn_id}
190 ${stdout}= Write Commands Until Prompt ${IP_LINK} 30s
192 Write Commands Until Prompt ${IP_LINK_DEL} ${NS_PORT1} 30s
193 Write Commands Until Prompt ${IP_LINK_DEL} ${NS_PORT2} 30s
194 ${stdout}= Write Commands Until Prompt ${NETNS} 30s
196 Write Commands Until Prompt ${NETNS_DEL} ${HWVTEP_NS1} 30s
197 Write Commands Until Prompt ${NETNS_DEL} ${HWVTEP_NS2} 30s
198 ${stdout}= Write Commands Until Prompt ${IP_LINK} 30s
202 [Arguments] ${conn_id} ${hwvtep_ip} ${hwvtep_bridge}
203 [Documentation] Configure the Hwvtep Emulation
204 Switch Connection ${conn_id}
205 Write Commands Until Prompt ${CREATE_OVSDB} 30s
206 Write Commands Until Prompt ${CREATE VTEP} 30s
207 Write Commands Until Prompt ${START_OVSDB_SERVER} 30s
208 ${stdout}= Write Commands Until Prompt ${GREP_OVS} 30s
210 Write Commands Until Prompt ${INIT_VSCTL} 30s
211 Write Commands Until Prompt ${DETACH_VSWITCHD} 30s
212 Write Commands Until Prompt ${CREATE_OVS_BRIDGE} ${hwvtep_bridge} 30s
213 ${stdout}= Write Commands Until Prompt ${OVS_SHOW} 30s
215 Write Commands Until Prompt ${ADD_VTEP_PS} ${hwvtep_bridge} 30s
216 Write Commands Until Prompt ${SET_VTEP_PS} ${hwvtep_bridge} tunnel_ips=${hwvtep_ip} 30s
217 Write Commands Until Prompt ${START_OVSVTEP} ${hwvtep_bridge} 30s
218 ${stdout}= Write Commands Until Prompt ${GREP_OVS} 30s
221 Namespace Intiate Hwvtep1
222 [Documentation] Create and configure the namespace, bridges and ports.
223 Switch Connection ${hwvtep_conn_id}
224 Create Configure Namespace ${HWVTEP_NS1} ${NS_PORT1} ${NS_TAP1} ${HWVTEP_BRIDGE}
225 Create Configure Namespace ${HWVTEP_NS2} ${NS_PORT2} ${NS2_TAP1} ${HWVTEP_BRIDGE}
227 Create Configure Namespace
228 [Arguments] ${ns_name} ${ns_port_name} ${tap_port_name} ${hwvtep_bridge}
229 Write Commands Until Prompt ${NETNS_ADD} ${ns_name} 30s
230 Write Commands Until Prompt ${IP_LINK_ADD} ${tap_port_name} type veth peer name ${ns_port_name} 30s
231 Write Commands Until Prompt ${CREATE_OVS_PORT} ${hwvtep_bridge} ${ns_port_name} 30s
232 Write Commands Until Prompt ${IP_LINK_SET} ${tap_port_name} netns ${ns_name} 30s
233 Write Commands Until Prompt ${NETNS_EXEC} ${ns_name} ${IPLINK_SET} ${tap_port_name} up 30s
234 Write Commands Until Prompt sudo ${IPLINK_SET} ${ns_port_name} up 30s
235 ${stdout}= Write Commands Until Prompt ${NETNS_EXEC} ${ns_name} ${IFCONF} 30s
239 [Documentation] Initial validation of the Hwvtep Configuration to confirm Phyisical_Switch table entries
240 Switch Connection ${hwvtep_conn_id}
241 ${stdout}= Write Commands Until Prompt ${VTEP LIST} ${PHYSICAL_SWITCH_TABLE} 30s
242 Should Contain ${stdout} ${HWVTEP_BRIDGE}
243 Should Contain ${stdout} ${HWVTEP_IP}
244 ${stdout}= Write Commands Until Prompt ${VTEP LIST} ${PHYSICAL_PORT_TABLE} 30s
245 Should Contain ${stdout} ${NS_PORT1}
246 Should Contain ${stdout} ${NS_PORT2}
248 Create And Set Hwvtep Connection Id
249 [Arguments] ${hwvtep_ip}
250 [Documentation] To create connection and return connection id for hwvtep_ip received
251 ${conn_id}= SSHLibrary.Open Connection ${hwvtep_ip} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s
253 Flexible SSH Login ${DEFAULT_USER} ${DEFAULT_PASSWORD}