Best Python code snippet using tempest_python
test_routers.py
Source:test_routers.py
...222 subnet02 = self.create_subnet(network02, cidr=sub02_cidr)223 router = self._create_router()224 interface01 = self._add_router_interface_with_subnet_id(router['id'],225 subnet01['id'])226 self._verify_router_interface(router['id'], subnet01['id'],227 interface01['port_id'])228 interface02 = self._add_router_interface_with_subnet_id(router['id'],229 subnet02['id'])230 self._verify_router_interface(router['id'], subnet02['id'],231 interface02['port_id'])232 @decorators.idempotent_id('96522edf-b4b5-45d9-8443-fa11c26e6eff')233 def test_router_interface_port_update_with_fixed_ip(self):234 network = self.create_network()235 subnet = self.create_subnet(network)236 router = self._create_router()237 fixed_ip = [{'subnet_id': subnet['id']}]238 interface = self._add_router_interface_with_subnet_id(router['id'],239 subnet['id'])240 self.assertIn('port_id', interface)241 self.assertIn('subnet_id', interface)242 port = self.ports_client.show_port(interface['port_id'])243 self.assertEqual(port['port']['id'], interface['port_id'])244 router_port = self.ports_client.update_port(port['port']['id'],245 fixed_ips=fixed_ip)246 self.assertEqual(subnet['id'],247 router_port['port']['fixed_ips'][0]['subnet_id'])248 def _verify_router_interface(self, router_id, subnet_id, port_id):249 show_port_body = self.ports_client.show_port(port_id)250 interface_port = show_port_body['port']251 self.assertEqual(router_id, interface_port['device_id'])252 self.assertEqual(subnet_id,253 interface_port['fixed_ips'][0]['subnet_id'])254class RoutersIpV6Test(RoutersTest):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!