Browse Source

Fix some tests failures on baremetal contrail lab

Change-Id: Ifb03b2828fe2ee3d725477684cb69060e541d4be
changes/17/456917/1
Georgy Dyuldin 2 years ago
parent
commit
d2e3ea9407

+ 13
- 0
plugin_test/vapor/vapor/fixtures/skip.py View File

@@ -14,6 +14,7 @@ import pytest
14 14
 import six
15 15
 from stepler.fixtures import skip
16 16
 
17
+from vapor.helpers import dpdk
17 18
 from vapor.helpers import sriov
18 19
 from vapor import settings
19 20
 
@@ -43,6 +44,18 @@ class Predicates(skip.Predicates):
43 44
                                                         computes)
44 45
         return len(sriov_device_mappings) > 0
45 46
 
47
+    @property
48
+    @_store_call
49
+    def dpdk_enabled(self):
50
+        """Define whether dpdk enabled at least on one node."""
51
+        os_faults_steps = self._get_fixture('os_faults_steps')
52
+        computes = self._get_fixture('computes')
53
+        dpdk_devices = dpdk.get_devices(os_faults_steps, computes)
54
+        for devices_groups in dpdk_devices.values():
55
+            if len(devices_groups[settings.DPDK_ENABLED_GROUP]) > 0:
56
+                return True
57
+        return False
58
+
46 59
     @property
47 60
     @_store_call
48 61
     def contrail_control_nodes_count(self):

+ 1
- 1
plugin_test/vapor/vapor/helpers/dpdk.py View File

@@ -21,7 +21,7 @@ from vapor import settings
21 21
 
22 22
 def get_devices(os_faults_steps, nodes):
23 23
     result = os_faults_steps.execute_cmd(
24
-        nodes, '{} --status'.format(settings.DPDK_NEC_BIND_PATH), check=False)
24
+        nodes, '{} --status'.format(settings.DPDK_NEC_BIND_CMD), check=False)
25 25
     node_statuses = {}
26 26
     for node_result in result:
27 27
         node = nodes_steps.get_node_by_result(node_result, os_faults_steps)

+ 4
- 2
plugin_test/vapor/vapor/settings.py View File

@@ -192,10 +192,10 @@ SERVER_ATTR_HYPERVISOR_HOSTNAME = 'OS-EXT-SRV-ATTR:hypervisor_hostname'
192 192
 
193 193
 NEUTRON_SRIOV_NIC_AGENT = "neutron-sriov-nic-agent"
194 194
 
195
-DPDK_NEC_BIND_PATH = '/opt/contrail/bin/dpdk_nic_bind.py'
195
+DPDK_NEC_BIND_CMD = 'curl https://raw.githubusercontent.com/Juniper/contrail-dpdk/master/tools/dpdk_nic_bind.py 2>/dev/null | python -'  # noqa
196 196
 
197 197
 # SR-IOV
198
-SRIOV_PHYSNET = 'physnet1'
198
+SRIOV_PHYSNET = os.environ.get('SRIOV_PHYSNET', 'physnet1')
199 199
 
200 200
 # Security groups
201 201
 INGRESS = 'ingress'
@@ -217,3 +217,5 @@ SECURITY_GROUP_PING_RULES = [
217 217
 
218 218
 SECURITY_GROUP_SSH_PING_RULES = (stepler_config.SECURITY_GROUP_SSH_RULES +
219 219
                                  SECURITY_GROUP_PING_RULES)
220
+
221
+DPDK_ENABLED_GROUP = u'Network devices using DPDK-compatible driver'

+ 23
- 15
plugin_test/vapor/vapor/tests/common/test_base.py View File

@@ -56,9 +56,8 @@ def test_create_vm_bulk(net_subnet_router, tiny_flavor,
56 56
 
57 57
 
58 58
 def test_delete_vm_with_associated_vn(contrail_network, contrail_subnet,
59
-                                      tiny_flavor, cirros_image,
60
-                                      server_steps, network_steps,
61
-                                      contrail_api_client):
59
+                                      flavor, cirros_image, server_steps,
60
+                                      network_steps, contrail_api_client):
62 61
     """Description: Test to validate that VN cannot be deleted if
63 62
         there is a VM associated with it.
64 63
     Test steps:
@@ -69,13 +68,20 @@ def test_delete_vm_with_associated_vn(contrail_network, contrail_subnet,
69 68
         The attempt to delete VN should fail.
70 69
     """
71 70
     server_steps.create_servers(
72
-        image=cirros_image, flavor=tiny_flavor,
73
-        nics=[{'net-id': contrail_network.uuid}])
71
+        image=cirros_image,
72
+        flavor=flavor,
73
+        nics=[{
74
+            'net-id': contrail_network.uuid
75
+        }])
76
+
74 77
     net = network_steps.get_network(id=contrail_network.uuid)
75 78
 
79
+    neutron_client = network_steps._client._rest_client
76 80
     # Check that we can't delete this net.
77
-    assert_that(calling(network_steps.delete).with_args(net),
78
-                raises(neutron_exceptions.NetworkInUseClient))
81
+    assert_that(
82
+        calling(neutron_client.delete_network).with_args(
83
+            contrail_network.uuid),
84
+        raises(neutron_exceptions.NetworkInUseClient))
79 85
 
80 86
     # Check that network is still there
81 87
     # via contrail API
@@ -84,8 +90,8 @@ def test_delete_vm_with_associated_vn(contrail_network, contrail_subnet,
84 90
                 has_item(has_entry('uuid', contrail_network.uuid)))
85 91
 
86 92
     # via neutron API
