How to use is_network_feature_enabled method in tempest

Best Python code snippet using tempest_python

test_network_qos_placement.py

Source:test_network_qos_placement.py Github

copy

Full Screen

...324 values.325 * The allocation on placement side should be according to the new326 rules.327 """328 if not utils.is_network_feature_enabled('update_port_qos'):329 raise self.skipException("update_port_qos feature is not enabled")330 self._create_network_and_qos_policies(331 self._create_qos_policies_from_life)332 port = self.create_port(333 self.prov_network['id'], qos_policy_id=self.qos_policy_1['id'])334 server1 = self.create_server(335 networks=[{'port': port['id']}])336 self._assert_allocation_is_as_expected(server1['id'], [port['id']],337 self.BANDWIDTH_1)338 self.ports_client.update_port(339 port['id'],340 **{'qos_policy_id': self.qos_policy_2['id']})341 self._assert_allocation_is_as_expected(server1['id'], [port['id']],342 self.BANDWIDTH_2)343 # I changed my mind344 self.ports_client.update_port(345 port['id'],346 **{'qos_policy_id': self.qos_policy_1['id']})347 self._assert_allocation_is_as_expected(server1['id'], [port['id']],348 self.BANDWIDTH_1)349 # bad request....350 self.qos_policy_not_valid = self._create_policy_and_min_bw_rule(351 name_prefix='test_policy_not_valid',352 min_kbps=self.PLACEMENT_MAX_INT)353 port_orig = self.ports_client.show_port(port['id'])['port']354 self.assertRaises(355 lib_exc.Conflict,356 self.ports_client.update_port,357 port['id'], **{'qos_policy_id': self.qos_policy_not_valid['id']})358 self._assert_allocation_is_as_expected(server1['id'], [port['id']],359 self.BANDWIDTH_1)360 port_upd = self.ports_client.show_port(port['id'])['port']361 self.assertEqual(port_orig['qos_policy_id'],362 port_upd['qos_policy_id'])363 self.assertEqual(self.qos_policy_1['id'], port_upd['qos_policy_id'])364 @decorators.idempotent_id('9cfc3bb8-f433-4c91-87b6-747cadc8958a')365 @utils.services('compute', 'network')366 def test_qos_min_bw_allocation_update_policy_from_zero(self):367 """Test port without QoS policy to have QoS policy368 This scenario checks if updating a port without QoS policy to369 have QoS policy with minimum_bandwidth rule succeeds only on370 controlplane, but placement allocation remains 0.371 """372 if not utils.is_network_feature_enabled('update_port_qos'):373 raise self.skipException("update_port_qos feature is not enabled")374 self._create_network_and_qos_policies(375 self._create_qos_policies_from_life)376 port = self.create_port(self.prov_network['id'])377 server1 = self.create_server(378 networks=[{'port': port['id']}])379 self._assert_allocation_is_as_expected(server1['id'], [port['id']], 0)380 self.ports_client.update_port(381 port['id'], **{'qos_policy_id': self.qos_policy_2['id']})382 self._assert_allocation_is_as_expected(server1['id'], [port['id']], 0)383 @decorators.idempotent_id('a9725a70-1d28-4e3b-ae0e-450abc235962')384 @utils.services('compute', 'network')385 def test_qos_min_bw_allocation_update_policy_to_zero(self):386 """Test port with QoS policy to remove QoS policy387 In this scenario port with QoS minimum_bandwidth rule update to388 remove QoS policy results in 0 placement allocation.389 """390 if not utils.is_network_feature_enabled('update_port_qos'):391 raise self.skipException("update_port_qos feature is not enabled")392 self._create_network_and_qos_policies(393 self._create_qos_policies_from_life)394 port = self.create_port(395 self.prov_network['id'], qos_policy_id=self.qos_policy_1['id'])396 server1 = self.create_server(397 networks=[{'port': port['id']}])398 self._assert_allocation_is_as_expected(server1['id'], [port['id']],399 self.BANDWIDTH_1)400 self.ports_client.update_port(401 port['id'],402 **{'qos_policy_id': None})403 self._assert_allocation_is_as_expected(server1['id'], [port['id']], 0)404 @decorators.idempotent_id('756ced7f-6f1a-43e7-a851-2fcfc16f3dd7')405 @utils.services('compute', 'network')406 def test_qos_min_bw_allocation_update_with_multiple_ports(self):407 if not utils.is_network_feature_enabled('update_port_qos'):408 raise self.skipException("update_port_qos feature is not enabled")409 self._create_network_and_qos_policies(410 self._create_qos_policies_from_life)411 port1 = self.create_port(412 self.prov_network['id'], qos_policy_id=self.qos_policy_1['id'])413 port2 = self.create_port(414 self.prov_network['id'], qos_policy_id=self.qos_policy_2['id'])415 server1 = self.create_server(416 networks=[{'port': port1['id']}, {'port': port2['id']}])417 self._assert_allocation_is_as_expected(418 server1['id'], [port1['id'], port2['id']],419 self.BANDWIDTH_1 + self.BANDWIDTH_2)420 self.ports_client.update_port(421 port1['id'],422 **{'qos_policy_id': self.qos_policy_2['id']})423 self._assert_allocation_is_as_expected(424 server1['id'], [port1['id'], port2['id']],425 2 * self.BANDWIDTH_2)426 @decorators.idempotent_id('0805779e-e03c-44fb-900f-ce97a790653b')427 @utils.services('compute', 'network')428 def test_empty_update(self):429 if not utils.is_network_feature_enabled('update_port_qos'):430 raise self.skipException("update_port_qos feature is not enabled")431 self._create_network_and_qos_policies(432 self._create_qos_policies_from_life)433 port = self.create_port(434 self.prov_network['id'], qos_policy_id=self.qos_policy_1['id'])435 server1 = self.create_server(436 networks=[{'port': port['id']}])437 self._assert_allocation_is_as_expected(server1['id'], [port['id']],438 self.BANDWIDTH_1)439 self.ports_client.update_port(440 port['id'],441 **{'description': 'foo'})442 self._assert_allocation_is_as_expected(server1['id'], [port['id']],443 self.BANDWIDTH_1)444 @decorators.idempotent_id('372b2728-cfed-469a-b5f6-b75779e1ccbe')445 @utils.services('compute', 'network')446 def test_qos_min_bw_allocation_update_policy_direction_change(self):447 """Test QoS min bw direction change on a bound port448 Related RFE in neutron: #1882804449 The scenario is the following:450 * Have a port with QoS policy and minimum bandwidth rule with ingress451 direction452 * Boot a VM with the port.453 * Update the port with a new policy to egress direction in454 minimum bandwidth rule.455 * The allocation on placement side should be according to the new456 rules.457 """458 if not utils.is_network_feature_enabled('update_port_qos'):459 raise self.skipException("update_port_qos feature is not enabled")460 def create_policies():461 self.qos_policy_ingress = self._create_policy_and_min_bw_rule(462 name_prefix='test_policy_ingress',463 min_kbps=self.BANDWIDTH_1,464 direction=self.INGRESS_DIRECTION,465 )466 self.qos_policy_egress = self._create_policy_and_min_bw_rule(467 name_prefix='test_policy_egress',468 min_kbps=self.BANDWIDTH_1,469 direction=self.EGRESS_DIRECTION,470 )471 self._create_network_and_qos_policies(create_policies)472 port = self.create_port(...

