2 Documentation Test suite to validate elan service functionality in ODL environment.
3 ... The assumption of this suite is that the environment is already configured with the proper
4 ... integration bridges and vxlan tunnels.
5 Suite Setup BuiltIn.Run Keywords Get OvsDebugInfo
6 ... AND Elan SuiteSetup
7 ... AND Get OvsDebugInfo
8 Suite Teardown Elan SuiteTeardown
9 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
10 Test Teardown Get Test Teardown Debugs
11 Library OperatingSystem
12 Library RequestsLibrary
13 Resource ../../../libraries/KarafKeywords.robot
14 Resource ../../../libraries/Utils.robot
15 Resource ../../../libraries/OVSDB.robot
16 Resource ../../../libraries/OpenStackOperations.robot
17 Resource ../../../libraries/DevstackUtils.robot
18 Resource ../../../libraries/SetupUtils.robot
19 Resource ../../../libraries/Tcpdump.robot
20 Resource ../../../variables/Variables.robot
21 Resource ../../../variables/netvirt/Variables.robot
24 ${SECURITY_GROUP} sg-elanservice
25 @{NETWORKS} ELAN1 ELAN2 ELAN3
26 @{SUBNETS} ELANSUBNET1 ELANSUBNET2 ELANSUBNET3
27 @{SUBNET_CIDR} 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24
28 @{ELAN1_PORT_LIST} ELANPORT11 ELANPORT12
29 @{ELAN2_PORT_LIST} ELANPORT21 ELANPORT22
30 @{ELAN3_PORT_LIST} ELANPORT31 ELANPORT32
31 @{VM_INSTANCES_ELAN1} ELANVM11 ELANVM12
32 @{VM_INSTANCES_ELAN2} ELANVM21 ELANVM22
33 @{VM_INSTANCES_ELAN3} ELANVM31 ELANVM32
34 ${PING_PASS} , 0% packet loss
38 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
39 OpenStackOperations.Create Network ${NETWORKS[0]}
40 OpenStackOperations.Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNET_CIDR[0]}
41 OpenStackOperations.Create Port ${NETWORKS[0]} ${ELAN1_PORT_LIST[0]} sg=${SECURITY_GROUP}
42 OpenStackOperations.Create Port ${NETWORKS[0]} ${ELAN1_PORT_LIST[1]} sg=${SECURITY_GROUP}
43 Builtin.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${PORT_URL} ${ELAN1_PORT_LIST}
44 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN1_PORT_LIST[0]} ${VM_INSTANCES_ELAN1[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
45 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN1_PORT_LIST[1]} ${VM_INSTANCES_ELAN1[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
46 @{VM_IP_ELAN1} ${DHCP_IP_ELAN1} = Get VM IPs @{VM_INSTANCES_ELAN1}
47 Set Suite Variable @{VM_IP_ELAN1}
48 Should Not Contain ${VM_IP_ELAN1} None
49 Should Not Contain ${DHCP_IP_ELAN1} None
50 @{VM_MACAddr_ELAN1} = BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${ELAN1_PORT_LIST}
51 Set Suite Variable @{VM_MACAddr_ELAN1}
53 Verify Datapath for Single ELAN with Multiple DPN
54 [Documentation] Verify Flow Table and Datapath
55 ${SRCMAC_CN1} = Create List @{VM_MACAddr_ELAN1}[0]
56 ${SRCMAC_CN2} = Create List @{VM_MACAddr_ELAN1}[1]
57 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${VM_MACAddr_ELAN1}
58 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${SRCMAC_CN2} ${VM_MACAddr_ELAN1}
59 Log Verify Datapath Test
60 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{VM_IP_ELAN1}[0] ping -c 3 @{VM_IP_ELAN1}[1]
61 Should Contain ${output} ${PING_PASS}
62 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{VM_IP_ELAN1}[1] ping -c 3 @{VM_IP_ELAN1}[0]
63 Should Contain ${output} ${PING_PASS}
65 Verify Datapath After OVS Restart
66 [Documentation] Verify datapath after OVS restart
67 Log Restarting OVS1 and OVS2
68 Restart OVSDB ${OS_COMPUTE_1_IP}
69 Restart OVSDB ${OS_COMPUTE_2_IP}
70 Log Checking the OVS state and Flow table after restart
71 Wait Until Keyword Succeeds 30s 10s Verify OVS Reports Connected tools_system=${OS_COMPUTE_1_IP}
72 Wait Until Keyword Succeeds 30s 10s Verify OVS Reports Connected tools_system=${OS_COMPUTE_2_IP}
73 ${SRCMAC_CN1} = Create List @{VM_MACAddr_ELAN1}[0]
74 ${SRCMAC_CN2} = Create List @{VM_MACAddr_ELAN1}[1]
75 Wait Until Keyword Succeeds 60s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${VM_MACAddr_ELAN1}
76 Wait Until Keyword Succeeds 60s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${SRCMAC_CN2} ${VM_MACAddr_ELAN1}
77 Log Verify Data path test
78 ${output} = Execute Command on VM Instance ${NETWORKS[0]} @{VM_IP_ELAN1}[0] ping -c 3 @{VM_IP_ELAN1}[1]
79 Should Contain ${output} ${PING_PASS}
80 ${output} = Execute Command on VM Instance ${NETWORKS[0]} @{VM_IP_ELAN1}[1] ping -c 3 @{VM_IP_ELAN1}[0]
81 Should Contain ${output} ${PING_PASS}
83 Verify Datapath After Recreate VM Instance
84 [Documentation] Verify datapath after recreating Vm instance
85 Delete Vm Instance ${VM_INSTANCES_ELAN1[0]}
86 ${SRCMAC_CN1} = Create List @{VM_MACAddr_ELAN1}[0]
87 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1}
88 Remove RSA Key From KnowHosts @{VM_IP_ELAN1}[0]
89 Create Vm Instance With Port On Compute Node ${ELAN1_PORT_LIST[0]} ${VM_INSTANCES_ELAN1[0]} ${OS_COMPUTE_1_IP}
90 @{VM_IP_ELAN1} ${DHCP_IP_ELAN1} = Get VM IPs @{VM_INSTANCES_ELAN1}
91 Set Suite Variable @{VM_IP_ELAN1}
92 Should Not Contain ${VM_IP_ELAN1} None
93 Should Not Contain ${DHCP_IP_ELAN1} None
94 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${VM_MACAddr_ELAN1}
95 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{VM_IP_ELAN1}[0] ping -c 3 @{VM_IP_ELAN1}[1]
96 Should Contain ${output} ${PING_PASS}
97 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{VM_IP_ELAN1}[1] ping -c 3 @{VM_IP_ELAN1}[0]
98 Should Contain ${output} ${PING_PASS}
100 Delete All ELAN1 VM And Verify Flow Table Updated
101 [Documentation] Verify Flow table after all VM instance deleted
102 Log Delete VM instances
103 : FOR ${VmInstance} IN @{VM_INSTANCES_ELAN1}
104 \ Delete Vm Instance ${VmInstance}
105 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_1_IP} ${VM_MACAddr_ELAN1}
106 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_2_IP} ${VM_MACAddr_ELAN1}
108 Verify Datapath for Multiple ELAN with Multiple DPN
109 [Documentation] Verify Flow Table and Data path for Multiple ELAN with Multiple DPN
110 [Setup] Run Keywords SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
111 ... AND MultipleElan Testsuite Setup
112 Log Verify flow table, fib Table and then datapath test
113 ${SRCMAC_CN1} = Create List @{VM_MACAddr_ELAN2}[0] @{VM_MACAddr_ELAN3}[0]
114 ${SRCMAC_CN2} = Create List @{VM_MACAddr_ELAN2}[1] @{VM_MACAddr_ELAN3}[1]
115 ${MAC_LIST} = Create List @{VM_MACAddr_ELAN2} @{VM_MACAddr_ELAN3}
116 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${MAC_LIST}
117 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${SRCMAC_CN2} ${MAC_LIST}
118 ${output} = Execute Command on VM Instance @{NETWORKS}[1] @{VM_IP_ELAN2}[0] ping -c 3 ${VM_IP_ELAN2[1]}
119 Should Contain ${output} ${PING_PASS}
120 ${output} = Execute Command on VM Instance @{NETWORKS}[2] @{VM_IP_ELAN3}[1] ping -c 3 ${VM_IP_ELAN3[0]}
121 Should Contain ${output} ${PING_PASS}
122 ${output} = Execute Command on VM Instance @{NETWORKS}[1] @{VM_IP_ELAN2}[0] ping -c 3 ${VM_IP_ELAN3[0]}
123 Should Not Contain ${output} ${PING_PASS}
124 ${output} = Execute Command on VM Instance @{NETWORKS}[2] @{VM_IP_ELAN3}[1] ping -c 3 ${VM_IP_ELAN2[1]}
125 Should Not Contain ${output} ${PING_PASS}
126 Log Reboot VM instance and verify flow
127 Get Test Teardown Debugs
128 ${filename_prefix} Replace String ${TEST_NAME} ${SPACE} _
129 ${cn1_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_1_IP} file_Name=${filename_prefix}_CN1
130 ${cn2_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_2_IP} file_Name=${filename_prefix}_CN2
131 ${os_conn_id} = Start Packet Capture on Node ${OS_CONTROL_NODE_IP} file_Name=${filename_prefix}_OS
132 # Because of bug 8389 which is infrequently happening, it's requested to add these extra debugs just before and after the
133 # nova reboot step. Once 8389 is resolved, we can remove this line to get debugs before nova reboot. The debugs will be
134 # collected immediately after when that step fails, as is the nature of robot test cases.
135 Reboot Nova VM ${VM_INSTANCES_ELAN2[0]}
136 @{VM_IP_ELAN2} ${DHCP_IP_ELAN2} = Get VM IPs @{VM_INSTANCES_ELAN2}
137 Should Not Contain ${VM_IP_ELAN2} None
138 Should Not Contain ${DHCP_IP_ELAN2} None
139 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${MAC_LIST}
140 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_ELAN2[1]} ping -c 3 @{VM_IP_ELAN2}[0]
141 Should Contain ${output} ${PING_PASS}
142 [Teardown] Run Keywords Get Test Teardown Debugs
143 ... AND MultipleElan Testsuite Cleanup
144 ... AND Stop Packet Capture on Node ${cn1_conn_id}
145 ... AND Stop Packet Capture on Node ${cn2_conn_id}
146 ... AND Stop Packet Capture on Node ${os_conn_id}
150 [Documentation] Elan suite setup
151 SetupUtils.Setup_Utils_For_Setup_And_Teardown
152 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set DEBUG org.opendaylight.genius.mdsalutil.internal.MDSALManager
153 DevstackUtils.Devstack Suite Setup
156 [Documentation] Elan suite teardown
158 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set INFO org.opendaylight.genius.mdsalutil.internal.MDSALManager
159 SingleElan SuiteTeardown
160 Close All Connections
162 SingleElan SuiteTeardown
163 [Documentation] Delete network,subnet and port
164 Log Delete Neutron Ports, Subnet and network
165 : FOR ${Port} IN @{ELAN1_PORT_LIST}
166 \ Delete Port ${Port}
167 Delete SubNet ${SUBNETS[0]}
168 Delete Network ${NETWORKS[0]}
169 Delete SecurityGroup ${SECURITY_GROUP}
171 SingleElan SuiteSetup
172 [Documentation] Create single ELAN with Multiple DPN
174 MultipleElan Testsuite Setup
175 [Documentation] Create additional ELAN for multipleElan with Multiple DPN test
176 OpenStackOperations.Create Network ${NETWORKS[1]}
177 OpenStackOperations.Create Network ${NETWORKS[2]}
178 OpenStackOperations.Create SubNet ${NETWORKS[1]} ${SUBNETS[1]} ${SUBNET_CIDR[1]}
179 OpenStackOperations.Create SubNet ${NETWORKS[2]} ${SUBNETS[2]} ${SUBNET_CIDR[2]}
180 OpenStackOperations.Create Port ${NETWORKS[1]} ${ELAN2_PORT_LIST[0]} sg=${SECURITY_GROUP}
181 OpenStackOperations.Create Port ${NETWORKS[1]} ${ELAN2_PORT_LIST[1]} sg=${SECURITY_GROUP}
182 OpenStackOperations.Create Port ${NETWORKS[2]} ${ELAN3_PORT_LIST[0]} sg=${SECURITY_GROUP}
183 OpenStackOperations.Create Port ${NETWORKS[2]} ${ELAN3_PORT_LIST[1]} sg=${SECURITY_GROUP}
184 Builtin.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${PORT_URL} ${ELAN3_PORT_LIST}
185 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN2_PORT_LIST[0]} ${VM_INSTANCES_ELAN2[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
186 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN2_PORT_LIST[1]} ${VM_INSTANCES_ELAN2[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
187 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN3_PORT_LIST[0]} ${VM_INSTANCES_ELAN3[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
188 OpenStackOperations.Create Vm Instance With Port On Compute Node ${ELAN3_PORT_LIST[1]} ${VM_INSTANCES_ELAN3[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
189 @{VM_IP_ELAN2} ${DHCP_IP_ELAN2} = Get VM IPs @{VM_INSTANCES_ELAN2}
190 @{VM_IP_ELAN3} ${DHCP_IP_ELAN3} = Get VM IPs @{VM_INSTANCES_ELAN3}
191 Set Suite Variable @{VM_IP_ELAN2}
192 Set Suite Variable @{VM_IP_ELAN3}
193 Should Not Contain ${VM_IP_ELAN2} None
194 Should Not Contain ${DHCP_IP_ELAN2} None
195 Should Not Contain ${VM_IP_ELAN3} None
196 Should Not Contain ${DHCP_IP_ELAN3} None
197 @{VM_MACAddr_ELAN2} BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${ELAN2_PORT_LIST}
198 Set Suite Variable @{VM_MACAddr_ELAN2}
199 @{VM_MACAddr_ELAN3} BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${ELAN3_PORT_LIST}
200 Set Suite Variable @{VM_MACAddr_ELAN3}
202 MultipleElan Testsuite Cleanup
203 [Documentation] Delete ELAN2 network,subnet and port
204 Get Test Teardown Debugs
205 : FOR ${VmInstance} IN @{VM_INSTANCES_ELAN2} @{VM_INSTANCES_ELAN3}
206 \ Delete Vm Instance ${VmInstance}
207 : FOR ${Port} IN @{ELAN2_PORT_LIST} @{ELAN3_PORT_LIST}
208 \ Delete Port ${Port}
209 Delete SubNet ${SUBNETS[1]}
210 Delete SubNet ${SUBNETS[2]}
211 Delete Network ${NETWORKS[1]}
212 Delete Network ${NETWORKS[2]}
214 Verify Flows Are Present For ELAN Service
215 [Arguments] ${ip} ${srcMacAddrs} ${destMacAddrs}
216 [Documentation] Verify Flows Are Present For ELAN service
217 ${flow_output} = Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
219 Should Contain ${flow_output} table=${ELAN_SMACTABLE}
220 ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE}
222 : FOR ${sMacAddr} IN @{srcMacAddrs}
223 \ ${resp}= Should Contain ${sMac_output} ${sMacAddr}
224 Should Contain ${flow_output} table=${ELAN_DMACTABLE}
225 ${dMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE}
227 : FOR ${dMacAddr} IN @{destMacAddrs}
228 \ ${resp}= Should Contain ${dMac_output} ${dMacAddr}
229 Should Contain ${flow_output} table=${ELAN_UNKNOWNMACTABLE}
230 ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_UNKNOWNMACTABLE}
233 Verify Flows Are Removed For ELAN Service
234 [Arguments] ${ip} ${srcMacAddrs}
235 [Documentation] Verify Flows Are Removed For ELAN Service
236 ${flow_output} = Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
238 Should Contain ${flow_output} table=${ELAN_SMACTABLE}
239 ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE}
241 : FOR ${sMacAddr} IN @{srcMacAddrs}
242 \ ${resp}= Should Not Contain ${sMac_output} ${sMacAddr}
243 Should Contain ${flow_output} table=${ELAN_DMACTABLE}
244 ${dMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE}
246 : FOR ${dMacAddr} IN @{srcMacAddrs}
247 \ ${resp}= Should Not Contain ${dMac_output} ${dMacAddr}