How to use _add_router_interface method in tempest

Best Python code snippet using tempest_python

test_nexus_plugin.py

Source:test_nexus_plugin.py Github

copy

Full Screen

...205 self.network3[const.NET_VLAN_ID])206 self._cisco_nexus_plugin.delete_port(207 INSTANCE3, self.network3[const.NET_VLAN_ID]208 )209 def _add_router_interface(self):210 """Add a router interface using fixed (canned) parameters."""211 vlan_name = self.vlan_name212 vlan_id = self.vlan_id213 gateway_ip = '10.0.0.1/24'214 router_id = '00000R1'215 subnet_id = '00001'216 return self._cisco_nexus_plugin.add_router_interface(217 vlan_name, vlan_id, subnet_id, gateway_ip, router_id)218 def _remove_router_interface(self):219 """Remove a router interface created with _add_router_interface."""220 vlan_id = self.vlan_id221 router_id = '00000R1'222 return self._cisco_nexus_plugin.remove_router_interface(vlan_id,223 router_id)224 def test_nexus_add_remove_router_interface(self):225 """Tests addition of a router interface."""226 self.assertTrue(self._add_router_interface())227 self.assertEqual(self._remove_router_interface(), '00000R1')228 def test_nexus_dup_add_router_interface(self):229 """Tests a duplicate add of a router interface."""230 self._add_router_interface()231 try:232 self.assertRaises(233 cisco_exc.SubnetInterfacePresent,234 self._add_router_interface)235 finally:236 self._remove_router_interface()237 def test_nexus_no_svi_switch_exception(self):238 """Tests failure to find a Nexus switch for SVI placement."""239 # Clear the Nexus switches dictionary.240 with mock.patch.dict(self._cisco_nexus_plugin._client.nexus_switches,241 {}, clear=True):242 # Clear the first Nexus IP address discovered in config243 with mock.patch.object(cisco_config, 'first_device_ip',244 new=None):245 self.assertRaises(cisco_exc.NoNexusSviSwitch,246 self._add_router_interface)247 def test_nexus_add_port_after_router_interface(self):248 """Tests creating a port after a router interface.249 Test creating a port after an SVI router interface has250 been created. Only a trunk call should be invoked and the251 plugin should not attempt to recreate the vlan.252 """253 self._add_router_interface()254 # Create a network on the switch255 self._cisco_nexus_plugin.create_network(256 self.network1, self.attachment1)257 # Grab a list of all mock calls from ncclient258 last_cfgs = (self.mock_ncclient.manager.connect.return_value.259 edit_config.mock_calls)260 # The last ncclient call should be for trunking and the second261 # to last call should be creating the SVI interface262 last_cfg = last_cfgs[-1][2]['config']263 self.assertIn('allowed', last_cfg)264 slast_cfg = last_cfgs[-2][2]['config']...

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