当前位置: 首页>>代码示例>>Python>>正文


Python PhysicalRouterDM.locate_all方法代码示例

本文整理汇总了Python中db.PhysicalRouterDM.locate_all方法的典型用法代码示例。如果您正苦于以下问题:Python PhysicalRouterDM.locate_all方法的具体用法?Python PhysicalRouterDM.locate_all怎么用?Python PhysicalRouterDM.locate_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db.PhysicalRouterDM的用法示例。


在下文中一共展示了PhysicalRouterDM.locate_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from db import PhysicalRouterDM [as 别名]
# 或者: from db.PhysicalRouterDM import locate_all [as 别名]
    def __init__(self, dm_logger=None, args=None, zookeeper_client=None,
                 amqp_client=None):
        DeviceManager._instance = self
        self._args = args
        self._amqp_client = amqp_client
        self.logger = dm_logger or DeviceManagerLogger(args)
        self._vnc_amqp = DMAmqpHandle(self.logger, self.REACTION_MAP,
                                      self._args)

        PushConfigState.set_push_mode(int(self._args.push_mode))
        PushConfigState.set_repush_interval(int(self._args.repush_interval))
        PushConfigState.set_repush_max_interval(
            int(self._args.repush_max_interval))
        PushConfigState.set_push_delay_per_kb(
            float(self._args.push_delay_per_kb))
        PushConfigState.set_push_delay_max(int(self._args.push_delay_max))
        PushConfigState.set_push_delay_enable(
            bool(self._args.push_delay_enable))

        self._chksum = ""
        if self._args.collectors:
            self._chksum = hashlib.md5(
                ''.join(self._args.collectors)).hexdigest()

        # Register Plugins
        try:
            DeviceConf.register_plugins()
        except DeviceConf.PluginsRegistrationFailed as e:
            self.logger.error("Exception: " + str(e))
        except Exception as e:
            tb = traceback.format_exc()
            self.logger.error(
                "Internal error while registering plugins: " + str(e) + tb)

        # Register Ansible Plugins
        try:
            AnsibleBase.register_plugins()
        except AnsibleBase.PluginsRegistrationFailed as e:
            self.logger.error("Exception: " + str(e))
        except Exception as e:
            tb = traceback.format_exc()
            self.logger.error(
                "Internal error while registering ansible plugins: " +
                str(e) + tb)

        # Register Feature Plugins
        try:
            FeatureBase.register_plugins()
        except FeatureBase.PluginRegistrationFailed as e:
            self.logger.error("Exception: " + str(e))
        except Exception as e:
            tb = traceback.format_exc()
            self.logger.error(
                "Internal error while registering feature plugins: " +
                str(e) + tb)
            raise e

        # Retry till API server is up
        connected = False
        self.connection_state_update(ConnectionStatus.INIT)
        api_server_list = args.api_server_ip.split(',')
        while not connected:
            try:
                self._vnc_lib = VncApi(
                    args.admin_user, args.admin_password,
                    args.admin_tenant_name, api_server_list,
                    args.api_server_port,
                    api_server_use_ssl=args.api_server_use_ssl)
                connected = True
                self.connection_state_update(ConnectionStatus.UP)
            except requests.exceptions.ConnectionError as e:
                # Update connection info
                self.connection_state_update(ConnectionStatus.DOWN, str(e))
                time.sleep(3)
            except ResourceExhaustionError:  # haproxy throws 503
                time.sleep(3)

        if PushConfigState.is_push_mode_ansible():
            FabricManager.initialize(args, dm_logger, self._vnc_lib)
        # Initialize amqp
        self._vnc_amqp.establish()

        # Initialize cassandra
        self._object_db = DMCassandraDB.get_instance(zookeeper_client, self._args, self.logger)
        DBBaseDM.init(self, self.logger, self._object_db)
        DBBaseDM._sandesh = self.logger._sandesh

        GlobalSystemConfigDM.locate_all()
        FeatureDM.locate_all()
        PhysicalRoleDM.locate_all()
        OverlayRoleDM.locate_all()
        RoleDefinitionDM.locate_all()
        FeatureConfigDM.locate_all()
        NodeProfileDM.locate_all()
        RoleConfigDM.locate_all()
        GlobalVRouterConfigDM.locate_all()
        VirtualNetworkDM.locate_all()
        DataCenterInterconnectDM.locate_all()
        FabricDM.locate_all()
        FabricNamespaceDM.locate_all()
#.........这里部分代码省略.........
开发者ID:Juniper,项目名称:contrail-controller,代码行数:103,代码来源:device_manager.py


注:本文中的db.PhysicalRouterDM.locate_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。