Ejemplo n.º 1
0
    def test_create_eswitch_mgr_ok(self):
        device_mappings = {'physnet1': 'p6p1'}
        with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                        "eswitch_manager.PciOsWrapper.scan_vf_devices",
                        return_value=self.SCANNED_DEVICES),\
                mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                           "eswitch_manager.PciOsWrapper.is_assigned_vf",
                           return_value=True):

            esm.ESwitchManager().discover_devices(device_mappings, None)
Ejemplo n.º 2
0
 def setUp(self):
     super(TestESwitchManagerApi, self).setUp()
     device_mappings = {'physnet1': 'p6p1'}
     with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                     "eswitch_manager.PciOsWrapper.scan_vf_devices",
                     return_value=self.SCANNED_DEVICES),\
             mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                        "eswitch_manager.PciOsWrapper.is_assigned_vf",
                        return_value=True):
         self.eswitch_mgr = esm.ESwitchManager(device_mappings, None)
Ejemplo n.º 3
0
 def test_create_eswitch_mgr_ok(self):
     device_mappings = {'physnet1': ['p6p1']}
     with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                     "eswitch_manager.PciOsWrapper.scan_vf_devices",
                     return_value=self.SCANNED_DEVICES),\
             mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                        "eswitch_manager.PciOsWrapper.pf_device_exists",
                        return_value=True):
         eswitch_mgr = esm.ESwitchManager()
         self.addCleanup(self.cleanup)
         eswitch_mgr.discover_devices(device_mappings, None)
Ejemplo n.º 4
0
    def test_create_eswitch_mgr_fail(self):
        device_mappings = {'physnet1': 'p6p1'}
        with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                        "eswitch_manager.PciOsWrapper.scan_vf_devices",
                        side_effect=exc.InvalidDeviceError(
                            dev_name="p6p1", reason="device" " not found")),\
                mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                           "eswitch_manager.PciOsWrapper.is_assigned_vf",
                           return_value=True):

            with testtools.ExpectedException(exc.InvalidDeviceError):
                esm.ESwitchManager().discover_devices(device_mappings, None)
Ejemplo n.º 5
0
 def test_create_eswitch_mgr_fail(self):
     device_mappings = {'physnet1': ['p6p1']}
     with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                     "eswitch_manager.PciOsWrapper.scan_vf_devices",
                     side_effect=exc.InvalidDeviceError(
                         dev_name="p6p1", reason="device" " not found")),\
             mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
                        "eswitch_manager.PciOsWrapper.pf_device_exists",
                        return_value=True):
         eswitch_mgr = esm.ESwitchManager()
         self.addCleanup(self.cleanup)
         self.assertRaises(exc.InvalidDeviceError,
                           eswitch_mgr.discover_devices, device_mappings,
                           None)
Ejemplo n.º 6
0
 def setUp(self):
     super(TestESwitchManagerApi, self).setUp()
     device_mappings = {'physnet1': ['p6p1']}
     self.eswitch_mgr = esm.ESwitchManager()
     self.addCleanup(self.cleanup)
     self._set_eswitch_manager(self.eswitch_mgr, device_mappings)
Ejemplo n.º 7
0
 def setup_eswitch_mgr(self, device_mappings, exclude_devices=None):
     exclude_devices = exclude_devices or {}
     self.eswitch_mgr = esm.ESwitchManager()
     self.eswitch_mgr.discover_devices(device_mappings, exclude_devices)
Ejemplo n.º 8
0
 def initialize(self):
     self.eswitch_mgr = esm.ESwitchManager()
Ejemplo n.º 9
0
 def setup_eswitch_mgr(self, device_mappings, exclude_devices={}):
     self.eswitch_mgr = esm.ESwitchManager(device_mappings, exclude_devices)