How to use create_loginable_secgroup_rule method in tempest

Best Python code snippet using tempest_python

base.py

Source:base.py Github

copy

Full Screen

...68 direction=direction,69 security_group_id=secgroup_id,70 **rule)71 @classmethod72 def create_loginable_secgroup_rule(cls, secgroup_id=None):73 """This rule is intended to permit inbound ssh74 Allowing ssh traffic traffic from all sources, so no group_id is75 provided.76 Setting a group_id would only permit traffic from ports77 belonging to the same security group.78 """79 rule_list = [{'protocol': 'tcp',80 'direction': 'ingress',81 'port_range_min': 22,82 'port_range_max': 22,83 'remote_ip_prefix': '0.0.0.0/0'}]84 cls.create_secgroup_rules(rule_list, secgroup_id=secgroup_id)85 @classmethod86 def create_router_and_interface(cls, subnet_id):87 router = cls.create_router(88 data_utils.rand_name('router'), admin_state_up=True,89 external_network_id=CONF.network.public_network_id)90 cls.create_router_interface(router['id'], subnet_id)91 cls.routers.append(router)92 return router93 @classmethod94 def create_and_associate_floatingip(cls, port_id):95 fip = cls.manager.network_client.create_floatingip(96 CONF.network.public_network_id,97 port_id=port_id)['floatingip']98 cls.floating_ips.append(fip)99 return fip100 @classmethod101 def check_connectivity(cls, host, ssh_user, ssh_key=None):102 ssh_client = ssh.Client(host, ssh_user, pkey=ssh_key)103 ssh_client.test_connection_auth()104 @classmethod105 def setup_network_and_server(cls):106 cls.network = cls.create_network()107 cls.subnet = cls.create_subnet(cls.network)108 cls.create_router_and_interface(cls.subnet['id'])109 cls.keypair = cls.create_keypair()110 cls.create_loginable_secgroup_rule()111 cls.server = cls.create_server(112 flavor_ref=CONF.compute.flavor_ref,113 image_ref=CONF.compute.image_ref,114 key_name=cls.keypair['name'],115 networks=[{'uuid': cls.network['id']}])116 waiters.wait_for_server_status(cls.manager.servers_client,117 cls.server['server']['id'],118 constants.SERVER_STATUS_ACTIVE)119 port = cls.client.list_ports(network_id=cls.network['id'],120 device_id=cls.server[121 'server']['id'])['ports'][0]...

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