How to use _create_protocol_ruleset method in tempest

Best Python code snippet using tempest_python

test_security_groups_basic_ops.py

Source:test_security_groups_basic_ops.py Github

copy

Full Screen

...405 self._log_console_output(servers=tenant.servers, client=client)406 if tenant.access_point is not None:407 self._log_console_output(408 servers=[tenant.access_point], client=client)409 def _create_protocol_ruleset(self, protocol, port=80):410 if protocol == 'icmp':411 ruleset = dict(protocol='icmp',412 direction='ingress')413 else:414 ruleset = dict(protocol=protocol,415 port_range_min=port,416 port_range_max=port,417 direction='ingress')418 return ruleset419 @decorators.idempotent_id('e79f879e-debb-440c-a7e4-efeda05b6848')420 @utils.services('compute', 'network')421 def test_cross_tenant_traffic(self):422 if not self.credentials_provider.is_multi_tenant():423 raise self.skipException("No secondary tenant defined")424 try:425 # deploy new project426 self._deploy_tenant(self.alt_tenant)427 self._verify_network_details(self.alt_tenant)428 self._verify_mac_addr(self.alt_tenant)429 # cross tenant check430 source_tenant = self.primary_tenant431 dest_tenant = self.alt_tenant432 protocol = CONF.scenario.protocol433 LOG.debug("Testing cross tenant traffic for %s protocol",434 protocol)435 if protocol in ['udp', 'tcp']:436 for tenant in [source_tenant, dest_tenant]:437 access_point = self._connect_to_access_point(tenant)438 access_point.nc_listen_host(protocol=protocol)439 ruleset = self._create_protocol_ruleset(protocol)440 self._test_cross_tenant_block(source_tenant, dest_tenant, ruleset)441 self._test_cross_tenant_allow(source_tenant, dest_tenant, ruleset)442 except Exception:443 self._log_console_output_for_all_tenants()444 raise445 @decorators.idempotent_id('63163892-bbf6-4249-aa12-d5ea1f8f421b')446 @utils.services('compute', 'network')447 def test_in_tenant_traffic(self):448 try:449 self._create_tenant_servers(self.primary_tenant, num=1)450 # in-tenant check451 self._test_in_tenant_block(self.primary_tenant)452 self._test_in_tenant_allow(self.primary_tenant)453 except Exception:...

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