Exemple #1
0
 def setUp(self):
     cfg.CONF.set_override('supported_pci_vendor_devs',
                           DEFAULT_PCI_INFO,
                           'ml2_sriov')
     super(SriovNicSwitchMechanismBaseTestCase, self).setUp()
     self.driver = mech_driver.SriovNicSwitchMechanismDriver()
     self.driver.initialize()
    def test_get_vif_details_without_agent(self):
        cfg.CONF.set_override('agent_required', False, 'ml2_sriov')
        self.driver = mech_driver.SriovNicSwitchMechanismDriver()
        self.driver.initialize()
        context = TestFakePortContext(self.AGENT_TYPE, self.AGENTS,
                                      self.VLAN_SEGMENTS,
                                      portbindings.VNIC_DIRECT)

        self.driver.bind_port(context)
        self.assertEqual(constants.PORT_STATUS_ACTIVE, context._bound_state)
 def setUp(self):
     self.override_vnic_types = [
         portbindings.VNIC_DIRECT, portbindings.VNIC_MACVTAP
     ]
     self.driver_with_vnic_types = \
         mech_driver.SriovNicSwitchMechanismDriver(
             supported_vnic_types=self.override_vnic_types)
     self.default_supported_vnics = [
         portbindings.VNIC_DIRECT, portbindings.VNIC_MACVTAP,
         portbindings.VNIC_DIRECT_PHYSICAL
     ]
     self.blacklist_cfg = {'SRIOV_DRIVER': {'vnic_type_blacklist': []}}
     super(SriovSwitchMechVnicTypesTestCase, self).setUp()
 def setUp(self):
     self.override_vnic_types = [
         portbindings.VNIC_DIRECT, portbindings.VNIC_MACVTAP
     ]
     self.default_supported_vnics = list(
         mech_driver.SRIOV_SUPPORTED_VNIC_TYPES)
     mech_driver.SRIOV_SUPPORTED_VNIC_TYPES = self.override_vnic_types
     self.driver_with_vnic_types = (
         mech_driver.SriovNicSwitchMechanismDriver())
     self.prohibit_list_cfg = {
         'SRIOV_DRIVER': {
             'vnic_type_prohibit_list': []
         }
     }
     super(SriovSwitchMechVnicTypesTestCase, self).setUp()
    def test_vnic_type_prohibit_list_valid_item(self):
        self.prohibit_list_cfg['SRIOV_DRIVER']['vnic_type_prohibit_list'] = \
            [portbindings.VNIC_MACVTAP]

        fake_conf = cfg.CONF
        fake_conf_fixture = base.MechDriverConfFixture(
            fake_conf, self.prohibit_list_cfg,
            mech_sriov_conf.register_sriov_mech_driver_opts)
        self.useFixture(fake_conf_fixture)

        mech_driver.SRIOV_SUPPORTED_VNIC_TYPES = self.default_supported_vnics
        test_driver = mech_driver.SriovNicSwitchMechanismDriver()

        supported_vnic_types = test_driver.supported_vnic_types
        self.assertNotIn(portbindings.VNIC_MACVTAP, supported_vnic_types)
        self.assertEqual(
            len(self.default_supported_vnics) - 1, len(supported_vnic_types))
 def setUp(self):
     super(SriovNicSwitchMechanismBaseTestCase, self).setUp()
     self.driver = mech_driver.SriovNicSwitchMechanismDriver()
     self.driver.initialize()
 def test_default_vnic_types(self):
     mech_driver.SRIOV_SUPPORTED_VNIC_TYPES = self.default_supported_vnics
     mech_sriov = mech_driver.SriovNicSwitchMechanismDriver()
     self.assertEqual(self.default_supported_vnics,
                      mech_sriov.supported_vnic_types)