2 Documentation Test suite to check connectivity in L3 using routers.
3 Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown
4 ... AND DevstackUtils.Devstack Suite Setup
5 Suite Teardown Close All Connections
6 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown Get Test Teardown Debugs
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/OpenStackOperations.robot
13 Resource ../../../libraries/SetupUtils.robot
14 Resource ../../../libraries/Utils.robot
15 Resource ../../../variables/netvirt/Variables.robot
18 @{NETWORKS_NAME} network_1 network_2 network_3
19 @{SUBNETS_NAME} subnet_1 subnet_2 subnet_3
20 @{NET_1_VM_INSTANCES} l3_instance_net_1_1 l3_instance_net_1_2 l3_instance_net_1_3
21 @{NET_2_VM_INSTANCES} l3_instance_net_2_1 l3_instance_net_2_2 l3_instance_net_2_3
22 @{NET_3_VM_INSTANCES} l3_instance_net_3_1 l3_instance_net_3_2 l3_instance_net_3_3
23 @{SUBNETS_RANGE} 50.0.0.0/24 60.0.0.0/24 70.0.0.0/24
24 ${network1_vlan_id} 1236
27 Create VLAN Network (network_1)
28 [Documentation] Create Network with neutron request.
29 # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
30 # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
31 : FOR ${feature_name} IN @{legacy_feature_list}
32 \ ${feature_check_status}= Run Keyword And Return Status Verify Feature Is Installed ${feature_name}
33 \ Exit For Loop If '${feature_check_status}' == 'True'
34 Run Keyword If '${feature_check_status}' == 'True' Create Network @{NETWORKS_NAME}[0]
35 ... ELSE Create Network @{NETWORKS_NAME}[0] --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
37 Create VXLAN Network (network_2)
38 [Documentation] Create Network with neutron request.
39 Create Network @{NETWORKS_NAME}[1]
41 Create VXLAN Network (network_3)
42 [Documentation] Create Network with neutron request.
43 Create Network @{NETWORKS_NAME}[2]
45 Create Subnets For network_1
46 [Documentation] Create Sub Nets for the Networks with neutron request.
47 Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0]
49 Create Subnets For network_2
50 [Documentation] Create Sub Nets for the Networks with neutron request.
51 Create SubNet @{NETWORKS_NAME}[1] @{SUBNETS_NAME}[1] @{SUBNETS_RANGE}[1]
53 Create Subnets For network_3
54 [Documentation] Create Sub Nets for the Networks with neutron request.
55 Create SubNet @{NETWORKS_NAME}[2] @{SUBNETS_NAME}[2] @{SUBNETS_RANGE}[2]
57 Create Vm Instances For network_1
58 [Documentation] Create Four Vm instances using flavor and image names for a network.
59 Create Vm Instances network_1 ${NET_1_VM_INSTANCES} sg=csit
61 Create Vm Instances For network_2
62 [Documentation] Create Four Vm instances using flavor and image names for a network.
63 Create Vm Instances network_2 ${NET_2_VM_INSTANCES} sg=csit
65 Create Vm Instances For network_3
66 [Documentation] Create Four Vm instances using flavor and image names for a network.
67 Create Vm Instances network_3 ${NET_3_VM_INSTANCES} sg=csit
69 Check Vm Instances Have Ip Address
70 [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses.
71 ... We are polling first and longest on the last VM created assuming that if it's received it's address
72 ... already the other instances should have theirs already or at least shortly thereafter.
73 # first, ensure all VMs are in ACTIVE state. if not, we can just fail the test case and not waste time polling
75 : FOR ${vm} IN @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES} @{NET_3_VM_INSTANCES}
76 \ Wait Until Keyword Succeeds 15s 5s Verify VM Is ACTIVE ${vm}
77 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
78 ... true @{NET_1_VM_INSTANCES}
79 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
80 ... true @{NET_2_VM_INSTANCES}
81 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
82 ... true @{NET_3_VM_INSTANCES}
83 ${NET3_L3_VM_IPS} ${NET3_DHCP_IP} Collect VM IP Addresses false @{NET_3_VM_INSTANCES}
84 ${NET2_L3_VM_IPS} ${NET2_DHCP_IP} Collect VM IP Addresses false @{NET_2_VM_INSTANCES}
85 ${NET1_L3_VM_IPS} ${NET1_DHCP_IP} Collect VM IP Addresses false @{NET_1_VM_INSTANCES}
86 ${VM_INSTANCES}= Collections.Combine Lists ${NET_1_VM_INSTANCES} ${NET_2_VM_INSTANCES} ${NET_3_VM_INSTANCES}
87 ${VM_IPS}= Collections.Combine Lists ${NET1_L3_VM_IPS} ${NET2_L3_VM_IPS} ${NET3_L3_VM_IPS}
88 ${LOOP_COUNT} Get Length ${VM_INSTANCES}
89 : FOR ${index} IN RANGE 0 ${LOOP_COUNT}
90 \ ${status} ${message} Run Keyword And Ignore Error Should Not Contain @{VM_IPS}[${index}] None
91 \ Run Keyword If '${status}' == 'FAIL' Write Commands Until Prompt nova console-log @{VM_INSTANCES}[${index}] 30s
92 Set Suite Variable ${NET1_L3_VM_IPS}
93 Set Suite Variable ${NET1_DHCP_IP}
94 Set Suite Variable ${NET2_L3_VM_IPS}
95 Set Suite Variable ${NET2_DHCP_IP}
96 Set Suite Variable ${NET3_L3_VM_IPS}
97 Set Suite Variable ${NET3_DHCP_IP}
98 Should Not Contain ${NET1_L3_VM_IPS} None
99 Should Not Contain ${NET2_L3_VM_IPS} None
100 Should Not Contain ${NET1_DHCP_IP} None
101 Should Not Contain ${NET2_DHCP_IP} None
102 Should Not Contain ${NET3_DHCP_IP} None
103 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES} @{NET_3_VM_INSTANCES}
104 ... AND Get Test Teardown Debugs
107 [Documentation] Create Router
108 Create Router router_1
110 Add Interfaces To Router
111 [Documentation] Add Interfaces
112 : FOR ${interface} IN @{SUBNETS_NAME}
113 \ Add Router Interface router_1 ${interface}
115 Ping Vm Instance1 In network_2 From network_1(vxlan to vlan)
116 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
117 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[0]
119 Ping Vm Instance2 In network_2 From network_1(vxlan to vlan)
120 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
121 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[1]
123 Ping Vm Instance3 In network_2 From network_1(vxlan to vlan)
124 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
125 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[2]
127 Ping Vm Instance1 In network_1 From network_2(vlan to vxlan)
128 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
129 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[0]
131 Ping Vm Instance2 In network_1 From network_2(vlan to vxlan)
132 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
133 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[1]
135 Ping Vm Instance3 In network_1 From network_2(vlan to vxlan)
136 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
137 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[2]
139 Ping Vm Instance1 In network_3 From network_2(vxlan to vxlan)
140 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
141 Ping Vm From DHCP Namespace network_2 @{NET3_L3_VM_IPS}[0]
143 Ping Vm Instance2 In network_3 From network_2(vxlan to vxlan)
144 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
145 Ping Vm From DHCP Namespace network_2 @{NET3_L3_VM_IPS}[1]
147 Ping Vm Instance3 In network_3 From network_2(vxlan to vxlan)
148 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
149 Ping Vm From DHCP Namespace network_2 @{NET3_L3_VM_IPS}[2]
151 Connectivity Tests From Vm Instance1 In network_1
152 [Documentation] Login to the VM instance and test operations
153 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
155 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[0] ${dst_list}
157 Connectivity Tests From Vm Instance2 In network_1
158 [Documentation] Login to the vm instance and test operations
159 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
161 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[1] ${dst_list}
163 Connectivity Tests From Vm Instance3 In network_1
164 [Documentation] Login to the vm instance and test operations
165 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
167 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[2] ${dst_list}
169 Connectivity Tests From Vm Instance1 In network_2
170 [Documentation] Login to the vm instance and test operations
171 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
173 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[0] ${dst_list}
175 Connectivity Tests From Vm Instance2 In network_2
176 [Documentation] Logging to the vm instance using generated key pair.
177 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
179 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[1] ${dst_list}
181 Connectivity Tests From Vm Instance3 In network_2
182 [Documentation] Logging to the vm instance using generated key pair.
183 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
185 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[2] ${dst_list}
187 Delete Vm Instances In network_1
188 [Documentation] Delete Vm instances using instance names in network_1.
189 : FOR ${VmElement} IN @{NET_1_VM_INSTANCES}
190 \ Delete Vm Instance ${VmElement}
192 Delete Vm Instances In network_2
193 [Documentation] Delete Vm instances using instance names in network_2.
194 : FOR ${VmElement} IN @{NET_2_VM_INSTANCES}
195 \ Delete Vm Instance ${VmElement}
197 Delete Vm Instances In network_3
198 [Documentation] Delete Vm instances using instance names in network_3.
199 : FOR ${VmElement} IN @{NET_3_VM_INSTANCES}
200 \ Delete Vm Instance ${VmElement}
201 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES} @{NET_3_VM_INSTANCES}
202 ... AND Get Test Teardown Debugs
204 Delete Router Interfaces
205 [Documentation] Remove Interface to the subnets.
206 : FOR ${interface} IN @{SUBNETS_NAME}
207 \ Remove Interface router_1 ${interface}
210 [Documentation] Delete Router and Interface to the subnets.
211 Delete Router router_1
213 Delete Sub Networks In network_1
214 [Documentation] Delete Sub Nets for the Networks with neutron request.
215 Delete SubNet subnet_1
217 Delete Sub Networks In network_2
218 [Documentation] Delete Sub Nets for the Networks with neutron request.
219 Delete SubNet subnet_2
221 Delete Sub Networks In network_3
222 [Documentation] Delete Sub Nets for the Networks with neutron request.
223 Delete SubNet subnet_3
226 [Documentation] Delete Networks with neutron request.
227 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
228 \ Delete Network ${NetworkElement}