예제 #1
0
 def setUp(self):
     super(TestAciVLANTrunkingPlugDriverGbp, self).setUp(
         create_mgmt_nw=False)
     # save possible test_lib.test_config 'config_files' dict entry so we
     # can restore it after tests since we will change its value
     self._old_config_files = copy.copy(test_lib.test_config.get(
         'config_files'))
     # include config files for device manager service plugin and router
     # service plugin since we define a number of hosting device templates,
     # hosting devices and routertypes there
     self._add_device_manager_plugin_ini_file()
     self._add_router_plugin_ini_file()
     #TODO(bobmel): Fix bug in test_extensions.py and we can remove the
     # below call to setup_config()
     self.setup_config()
     self.mock_gbp_driver = mock.MagicMock()
     self.mock_gbp_plugin = mock.MagicMock()
     self.mock_gbp_plugin.policy_driver_manager.policy_drivers = {
         'apic': self.mock_gbp_driver}
     g_p_mock = mock.MagicMock()
     plugins = {'CORE': self.core_plugin,
                'GROUP_POLICY': self.mock_gbp_plugin,
                bc.constants.L3: self.l3_plugin,
                cisco_constants.DEVICE_MANAGER: self.core_plugin}
     g_p_mock.side_effect = lambda svc='CORE': plugins.get(svc)
     mock.patch('networking_cisco.backwards_compatibility.get_plugin',
                g_p_mock).start()
     plug = aci_vlan.AciVLANTrunkingPlugDriver()
     plug.apic_driver.gbp_plugin.get_l3p_id_from_router_id = mock.Mock(
         return_value='somerouterid')
     plug.apic_driver.l3out_vlan_alloc.get_vlan_allocated = self._stub_vlan
     self.plugging_driver = plug
     self.vlan_dict = {'net1': APIC_VLAN1,
                       'net2': APIC_VLAN2,
                       'Datacenter-Out': APIC_VLAN2}
 def setUp(self):
     super(TestAciVLANTrunkingPlugDriverGbp,
           self).setUp(create_mgmt_nw=False)
     # save possible test_lib.test_config 'config_files' dict entry so we
     # can restore it after tests since we will change its value
     self._old_config_files = copy.copy(
         test_lib.test_config.get('config_files'))
     # include config files for device manager service plugin and router
     # service plugin since we define a number of hosting device templates,
     # hosting devices and routertypes there
     self._add_device_manager_plugin_ini_file()
     self._add_router_plugin_ini_file()
     #TODO(bobmel): Fix bug in test_extensions.py and we can remove the
     # below call to setup_config()
     self.setup_config()
     self.l3_plugin._core_plugin.mechanism_manager = mock.MagicMock()
     plug = aci_vlan.AciVLANTrunkingPlugDriver()
     plug.apic_driver.l3out_vlan_alloc.get_vlan_allocated = self._stub_vlan
     plug.apic_driver.per_tenant_context = True
     self.plugging_driver = plug
     self.vlan_dict = {
         'net1': APIC_VLAN1,
         'net2': APIC_VLAN2,
         'Datacenter-Out': APIC_VLAN2
     }