Full Screen

Full Screen

test_metadata.py

Source:test_metadata.py Github

copy

Full Screen

...36 force_tenant_isolation = False37 @classmethod38 def skip_checks(cls):39 super(MetadataTest, cls).skip_checks()40 if not utils.is_network_feature_enabled('ipv6_metadata'):41 raise cls.skipException("Metadata over IPv6 is not enabled")42 @classmethod43 def resource_setup(cls):44 super(MetadataTest, cls).resource_setup()45 cls.rand_name = data_utils.rand_name(46 cls.__name__.rsplit('.', 1)[-1])47 cls.reserve_external_subnet_cidrs()48 cls.network = cls.create_network(name=cls.rand_name)49 cls.subnet_v4 = cls.create_subnet(50 network=cls.network, name=cls.rand_name)51 cls.subnet_v6 = cls.create_subnet(52 network=cls.network, name=cls.rand_name, ip_version=6)53 cls.router = cls.create_router_by_client()54 cls.create_router_interface(cls.router['id'], cls.subnet_v4['id'])...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...88 return True89 if extension_name in config_dict[service]:90 return True91 return False92def is_network_feature_enabled(feature_name):93 """A function that will check the list of available network features94 """95 list_of_features = CONF.network_feature_enabled.available_features96 if not list_of_features:97 return False98 if list_of_features[0] == 'all':99 return True100 if feature_name in list_of_features:101 return True...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful