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 @{NETWORKS_NAME} l2_network_1 l2_network_2
21 @{SUBNETS_NAME} l2_subnet_1 l2_subnet_2
22 @{NET_1_VM_INSTANCES} MyFirstInstance_1 MySecondInstance_1 MyThirdInstance_1
23 @{NET_2_VM_INSTANCES} MyFirstInstance_2 MySecondInstance_2 MyThirdInstance_2
24 @{SUBNETS_RANGE} 30.0.0.0/24 40.0.0.0/24
25 ${network1_vlan_id} 1235
28 Create VLAN Network (l2_network_1)
29 [Documentation] Create Network with neutron request.
30 # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
31 # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
32 : FOR ${feature_name} IN @{legacy_feature_list}
33 \ ${feature_check_status}= Run Keyword And Return Status Verify Feature Is Installed ${feature_name}
34 \ Exit For Loop If '${feature_check_status}' == 'True'
35 Run Keyword If '${feature_check_status}' == 'True' Create Network @{NETWORKS_NAME}[0]
36 ... ELSE Create Network @{NETWORKS_NAME}[0] --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
38 Create VXLAN Network (l2_network_2)
39 [Documentation] Create Network with neutron request.
40 Create Network @{NETWORKS_NAME}[1]
42 Create Subnets For l2_network_1
43 [Documentation] Create Sub Nets for the Networks with neutron request.
44 Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0]
46 Create Subnets For l2_network_2
47 [Documentation] Create Sub Nets for the Networks with neutron request.
48 Create SubNet @{NETWORKS_NAME}[1] @{SUBNETS_NAME}[1] @{SUBNETS_RANGE}[1]
51 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
52 Neutron Security Group Create csit
53 Neutron Security Group Rule Create csit direction=ingress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
54 Neutron Security Group Rule Create csit direction=egress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
55 Neutron Security Group Rule Create csit direction=ingress protocol=icmp remote_ip_prefix=0.0.0.0/0
56 Neutron Security Group Rule Create csit direction=egress protocol=icmp remote_ip_prefix=0.0.0.0/0
57 Neutron Security Group Rule Create csit direction=ingress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
58 Neutron Security Group Rule Create csit direction=egress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
60 Create Vm Instances For l2_network_1
61 [Documentation] Create Four Vm instances using flavor and image names for a network.
62 Create Vm Instances l2_network_1 ${NET_1_VM_INSTANCES} sg=csit
64 Create Vm Instances For l2_network_2
65 [Documentation] Create Four Vm instances using flavor and image names for a network.
66 Create Vm Instances l2_network_2 ${NET_2_VM_INSTANCES} sg=csit
68 Check Vm Instances Have Ip Address
69 [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses.
70 ... We are polling first and longest on the last VM created assuming that if it's received it's address
71 ... already the other instances should have theirs already or at least shortly thereafter.
72 # first, ensure all VMs are in ACTIVE state. if not, we can just fail the test case and not waste time polling
74 : FOR ${vm} IN @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
75 \ Wait Until Keyword Succeeds 15s 5s Verify VM Is ACTIVE ${vm}
76 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
77 ... true @{NET_1_VM_INSTANCES}
78 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
79 ... true @{NET_2_VM_INSTANCES}
80 ${NET1_VM_IPS} ${NET1_DHCP_IP} Collect VM IP Addresses false @{NET_1_VM_INSTANCES}
81 ${NET2_VM_IPS} ${NET2_DHCP_IP} Collect VM IP Addresses false @{NET_2_VM_INSTANCES}
82 ${VM_INSTANCES}= Collections.Combine Lists ${NET_1_VM_INSTANCES} ${NET_2_VM_INSTANCES}
83 ${VM_IPS}= Collections.Combine Lists ${NET1_VM_IPS} ${NET2_VM_IPS}
84 ${LOOP_COUNT} Get Length ${VM_INSTANCES}
85 : FOR ${index} IN RANGE 0 ${LOOP_COUNT}
86 \ ${status} ${message} Run Keyword And Ignore Error Should Not Contain @{VM_IPS}[${index}] None
87 \ Run Keyword If '${status}' == 'FAIL' Write Commands Until Prompt nova console-log @{VM_INSTANCES}[${index}] 30s
88 Set Suite Variable ${NET1_VM_IPS}
89 Set Suite Variable ${NET2_VM_IPS}
90 Should Not Contain ${NET1_VM_IPS} None
91 Should Not Contain ${NET2_VM_IPS} None
92 Should Not Contain ${NET1_DHCP_IP} None
93 Should Not Contain ${NET2_DHCP_IP} None
94 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
95 ... AND Get Test Teardown Debugs
97 Ping Vm Instance1 In l2_network_1
98 [Documentation] Check reachability of vm instances by pinging to them.
99 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[0]
101 Ping Vm Instance2 In l2_network_1
102 [Documentation] Check reachability of vm instances by pinging to them.
103 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[1]
105 Ping Vm Instance3 In l2_network_1
106 [Documentation] Check reachability of vm instances by pinging to them.
107 Ping Vm From DHCP Namespace l2_network_1 @{NET1_VM_IPS}[2]
109 Ping Vm Instance1 In l2_network_2
110 [Documentation] Check reachability of vm instances by pinging to them.
111 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[0]
113 Ping Vm Instance2 In l2_network_2
114 [Documentation] Check reachability of vm instances by pinging to them.
115 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[1]
117 Ping Vm Instance3 In l2_network_2
118 [Documentation] Check reachability of vm instances by pinging to them.
119 Ping Vm From DHCP Namespace l2_network_2 @{NET2_VM_IPS}[2]
121 Connectivity Tests From Vm Instance1 In l2_network_1
122 [Documentation] Login to the vm instance and test some operations
123 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[0] ${NET1_VM_IPS}
125 Connectivity Tests From Vm Instance2 In l2_network_1
126 [Documentation] Login to the vm instance and test operations
127 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[1] ${NET1_VM_IPS}
129 Connectivity Tests From Vm Instance3 In l2_network_1
130 [Documentation] Login to the vm instance and test operations
131 Test Operations From Vm Instance l2_network_1 @{NET1_VM_IPS}[2] ${NET1_VM_IPS}
133 Connectivity Tests From Vm Instance1 In l2_network_2
134 [Documentation] Login to the vm instance and test operations
135 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[0] ${NET2_VM_IPS}
137 Connectivity Tests From Vm Instance2 In l2_network_2
138 [Documentation] Logging to the vm instance using generated key pair.
139 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[1] ${NET2_VM_IPS}
141 Connectivity Tests From Vm Instance3 In l2_network_2
142 [Documentation] Login to the vm instance using generated key pair.
143 Test Operations From Vm Instance l2_network_2 @{NET2_VM_IPS}[2] ${NET2_VM_IPS}
146 [Documentation] Delete Vm instances using instance names.
147 Delete Vm Instance MyFirstInstance_1
149 No Ping For Deleted Vm
150 [Documentation] Check non reachability of deleted vm instances by pinging to them.
151 ${output}= Ping From DHCP Should Not Succeed l2_network_1 @{NET_1_VM_IPS}[0]
153 Delete Vm Instances In l2_network_1
154 [Documentation] Delete Vm instances using instance names in l2_network_1.
155 : FOR ${VmElement} IN @{NET_1_VM_INSTANCES}
156 \ Delete Vm Instance ${VmElement}
158 Delete Vm Instances In l2_network_2
159 [Documentation] Delete Vm instances using instance names in l2_network_2.
160 : FOR ${VmElement} IN @{NET_2_VM_INSTANCES}
161 \ Delete Vm Instance ${VmElement}
162 [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} @{NET_2_VM_INSTANCES}
163 ... AND Get Test Teardown Debugs
165 Delete Sub Networks In l2_network_1
166 [Documentation] Delete Sub Nets for the Networks with neutron request.
167 Delete SubNet l2_subnet_1
169 Delete Sub Networks In l2_network_2
170 [Documentation] Delete Sub Nets for the Networks with neutron request.
171 Delete SubNet l2_subnet_2
174 [Documentation] Delete Networks with neutron request.
175 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
176 \ Delete Network ${NetworkElement}
179 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
180 ${feature_check_status}= Run Keyword And Return Status Verify Feature Is Installed odl-vtn-manager-neutron
181 Run Keyword If '${feature_check_status}' != 'True' Verify Flows Are Cleaned Up On All OpenStack Nodes