Browse Source

Refactoring of destructive DVS scenarios

* Create new function to check ping vms
* Fix documentation strings

Change-Id: I8461728188420f4f6e0db0467a8f48e241298e0f
Vasily Gorin 2 years ago
parent
commit
7209f296c6

+ 1
- 1
docs/user_guide/conf.py View File

@@ -278,7 +278,7 @@ epub_copyright = u'2016, Mirantis Inc.'
278 278
 # The basename for the epub file. It defaults to the project name.
279 279
 # epub_basename = u'fuel-plugin-openbook'
280 280
 
281
-# The HTML theme for the epub output. Since the default themes are not optimized
281
+# The HTML theme for the epub output. Since the default themes are'nt optimized
282 282
 # for small screen space, using the same theme for HTML and epub output is
283 283
 # usually not wise. This defaults to 'epub', a theme designed to save visual
284 284
 # space.

+ 65
- 57
plugin_test/helpers/openstack.py View File

@@ -16,13 +16,12 @@ import time
16 16
 
17 17
 import paramiko
18 18
 import yaml
19
-from devops.error import TimeoutError
20 19
 from devops.helpers.helpers import icmp_ping
21 20
 from devops.helpers.helpers import tcp_ping
22 21
 from devops.helpers.helpers import wait
23
-from proboscis.asserts import assert_true
24 22
 
25 23
 from fuelweb_test import logger
24
+from fuelweb_test.helpers.ssh_manager import SSHManager
26 25
 from fuelweb_test.helpers.utils import pretty_log
27 26
 
28 27
 # timeouts
