Exemple #1
0
    def test_vnic_type_blacklist_not_valid_item(self):
        self.blacklist_cfg['SRIOV_DRIVER']['vnic_type_blacklist'] = ['foo']
        fake_conf = cfg.CONF
        fake_conf_fixture = base.MechDriverConfFixture(
            fake_conf, self.blacklist_cfg,
            mech_sriov_conf.register_sriov_mech_driver_opts)
        self.useFixture(fake_conf_fixture)

        self.assertRaises(ValueError,
                          mech_driver.SriovNicSwitchMechanismDriver)
Exemple #2
0
    def test_vnic_type_prohibit_list_all_items(self):
        self.prohibit_list_cfg['OVS_DRIVER']['vnic_type_prohibit_list'] = \
            self.supported_vnics
        fake_conf = cfg.CONF
        fake_conf_fixture = base.MechDriverConfFixture(
            fake_conf, self.prohibit_list_cfg,
            mech_ovs_conf.register_ovs_mech_driver_opts)
        self.useFixture(fake_conf_fixture)

        self.assertRaises(ValueError,
                          mech_openvswitch.OpenvswitchMechanismDriver)
    def test_vnic_type_blacklist_all_items(self):
        self.blacklist_cfg['OVS_DRIVER']['vnic_type_blacklist'] = \
            [portbindings.VNIC_NORMAL, portbindings.VNIC_DIRECT]
        fake_conf = cfg.CONF
        fake_conf_fixture = base.MechDriverConfFixture(
            fake_conf, self.blacklist_cfg,
            mech_ovs_conf.register_ovs_mech_driver_opts)
        self.useFixture(fake_conf_fixture)

        self.assertRaises(ValueError,
                          mech_openvswitch.OpenvswitchMechanismDriver)
Exemple #4
0
    def test_vnic_type_prohibit_list_all_items(self):
        self.prohibit_list_cfg['SRIOV_DRIVER']['vnic_type_prohibit_list'] = \
            [portbindings.VNIC_DIRECT,
             portbindings.VNIC_MACVTAP,
             portbindings.VNIC_DIRECT_PHYSICAL]

        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)

        self.assertRaises(ValueError,
                          mech_driver.SriovNicSwitchMechanismDriver)
Exemple #5
0
    def test_vnic_type_prohibit_list_valid_item(self):
        self.prohibit_list_cfg['OVS_DRIVER']['vnic_type_prohibit_list'] = \
            [portbindings.VNIC_DIRECT]

        fake_conf = cfg.CONF
        fake_conf_fixture = base.MechDriverConfFixture(
            fake_conf, self.prohibit_list_cfg,
            mech_ovs_conf.register_ovs_mech_driver_opts)
        self.useFixture(fake_conf_fixture)

        test_driver = mech_openvswitch.OpenvswitchMechanismDriver()

        supported_vnic_types = test_driver.supported_vnic_types
        self.assertNotIn(portbindings.VNIC_DIRECT, supported_vnic_types)
        self.assertEqual(len(self.default_supported_vnics) - 1,
                         len(supported_vnic_types))
    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))