Ejemplo n.º 1
0
    def setUp(self):
        """Sets up mock Ucs Sdk."""
        super(TestCiscoUcsmMechDriver, self).setUp()
        self.set_up_mocks()

        def new_ucsm_driver_init(mech_instance):
            mech_instance.ucsmsdk = None
            mech_instance.handles = {}
            mech_instance.supported_sriov_vnic_types = SRIOV_VNIC_TYPES
            mech_instance.supported_pci_devs = SUPPORTED_PCI_DEVS
            mech_instance.ucsm_host_dict = UCSM_HOST_DICT
            conf.load_single_ucsm_config()

        mock.patch.object(ucsm_network_driver.CiscoUcsmDriver,
                          '__init__',
                          new=new_ucsm_driver_init).start()

        self.mech_driver = md.CiscoUcsmMechanismDriver()
        self.mech_driver.initialize()
        self.vif_type = const.VIF_TYPE_802_QBH
        self.db = ucsm_db.UcsmDbModel()
        self.ucsm_driver = ucsm_network_driver.CiscoUcsmDriver()
        self.ucsm_driver.ucsm_db = ucsm_db.UcsmDbModel()
        conf.load_single_ucsm_config()
Ejemplo n.º 2
0
    def initialize(self):
        self.vif_type = const.VIF_TYPE_802_QBH
        self.vif_details = {bc.portbindings.CAP_PORT_FILTER: False}
        self.ucsm_db = ucsm_db.UcsmDbModel()

        if importutils.try_import('ucsmsdk'):
            self.driver = ucsm_network_driver.CiscoUcsmDriver()
        elif importutils.try_import('UcsSdk'):
            warnings.warn("Cannot find ucsmsdk package, falling back to "
                    "using UcsSdk which is now deprecated. For new "
                    "features please run with ucsmsdk installed.",
                    DeprecationWarning)
            self.driver = deprecated_network_driver.CiscoUcsmDriver()
        else:
            LOG.error('Could not import ucsm sdk.')

        config.load_single_ucsm_config()
Ejemplo n.º 3
0
    def __init__(self):
        LOG.debug("UCS Manager Network driver found")
        self.ucsmsdk = None
        self.supported_sriov_vnic_types = [bc.portbindings.VNIC_DIRECT,
                                           bc.portbindings.VNIC_MACVTAP]
        self.supported_pci_devs = CONF.ml2_cisco_ucsm.supported_pci_devs

        config.load_single_ucsm_config()

        self.ucsm_db = ucsm_db.UcsmDbModel()
        self.ucsm_host_dict = {}
        self.ucsm_sp_dict = {}
        self._create_host_and_sp_dicts_from_config()

        # Start timer to monitor Port Profiles that need to be deleted.
        Timer(const.DEFAULT_PP_DELETE_TIME,
            self._delayed_delete_port_profile, ()).start()
        LOG.debug('Starting periodic Port Profile delete timer for %d',
            const.DEFAULT_PP_DELETE_TIME)