2 Documentation Test suite to check North-South connectivity in L3 using a router and an external network
3 Suite Setup Devstack Suite Setup Tests source_pwd=yes
4 Suite Teardown Close All Connections
5 Test Teardown Get OvsDebugInfo
7 Library OperatingSystem
8 Library RequestsLibrary
9 Resource ../../../libraries/Utils.robot
10 Resource ../../../libraries/OpenStackOperations.robot
11 Resource ../../../libraries/DevstackUtils.robot
14 @{NETWORKS_NAME} l3_net
15 @{SUBNETS_NAME} l3_subnet
16 @{VM_INSTANCES} VmInstance1_net VmInstance2_net
17 @{SUBNETS_RANGE} 90.0.0.0/24
18 ${external_gateway} 10.10.10.250
19 ${external_subnet} 10.10.10.0/24
20 ${external_physical_network} physnet1
21 ${external_net_name} external-net
22 ${external_subnet_name} external-subnet
25 Create All Controller Sessions
26 [Documentation] Create sessions for all three controllers
27 ClusterManagement.ClusterManagement Setup
29 Create Private Network
30 [Documentation] Create Network with neutron request.
31 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
32 \ OpenStackOperations.Create Network ${NetworkElement}
34 Create Subnet For Private Network
35 [Documentation] Create Sub Nets for the Networks with neutron request.
36 OpenStackOperations.Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0]
38 Create External Network And Subnet
39 Create Network ${external_net_name} --router:external --provider:network_type=flat --provider:physical_network=${external_physical_network}
40 Create Subnet ${external_net_name} ${external_subnet_name} ${external_subnet} --gateway ${external_gateway}
43 [Documentation] Create Router and Add Interface to the subnets.
44 OpenStackOperations.Create Router router1
46 Add Interfaces To Router
47 [Documentation] Add Interfaces
48 : FOR ${interface} IN @{SUBNETS_NAME}
49 \ OpenStackOperations.Add Router Interface router1 ${interface}
51 Add Router Gateway To Router
52 [Documentation] Add Router Gateway
53 OpenStackOperations.Add Router Gateway router1 ${external_net_name}
55 Verify Created Routers
56 [Documentation] Check created routers using northbound rest calls
57 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
59 Should Contain ${data} router1
62 [Documentation] Create VM instances using flavor and image names for a network.
63 OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${VM_INSTANCES} sg=csit
65 Check Vm Instances Have Ip Address
66 [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses.
67 ... We are polling first and longest on the last VM created assuming that if it's received it's address
68 ... already the other instances should have theirs already or at least shortly thereafter.
69 # first, ensure all VMs are in ACTIVE state. if not, we can just fail the test case and not waste time polling
71 : FOR ${vm} IN @{VM_INSTANCES}
72 \ Wait Until Keyword Succeeds 15s 5s Verify VM Is ACTIVE ${vm}
73 Wait Until Keyword Succeeds 180s 10s Verify VMs Received DHCP Lease @{VM_INSTANCES}
74 [Teardown] Run Keywords Show Debugs ${VM_INSTANCES}
75 ... AND Get OvsDebugInfo
77 Create And Associate Floating IPs for VMs
78 [Documentation] Create and associate a floating IP for the VM
79 ${VM_FLOATING_IPS} OpenStackOperations.Create And Associate Floating IPs ${external_net_name} @{VM_INSTANCES}
80 Set Suite Variable ${VM_FLOATING_IPS}
81 [Teardown] Run Keywords Show Debugs ${VM_INSTANCES}
82 ... AND Get OvsDebugInfo
84 Ping External Gateway From Control Node
85 [Documentation] Check reachability of external gateway by pinging it from the control node.
86 OpenStackOperations.Ping Vm From Control Node ${external_gateway}
88 Ping Vm Instance1 Floating IP From Control Node
89 [Documentation] Check reachability of VM instance through floating IP by pinging them.
90 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0]
92 Ping Vm Instance2 Floating IP From Control Node
93 [Documentation] Check reachability of VM instance through floating IP by pinging them.
94 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1]
97 [Documentation] Delete Vm instances using instance names.
98 : FOR ${VmElement} IN @{VM_INSTANCES}
99 \ OpenStackOperations.Delete Vm Instance ${VmElement}
101 Delete Router Interfaces
102 [Documentation] Remove Interface to the subnets.
103 : FOR ${interface} IN @{SUBNETS_NAME}
104 \ OpenStackOperations.Remove Interface router1 ${interface}
107 [Documentation] Delete Router and Interface to the subnets.
108 OpenStackOperations.Delete Router router1
110 Verify Deleted Routers
111 [Documentation] Check deleted routers using northbound rest calls
112 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
114 Should Not Contain ${data} router1
117 [Documentation] Delete Sub Nets for the Networks with neutron request.
118 OpenStackOperations.Delete SubNet @{SUBNETS_NAME}[0]
121 [Documentation] Delete Networks with neutron request.
122 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
123 \ OpenStackOperations.Delete Network ${NetworkElement}
124 OpenStackOperations.Delete Network ${external_net_name}