How to use show_port method in tempest

Best Python code snippet using tempest_python

test_ports.py

Source:test_ports.py Github

copy

Full Screen

...26 def test_create_port(self):27 node_id = self.node['uuid']28 address = data_utils.rand_mac_address()29 _, port = self.create_port(node_id=node_id, address=address)30 _, body = self.client.show_port(port['uuid'])31 self._assertExpected(port, body)32 @decorators.idempotent_id('d1f6b249-4cf6-4fe6-9ed6-a6e84b1bf67b')33 def test_create_port_specifying_uuid(self):34 node_id = self.node['uuid']35 address = data_utils.rand_mac_address()36 uuid = data_utils.rand_uuid()37 _, port = self.create_port(node_id=node_id,38 address=address, uuid=uuid)39 _, body = self.client.show_port(uuid)40 self._assertExpected(port, body)41 @decorators.idempotent_id('4a02c4b0-6573-42a4-a513-2e36ad485b62')42 def test_create_port_with_extra(self):43 node_id = self.node['uuid']44 address = data_utils.rand_mac_address()45 extra = {'str': 'value', 'int': 123, 'float': 0.123,46 'bool': True, 'list': [1, 2, 3], 'dict': {'foo': 'bar'}}47 _, port = self.create_port(node_id=node_id, address=address,48 extra=extra)49 _, body = self.client.show_port(port['uuid'])50 self._assertExpected(port, body)51 @decorators.idempotent_id('1bf257a9-aea3-494e-89c0-63f657ab4fdd')52 def test_delete_port(self):53 node_id = self.node['uuid']54 address = data_utils.rand_mac_address()55 _, port = self.create_port(node_id=node_id, address=address)56 self.delete_port(port['uuid'])57 self.assertRaises(lib_exc.NotFound, self.client.show_port,58 port['uuid'])59 @decorators.idempotent_id('9fa77ab5-ce59-4f05-baac-148904ba1597')60 def test_show_port(self):61 _, port = self.client.show_port(self.port['uuid'])62 self._assertExpected(self.port, port)63 @decorators.idempotent_id('7c1114ff-fc3f-47bb-bc2f-68f61620ba8b')64 def test_show_port_by_address(self):65 _, port = self.client.show_port_by_address(self.port['address'])66 self._assertExpected(self.port, port['ports'][0])67 @decorators.idempotent_id('bd773405-aea5-465d-b576-0ab1780069e5')68 def test_show_port_with_links(self):69 _, port = self.client.show_port(self.port['uuid'])70 self.assertIn('links', port.keys())71 self.assertEqual(2, len(port['links']))72 self.assertIn(port['uuid'], port['links'][0]['href'])73 @decorators.idempotent_id('b5e91854-5cd7-4a8e-bb35-3e0a1314606d')74 def test_list_ports(self):75 _, body = self.client.list_ports()76 self.assertIn(self.port['uuid'],77 [i['uuid'] for i in body['ports']])78 # Verify self links.79 for port in body['ports']:80 self.validate_self_link('ports', port['uuid'],81 port['links'][0]['href'])82 @decorators.idempotent_id('324a910e-2f80-4258-9087-062b5ae06240')83 def test_list_with_limit(self):84 _, body = self.client.list_ports(limit=3)85 next_marker = body['ports'][-1]['uuid']86 self.assertIn(next_marker, body['next'])87 @decorators.idempotent_id('8a94b50f-9895-4a63-a574-7ecff86e5875')88 def test_list_ports_details(self):89 node_id = self.node['uuid']90 uuids = [91 self.create_port(node_id=node_id,92 address=data_utils.rand_mac_address())93 [1]['uuid'] for i in range(0, 5)]94 _, body = self.client.list_ports_detail()95 ports_dict = dict((port['uuid'], port) for port in body['ports']96 if port['uuid'] in uuids)97 for uuid in uuids:98 self.assertIn(uuid, ports_dict)99 port = ports_dict[uuid]100 self.assertIn('extra', port)101 self.assertIn('node_uuid', port)102 # never expose the node_id103 self.assertNotIn('node_id', port)104 # Verify self link.105 self.validate_self_link('ports', port['uuid'],106 port['links'][0]['href'])107 @decorators.idempotent_id('8a03f688-7d75-4ecd-8cbc-e06b8f346738')108 def test_list_ports_details_with_address(self):109 node_id = self.node['uuid']110 address = data_utils.rand_mac_address()111 self.create_port(node_id=node_id, address=address)112 for i in range(0, 5):113 self.create_port(node_id=node_id,114 address=data_utils.rand_mac_address())115 _, body = self.client.list_ports_detail(address=address)116 self.assertEqual(1, len(body['ports']))117 self.assertEqual(address, body['ports'][0]['address'])118 @decorators.idempotent_id('9c26298b-1bcb-47b7-9b9e-8bdd6e3c4aba')119 def test_update_port_replace(self):120 node_id = self.node['uuid']121 address = data_utils.rand_mac_address()122 extra = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}123 _, port = self.create_port(node_id=node_id, address=address,124 extra=extra)125 new_address = data_utils.rand_mac_address()126 new_extra = {'key1': 'new-value1', 'key2': 'new-value2',127 'key3': 'new-value3'}128 patch = [{'path': '/address',129 'op': 'replace',130 'value': new_address},131 {'path': '/extra/key1',132 'op': 'replace',133 'value': new_extra['key1']},134 {'path': '/extra/key2',135 'op': 'replace',136 'value': new_extra['key2']},137 {'path': '/extra/key3',138 'op': 'replace',139 'value': new_extra['key3']}]140 self.client.update_port(port['uuid'], patch)141 _, body = self.client.show_port(port['uuid'])142 self.assertEqual(new_address, body['address'])143 self.assertEqual(new_extra, body['extra'])144 @decorators.idempotent_id('d7e7fece-6ed9-460a-9ebe-9267217e8580')145 def test_update_port_remove(self):146 node_id = self.node['uuid']147 address = data_utils.rand_mac_address()148 extra = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}149 _, port = self.create_port(node_id=node_id, address=address,150 extra=extra)151 # Removing one item from the collection152 self.client.update_port(port['uuid'],153 [{'path': '/extra/key2',154 'op': 'remove'}])155 extra.pop('key2')156 _, body = self.client.show_port(port['uuid'])157 self.assertEqual(extra, body['extra'])158 # Removing the collection159 self.client.update_port(port['uuid'], [{'path': '/extra',160 'op': 'remove'}])161 _, body = self.client.show_port(port['uuid'])162 self.assertEqual({}, body['extra'])163 # Assert nothing else was changed164 self.assertEqual(node_id, body['node_uuid'])165 self.assertEqual(address, body['address'])166 @decorators.idempotent_id('241288b3-e98a-400f-a4d7-d1f716146361')167 def test_update_port_add(self):168 node_id = self.node['uuid']169 address = data_utils.rand_mac_address()170 _, port = self.create_port(node_id=node_id, address=address)171 extra = {'key1': 'value1', 'key2': 'value2'}172 patch = [{'path': '/extra/key1',173 'op': 'add',174 'value': extra['key1']},175 {'path': '/extra/key2',176 'op': 'add',177 'value': extra['key2']}]178 self.client.update_port(port['uuid'], patch)179 _, body = self.client.show_port(port['uuid'])180 self.assertEqual(extra, body['extra'])181 @decorators.idempotent_id('5309e897-0799-4649-a982-0179b04c3876')182 def test_update_port_mixed_ops(self):183 node_id = self.node['uuid']184 address = data_utils.rand_mac_address()185 extra = {'key1': 'value1', 'key2': 'value2'}186 _, port = self.create_port(node_id=node_id, address=address,187 extra=extra)188 new_address = data_utils.rand_mac_address()189 new_extra = {'key1': 0.123, 'key3': {'cat': 'meow'}}190 patch = [{'path': '/address',191 'op': 'replace',192 'value': new_address},193 {'path': '/extra/key1',194 'op': 'replace',195 'value': new_extra['key1']},196 {'path': '/extra/key2',197 'op': 'remove'},198 {'path': '/extra/key3',199 'op': 'add',200 'value': new_extra['key3']}]201 self.client.update_port(port['uuid'], patch)202 _, body = self.client.show_port(port['uuid'])203 self.assertEqual(new_address, body['address'])204 self.assertEqual(new_extra, body['extra'])205class TestPortsWithPhysicalNetwork(base.BaseBaremetalTest):206 """Tests for ports with physical network information."""207 min_microversion = '1.34'208 def setUp(self):209 super(TestPortsWithPhysicalNetwork, self).setUp()210 self.useFixture(211 api_microversion_fixture.APIMicroversionFixture(212 TestPortsWithPhysicalNetwork.min_microversion)213 )214 _, self.chassis = self.create_chassis()215 _, self.node = self.create_node(self.chassis['uuid'])216 @decorators.idempotent_id('f1a5d279-c456-4311-ad31-fea09f61c22b')217 def test_create_port_with_physical_network(self):218 node_id = self.node['uuid']219 address = data_utils.rand_mac_address()220 _, port = self.create_port(node_id=node_id, address=address,221 physical_network='physnet1')222 _, body = self.client.show_port(port['uuid'])223 self._assertExpected(port, body)224 self.assertEqual('physnet1', port['physical_network'])225 @decorators.idempotent_id('9c26298b-1bcb-47b7-9b9e-8bdd6e3c4aba')226 def test_update_port_replace_physical_network(self):227 node_id = self.node['uuid']228 address = data_utils.rand_mac_address()229 _, port = self.create_port(node_id=node_id, address=address,230 physical_network='physnet1')231 new_physnet = 'physnet2'232 patch = [{'path': '/physical_network',233 'op': 'replace',234 'value': new_physnet}]235 self.client.update_port(port['uuid'], patch)236 _, body = self.client.show_port(port['uuid'])237 self.assertEqual(new_physnet, body['physical_network'])238 @decorators.idempotent_id('6503309c-b2c7-4f59-b15a-0d92b5de9210')239 def test_update_port_remove_physical_network(self):240 node_id = self.node['uuid']241 address = data_utils.rand_mac_address()242 _, port = self.create_port(node_id=node_id, address=address,243 physical_network='physnet1')244 patch = [{'path': '/physical_network',245 'op': 'remove'}]246 self.client.update_port(port['uuid'], patch)247 _, body = self.client.show_port(port['uuid'])248 self.assertIsNone(body['physical_network'])249 @decorators.idempotent_id('4155c24d-8474-4b53-a320-aee475f85a68')250 def test_create_ports_in_portgroup_with_physical_network(self):251 node_id = self.node['uuid']252 address = data_utils.rand_mac_address()253 _, portgroup = self.create_portgroup(node_id, address=address)254 _, port1 = self.create_port(node_id=node_id, address=address,255 portgroup_uuid=portgroup['uuid'],256 physical_network='physnet1')257 address = data_utils.rand_mac_address()258 _, port2 = self.create_port(node_id=node_id, address=address,259 portgroup_uuid=portgroup['uuid'],260 physical_network='physnet1')261 _, body = self.client.show_port(port1['uuid'])262 self.assertEqual('physnet1', body['physical_network'])263 self.assertEqual(portgroup['uuid'], body['portgroup_uuid'])264 _, body = self.client.show_port(port2['uuid'])265 self.assertEqual('physnet1', body['physical_network'])266 self.assertEqual(portgroup['uuid'], body['portgroup_uuid'])267 @decorators.idempotent_id('cf05a3ef-3bc4-4db7-bb4c-4eb871eb9f81')268 def test_update_ports_in_portgroup_with_physical_network(self):269 node_id = self.node['uuid']270 address = data_utils.rand_mac_address()271 _, portgroup = self.create_portgroup(node_id, address=address)272 _, port1 = self.create_port(node_id=node_id, address=address,273 portgroup_uuid=portgroup['uuid'],274 physical_network='physnet1')275 address = data_utils.rand_mac_address()276 _, port2 = self.create_port(node_id=node_id, address=address,277 physical_network='physnet1')278 patch = [{'path': '/portgroup_uuid',279 'op': 'replace',280 'value': portgroup['uuid']}]281 self.client.update_port(port2['uuid'], patch)282 _, body = self.client.show_port(port1['uuid'])283 self.assertEqual('physnet1', body['physical_network'])284 self.assertEqual(portgroup['uuid'], body['portgroup_uuid'])285 _, body = self.client.show_port(port2['uuid'])286 self.assertEqual('physnet1', body['physical_network'])...

Full Screen

Full Screen

flow_falcon_resolution_setting.py

Source:flow_falcon_resolution_setting.py Github

copy

Full Screen

...94 :type: str95 """96 self._show_dscp = show_dscp97 @property98 def show_port(self):99 """Gets the show_port of this FlowFalconResolutionSetting. # noqa: E501100 :return: The show_port of this FlowFalconResolutionSetting. # noqa: E501101 :rtype: str102 """103 return self._show_port104 @show_port.setter105 def show_port(self, show_port):106 """Sets the show_port of this FlowFalconResolutionSetting.107 :param show_port: The show_port of this FlowFalconResolutionSetting. # noqa: E501108 :type: str109 """110 self._show_port = show_port111 @property112 def show_protocol(self):113 """Gets the show_protocol of this FlowFalconResolutionSetting. # noqa: E501114 :return: The show_protocol of this FlowFalconResolutionSetting. # noqa: E501115 :rtype: str116 """117 return self._show_protocol118 @show_protocol.setter119 def show_protocol(self, show_protocol):...

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