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 OpenStackOperations.Get OvsDebugInfo
6 ... AND Elan SuiteSetup
7 ... AND OpenStackOperations.Get OvsDebugInfo
8 Suite Teardown Elan SuiteTeardown
9 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
10 Test Teardown OpenStackOperations.Get Test Teardown Debugs
11 Library OperatingSystem
12 Library RequestsLibrary
14 Resource ../../../libraries/KarafKeywords.robot
15 Resource ../../../libraries/Utils.robot
16 Resource ../../../libraries/OVSDB.robot
17 Resource ../../../libraries/OpenStackOperations.robot
18 Resource ../../../libraries/DevstackUtils.robot
19 Resource ../../../libraries/SetupUtils.robot
20 Resource ../../../libraries/Tcpdump.robot
21 Resource ../../../variables/Variables.robot
22 Resource ../../../variables/netvirt/Variables.robot
25 ${SECURITY_GROUP} elan_sg
26 @{NETWORKS} elan_net_1 elan_net_2 elan_net_3
27 @{SUBNETS} elan_sub_1 elan_sub_2 elan_sub_3
28 @{SUBNET_CIDRS} 81.1.1.0/24 82.1.1.0/24 83.1.1.0/24
29 @{NET_1_PORTS} elan_net_1_port_1 elan_net_1_port_2
30 @{NET_2_PORTS} elan_net_2_port_1 elan_net_2_port_2
31 @{NET_3_PORTS} elan_net_3_port_1 elan_net_3_port_2
32 @{NET_1_VMS} elan_net_1_vm_1 elan_net_1_vm_2
33 @{NET_2_VMS} elan_net_2_vm_1 elan_net_2_vm_2
34 @{NET_3_VMS} elan_net_3_vm_1 elan_net_3_vm_2
38 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
39 OpenStackOperations.Create Network @{NETWORKS}[0]
40 OpenStackOperations.Create SubNet @{NETWORKS}[0] @{SUBNETS}[0] ${SUBNET_CIDRS[0]}
41 OpenStackOperations.Create Port @{NETWORKS}[0] ${NET_1_PORTS[0]} sg=${SECURITY_GROUP}
42 OpenStackOperations.Create Port @{NETWORKS}[0] ${NET_1_PORTS[1]} sg=${SECURITY_GROUP}
43 BuiltIn.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${PORT_URL} ${NET_1_PORTS}
44 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_1_PORTS[0]} ${NET_1_VMS[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
45 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_1_PORTS[1]} ${NET_1_VMS[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
46 @{NET_1_VM_IPS} ${NET_1_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_1_VMS}
47 Builtin.Set Suite Variable @{NET_1_VM_IPS}
48 BuiltIn.Should Not Contain ${NET_1_VM_IPS} None
49 BuiltIn.Should Not Contain ${NET_1_DHCP_IP} None
50 @{NET_1_MACS} = BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${NET_1_PORTS}
51 Builtin.Set Suite Variable @{NET_1_MACS}
53 Verify Datapath for Single ELAN with Multiple DPN
54 [Documentation] Verify Flow Table and Datapath
55 ${smac_cn1} = BuiltIn.Create List @{NET_1_MACS}[0]
56 ${smac_cn2} = BuiltIn.Create List @{NET_1_MACS}[1]
57 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1} ${NET_1_MACS}
58 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${smac_cn2} ${NET_1_MACS}
59 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[0] ping -c 3 @{NET_1_VM_IPS}[1]
60 BuiltIn.Should Contain ${output} ${PING_REGEXP}
61 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[1] ping -c 3 @{NET_1_VM_IPS}[0]
62 BuiltIn.Should Contain ${output} ${PING_REGEXP}
64 Verify Datapath After OVS Restart
65 [Documentation] Verify datapath after OVS restart
66 OVSDB.Restart OVSDB ${OS_COMPUTE_1_IP}
67 OVSDB.Restart OVSDB ${OS_COMPUTE_2_IP}
68 BuiltIn.Wait Until Keyword Succeeds 30s 10s OVSDB.Verify OVS Reports Connected tools_system=${OS_COMPUTE_1_IP}
69 BuiltIn.Wait Until Keyword Succeeds 30s 10s OVSDB.Verify OVS Reports Connected tools_system=${OS_COMPUTE_2_IP}
70 ${smac_cn1} = BuiltIn.Create List @{NET_1_MACS}[0]
71 ${smac_cn2} = BuiltIn.Create List @{NET_1_MACS}[1]
72 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1} ${NET_1_MACS}
73 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${smac_cn2} ${NET_1_MACS}
74 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[0] ping -c 3 @{NET_1_VM_IPS}[1]
75 BuiltIn.Should Contain ${output} ${PING_REGEXP}
76 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[1] ping -c 3 @{NET_1_VM_IPS}[0]
77 BuiltIn.Should Contain ${output} ${PING_REGEXP}
79 Verify Datapath After Recreate VM Instance
80 [Documentation] Verify datapath after recreating Vm instance
81 OpenStackOperations.Delete Vm Instance ${NET_1_VMS[0]}
82 ${smac_cn1} = BuiltIn.Create List @{NET_1_MACS}[0]
83 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1}
84 OpenStackOperations.Remove RSA Key From KnownHosts @{NET_1_VM_IPS}[0]
85 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_1_PORTS[0]} ${NET_1_VMS[0]} ${OS_COMPUTE_1_IP}
86 @{NET_1_VM_IPS} ${NET_1_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_1_VMS}
87 Builtin.Set Suite Variable @{NET_1_VM_IPS}
88 BuiltIn.Should Not Contain ${NET_1_VM_IPS} None
89 BuiltIn.Should Not Contain ${NET_1_DHCP_IP} None
90 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1} ${NET_1_MACS}
91 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[0] ping -c 3 @{NET_1_VM_IPS}[1]
92 BuiltIn.Should Contain ${output} ${PING_REGEXP}
93 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET_1_VM_IPS}[1] ping -c 3 @{NET_1_VM_IPS}[0]
94 BuiltIn.Should Contain ${output} ${PING_REGEXP}
96 Delete All elan_net_1 VM And Verify Flow Table Updated
97 [Documentation] Verify Flow table after all VM instance deleted
98 : FOR ${vm} IN @{NET_1_VMS}
99 \ OpenStackOperations.Delete Vm Instance ${vm}
100 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_1_IP} ${NET_1_MACS}
101 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_2_IP} ${NET_1_MACS}
103 Verify Datapath for Multiple ELAN with Multiple DPN
104 [Documentation] Verify Flow Table and Data path for Multiple ELAN with Multiple DPN
105 [Setup] BuiltIn.Run Keywords SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
106 ... AND MultipleElan Testsuite Setup
107 ${smac_cn1} = BuiltIn.Create List @{VM_MACAddr_elan_net_2}[0] @{VM_MACAddr_elan_net_3}[0]
108 ${smac_cn2} = BuiltIn.Create List @{VM_MACAddr_elan_net_2}[1] @{VM_MACAddr_elan_net_3}[1]
109 ${MAC_LIST} = BuiltIn.Create List @{VM_MACAddr_elan_net_2} @{VM_MACAddr_elan_net_3}
110 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1} ${MAC_LIST}
111 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${smac_cn2} ${MAC_LIST}
112 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[1] @{NET_2_VM_IPS}[0] ping -c 3 ${NET_2_VM_IPS[1]}
113 BuiltIn.Should Contain ${output} ${PING_REGEXP}
114 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{NET_3_VM_IPS}[1] ping -c 3 ${NET_3_VM_IPS[0]}
115 BuiltIn.Should Contain ${output} ${PING_REGEXP}
116 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[1] @{NET_2_VM_IPS}[0] ping -c 3 ${NET_3_VM_IPS[0]}
117 BuiltIn.Should Not Contain ${output} ${PING_REGEXP}
118 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{NET_3_VM_IPS}[1] ping -c 3 ${NET_2_VM_IPS[1]}
119 BuiltIn.Should Not Contain ${output} ${PING_REGEXP}
120 @{NET_2_VM_IPS} ${NET_2_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_2_VMS}
121 BuiltIn.Should Not Contain ${NET_2_VM_IPS} None
122 BuiltIn.Should Not Contain ${NET_2_DHCP_IP} None
123 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${smac_cn1} ${MAC_LIST}
124 ${output} = OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[1] ${NET_2_VM_IPS[1]} ping -c 3 @{NET_2_VM_IPS}[0]
125 BuiltIn.Should Contain ${output} ${PING_REGEXP}
126 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
127 ... AND MultipleElan Testsuite Cleanup
131 [Documentation] Elan suite setup
132 SetupUtils.Setup_Utils_For_Setup_And_Teardown
133 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set DEBUG org.opendaylight.genius.mdsalutil.internal.MDSALManager
134 DevstackUtils.Devstack Suite Setup
137 [Documentation] Elan suite teardown
138 OpenStackOperations.Get OvsDebugInfo
139 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set INFO org.opendaylight.genius.mdsalutil.internal.MDSALManager
140 OpenStackOperations.OpenStack Suite Teardown
142 MultipleElan Testsuite Setup
143 [Documentation] Create additional ELAN for multipleElan with Multiple DPN test
144 OpenStackOperations.Create Network @{NETWORKS}[1]
145 OpenStackOperations.Create Network @{NETWORKS}[2]
146 OpenStackOperations.Create SubNet @{NETWORKS}[1] @{SUBNETS}[1] ${SUBNET_CIDRS[1]}
147 OpenStackOperations.Create SubNet @{NETWORKS}[2] @{SUBNETS}[2] ${SUBNET_CIDRS[2]}
148 OpenStackOperations.Create Port @{NETWORKS}[1] ${NET_2_PORTS[0]} sg=${SECURITY_GROUP}
149 OpenStackOperations.Create Port @{NETWORKS}[1] ${NET_2_PORTS[1]} sg=${SECURITY_GROUP}
150 OpenStackOperations.Create Port @{NETWORKS}[2] ${NET_3_PORTS[0]} sg=${SECURITY_GROUP}
151 OpenStackOperations.Create Port @{NETWORKS}[2] ${NET_3_PORTS[1]} sg=${SECURITY_GROUP}
152 BuiltIn.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${PORT_URL} ${NET_3_PORTS}
153 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_2_PORTS[0]} ${NET_2_VMS[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
154 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_2_PORTS[1]} ${NET_2_VMS[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
155 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_3_PORTS[0]} ${NET_3_VMS[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
156 OpenStackOperations.Create Vm Instance With Port On Compute Node ${NET_3_PORTS[1]} ${NET_3_VMS[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
157 @{NET_2_VM_IPS} ${NET_2_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_2_VMS}
158 @{NET_3_VM_IPS} ${NET_3_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_3_VMS}
159 Builtin.Set Suite Variable @{NET_2_VM_IPS}
160 Builtin.Set Suite Variable @{NET_3_VM_IPS}
161 BuiltIn.Should Not Contain ${NET_2_VM_IPS} None
162 BuiltIn.Should Not Contain ${NET_2_DHCP_IP} None
163 BuiltIn.Should Not Contain ${NET_3_VM_IPS} None
164 BuiltIn.Should Not Contain ${NET_3_DHCP_IP} None
165 @{VM_MACAddr_elan_net_2} BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${NET_2_PORTS}
166 Builtin.Set Suite Variable @{VM_MACAddr_elan_net_2}
167 @{VM_MACAddr_elan_net_3} BuiltIn.Wait Until Keyword Succeeds 30s 10s OpenStackOperations.Get Ports MacAddr ${NET_3_PORTS}
168 Builtin.Set Suite Variable @{VM_MACAddr_elan_net_3}
170 MultipleElan Testsuite Cleanup
171 [Documentation] Delete elan_net_2 network,subnet and port
172 OpenStackOperations.Get Test Teardown Debugs
173 : FOR ${vm} IN @{NET_2_VMS} @{NET_3_VMS}
174 \ OpenStackOperations.Delete Vm Instance ${vm}
175 : FOR ${Port} IN @{NET_2_PORTS} @{NET_3_PORTS}
176 \ OpenStackOperations.Delete Port ${Port}
177 OpenStackOperations.Delete SubNet @{SUBNETS}[1]
178 OpenStackOperations.Delete SubNet @{SUBNETS}[2]
179 OpenStackOperations.Delete Network @{NETWORKS}[1]
180 OpenStackOperations.Delete Network @{NETWORKS}[2]
182 Verify Flows Are Present For ELAN Service
183 [Arguments] ${ip} ${smacs} ${dmacs}
184 ${flow_output} = Utils.Run Command On Remote System And Log ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
185 BuiltIn.Should Contain ${flow_output} table=${ELAN_SMACTABLE}
186 ${smac_output} = String.Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE}
187 Builtin.Log ${smac_output}
188 : FOR ${smac} IN @{smacs}
189 \ ${resp} = BuiltIn.Should Contain ${smac_output} ${smac}
190 BuiltIn.Should Contain ${flow_output} table=${ELAN_DMACTABLE}
191 ${dmac_output} = String.Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE}
192 Builtin.Log ${dmac_output}
193 : FOR ${dmac} IN @{dmacs}
194 \ ${resp} = BuiltIn.Should Contain ${dmac_output} ${dmac}
195 BuiltIn.Should Contain ${flow_output} table=${ELAN_UNKNOWNMACTABLE}
196 ${smac_output} = String.Get Lines Containing String ${flow_output} table=${ELAN_UNKNOWNMACTABLE}
197 Builtin.Log ${smac_output}
199 Verify Flows Are Removed For ELAN Service
200 [Arguments] ${ip} ${smacs}
201 ${flow_output} = Utils.Run Command On Remote System And Log ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
202 BuiltIn.Should Contain ${flow_output} table=${ELAN_SMACTABLE}
203 ${smac_output} = String.Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE}
204 Builtin.Log ${smac_output}
205 : FOR ${smac} IN @{smacs}
206 \ ${resp} = BuiltIn.Should Not Contain ${smac_output} ${smac}
207 BuiltIn.Should Contain ${flow_output} table=${ELAN_DMACTABLE}
208 ${dmac_output} = String.Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE}
209 Builtin.Log ${dmac_output}
210 : FOR ${dmac} IN @{smacs}
211 \ ${resp} = BuiltIn.Should Not Contain ${dmac_output} ${dmac}