2 Documentation Test suite for VM based Host Route Handling
5 Library RequestsLibrary
8 Resource ../../../libraries/DevstackUtils.robot
9 Resource ../../../libraries/OpenStackOperations.robot
10 Resource ../../../libraries/VpnOperations.robot
11 Resource ../../../variables/netvirt/Variables.robot
12 Resource ../../../variables/Variables.robot
14 Suite Setup Suite Setup
15 Suite Teardown OpenStackOperations.OpenStack Suite Teardown
16 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Test Teardown OpenStackOperations.Get Test Teardown Debugs
22 ... host_route_network_1
23 ... host_route_network_2
24 ... host_route_network_3
25 ... host_route_network_4
27 ... host_route_subnet_1
28 ... host_route_subnet_2
29 ... host_route_subnet_3
30 ... host_route_subnet_4
31 @{SUBNET_CIDR} 10.10.10.0 10.20.20.0 10.30.30.0 10.40.40.0
33 ${SECURITY_GROUP} host_route_security_group
43 ... host_route_gw_port_1
44 ... host_route_gw_port_2
45 ... host_route_gw_port_3
46 ... host_route_gw_port_4
47 ... host_route_gw_port_5
48 ... host_route_gw_port_6
49 ... host_route_gw_port_7
50 ${ALLOWED_ADDRESS_PAIR} 0.0.0.0/0
51 ${NETWORK_1_VM} host_route_vm_1
52 @{NETWORK_2_VMS} host_route_vm_2 host_route_vm_3
53 @{NETWORK_3_VMS} host_route_vm_4 host_route_vm_5
54 @{NETWORK_4_VMS} host_route_vm_6 host_route_vm_7
55 @{GATEWAY_VMS} host_route_gw_vm_1 host_route_gw_vm_2
56 ${ROUTER} host_route_router_1
57 @{NON_NEUTRON_DESTINATION} 5.5.5.0 6.6.6.0
58 ${NON_NEUTRON_NEXTHOP} 10.10.10.250
62 Verify creation of host route via openstack subnet create option
63 [Documentation] Creating subnet host route via openstack cli and verifying in controller and openstack.
64 OpenStackOperations.Create SubNet
67 ... ${SUBNET_CIDR}[0]${PREFIX24}
68 ... --host-route destination=${SUBNET_CIDR}[2]${PREFIX24},gateway=${NON_NEUTRON_NEXTHOP}
69 ${SUBNET_GW_IP} = BuiltIn.Create List
70 FOR ${subnet} IN @{SUBNETS}
71 ${ip} = OpenStackOperations.Get Subnet Gateway Ip ${subnet}
72 Collections.Append To List ${SUBNET_GW_IP} ${ip}
74 BuiltIn.Set Suite Variable ${SUBNET_GW_IP}
75 ${elements} = BuiltIn.Create List
76 ... "destination":"${SUBNET_CIDR}[2]${PREFIX24}","nexthop":"${NON_NEUTRON_NEXTHOP}"
77 BuiltIn.Wait Until Keyword Succeeds
80 ... Utils.Check For Elements At URI
83 Verify Hostroutes In Subnet
85 ... destination='${SUBNET_CIDR}[2]${PREFIX24}',\\sgateway='${NON_NEUTRON_NEXTHOP}'
86 OpenStackOperations.Create Port
89 ... sg=${SECURITY_GROUP}
90 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
91 OpenStackOperations.Create Vm Instance With Port On Compute Node
94 ... ${OS_CMP1_HOSTNAME}
95 ... sg=${SECURITY_GROUP}
96 OpenStackOperations.Create Port
98 ... ${GATEWAY_PORTS}[0]
99 ... sg=${SECURITY_GROUP}
100 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
101 OpenStackOperations.Create Vm Instance With Ports On Compute Node
102 ... ${GATEWAY_PORTS}[0]
103 ... ${GATEWAY_PORTS}[1]
104 ... ${GATEWAY_VMS}[0]
105 ... ${OS_CMP1_HOSTNAME}
106 ... sg=${SECURITY_GROUP}
107 OpenStackOperations.Create Vm Instance With Ports On Compute Node
108 ... ${GATEWAY_PORTS}[4]
109 ... ${GATEWAY_PORTS}[5]
110 ... ${GATEWAY_VMS}[1]
111 ... ${OS_CMP2_HOSTNAME}
112 ... sg=${SECURITY_GROUP}
113 OpenStackOperations.Poll VM Is ACTIVE ${NETWORK_1_VM}
114 BuiltIn.Wait Until Keyword Succeeds 180s 15s OpenStackOperations.Get VM IP true ${NETWORK_1_VM}
115 ${NETWORK_1_VM_IPS} ${NETWORK_1_DHCP_IP} ${VM_COSOLE_OUTPUT} = OpenStackOperations.Get VM IP
118 BuiltIn.Set Suite Variable ${NETWORK_1_VM_IPS}
119 @{GATEWAY_VM_IPS} ${GATEWAY_DHCP_IP} = OpenStackOperations.Get VM IPs @{GATEWAY_VMS}
120 BuiltIn.Set Suite Variable @{GATEWAY_VM_IPS}
121 #TODO: Verifiy the routes in VM.
122 OpenStackOperations.Show Debugs ${NETWORK_1_VM} @{GATEWAY_VMS}
123 OpenStackOperations.Get Suite Debugs
125 Verify creation of host route via openstack subnet update option
126 [Documentation] Creating host route using subnet update option and setting nexthop ip to subnet gateway ip. Verifying in controller and openstack.
127 OpenStackOperations.Update SubNet
129 ... --host-route destination=${NON_NEUTRON_DESTINATION}[0]${PREFIX24},gateway=${SUBNET_GW_IP}[0]
130 ${elements} = BuiltIn.Create List
131 ... "destination":"${NON_NEUTRON_DESTINATION}[0]${PREFIX24}","nexthop":"${SUBNET_GW_IP}[0]"
132 BuiltIn.Wait Until Keyword Succeeds
135 ... Utils.Check For Elements At URI
136 ... ${SUBNETWORK_URL}
138 Verify Hostroutes In Subnet
140 ... destination='${NON_NEUTRON_DESTINATION}[0]${PREFIX24}',\\sgateway='${SUBNET_GW_IP}[0]'
142 Verify removal of host route
143 [Documentation] Removing subnet host routes via cli and verifying in controller and openstack.
144 OpenStackOperations.Unset SubNet
146 ... --host-route destination=${NON_NEUTRON_DESTINATION}[0]${PREFIX24},gateway=${SUBNET_GW_IP}[0]
147 ${elements} = BuiltIn.Create List
148 ... "destination":"${NON_NEUTRON_DESTINATION}[0]${PREFIX24}","nexthop":"${SUBNET_GW_IP}[0]"
149 BuiltIn.Wait Until Keyword Succeeds
152 ... Utils.Check For Elements Not At URI
153 ... ${SUBNETWORK_URL}
155 Verify No Hostroutes In Subnet
157 ... destination='${NON_NEUTRON_DESTINATION}[0]${PREFIX24}',\\sgateway='${SUBNET_GW_IP}[0]'
159 Verify creation of host route via openstack subnet set option with VM port as next hop IP
160 [Documentation] Creating host route using subnet update option and setting nexthop to gateway vm ip and verifying in controller and openstack.
161 OpenStackOperations.Update SubNet
163 ... --host-route destination=${SUBNET_CIDR}[2]${PREFIX24},gateway=${GATEWAY_VM_IPS}[0]
164 ${elements} = BuiltIn.Create List
165 ... "destination":"${SUBNET_CIDR}[2]${PREFIX24}","nexthop":"${GATEWAY_VM_IPS}[0]"
166 BuiltIn.Wait Until Keyword Succeeds
169 ... Utils.Check For Elements At URI
170 ... ${SUBNETWORK_URL}
172 Verify Hostroutes In Subnet
174 ... destination='${SUBNET_CIDR}[2]${PREFIX24}',\\sgateway='${GATEWAY_VM_IPS}[0]'
176 Verify creation of host route via openstack subnet set option with VM port as next hop IP with change in destination prefix
177 [Documentation] Creating host route using subnet update option and setting nexthop ip to gateway vm ip and changing destination prefix.
178 ... Verifying in controller and openstack.
179 OpenStackOperations.Update SubNet
181 ... --host-route destination=${SUBNET_CIDR}[1]${PREFIX24},gateway=${GATEWAY_VM_IPS}[0]
182 ${elements} = BuiltIn.Create List
183 ... "destination":"${SUBNET_CIDR}[1]${PREFIX24}","nexthop":"${GATEWAY_VM_IPS}[0]"
184 BuiltIn.Wait Until Keyword Succeeds
187 ... Utils.Check For Elements At URI
188 ... ${SUBNETWORK_URL}
190 Verify Hostroutes In Subnet
192 ... destination='${SUBNET_CIDR}[1]${PREFIX24}',\\sgateway='${GATEWAY_VM_IPS}[0]'
194 Verify creation of host route via openstack subnet set option with change in next hop IP
195 [Documentation] Creating host route using subnet update option and setting nexthop ip to new gateway vm ip without changing the
196 ... destination prefix. Verifying in controller and openstack.
197 OpenStackOperations.Update SubNet
199 ... --host-route destination=${SUBNET_CIDR}[1]${PREFIX24},gateway=${GATEWAY_VM_IPS}[1]
200 ${elements} = BuiltIn.Create List
201 ... "destination":"${SUBNET_CIDR}[1]${PREFIX24}","nexthop":"${GATEWAY_VM_IPS}[1]"
202 BuiltIn.Wait Until Keyword Succeeds
205 ... Utils.Check For Elements At URI
206 ... ${SUBNETWORK_URL}
208 Verify Hostroutes In Subnet
210 ... destination='${SUBNET_CIDR}[1]${PREFIX24}',\\sgateway='${GATEWAY_VM_IPS}[1]'
215 [Documentation] Creates initial setup.
216 VpnOperations.Basic Suite Setup
217 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
218 FOR ${network} IN @{NETWORKS}
219 OpenStackOperations.Create Network ${network}
221 FOR ${i} IN RANGE 1 4
222 OpenStackOperations.Create SubNet ${NETWORKS}[${i}] ${SUBNETS}[${i}] ${SUBNET_CIDR}[${i}]${PREFIX24}
223 OpenStackOperations.Create Port
224 ... ${NETWORKS}[${i}]
226 ... sg=${SECURITY_GROUP}
227 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
228 OpenStackOperations.Create Vm Instance With Port On Compute Node
230 ... ${NETWORK_${i+1}_VMS}[0]
231 ... ${OS_CMP1_HOSTNAME}
232 ... sg=${SECURITY_GROUP}
233 OpenStackOperations.Create Port
234 ... ${NETWORKS}[${i}]
236 ... sg=${SECURITY_GROUP}
237 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
238 OpenStackOperations.Create Vm Instance With Port On Compute Node
240 ... ${NETWORK_${i+1}_VMS}[1]
241 ... ${OS_CMP2_HOSTNAME}
242 ... sg=${SECURITY_GROUP}
243 OpenStackOperations.Create Port
244 ... ${NETWORKS}[${i}]
245 ... ${GATEWAY_PORTS}[${i}]
246 ... sg=${SECURITY_GROUP}
247 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
248 OpenStackOperations.Create Port
249 ... ${NETWORKS}[${i}]
250 ... ${GATEWAY_PORTS}[${i+3}]
251 ... sg=${SECURITY_GROUP}
252 ... allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
254 @{NETWORK_2_VM_IPS} ${NETWORK_2_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_2_VMS}
255 BuiltIn.Set Suite Variable @{NETWORK_2_VM_IPS}
256 @{NETWORK_3_VM_IPS} ${NETWORK_3_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_3_VMS}
257 BuiltIn.Set Suite Variable @{NETWORK_3_VM_IPS}
258 @{NETWORK_4_VM_IPS} ${NETWORK_4_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_4_VMS}
259 BuiltIn.Set Suite Variable @{NETWORK_4_VM_IPS}
260 OpenStackOperations.Show Debugs @{NETWORK_2_VMS} @{NETWORK_3_VMS} @(NETWORK_4_VMS)
261 OpenStackOperations.Get Suite Debugs
263 Verify Hostroutes In Subnet
264 [Documentation] Show subnet with openstack request and verifies given hostroute in subnet.
265 [Arguments] ${subnet_name} @{elements}
266 ${output} = OpenStackOperations.Show SubNet ${subnet_name}
267 FOR ${element} IN @{elements}
268 BuiltIn.Should Match Regexp ${output} ${element}
271 Verify No Hostroutes In Subnet
272 [Documentation] Show subnet with openstack request and verifies no given hostroute in subnet.
273 [Arguments] ${subnet_name} @{elements}
274 ${output} = OpenStackOperations.Show SubNet ${subnet_name}
275 FOR ${element} IN @{elements}
276 BuiltIn.Should Not Match Regexp ${output} ${element}