2 Documentation Test suite to verify packet flows between vm instances.
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/DataModels.robot
13 Resource ../../../libraries/OpenStackOperations.robot
14 Resource ../../../libraries/SetupUtils.robot
15 Resource ../../../libraries/Utils.robot
16 Resource ../../../libraries/KarafKeywords.robot
17 Resource ../../../variables/netvirt/Variables.robot
20 ${SECURITY_GROUP} sg-connectivity
21 @{NETWORKS_NAME} l2_network_1 l2_network_2
22 @{SUBNETS_NAME} l2_subnet_1 l2_subnet_2
23 @{NET_1_VM_GRP_NAME} NET1-VM
24 @{NET_2_VM_GRP_NAME} NET2-VM
25 @{NET_1_VM_INSTANCES} NET1-VM-1 NET1-VM-2 NET1-VM-3 NET1-VM-4
26 @{NET_2_VM_INSTANCES} NET2-VM-1 NET2-VM-2 NET2-VM-3 NET2-VM-4
27 @{SUBNETS_RANGE} 30.0.0.0/24 40.0.0.0/24
28 ${network1_vlan_id} 1235
31 Create VLAN Network (l2_network_1)
32 [Documentation] Create Network with neutron request.
33 # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
34 # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
35 : FOR ${feature_name} IN @{legacy_feature_list}
36 \ ${feature_check_status}= Run Keyword And Return Status Verify Feature Is Installed ${feature_name}
37 \ Exit For Loop If '${feature_check_status}' == 'True'
38 Run Keyword If '${feature_check_status}' == 'True' Create Network @{NETWORKS_NAME}[0]
39 ... ELSE Create Network @{NETWORKS_NAME}[0] --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
41 Create VXLAN Network (l2_network_2)
42 [Documentation] Create Network with neutron request.
43 Create Network @{NETWORKS_NAME}[1]
45 Create Subnets For l2_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 l2_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]
54 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
55 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
57 Create Vm Instances For l2_network_1
58 [Documentation] Create Four Vm instances using flavor and image names for a network.
59 Create Vm Instances l2_network_1 ${NET_1_VM_GRP_NAME} sg=${SECURITY_GROUP} min=3 max=3
61 Create Vm Instances For l2_network_2
62 [Documentation] Create Four Vm instances using flavor and image names for a network.
63 Create Vm Instances l2_network_2 ${NET_2_VM_GRP_NAME} sg=${SECURITY_GROUP} min=3 max=3
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 @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
72 \ Poll VM Is ACTIVE ${vm}
73 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
74 ... true @{NET_1_VM_INSTANCES}
75 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
76 ... true @{NET_2_VM_INSTANCES}
77 ${NET1_VM_IPS} ${NET1_DHCP_IP} Collect VM IP Addresses false @{NET_1_VM_INSTANCES}
78 ${NET2_VM_IPS} ${NET2_DHCP_IP} Collect VM IP Addresses false @{NET_2_VM_INSTANCES}
79 ${VM_INSTANCES}= Collections.Combine Lists ${NET_1_VM_INSTANCES} ${NET_2_VM_INSTANCES}
80 ${VM_IPS}= Collections.Combine Lists ${NET1_VM_IPS} ${NET2_VM_IPS}
81 ${LOOP_COUNT} Get Length ${VM_INSTANCES}
82 : FOR ${index} IN RANGE 0 ${LOOP_COUNT}
83 \ ${status} ${message} Run Keyword And Ignore Error Should Not Contain @{VM_IPS}[${index}] None
84 \ Run Keyword If '${status}' == 'FAIL' Write Commands Until Prompt openstack console log show @{VM_INSTANCES}[${index}] 30s
85 Set Suite Variable ${NET1_VM_IPS}
86 Set Suite Variable ${NET2_VM_IPS}
87 Should Not Contain ${NET1_VM_IPS} None
88 Should Not Contain ${NET2_VM_IPS} None
89 Should Not Contain ${NET1_DHCP_IP} None
90 Should Not Contain ${NET2_DHCP_IP} None
91 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
92 ... AND Get Test Teardown Debugs
94 Ping Vm Instance1 In l2_network_1
95 [Documentation] Check reachability of vm instances by pinging to them.
96 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[0]
98 Ping Vm Instance2 In l2_network_1
99 [Documentation] Check reachability of vm instances by pinging to them.
100 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[1]
102 Ping Vm Instance3 In l2_network_1
103 [Documentation] Check reachability of vm instances by pinging to them.
104 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[2]
106 Ping Vm Instance1 In l2_network_2
107 [Documentation] Check reachability of vm instances by pinging to them.
108 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[0]
110 Ping Vm Instance2 In l2_network_2
111 [Documentation] Check reachability of vm instances by pinging to them.
112 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[1]
114 Ping Vm Instance3 In l2_network_2
115 [Documentation] Check reachability of vm instances by pinging to them.
116 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[2]
118 Connectivity Tests From Vm Instance1 In l2_network_1
119 [Documentation] Login to the vm instance and test some operations
120 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[0] ${NET1_VM_IPS}
122 Connectivity Tests From Vm Instance2 In l2_network_1
123 [Documentation] Login to the vm instance and test operations
124 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[1] ${NET1_VM_IPS}
126 Connectivity Tests From Vm Instance3 In l2_network_1
127 [Documentation] Login to the vm instance and test operations
128 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[2] ${NET1_VM_IPS}
130 Connectivity Tests From Vm Instance1 In l2_network_2
131 [Documentation] Login to the vm instance and test operations
132 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[0] ${NET2_VM_IPS}
134 Connectivity Tests From Vm Instance2 In l2_network_2
135 [Documentation] Logging to the vm instance using generated key pair.
136 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[1] ${NET2_VM_IPS}
138 Connectivity Tests From Vm Instance3 In l2_network_2
139 [Documentation] Login to the vm instance using generated key pair.
140 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[2] ${NET2_VM_IPS}
143 [Documentation] Delete Vm instances using instance names.
144 Delete Vm Instance NET1-VM-1
146 No Ping For Deleted Vm
147 [Documentation] Check non reachability of deleted vm instances by pinging to them.
148 ${output}= Ping From DHCP Should Not Succeed l2_network_1 @{NET_1_VM_IPS}[0]
150 Delete Vm Instances In l2_network_1
151 [Documentation] Delete Vm instances using instance names in l2_network_1.
152 : FOR ${VmElement} IN @{NET_1_VM_INSTANCES}
153 \ Delete Vm Instance ${VmElement}
155 Delete Vm Instances In l2_network_2
156 [Documentation] Delete Vm instances using instance names in l2_network_2.
157 : FOR ${VmElement} IN @{NET_2_VM_INSTANCES}
158 \ Delete Vm Instance ${VmElement}
159 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
160 ... AND Get Test Teardown Debugs
162 Delete Sub Networks In l2_network_1
163 [Documentation] Delete Sub Nets for the Networks with neutron request.
164 Delete SubNet l2_subnet_1
166 Delete Sub Networks In l2_network_2
167 [Documentation] Delete Sub Nets for the Networks with neutron request.
168 Delete SubNet l2_subnet_2
171 [Documentation] Delete Networks with neutron request.
172 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
173 \ Delete Network ${NetworkElement}
176 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
177 ${feature_check_status}= Run Keyword And Return Status Verify Feature Is Installed odl-vtn-manager-neutron
178 Run Keyword If '${feature_check_status}' != 'True' Verify Flows Are Cleaned Up On All OpenStack Nodes