87
-    assert_that(network_steps.get_network_by_name(net['name']),
88
-                is_not(empty()))
93
+    assert_that(
94
+        network_steps.get_network_by_name(net['name']), is_not(empty()))
89 95
 
90 96
 
91 97
 def test_two_nets_same_name(contrail_api_client, contrail_network,
@@ -234,9 +240,10 @@ def test_create_server_on_exhausted_subnet(cirros_image, flavor, network,
234 240
                                '(Exceeded maximum number of retries)'))
235 241
 
236 242
 
237
-def test_file_transfer_with_scp(
238
-        ubuntu_image, keypair, flavor, create_floating_ip, public_network,
239
-        network, subnet, security_group, server_steps, port_steps):
243
+def test_file_transfer_with_scp(ubuntu_xenial_image, keypair, flavor,
244
+                                create_floating_ip, public_network, network,
245
+                                subnet, security_group, port_steps,
246
+                                server_steps):
240 247
     """Validate File Transfer using scp between VMs.
241 248
 
242 249
     Steps:
@@ -262,7 +269,9 @@ def test_file_transfer_with_scp(
262 269
         "chmod 600 {path}",
263 270
         "echo {done_marker}",
264 271
     ]).format(
265
-        content=key_content, path=key_path, user=username,
272
+        content=key_content,
273
+        path=key_path,
274
+        user=username,
266 275
         done_marker=stepler_config.USERDATA_DONE_MARKER)
267 276
 
268 277
     ssh_opts = ('-o UserKnownHostsFile=/dev/null '
@@ -271,7 +280,7 @@ def test_file_transfer_with_scp(
271 280
     # Boot servers
272 281
     servers = server_steps.create_servers(
273 282
         count=2,
274
-        image=ubuntu_image,
283
+        image=ubuntu_xenial_image,
275 284
         flavor=flavor,
276 285
         networks=[network],
277 286
         security_groups=[security_group],
@@ -435,7 +444,6 @@ def test_vm_multi_intf_in_same_vn_chk_ping(
435 444
                 ip, server_ssh, timeout=stepler_config.PING_CALL_TIMEOUT)
436 445
 
437 446
 
438
-@pytest.mark.parametrize('flavor', [dict(ram=128, disk=1)], indirect=True)
439 447
 def test_create_multiple_servers_on_many_networks(
440 448
         cirros_image, flavor, create_network, create_subnet, server_steps):
441 449
     """Validate creation of multiple VN with multiple subnet and VMs in it.

+ 1
- 0
plugin_test/vapor/vapor/tests/common/test_security_group.py View File

@@ -304,6 +304,7 @@ def test_security_group_rules_uuid_in_contrail_and_neutron(contrail_api_client,
304 304
     assert_that(contrail_rules_uuids, equal_to(neutron_rules_uuids))
305 305
 
306 306
 
307
+@pytest.mark.requires('not dpdk_enabled')
307 308
 @pytest.mark.parametrize(
308 309
     'contrail_2_servers_different_networks', [dict(ubuntu=True)],
309 310
     indirect=True,

+ 3
- 2
plugin_test/vapor/vapor/tests/common/test_sg_policy.py View File

@@ -223,8 +223,9 @@ def test_security_group_and_allow_all_policy(
223 223
     ids=['tcp_all', 'tcp_port'])
224 224
 def test_allow_all_security_group_and_policies(
225 225
         contrail_network_policy, security_group,
226
-        neutron_security_group_rule_steps, connectivity_test_resources,
227
-        server_steps, contrail_api_client, policy_entries, checks):
226
+        neutron_security_group_rule_steps, server_steps,
227
+        connectivity_test_resources, contrail_api_client, policy_entries,
228
+        checks):
228 229
     """Verify traffic restrictions by policy with security group.
229 230
 
230 231
     Steps:

+ 2
- 3
plugin_test/vapor/vapor/tests/test_dpdk.py View File

@@ -38,8 +38,7 @@ def test_bound_network_interfaces(os_faults_steps, computes):
38 38
     devices = dpdk.get_devices(os_faults_steps, computes)
39 39
     assert_that(devices.values(),
40 40
                 only_contains(
41
-                    has_entries('Network devices using DPDK-compatible driver',
42
-                                is_not(empty()))))
41
+                    has_entries(settings.DPDK_ENABLED_GROUP, is_not(empty()))))
43 42
 
44 43
 
45 44
 def test_huge_pages_usage(os_faults_steps, computes):
@@ -71,7 +70,7 @@ def test_contrail_vrouter_dpdk_cpu_usage(os_faults_steps, computes):
71 70
 
72 71
 
73 72
 @pytest.mark.parametrize(
74
-    'flavor', [dict(metadata={"hw:mem_page_size": "small"})], indirect=True)
73
+    'flavor', [dict(ram=1024, metadata={"hw:mem_page_size": "large"})], indirect=True)
75 74
 @pytest.mark.usefixtures('flavor')
76 75
 def test_vrouter_create_interface(request, os_faults_steps, computes):
77 76
     """Verify if vRouter creates interface after creation of a virtual machine.

+ 1
- 0
plugin_test/vapor/vapor/tests/test_system.py View File

@@ -29,6 +29,7 @@ from vapor.helpers import policy
29 29
 from vapor import settings
30 30
 
31 31
 
32
+@pytest.mark.requires('not dpdk_enabled')
32 33
 def test_no_connectivity_between_vms_in_different_tenants(
33 34
         request, contrail_api_client, os_faults_steps):
34 35
     """Check no connectivity between VMs in different tenants.

Loading…
Cancel
Save