How to use _test_create_interface_by_network_id method in tempest

Best Python code snippet using tempest_python

test_attach_interfaces.py

Source:test_attach_interfaces.py Github

copy

Full Screen

...45 resp, iface = self.client.wait_for_interface_status(46 server['id'], iface['port_id'], 'ACTIVE')47 self._check_interface(iface)48 return iface49 def _test_create_interface_by_network_id(self, server, ifs):50 network_id = ifs[0]['net_id']51 resp, iface = self.client.create_interface(server['id'],52 network_id=network_id)53 resp, iface = self.client.wait_for_interface_status(54 server['id'], iface['port_id'], 'ACTIVE')55 self._check_interface(iface, network_id=network_id)56 return iface57 def _test_show_interface(self, server, ifs):58 iface = ifs[0]59 resp, _iface = self.client.show_interface(server['id'],60 iface['port_id'])61 self.assertEqual(iface, _iface)62 def _test_delete_interface(self, server, ifs):63 # NOTE(danms): delete not the first or last, but one in the middle64 iface = ifs[1]65 self.client.delete_interface(server['id'], iface['port_id'])66 for i in range(0, 5):67 _r, _ifs = self.client.list_interfaces(server['id'])68 if len(ifs) != len(_ifs):69 break70 time.sleep(1)71 self.assertEqual(len(_ifs), len(ifs) - 1)72 for _iface in _ifs:73 self.assertNotEqual(iface['port_id'], _iface['port_id'])74 return _ifs75 def _compare_iface_list(self, list1, list2):76 # NOTE(danms): port_state will likely have changed, so just77 # confirm the port_ids are the same at least78 list1 = [x['port_id'] for x in list1]79 list2 = [x['port_id'] for x in list2]80 self.assertEqual(sorted(list1), sorted(list2))81 @attr(type='gate')82 def test_create_list_show_delete_interfaces(self):83 server, ifs = self._create_server_get_interfaces()84 interface_count = len(ifs)85 self.assertTrue(interface_count > 0)86 self._check_interface(ifs[0])87 iface = self._test_create_interface(server)88 ifs.append(iface)89 iface = self._test_create_interface_by_network_id(server, ifs)90 ifs.append(iface)91 resp, _ifs = self.client.list_interfaces(server['id'])92 self._compare_iface_list(ifs, _ifs)93 self._test_show_interface(server, ifs)94 _ifs = self._test_delete_interface(server, ifs)95 self.assertEqual(len(ifs) - 1, len(_ifs))96class AttachInterfacesTestXML(AttachInterfacesTestJSON):...

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