How to use show_trunk method in tempest

Best Python code snippet using tempest_python

test_trunk.py

Source:test_trunk.py Github

copy

Full Screen

...55class TrunkTestJSON(TrunkTestJSONBase):56 @test.idempotent_id('e1a6355c-4768-41f3-9bf8-0f1d192bd501')57 def test_create_trunk_empty_subports_list(self):58 trunk = self._create_trunk_with_network_and_parent([])59 observed_trunk = self.client.show_trunk(trunk['trunk']['id'])60 self.assertEqual(trunk, observed_trunk)61 @test.idempotent_id('382dfa39-ca03-4bd3-9a1c-91e36d2e3796')62 def test_create_trunk_subports_not_specified(self):63 trunk = self._create_trunk_with_network_and_parent(None)64 observed_trunk = self.client.show_trunk(trunk['trunk']['id'])65 self.assertEqual(trunk, observed_trunk)66 @test.idempotent_id('7de46c22-e2b6-4959-ac5a-0e624632ab32')67 def test_create_show_delete_trunk(self):68 trunk = self._create_trunk_with_network_and_parent(None)69 trunk_id = trunk['trunk']['id']70 parent_port_id = trunk['trunk']['port_id']71 res = self.client.show_trunk(trunk_id)72 self.assertEqual(trunk_id, res['trunk']['id'])73 self.assertEqual(parent_port_id, res['trunk']['port_id'])74 self.client.delete_trunk(trunk_id)75 self.assertRaises(lib_exc.NotFound, self.client.show_trunk, trunk_id)76 @test.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32')77 def test_create_update_trunk(self):78 trunk = self._create_trunk_with_network_and_parent(None)79 trunk_id = trunk['trunk']['id']80 res = self.client.show_trunk(trunk_id)81 self.assertTrue(res['trunk']['admin_state_up'])82 self.assertEqual("", res['trunk']['name'])83 res = self.client.update_trunk(84 trunk_id, name='foo', admin_state_up=False)85 self.assertFalse(res['trunk']['admin_state_up'])86 self.assertEqual("foo", res['trunk']['name'])87 # enable the trunk so that it can be managed88 self.client.update_trunk(trunk_id, admin_state_up=True)89 @test.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85')90 def test_list_trunks(self):91 trunk1 = self._create_trunk_with_network_and_parent(None)92 trunk2 = self._create_trunk_with_network_and_parent(None)93 expected_trunks = {trunk1['trunk']['id']: trunk1['trunk'],94 trunk2['trunk']['id']: trunk2['trunk']}95 trunk_list = self.client.list_trunks()['trunks']96 matched_trunks = [x for x in trunk_list if x['id'] in expected_trunks]97 self.assertEqual(2, len(matched_trunks))98 for trunk in matched_trunks:99 self.assertEqual(expected_trunks[trunk['id']], trunk)100 @test.idempotent_id('bb5fcead-09b5-484a-bbe6-46d1e06d6cc0')101 def test_add_subport(self):102 trunk = self._create_trunk_with_network_and_parent([])103 network = self.create_network()104 port = self.create_port(network)105 subports = [{'port_id': port['id'],106 'segmentation_type': 'vlan',107 'segmentation_id': 2}]108 self.client.add_subports(trunk['trunk']['id'], subports)109 trunk = self.client.show_trunk(trunk['trunk']['id'])110 observed_subports = trunk['trunk']['sub_ports']111 self.assertEqual(1, len(observed_subports))112 created_subport = observed_subports[0]113 self.assertEqual(subports[0], created_subport)114 @test.idempotent_id('ee5fcead-1abf-483a-bce6-43d1e06d6aa0')115 def test_delete_trunk_with_subport_is_allowed(self):116 network = self.create_network()117 port = self.create_port(network)118 subports = [{'port_id': port['id'],119 'segmentation_type': 'vlan',120 'segmentation_id': 2}]121 trunk = self._create_trunk_with_network_and_parent(subports)122 self.client.delete_trunk(trunk['trunk']['id'])123 @test.idempotent_id('96eea398-a03c-4c3e-a99e-864392c2ca53')124 def test_remove_subport(self):125 subport_parent1 = self.create_port(self.create_network())126 subport_parent2 = self.create_port(self.create_network())127 subports = [{'port_id': subport_parent1['id'],128 'segmentation_type': 'vlan',129 'segmentation_id': 2},130 {'port_id': subport_parent2['id'],131 'segmentation_type': 'vlan',132 'segmentation_id': 4}]133 trunk = self._create_trunk_with_network_and_parent(subports)134 removed_subport = trunk['trunk']['sub_ports'][0]135 expected_subport = None136 for subport in subports:137 if subport['port_id'] != removed_subport['port_id']:138 expected_subport = subport139 break140 # Remove the subport and validate PUT response141 res = self.client.remove_subports(trunk['trunk']['id'],142 [removed_subport])143 self.assertEqual(1, len(res['sub_ports']))144 self.assertEqual(expected_subport, res['sub_ports'][0])145 # Validate the results of a subport list146 trunk = self.client.show_trunk(trunk['trunk']['id'])147 observed_subports = trunk['trunk']['sub_ports']148 self.assertEqual(1, len(observed_subports))149 self.assertEqual(expected_subport, observed_subports[0])150 @test.idempotent_id('bb5fcaad-09b5-484a-dde6-4cd1ea6d6ff0')151 def test_get_subports(self):152 network = self.create_network()153 port = self.create_port(network)154 subports = [{'port_id': port['id'],155 'segmentation_type': 'vlan',156 'segmentation_id': 2}]157 trunk = self._create_trunk_with_network_and_parent(subports)158 trunk = self.client.get_subports(trunk['trunk']['id'])159 observed_subports = trunk['sub_ports']160 self.assertEqual(1, len(observed_subports))...

Full Screen

Full Screen

x_mas_tree_of_starbucks.py

Source:x_mas_tree_of_starbucks.py Github

copy

Full Screen

...28 calc_result = str(n+1) + '...n_stars= ' + str(n_stars)29 else:30 calc_result = ''31 print(("#" * n_stars).center(GROUND_WIDTH), calc_result)32def show_trunk(height=2):33 """ height = stack height, default = 2 """34 for k in range(height):35 print("▒".center(GROUND_WIDTH))36def show_ground(gound_width):37 print('M'*gound_width)38 print('Ground Width =', gound_width)39def xmas_tree_small(stack, calc=1):40 """ DOC String : MAKING X-MAS TREE41 (1) .center() string function -42 (2) use For loop43 (3) stack can be varied.44 """45 """" #1. making STAR on the Tree TOP ..... """46 show_stars()47 """ #2. making tree LEAVES BODY ..... """48 show_stacked_body(0, stack, calc)49 """ #3. making a tree TRUNK .... """50 show_trunk(4)51 """ #4. GROUND width $ .... """52 show_ground(GROUND_WIDTH)53if __name__ == '__main__':54 show_stars()55 show_stacked_body(0, 7, 0)56 show_stacked_body(3, 11, 0)57 show_stacked_body(7, 15, 0)58 show_stacked_body(11, 19, 0)59 show_trunk(6)...

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