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
17 @{NETWORKS_NAME} network_1 network_2
18 @{SUBNETS_NAME} subnet_1 subnet_2
19 @{NET_1_VM_INSTANCES} l3_instance_net_1_1 l3_instance_net_1_2 l3_instance_net_1_3
20 @{NET_2_VM_INSTANCES} l3_instance_net_2_1 l3_instance_net_2_2 l3_instance_net_2_3
21 @{SUBNETS_RANGE} 50.0.0.0/24 60.0.0.0/24
25 [Documentation] Create Network with neutron request.
26 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
27 \ Create Network ${NetworkElement}
29 Create Subnets For network_1
30 [Documentation] Create Sub Nets for the Networks with neutron request.
31 Create SubNet network_1 subnet_1 @{SUBNETS_RANGE}[0]
33 Create Subnets For network_2
34 [Documentation] Create Sub Nets for the Networks with neutron request.
35 Create SubNet network_2 subnet_2 @{SUBNETS_RANGE}[1]
37 Create Vm Instances For network_1
38 [Documentation] Create Four Vm instances using flavor and image names for a network.
39 Create Vm Instances network_1 ${NET_1_VM_INSTANCES} sg=csit
41 Create Vm Instances For network_2
42 [Documentation] Create Four Vm instances using flavor and image names for a network.
43 Create Vm Instances network_2 ${NET_2_VM_INSTANCES} sg=csit
45 Check Vm Instances Have Ip Address
46 [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses.
47 ... We are polling first and longest on the last VM created assuming that if it's received it's address
48 ... already the other instances should have theirs already or at least shortly thereafter.
49 # first, ensure all VMs are in ACTIVE state. if not, we can just fail the test case and not waste time polling
51 : FOR ${vm} IN @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
52 \ Wait Until Keyword Succeeds 15s 5s Verify VM Is ACTIVE ${vm}
53 : FOR ${index} IN RANGE 1 5
54 \ ${NET1_L3_VM_IPS} @{NET1_DHCP_IP} Verify VMs Received DHCP Lease @{NET_1_VM_INSTANCES}
55 \ ${NET2_L3_VM_IPS} @{NET2_DHCP_IP} Verify VMs Received DHCP Lease @{NET_2_VM_INSTANCES}
56 \ ${VM_IPS}= Collections.Combine Lists ${NET1_L3_VM_IPS} ${NET2_L3_VM_IPS} ${NET1_DHCP_IP} ${NET2_DHCP_IP}
57 \ ${status} ${message} Run Keyword And Ignore Error List Should Not Contain Value ${VM_IPS} None
58 \ Exit For Loop If '${status}' == 'PASS'
60 : FOR ${vm} IN @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
61 \ Write Commands Until Prompt nova console-log ${vm} 30s
62 Set Suite Variable ${NET1_L3_VM_IPS}
63 Set Suite Variable ${NET1_DHCP_IP}
64 Set Suite Variable ${NET2_L3_VM_IPS}
65 Set Suite Variable ${NET2_DHCP_IP}
66 Should Not Contain ${NET1_L3_VM_IPS} None
67 Should Not Contain ${NET2_L3_VM_IPS} None
68 Should Not Contain ${NET1_DHCP_IP} None
69 Should Not Contain ${NET2_DHCP_IP} None
70 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
71 ... AND Get Test Teardown Debugs
74 [Documentation] Create Router
75 Create Router router_1
77 Add Interfaces To Router
78 [Documentation] Add Interfaces
79 : FOR ${interface} IN @{SUBNETS_NAME}
80 \ Add Router Interface router_1 ${interface}
82 Ping Vm Instance1 In network_2 From network_1
83 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
84 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[0]
86 Ping Vm Instance2 In network_2 From network_1
87 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
88 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[1]
90 Ping Vm Instance3 In network_2 From network_1
91 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
92 Ping Vm From DHCP Namespace network_1 @{NET2_L3_VM_IPS}[2]
94 Ping Vm Instance1 In network_1 From network_2
95 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
96 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[0]
98 Ping Vm Instance2 In network_1 From network_2
99 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
100 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[1]
102 Ping Vm Instance3 In network_1 From network_2
103 [Documentation] Check reachability of vm instances by pinging to them after creating routers.
104 Ping Vm From DHCP Namespace network_2 @{NET1_L3_VM_IPS}[2]
106 Connectivity Tests From Vm Instance1 In network_1
107 [Documentation] Login to the VM instance and test operations
108 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
110 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[0] ${dst_list}
112 Connectivity Tests From Vm Instance2 In network_1
113 [Documentation] Login to the vm instance and test operations
114 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
116 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[1] ${dst_list}
118 Connectivity Tests From Vm Instance3 In network_1
119 [Documentation] Login to the vm instance and test operations
120 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
122 Test Operations From Vm Instance network_1 @{NET1_L3_VM_IPS}[2] ${dst_list}
124 Connectivity Tests From Vm Instance1 In network_2
125 [Documentation] Login to the vm instance and test operations
126 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
128 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[0] ${dst_list}
130 Connectivity Tests From Vm Instance2 In network_2
131 [Documentation] Logging to the vm instance using generated key pair.
132 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
134 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[1] ${dst_list}
136 Connectivity Tests From Vm Instance3 In network_2
137 [Documentation] Logging to the vm instance using generated key pair.
138 ${dst_list}= Create List @{NET1_L3_VM_IPS} @{NET2_L3_VM_IPS}
140 Test Operations From Vm Instance network_2 @{NET2_L3_VM_IPS}[2] ${dst_list}
142 Delete Vm Instances In network_1
143 [Documentation] Delete Vm instances using instance names in network_1.
144 : FOR ${VmElement} IN @{NET_1_VM_INSTANCES}
145 \ Delete Vm Instance ${VmElement}
147 Delete Vm Instances In network_2
148 [Documentation] Delete Vm instances using instance names in network_2.
149 : FOR ${VmElement} IN @{NET_2_VM_INSTANCES}
150 \ Delete Vm Instance ${VmElement}
151 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
152 ... AND Get Test Teardown Debugs
154 Delete Router Interfaces
155 [Documentation] Remove Interface to the subnets.
156 : FOR ${interface} IN @{SUBNETS_NAME}
157 \ Remove Interface router_1 ${interface}
160 [Documentation] Delete Router and Interface to the subnets.
161 Delete Router router_1
163 Delete Sub Networks In network_1
164 [Documentation] Delete Sub Nets for the Networks with neutron request.
165 Delete SubNet subnet_1
167 Delete Sub Networks In network_2
168 [Documentation] Delete Sub Nets for the Networks with neutron request.
169 Delete SubNet subnet_2
172 [Documentation] Delete Networks with neutron request.
173 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
174 \ Delete Network ${NetworkElement}