How to use show_security_group method in tempest

Best Python code snippet using tempest_python

awsman.py

Source:awsman.py Github

copy

Full Screen

...52 session = boto3.Session(profile_name=profile, region_name=region)53 ec2_con = session.client('ec2')54 response = ec2_con.describe_security_groups(GroupIds=[sg_id])55 for sg in response['SecurityGroups']:56 show_security_group(sg)57 58 59def do_sg_list(profile, region):60 session = boto3.Session(profile_name=profile, region_name=region)61 ec2_con = session.client('ec2')62 response = ec2_con.describe_security_groups()63 print(response)64 for sg in response['SecurityGroups']:65 show_security_group(sg)66 show_rules_in_response(sg['IpPermissionsEgress'])67def show_security_group(sg):68 if 'Tags' in sg:69 name = get_name_from_tags(sg['Tags'])70 else:71 name = "NO NAME"72 print(name + ": " + sg['GroupId'])73 print(" " + sg['Description'])74 print(" Ingress:")75 show_rules_in_response(sg['IpPermissions'])76 print(" Egress:")77def do_ec2_list(profile, region):78 session = boto3.Session(profile_name=profile, region_name=region)79 ec2_con = session.client('ec2')80 response = ec2_con.describe_instances()81 for reservation in response['Reservations']:...

Full Screen

Full Screen

test_securitygroups_requests.py

Source:test_securitygroups_requests.py Github

copy

Full Screen

...24 ok_(res is True, "Sec. group was not deleted.")25 def test_show_group(self):26 created = self.ghelper.create_security_group()27 gid = created['id']28 shown = self.ghelper.show_security_group(gid)29 ok_(created == shown, "'Show sec. group' failed. Expected: %s, Actual: %s." % (created, shown))30 def test_add_delete_rule(self):31 # create sec. group32 group = self.ghelper.create_security_group()33 gid = group['id']34 # add rule35 rule = self.ghelper.add_rule(gid)36 rid = str(rule['id'])37 # show group created before38 group = self.ghelper.show_security_group(gid)39 # check if it contains just created rule40 ok_(rid in (r['id'] for r in group['rules']), "'Add rule to sec. group' failed.")41 # delete rule42 res = self.ghelper.delete_rule(rid)43 # show group created before44 group = self.ghelper.show_security_group(gid)45 ok_(rid not in (r['id'] for r in group['rules']), "'Delete rule from sec. group' failed.")46# just for local debugging47if __name__ == "__main__":48 t = TestSecurityGroupsRequests()49 t.setup_class()50 # t.test_list_of_groups()51 # t.test_create_group()52 # t.test_delete_group()53 t.test_show_group()54 t.test_add_delete_rule()55 t.teardown()...

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