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