@@ -56,18 +55,17 @@ def verify_instance_state(os_conn, instances=None, expected_state='ACTIVE',
56 55
     if not instances:
57 56
         instances = os_conn.nova.servers.list()
58 57
     for instance in instances:
59
-        try:
60
-            wait(
61
-                lambda:
62
-                os_conn.get_instance_detail(instance).status == expected_state,
63
-                timeout=BOOT_TIMEOUT)
64
-        except TimeoutError:
65
-            current_state = os_conn.get_instance_detail(instance).status
66
-            assert_true(
67
-                current_state == expected_state,
68
-                "Timeout is reached. Current state of Vm {0} is {1}".format(
69
-                    instance.name, current_state)
70
-            )
58
+        wait(
59
+            lambda:
60
+            os_conn.get_instance_detail(instance).status == expected_state,
61
+            timeout=BOOT_TIMEOUT,
62
+            timeout_msg="Timeout is reached. "
63
+                        "Current state of Vm {0} is {1}."
64
+                        "Expected state is {2}".format(
65
+                            instance.name,
66
+                            os_conn.get_instance_detail(instance).status,
67
+                            expected_state)
68
+        )
71 69
 
72 70
 
73 71
 def create_instances(os_conn, nics, vm_count=1,
@@ -102,33 +100,14 @@ def create_instances(os_conn, nics, vm_count=1,
102 100
     return instances
103 101
 
104 102
 
105
-def generate_message(command, result_of_command, ip_from, ip_to):
106
-    """Generate error message for check connection methods.
107
-
108
-    :param command: type string, name of command
109
-    :param result_of_command: type interger, exite code of command execution
110
-    :param ip_from: type string, check connection from 'ip_from'
111
-    :param ip_to: type string, check connection from 'ip_to'
112
-    """
113
-    if result_of_command == 0:
114
-        param = "isn't"
115
-    else:
116
-        param = "is"
117
-    message = "{0} {1} available from {2} to {3}".format(
118
-        command, param, ip_from, ip_to)
119
-    return message
120
-
121
-
122
-def check_connection_vms(ip_pair, command='pingv4',
123
-                         result_of_command=0,
103
+def check_connection_vms(ip_pair, command='pingv4', result_of_command=0,
124 104
                          timeout=30, interval=5):
125 105
     """Check network connectivity between instances.
126 106
 
127
-    :param os_conn: type object, openstack
128 107
     :param ip_pair: type dict, {ip_from: [ip_to1, ip_to2, etc.]}
129 108
     :param command: type string, key from dictionary 'commands'
130 109
                     by default is 'pingv4'
131
-    :param result_of_command: type interger, exite code of command execution
110
+    :param result_of_command: type integer, exit code of command execution
132 111
                               by default is 0
133 112
     :param timeout: wait to get expected result
134 113
     :param interval: interval of executing command
@@ -139,21 +118,20 @@ def check_connection_vms(ip_pair, command='pingv4',
139 118
         "arping": "sudo arping -I eth0 {}",
140 119
         "ssh": " "}
141 120
 
121
+    msg = 'Command "{0}", Actual exit code is NOT {1}'
142 122
     for ip_from in ip_pair:
143
-        with get_ssh_connection(
144
-            ip_from, instance_creds[0], instance_creds[1]
145
-        ) as ssh:
123
+        with get_ssh_connection(ip_from, instance_creds[0],
124
+                                instance_creds[1]) as ssh:
146 125
             for ip_to in ip_pair[ip_from]:
147
-                message = generate_message(
148
-                    commands[command], result_of_command, ip_from, ip_to)
149 126
                 logger.info("Check connection from {0} to {1}.".format(
150 127
                     ip_from, ip_to))
151 128
                 cmd = commands[command].format(ip_to)
152
-                wait(lambda: execute(
153
-                     ssh, cmd)['exit_code'] == result_of_command,
129
+
130
+                wait(lambda:
131
+                     execute(ssh, cmd)['exit_code'] == result_of_command,
154 132
                      interval=interval,
155 133
                      timeout=timeout,
156
-                     timeout_msg=message.format(ip_from, ip_to)
134
+                     timeout_msg=msg.format(cmd, result_of_command)
157 135
                      )
158 136
 
159 137
 
@@ -163,10 +141,10 @@ def check_connection_through_host(remote, ip_pair, command='pingv4',
163 141
     """Check network connectivity between instances.
164 142
 
165 143
     :param ip_pair: type list,  ips of instances
166
-    :param remote: SSHClient to instance
144
+    :param remote: Access point IP
167 145
     :param command: type string, key from dictionary 'commands'
168 146
                     by default is 'pingv4'
169
-    :param  result_of_command: type interger, exite code of command execution
147
+    :param  result_of_command: type integer, exit code of command execution
170 148
                                by default is 0
171 149
     :param timeout: wait to get expected result
172 150
     :param interval: interval of executing command
@@ -176,35 +154,63 @@ def check_connection_through_host(remote, ip_pair, command='pingv4',
176 154
         "pingv6": "ping6 -c 5 {}",
177 155
         "arping": "sudo arping -I eth0 {}"}
178 156
 
157
+    msg = 'Command "{0}", Actual exit code is NOT {1}'
158
+
179 159
     for ip_from in ip_pair:
180 160
         for ip_to in ip_pair[ip_from]:
181 161
             logger.info('Check ping from {0} to {1}'.format(ip_from, ip_to))
182
-            message = generate_message(
183
-                commands[command], result_of_command, ip_from, ip_to)
162
+            cmd = commands[command].format(ip_to)
184 163
             wait(
185 164
                 lambda:
186 165
                 remote_execute_command(
187 166
                     remote,
188 167
                     ip_from,
189
-                    commands[command].format(ip_to),
168
+                    cmd,
190 169
                     wait=timeout)['exit_code'] == result_of_command,
191 170
                 interval=interval,
192 171
                 timeout=timeout,
193
-                timeout_msg=message.format(
194
-                    ip_from, ip_to)
172
+                timeout_msg=msg.format(cmd, result_of_command)
195 173
             )
196 174
 
197 175
 
176
+def ping_each_other(ips, command='pingv4', expected_ec=0,
177
+                    timeout=30, interval=5, access_point_ip=None):
178
+    """Check network connectivity between instances.
179
+
180
+    :param ips: list, list of ips
181
+    :param command: type string, key from dictionary 'commands'
182
+                    by default is 'pingv4'
183
+    :param expected_ec: type integer, exit code of command execution
184
+                              by default is 0
185
+    :param timeout: wait to get expected result
186
+    :param interval: interval of executing command
187
+    :param access_point_ip: It is used if check via host
188
+    """
189
+    ip_pair = {key: [ip for ip in ips if ip != key] for key in ips}
190
+    if access_point_ip:
191
+        check_connection_through_host(remote=access_point_ip,
192
+                                      ip_pair=ip_pair,
193
+                                      command=command,
194
+                                      result_of_command=expected_ec,
195
+                                      timeout=timeout,
196
+                                      interval=interval)
197
+    else:
198
+        check_connection_vms(ip_pair=ip_pair,
199
+                             command=command,
200
+                             result_of_command=expected_ec,
201
+                             timeout=timeout,
202
+                             interval=interval)
203
+
204
+
198 205
 def create_and_assign_floating_ips(os_conn, instances_list):
199
-    """Create Vms on available hypervisors.
206
+    """Associate floating ips with specified instances.
200 207
 
201 208
     :param os_conn: type object, openstack
202 209
     :param instances_list: type list, instances
203 210
     """
204 211
     fips = []
205 212
     for instance in instances_list:
206
-            ip = os_conn.assign_floating_ip(
207
-                instance).ip
213
+            ip = os_conn.assign_floating_ip(instance).ip
208 214
             fips.append(ip)
209 215
             wait(lambda: icmp_ping(ip), timeout=60 * 5, interval=5)
210 216
     return fips
@@ -323,19 +329,21 @@ def add_role_to_user(os_conn, user_name, role_name, tenant_name):
323 329
     os_conn.keystone.roles.add_user_role(user_id, role_id, tenant_id)
324 330
 
325 331
 
326
-def check_service(ssh, commands):
332
+def check_service(ip, commands):
327 333
         """Check that required nova services are running on controller.
328 334
 
329
-        :param ssh: SSHClient
335
+        :param ip: ip address of node
330 336
         :param commands: type list, nova commands to execute on controller,
331 337
                          example of commands:
332 338
                          ['nova-manage service list | grep vcenter-vmcluster1'
333 339
         """
334
-        ssh.execute('source openrc')
340
+        SSHManager.execute_on_remote(ip=ip, cmd='source openrc')
341
+
335 342
         for cmd in commands:
336 343
             wait(
337 344
                 lambda:
338
-                ':-)' in list(ssh.execute(cmd)['stdout'])[-1].split(' '),
345
+                ':-)' in SSHManager.execute_on_remote(ip=ip,
346
+                                                      cmd=cmd)['stdout'][-1],
339 347
                 timeout=200)
340 348
 
341 349
 

+ 125
- 146
plugin_test/tests/test_plugin_vmware_dvs_destructive.py View File

@@ -20,6 +20,7 @@ from devops.helpers.helpers import icmp_ping
20 20
 from devops.helpers.helpers import wait
21 21
 from proboscis import test
22 22
 from proboscis.asserts import assert_true
23
+from proboscis.asserts import fail
23 24
 
24 25
 import fuelweb_test.tests.base_test_case
25 26
 from fuelweb_test import logger
@@ -58,8 +59,21 @@ class TestDVSDestructive(TestBasic):
58 59
     cmds = ['nova-manage service list | grep vcenter-vmcluster1',
59 60
             'nova-manage service list | grep vcenter-vmcluster2']
60 61
 
61
-    net_data = [{'net_1': '192.168.112.0/24'},
62
-                {'net_2': '192.168.113.0/24'}]
62
+    networks = [
63
+        {'name': 'net_1',
64
+         'subnets': [
65
+             {'name': 'subnet_1',
66
+              'cidr': '192.168.112.0/24'}
67
+         ]
68
+         },
69
+        {'name': 'net_2',
70
+         'subnets': [
71
+             {'name': 'subnet_1',
72
+              'cidr': '192.168.113.0/24'}
73
+         ]
74
+         }
75
+    ]
76
+
63 77
     # defaults
64 78
     inter_net_name = openstack.get_defaults()['networks']['internal']['name']
65 79
     ext_net_name = openstack.get_defaults()['networks']['floating']['name']
@@ -112,17 +126,7 @@ class TestDVSDestructive(TestBasic):
112 126
                 instance, net_name=self.inter_net_name))
113 127
         time.sleep(30)
114 128
         self.show_step(13)
115
-        ip_pair = {
116
-            key: [value for value in ips if key != value] for key in ips}
117
-        for ip_from in ip_pair:
118
-            for ip_to in ip_pair[ip_from]:
119
-                ping_result = openstack.remote_execute_command(
120
-                    access_point_ip, ip_from, "ping -c 5 {0}".format(ip_to))
121
-                assert_true(
122
-                    ping_result['exit_code'] == 0,
123
-                    "Ping isn't available from {0} to {1}".format(ip_from,
124
-                                                                  ip_to)
125
-                )
129
+        openstack.ping_each_other(ips=ips, access_point_ip=access_point_ip)
126 130
 
127 131
         self.show_step(14)
128 132
         vcenter_name = [
@@ -136,25 +140,19 @@ class TestDVSDestructive(TestBasic):
136 140
         node.reset()
137 141
 
138 142
         self.show_step(15)
139
-        wait(lambda: not icmp_ping(
140
-            self.VCENTER_IP), interval=1, timeout=10,
141
-            timeout_msg='Vcenter is still available.')
143
+        wait(lambda: not icmp_ping(self.VCENTER_IP),
144
+             interval=1,
145
+             timeout=10,
146
+             timeout_msg='Vcenter is still available.')
142 147
 
143 148
         self.show_step(16)
144
-        wait(lambda: icmp_ping(
145
-            self.VCENTER_IP), interval=5, timeout=120,
146
-            timeout_msg='Vcenter is not available.')
149
+        wait(lambda: icmp_ping(self.VCENTER_IP),
150
+             interval=5,
151
+             timeout=120,
152
+             timeout_msg='Vcenter is not available.')
147 153
 
148 154
         self.show_step(17)
149
-        for ip_from in ip_pair:
150
-            for ip_to in ip_pair[ip_from]:
151
-                ping_result = openstack.remote_execute_command(
152
-                    access_point_ip, ip_from, "ping -c 5 {0}".format(ip_to))
153
-                assert_true(
154
-                    ping_result['exit_code'] == 0,
155
-                    "Ping isn't available from {0} to {1}".format(ip_from,
156
-                                                                  ip_to)
157
-                )
155
+        openstack.ping_each_other(ips=ips, access_point_ip=access_point_ip)
158 156
 
159 157
     @test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
160 158
           groups=["dvs_vcenter_uninstall"])
@@ -186,10 +184,8 @@ class TestDVSDestructive(TestBasic):
186 184
         self.show_step(3)
187 185
         output = self.ssh_manager.execute_on_remote(
188 186
             ip=self.ssh_manager.admin_ip, cmd='fuel plugins list')['stdout']
189
-        assert_true(
190
-            plugin.plugin_name in output[-1].split(' '),
191
-            "Plugin '{0}' was removed".format(plugin.plugin_name)
192
-        )
187
+        assert_true(plugin.plugin_name in output[-1].split(' '),
188
+                    "Plugin '{0}' was removed".format(plugin.plugin_name))
193 189
 
194 190
     @test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
195 191
           groups=["dvs_vcenter_bind_port"])
@@ -199,26 +195,26 @@ class TestDVSDestructive(TestBasic):
199 195
 
200 196
         Scenario:
201 197
             1. Revert snapshot to dvs_vcenter_systest_setup
202
-            2. Create private networks net01 with sunet.
203
-            3. Launch instances VM_1 and VM_2 in the net01
198
+            2. Create private networks net01 with subnet.
199
+            3. Launch instance VM_1 in the net01
204 200
                with image TestVM and flavor m1.micro in nova az.
205
-            4. Launch instances VM_3 and VM_4 in the net01
206
-               with image TestVM-VMDK and flavor m1.micro in nova az.
207
-            4. Bind sub_net port of instances.
208
-            5. Check instances are not available.
209
-            6. Enable sub_net port of all instances.
210
-            7. Verify that instances communicate between each other.
201
+            4. Launch instance VM_2 in the net01
202
+               with image TestVM-VMDK and flavor m1.micro in vcenter az.
203
+            5. Disable sub_net port of instances.
204
+            6. Check instances are not available.
205
+            7. Enable sub_net port of all instances.
206
+            8. Verify that instances communicate between each other.
211 207
                Send icmp ping between instances.
212 208
 
213 209
 
214 210
         Duration: 1,5 hours
215 211
 
216 212
         """
213
+        self.show_step(1)
217 214
         self.env.revert_snapshot("dvs_vcenter_systest_setup")
218 215
 
219 216
         cluster_id = self.fuel_web.get_last_created_cluster()
220 217
 
221
-        # Create new network
222 218
         os_ip = self.fuel_web.get_public_vip(cluster_id)
223 219
         os_conn = os_actions.OpenStackActions(
224 220
             os_ip, SERVTEST_USERNAME,
@@ -228,28 +224,27 @@ class TestDVSDestructive(TestBasic):
228 224
         # create security group with rules for ssh and ping
229 225
         security_group = os_conn.create_sec_group_for_ssh()
230 226
 
231
-        logger.info("Create non default network with subnet.")
232
-        logger.info('Create network {}'.format(self.net_data[0].keys()[0]))
233
-        network = os_conn.create_network(
234
-            network_name=self.net_data[0].keys()[0])['network']
227
+        self.show_step(2)
228
+        net = self.networks[0]
229
+        network = os_conn.create_network(network_name=net['name'])['network']
235 230
 
236 231
         subnet = os_conn.create_subnet(
237
-            subnet_name=network['name'],
232
+            subnet_name=net['subnets'][0]['name'],
238 233
             network_id=network['id'],
239
-            cidr=self.net_data[0][self.net_data[0].keys()[0]])
234
+            cidr=net['subnets'][0]['cidr'])
240 235
 
241
-        logger.info("Check that network are created.")
236
+        logger.info("Check network was created.")
242 237
         assert_true(
243 238
             os_conn.get_network(network['name'])['id'] == network['id']
244 239
         )
245 240
 
246 241
         logger.info("Add net_1 to default router")
247 242
         router = os_conn.get_router(os_conn.get_network(self.ext_net_name))
248
-        os_conn.add_router_interface(
249
-            router_id=router["id"],
250
-            subnet_id=subnet["id"])
243
+        os_conn.add_router_interface(router_id=router["id"],
244
+                                     subnet_id=subnet["id"])
251 245
 
252
-        #  Launch instance VM_1 and VM_2
246
+        self.show_step(3)
247
+        self.show_step(4)
253 248
         instances = openstack.create_instances(
254 249
             os_conn=os_conn, nics=[{'net-id': network['id']}], vm_count=1,
255 250
             security_groups=[security_group.name]
@@ -257,39 +252,39 @@ class TestDVSDestructive(TestBasic):
257 252
         openstack.verify_instance_state(os_conn)
258 253
 
259 254
         ports = os_conn.neutron.list_ports()['ports']
260
-        floating_ip = openstack.create_and_assign_floating_ips(
261
-            os_conn, instances)
262
-        instance_ports = []
263
-        for instance in instances:
264
-            instance_addr = os_conn.get_nova_instance_ip(
265
-                instance, net_name=network['name'])
266
-            for port in ports:
267
-                port_addr = port['fixed_ips'][0]['ip_address']
268
-                if instance_addr == port_addr:
269
-                    instance_ports.append(port)
270
-        for port in instance_ports:
255
+        fips = openstack.create_and_assign_floating_ips(os_conn, instances)
256
+
257
+        inst_ips = [os_conn.get_nova_instance_ip(
258
+            instance, net_name=network['name']) for instance in instances]
259
+        inst_ports = [p for p in ports
260
+                      if p['fixed_ips'][0]['ip_address'] in inst_ips]
261
+
262
+        self.show_step(5)
263
+        for port in inst_ports:
271 264
             os_conn.neutron.update_port(
272 265
                 port['id'], {'port': {'admin_state_up': False}}
273 266
             )
274 267
 
275
-        ip_pair = dict.fromkeys(floating_ip)
276
-        for key in ip_pair:
277
-            ip_pair[key] = [value for value in floating_ip if key != value]
278
-        # Verify that not connection to instances
268
+        self.show_step(6)
269
+        # TODO(vgorin) create better solution for this step
279 270
         try:
280
-            openstack.check_connection_vms(ip_pair)
271
+            openstack.ping_each_other(fips)
272
+            checker = 1
281 273
         except Exception as e:
282
-                logger.info(str(e))
274
+            logger.info(e)
275
+            checker = 0
283 276
 
284
-        # Enable sub_net ports of instances
285
-        for port in instance_ports:
277
+        if checker:
278
+            fail('Ping is available between instances')
279
+
280
+        self.show_step(7)
281
+        for port in inst_ports:
286 282
             os_conn.neutron.update_port(
287 283
                 port['id'], {'port': {'admin_state_up': True}}
288 284
             )
289 285
 
290
-        # Verify that instances communicate between each other.
291
-        # Send icmp ping between instances
292
-        openstack.check_connection_vms(ip_pair, timeout=90)
286
+        self.show_step(8)
287
+        openstack.ping_each_other(fips, timeout=90)
293 288
 
294 289
     @test(depends_on=[SetupEnvironment.prepare_slaves_5],
295 290
           groups=["dvs_destructive_setup_2"])
@@ -300,20 +295,24 @@ class TestDVSDestructive(TestBasic):
300 295
         Scenario:
301 296
             1. Upload plugins to the master node
302 297
             2. Install plugin.
303
-            3. Create cluster with vcenter.
298
+            3. Configure cluster with 2 vcenter clusters.
304 299
             4. Add 3 node with controller role.
305 300
             5. Add 2 node with compute role.
306
-            6. Deploy the cluster.
307
-            7. Launch instances.
301
+            6. Configure vcenter
302
+            7. Deploy the cluster.
303
+            8. Run smoke OSTF tests
304
+            9. Launch instances. 1 per az. Assign floating ips.
305
+            10. Make snapshot
308 306
 
309 307
         Duration: 1.8 hours
310
-
308
+        Snapshot: dvs_destructive_setup_2
311 309
         """
310
+        self.show_step(1)
312 311
         self.env.revert_snapshot("ready_with_5_slaves")
313 312
 
314 313
         plugin.install_dvs_plugin(self.ssh_manager.admin_ip)
315 314
 
316
-        # Configure cluster with 2 vcenter clusters
315
+        self.show_step(2)
317 316
         cluster_id = self.fuel_web.create_cluster(
318 317
             name=self.__class__.__name__,
319 318
             mode=DEPLOYMENT_MODE,
@@ -324,7 +323,8 @@ class TestDVSDestructive(TestBasic):
324 323
         )
325 324
         plugin.enable_plugin(cluster_id, self.fuel_web)
326 325
 
327
-        # Assign role to node
326
+        self.show_step(3)
327
+        self.show_step(4)
328 328
         self.fuel_web.update_nodes(
329 329
             cluster_id,
330 330
             {'slave-01': ['controller'],
@@ -333,21 +333,23 @@ class TestDVSDestructive(TestBasic):
333 333
              'slave-04': ['compute'],
334 334
              'slave-05': ['compute']}
335 335
         )
336
-        # Configure VMWare vCenter settings
336
+        self.show_step(6)
337 337
         self.fuel_web.vcenter_configure(cluster_id, multiclusters=True)
338 338
 
339
+        self.show_step(7)
339 340
         self.fuel_web.deploy_cluster_wait(cluster_id)
340 341
 
342
+        self.show_step(8)
341 343
         self.fuel_web.run_ostf(
342 344
             cluster_id=cluster_id, test_sets=['smoke'])
343 345
 
346
+        self.show_step(9)
344 347
         os_ip = self.fuel_web.get_public_vip(cluster_id)
345 348
         os_conn = os_actions.OpenStackActions(
346 349
             os_ip, SERVTEST_USERNAME,
347 350
             SERVTEST_PASSWORD,
348 351
             SERVTEST_TENANT)
349 352
 
350
-        # create security group with rules for ssh and ping
351 353
         security_group = os_conn.create_sec_group_for_ssh()
352 354
 
353 355
         network = os_conn.nova.networks.find(label=self.inter_net_name)
@@ -356,10 +358,9 @@ class TestDVSDestructive(TestBasic):
356 358
             security_groups=[security_group.name]
357 359
         )
358 360
         openstack.verify_instance_state(os_conn)
361
+        openstack.create_and_assign_floating_ips(os_conn, instances)
359 362
 
360
-        for instance in instances:
361
-            os_conn.assign_floating_ip(instance)
362
-
363
+        self.show_step(10)
363 364
         self.env.make_snapshot("dvs_destructive_setup_2", is_make=True)
364 365
 
365 366
     @test(depends_on=[dvs_destructive_setup_2],
@@ -373,13 +374,14 @@ class TestDVSDestructive(TestBasic):
373 374
             2. Verify connection between instances. Send ping,
374 375
                check that ping get reply
375 376
             3. Reset controller.
376
-            4. Check that vmclusters should be migrate to another controller.
377
+            4. Check that vmclusters migrate to another controller.
377 378
             5. Verify connection between instances.
378 379
                 Send ping, check that ping get reply
379 380
 
380 381
         Duration: 1.8 hours
381 382
 
382 383
         """
384
+        self.show_step(1)
383 385
         self.env.revert_snapshot("dvs_destructive_setup_2")
384 386
 
385 387
         cluster_id = self.fuel_web.get_last_created_cluster()
@@ -389,36 +391,27 @@ class TestDVSDestructive(TestBasic):
389 391
             SERVTEST_PASSWORD,
390 392
             SERVTEST_TENANT)
391 393
 
392
-        # Verify connection between instances.
393
-        # Send ping Check that ping get reply.
394
+        self.show_step(2)
394 395
         srv_list = os_conn.get_servers()
395
-        floating_ip = []
396
+        fips = []
396 397
         for srv in srv_list:
397
-            floating_ip.append(os_conn.get_nova_instance_ip(
398
+            fips.append(os_conn.get_nova_instance_ip(
398 399
                 srv, net_name=self.inter_net_name, addrtype='floating'))
399
-        ip_pair = dict.fromkeys(floating_ip)
400
-        for key in ip_pair:
401
-            ip_pair[key] = [value for value in floating_ip if key != value]
402
-        openstack.check_connection_vms(ip_pair)
403 400
 
404
-        controller = self.fuel_web.get_nailgun_primary_node(
405
-            self.env.d_env.nodes().slaves[0]
406
-        )
401
+        openstack.ping_each_other(fips)
407 402
 
408
-        self.fuel_web.cold_restart_nodes(
409
-            [self.fuel_web.environment.d_env.get_node(name=controller.name)],
410
-            wait_offline=True, wait_online=True,
411
-            wait_after_destroy=300)
403
+        d_ctrl = self.fuel_web.get_nailgun_primary_node(
404
+            self.env.d_env.nodes().slaves[0])
405
+        n_ctrl = self.fuel_web.get_nailgun_node_by_devops_node(d_ctrl)
412 406
 
413
-        controller = self.fuel_web.get_nailgun_primary_node(
414
-            self.env.d_env.nodes().slaves[1]
415
-        )
407
+        self.show_step(3)
408
+        self.fuel_web.cold_restart_nodes([d_ctrl], wait_after_destroy=300)
409
+
410
+        self.show_step(4)
411
+        openstack.check_service(ip=n_ctrl['ip'], commands=self.cmds)
416 412
 
417
-        # Verify connection between instances.
418
-        # Send ping Check that ping get reply.
419
-        with self.fuel_web.get_ssh_for_node(controller.name) as ssh_control:
420
-            openstack.check_service(ssh=ssh_control, commands=self.cmds)
421
-        openstack.check_connection_vms(ip_pair)
413
+        self.show_step(5)
414
+        openstack.ping_each_other(fips)
422 415
 
423 416
     @test(depends_on=[dvs_destructive_setup_2],
424 417
           groups=["dvs_vcenter_shutdown_controller"])
@@ -438,6 +431,7 @@ class TestDVSDestructive(TestBasic):
438 431
         Duration: 1.8 hours
439 432
 
440 433
         """
434
+        self.show_step(1)
441 435
         self.env.revert_snapshot("dvs_destructive_setup_2")
442 436
 
443 437
         cluster_id = self.fuel_web.get_last_created_cluster()
@@ -447,37 +441,29 @@ class TestDVSDestructive(TestBasic):
447 441
             SERVTEST_PASSWORD,
448 442
             SERVTEST_TENANT)
449 443
 
450
-        # Verify connection between instances.
451
-        # Send ping, check that ping get reply.
444
+        self.show_step(2)
452 445
         srv_list = os_conn.get_servers()
453
-        floating_ip = []
446
+        fips = []
454 447
         for srv in srv_list:
455
-            floating_ip.append(os_conn.get_nova_instance_ip(
448
+            fips.append(os_conn.get_nova_instance_ip(
456 449
                 srv, net_name=self.inter_net_name, addrtype='floating'))
457
-        ip_pair = dict.fromkeys(floating_ip)
458
-        for key in ip_pair:
459
-            ip_pair[key] = [value for value in floating_ip if key != value]
460
-        openstack.check_connection_vms(ip_pair)
450
+        openstack.ping_each_other(fips)
461 451
 
462
-        controllers = self.fuel_web.get_devops_nodes_by_nailgun_nodes(
463
-            self.fuel_web.get_nailgun_cluster_nodes_by_roles(
464
-                cluster_id=cluster_id,
465
-                roles=['controller']))
452
+        n_ctrls = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
453
+            cluster_id=cluster_id, roles=['controller'])
466 454
 
467
-        with self.fuel_web.get_ssh_for_node(controllers[0].name) as ssh_contr:
468
-            openstack.check_service(ssh=ssh_contr, commands=self.cmds)
469
-
470
-        openstack.check_connection_vms(ip_pair)
455
+        openstack.check_service(ip=n_ctrls[0]['ip'], commands=self.cmds)
456
+        openstack.ping_each_other(fips)
471 457
 
458
+        self.show_step(3)
472 459
         self.fuel_web.warm_shutdown_nodes(
473
-            [self.fuel_web.environment.d_env.get_node(
474
-                name=controllers[0].name)])
460
+            [self.fuel_web.get_devops_node_by_nailgun_node(n_ctrls[0])])
475 461
 
476
-        # Verify connection between instances.
477
-        # Send ping Check that ping get reply.
478
-        with self.fuel_web.get_ssh_for_node(controllers[1].name) as ssh_contr:
479
-            openstack.check_service(ssh=ssh_contr, commands=self.cmds)
480
-        openstack.check_connection_vms(ip_pair, timeout=90)
462
+        self.show_step(4)
463
+        openstack.check_service(ip=n_ctrls[1]['ip'], commands=self.cmds)
464
+
465
+        self.show_step(5)
466
+        openstack.ping_each_other(fips, timeout=90)
481 467
 
482 468
     @test(depends_on=[SetupEnvironment.prepare_slaves_5],
483 469
           groups=["dvs_reboot_vcenter_1"])
@@ -551,10 +537,7 @@ class TestDVSDestructive(TestBasic):
551 537
         plugin.enable_plugin(cluster_id, self.fuel_web)
552 538
 
553 539
         self.show_step(7)
554
-        self.fuel_web.vcenter_configure(
555
-            cluster_id,
556
-            multiclusters=True
557
-        )
540
+        self.fuel_web.vcenter_configure(cluster_id, multiclusters=True)
558 541
 
559 542
         self.show_step(8)
560 543
         self.fuel_web.verify_network(cluster_id)
@@ -563,15 +546,13 @@ class TestDVSDestructive(TestBasic):
563 546
         self.fuel_web.deploy_cluster_wait(cluster_id)
564 547
 
565 548
         self.show_step(10)
566
-        self.fuel_web.run_ostf(
567
-            cluster_id=cluster_id, test_sets=['smoke'])
549
+        self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
568 550
 
569 551
         os_ip = self.fuel_web.get_public_vip(cluster_id)
570 552
         self.extended_tests_reset_vcenter(os_ip)
571 553
 
572 554
         self.show_step(18)
573
-        self.fuel_web.run_ostf(
574
-            cluster_id=cluster_id, test_sets=['smoke'])
555
+        self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
575 556
 
576 557
     @test(depends_on=[SetupEnvironment.prepare_slaves_5],
577 558
           groups=["dvs_reboot_vcenter_2"])
@@ -599,7 +580,7 @@ class TestDVSDestructive(TestBasic):
599 580
                configure Nova Compute instances on compute-vmware.
600 581
             8. Verify networks.
601 582
             9. Deploy cluster.
602
-            10. Run OSTF.
583
+            10. Run Smoke OSTF.
603 584
             11. Launch instance VM_1 with image TestVM, availability zone nova
604 585
                 and flavor m1.micro.
605 586
             12. Launch instance VM_2 with image TestVM-VMDK, availability zone
@@ -610,7 +591,7 @@ class TestDVSDestructive(TestBasic):
610 591
             15. Check that controller lost connection with vCenter.
611 592
             16. Wait for vCenter.
612 593
             17. Ensure that all instances from vCenter displayed in dashboard.
613
-            18. Run OSTF.
594
+            18. Run Smoke OSTF.
614 595
 
615 596
 
616 597
         Duration: 2.5 hours
@@ -661,12 +642,10 @@ class TestDVSDestructive(TestBasic):
661 642
         self.fuel_web.deploy_cluster_wait(cluster_id)
662 643
 
663 644
         self.show_step(10)
664
-        self.fuel_web.run_ostf(
665
-            cluster_id=cluster_id, test_sets=['smoke'])
645
+        self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
666 646
 
667 647
         os_ip = self.fuel_web.get_public_vip(cluster_id)
668 648
         self.extended_tests_reset_vcenter(os_ip)
669 649
 
670 650
         self.show_step(18)
671
-        self.fuel_web.run_ostf(
672
-            cluster_id=cluster_id, test_sets=['smoke'])
651
+        self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])

Loading…
Cancel
Save