2 Documentation Test suite for VM based Host Route Handling
3 Suite Setup Suite Setup
4 Suite Teardown OpenStackOperations.OpenStack Suite Teardown
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Teardown OpenStackOperations.Get Test Teardown Debugs
8 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/OpenStackOperations.robot
13 Resource ../../../libraries/VpnOperations.robot
14 Resource ../../../variables/netvirt/Variables.robot
15 Resource ../../../variables/Variables.robot
18 @{NETWORKS} host_route_network_1 host_route_network_2 host_route_network_3 host_route_network_4
19 @{SUBNETS} host_route_subnet_1 host_route_subnet_2 host_route_subnet_3 host_route_subnet_4
20 @{SUBNET_CIDR} 10.10.10.0 10.20.20.0 10.30.30.0 10.40.40.0
22 ${SECURITY_GROUP} host_route_security_group
23 @{PORTS} host_route_port_1 host_route_port_2 host_route_port_3 host_route_port_4 host_route_port_5 host_route_port_6 host_route_port_7
24 @{GATEWAY_PORTS} host_route_gw_port_1 host_route_gw_port_2 host_route_gw_port_3 host_route_gw_port_4 host_route_gw_port_5 host_route_gw_port_6 host_route_gw_port_7
25 ${ALLOWED_ADDRESS_PAIR} 0.0.0.0/0
26 ${NETWORK_1_VMS} host_route_vm_1
27 @{NETWORK_2_VMS} host_route_vm_2 host_route_vm_3
28 @{NETWORK_3_VMS} host_route_vm_4 host_route_vm_5
29 @{NETWORK_4_VMS} host_route_vm_6 host_route_vm_7
30 @{GATEWAY_VMS} host_route_gw_vm_1 host_route_gw_vm_2
31 ${ROUTER} host_route_router_1
32 @{NON_NEUTRON_DESTINATION} 5.5.5.0 6.6.6.0
33 ${NON_NEUTRON_NEXTHOP} 10.10.10.250
36 Verify creation of host route via openstack subnet create option
37 [Documentation] Creating subnet host route via openstack cli and verifying in controller and openstack.
38 OpenStackOperations.Create SubNet @{NETWORKS}[0] @{SUBNETS}[0] @{SUBNET_CIDR}[0]${PREFIX24} --host-route destination=@{SUBNET_CIDR}[2]${PREFIX24},gateway=${NON_NEUTRON_NEXTHOP}
39 ${SUBNET_GW_IP} BuiltIn.Create List
40 : FOR ${subnet} IN @{SUBNETS}
41 \ ${ip} = OpenStackOperations.Get Subnet Gateway Ip ${subnet}
42 \ Collections.Append To List ${SUBNET_GW_IP} ${ip}
43 BuiltIn.Set Suite Variable ${SUBNET_GW_IP}
44 ${elements} = BuiltIn.Create List "destination":"@{SUBNET_CIDR}[2]${PREFIX24}","nexthop":"${NON_NEUTRON_NEXTHOP}"
45 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${elements}
46 Verify Hostroutes In Subnet @{SUBNETS}[0] destination='@{SUBNET_CIDR}[2]${PREFIX24}',\\sgateway='${NON_NEUTRON_NEXTHOP}'
47 OpenStackOperations.Create Port @{NETWORKS}[0] @{PORTS}[0] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
48 OpenStackOperations.Create Vm Instance With Port On Compute Node @{PORTS}[0] ${NETWORK_1_VMS} ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
49 OpenStackOperations.Create Port @{NETWORKS}[0] @{GATEWAY_PORTS}[0] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
50 OpenStackOperations.Create Vm Instance With Ports On Compute Node @{GATEWAY_PORTS}[0] @{GATEWAY_PORTS}[1] @{GATEWAY_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
51 OpenStackOperations.Create Vm Instance With Ports On Compute Node @{GATEWAY_PORTS}[4] @{GATEWAY_PORTS}[5] @{GATEWAY_VMS}[1] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
52 OpenStackOperations.Poll VM Is ACTIVE ${NETWORK_1_VMS}
53 BuiltIn.Wait Until Keyword Succeeds 180s 15s OpenStackOperations.Get VM IP true ${NETWORK_1_VMS}
54 ${NETWORK_1_VM_IPS} ${NETWORK_1_DHCP_IP} ${VM_COSOLE_OUTPUT} = OpenStackOperations.Get VM IP true ${NETWORK_1_VMS}
55 BuiltIn.Set Suite Variable ${NETWORK_1_VM_IPS}
56 @{GATEWAY_VM_IPS} ${GATEWAY_DHCP_IP} = OpenStackOperations.Get VM IPs @{GATEWAY_VMS}
57 BuiltIn.Set Suite Variable @{GATEWAY_VM_IPS}
58 #TODO: Verifiy the routes in VM.
59 OpenStackOperations.Show Debugs ${NETWORK_1_VMS} @{GATEWAY_VMS}
60 OpenStackOperations.Get Suite Debugs
62 Verify creation of host route via openstack subnet update option
63 [Documentation] Creating host route using subnet update option and setting nexthop ip to subnet gateway ip. Verifying in controller and openstack.
64 OpenStackOperations.Update SubNet @{SUBNETS}[0] --host-route destination=@{NON_NEUTRON_DESTINATION}[0]${PREFIX24},gateway=@{SUBNET_GW_IP}[0]
65 ${elements} = BuiltIn.Create List "destination":"@{NON_NEUTRON_DESTINATION}[0]${PREFIX24}","nexthop":"@{SUBNET_GW_IP}[0]"
66 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${elements}
67 Verify Hostroutes In Subnet @{SUBNETS}[0] destination='@{NON_NEUTRON_DESTINATION}[0]${PREFIX24}',\\sgateway='@{SUBNET_GW_IP}[0]'
69 Verify removal of host route
70 [Documentation] Removing subnet host routes via cli and verifying in controller and openstack.
71 OpenStackOperations.Unset SubNet @{SUBNETS}[0] --host-route destination=@{NON_NEUTRON_DESTINATION}[0]${PREFIX24},gateway=@{SUBNET_GW_IP}[0]
72 ${elements} = BuiltIn.Create List "destination":"@{NON_NEUTRON_DESTINATION}[0]${PREFIX24}","nexthop":"@{SUBNET_GW_IP}[0]"
73 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements Not At URI ${SUBNETWORK_URL} ${elements}
74 Verify No Hostroutes In Subnet @{SUBNETS}[0] destination='@{NON_NEUTRON_DESTINATION}[0]${PREFIX24}',\\sgateway='@{SUBNET_GW_IP}[0]'
76 Verify creation of host route via openstack subnet set option with VM port as next hop IP
77 [Documentation] Creating host route using subnet update option and setting nexthop to gateway vm ip and verifying in controller and openstack.
78 OpenStackOperations.Update SubNet @{SUBNETS}[0] --host-route destination=@{SUBNET_CIDR}[2]${PREFIX24},gateway=@{GATEWAY_VM_IPS}[0]
79 ${elements} = BuiltIn.Create List "destination":"@{SUBNET_CIDR}[2]${PREFIX24}","nexthop":"@{GATEWAY_VM_IPS}[0]"
80 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${elements}
81 Verify Hostroutes In Subnet @{SUBNETS}[0] destination='@{SUBNET_CIDR}[2]${PREFIX24}',\\sgateway='@{GATEWAY_VM_IPS}[0]'
83 Verify creation of host route via openstack subnet set option with VM port as next hop IP with change in destination prefix
84 [Documentation] Creating host route using subnet update option and setting nexthop ip to gateway vm ip and changing destination prefix.
85 ... Verifying in controller and openstack.
86 OpenStackOperations.Update SubNet @{SUBNETS}[0] --host-route destination=@{SUBNET_CIDR}[1]${PREFIX24},gateway=@{GATEWAY_VM_IPS}[0]
87 ${elements} = BuiltIn.Create List "destination":"@{SUBNET_CIDR}[1]${PREFIX24}","nexthop":"@{GATEWAY_VM_IPS}[0]"
88 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${elements}
89 Verify Hostroutes In Subnet @{SUBNETS}[0] destination='@{SUBNET_CIDR}[1]${PREFIX24}',\\sgateway='@{GATEWAY_VM_IPS}[0]'
91 Verify creation of host route via openstack subnet set option with change in next hop IP
92 [Documentation] Creating host route using subnet update option and setting nexthop ip to new gateway vm ip without changing the
93 ... destination prefix. Verifying in controller and openstack.
94 OpenStackOperations.Update SubNet @{SUBNETS}[0] --host-route destination=@{SUBNET_CIDR}[1]${PREFIX24},gateway=@{GATEWAY_VM_IPS}[1]
95 ${elements} = BuiltIn.Create List "destination":"@{SUBNET_CIDR}[1]${PREFIX24}","nexthop":"@{GATEWAY_VM_IPS}[1]"
96 BuiltIn.Wait Until Keyword Succeeds 30s 5s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${elements}
97 Verify Hostroutes In Subnet @{SUBNETS}[0] destination='@{SUBNET_CIDR}[1]${PREFIX24}',\\sgateway='@{GATEWAY_VM_IPS}[1]'
101 [Documentation] Creates initial setup.
102 VpnOperations.Basic Suite Setup
103 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
104 : FOR ${network} IN @{NETWORKS}
105 \ OpenStackOperations.Create Network ${network}
106 : FOR ${i} IN RANGE 1 4
107 \ OpenStackOperations.Create SubNet @{NETWORKS}[${i}] @{SUBNETS}[${i}] @{SUBNET_CIDR}[${i}]${PREFIX24}
108 \ OpenStackOperations.Create Port @{NETWORKS}[${i}] @{PORTS}[${i}] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
109 \ OpenStackOperations.Create Vm Instance With Port On Compute Node @{PORTS}[${i}] @{NETWORK_${i+1}_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
110 \ OpenStackOperations.Create Port @{NETWORKS}[${i}] @{PORTS}[${i+3}] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
111 \ OpenStackOperations.Create Vm Instance With Port On Compute Node @{PORTS}[${i+3}] @{NETWORK_${i+1}_VMS}[1] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
112 \ OpenStackOperations.Create Port @{NETWORKS}[${i}] @{GATEWAY_PORTS}[${i}] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
113 \ OpenStackOperations.Create Port @{NETWORKS}[${i}] @{GATEWAY_PORTS}[${i+3}] sg=${SECURITY_GROUP} allowed_address_pairs=${ALLOWED_ADDRESS_PAIR}
114 @{NETWORK_2_VM_IPS} ${NETWORK_2_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_2_VMS}
115 BuiltIn.Set Suite Variable @{NETWORK_2_VM_IPS}
116 @{NETWORK_3_VM_IPS} ${NETWORK_3_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_3_VMS}
117 BuiltIn.Set Suite Variable @{NETWORK_3_VM_IPS}
118 @{NETWORK_4_VM_IPS} ${NETWORK_4_DHCP_IP} = OpenStackOperations.Get VM IPs @{NETWORK_4_VMS}
119 BuiltIn.Set Suite Variable @{NETWORK_4_VM_IPS}
120 OpenStackOperations.Show Debugs @{NETWORK_2_VMS} @{NETWORK_3_VMS} @(NETWORK_4_VMS)
121 OpenStackOperations.Get Suite Debugs
123 Verify Hostroutes In Subnet
124 [Arguments] ${subnet_name} @{elements}
125 [Documentation] Show subnet with openstack request and verifies given hostroute in subnet.
126 ${output} = OpenStackOperations.Show SubNet ${subnet_name}
127 : FOR ${element} IN @{elements}
128 \ BuiltIn.Should Match Regexp ${output} ${element}
130 Verify No Hostroutes In Subnet
131 [Arguments] ${subnet_name} @{elements}
132 [Documentation] Show subnet with openstack request and verifies no given hostroute in subnet.
133 ${output} = OpenStackOperations.Show SubNet ${subnet_name}
134 : FOR ${element} IN @{elements}
135 \ BuiltIn.Should Not Match Regexp ${output} ${element}