• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.parse_mappings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.common.utils.parse_mappings函数的典型用法代码示例。如果您正苦于以下问题:Python parse_mappings函数的具体用法?Python parse_mappings怎么用?Python parse_mappings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: remove_empty_bridges

def remove_empty_bridges():
    try:
        interface_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing physical_interface_mappings failed: %s."), e)
        sys.exit(1)
    LOG.info(_LI("Interface mappings: %s."), interface_mappings)

    try:
        bridge_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.bridge_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing bridge_mappings failed: %s."), e)
        sys.exit(1)
    LOG.info(_LI("Bridge mappings: %s."), bridge_mappings)

    lb_manager = linuxbridge_neutron_agent.LinuxBridgeManager(
        bridge_mappings, interface_mappings)

    # NOTE(mgagne) Don't remove pre-existing user-defined bridges
    bridge_names = set(lb_manager.get_all_neutron_bridges())
    bridge_names -= set(bridge_mappings.values())

    for bridge_name in bridge_names:
        if lb_manager.get_tap_devices_count(bridge_name):
            continue

        try:
            lb_manager.delete_bridge(bridge_name)
            LOG.info(_LI("Linux bridge %s deleted"), bridge_name)
        except RuntimeError:
            LOG.exception(_LE("Linux bridge %s delete failed"), bridge_name)
    LOG.info(_LI("Linux bridge cleanup completed successfully"))
开发者ID:asgard-lab,项目名称:neutron,代码行数:34,代码来源:linuxbridge_cleanup.py


示例2: main

def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    try:
        interface_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_LI("Interface mappings: %s"), interface_mappings)

    try:
        bridge_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.bridge_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing bridge_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_LI("Bridge mappings: %s"), bridge_mappings)

    manager = LinuxBridgeManager(bridge_mappings, interface_mappings)

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout,
                               constants.AGENT_TYPE_LINUXBRIDGE,
                               LB_AGENT_BINARY)
    LOG.info(_LI("Agent initialized successfully, now running... "))
    launcher = service.launch(cfg.CONF, agent)
    launcher.wait()
开发者ID:dims,项目名称:neutron,代码行数:32,代码来源:linuxbridge_neutron_agent.py


示例3: create_agent_config_map

def create_agent_config_map(config):
    """Create a map of agent config parameters.

    :param config: an instance of cfg.CONF
    :returns: a map of agent configuration parameters
    """
    try:
        bridge_mappings = n_utils.parse_mappings(config.OVS.bridge_mappings)
    except ValueError as e:
        raise ValueError(_("Parsing bridge_mappings failed: %s.") % e)
    try:
        interface_mappings = n_utils.parse_mappings(config.AGENT.physical_interface_mappings)
    except ValueError as e:
        raise ValueError(_("Parsing physical_interface_mappings failed: %s.") % e)

    kwargs = dict(
        integ_br=config.OVS.integration_bridge,
        local_ip=config.OVS.local_ip,
        interface_mappings=interface_mappings,
        bridge_mappings=bridge_mappings,
        polling_interval=config.AGENT.polling_interval,
        tunnel_types=config.AGENT.tunnel_types,
    )

    # Verify the tunnel_types specified are valid
    for tun in kwargs["tunnel_types"]:
        if tun not in constants.TUNNEL_NETWORK_TYPES:
            msg = _("Invalid tunnel type specificed: %s"), tun
            raise ValueError(msg)
        if not kwargs["local_ip"]:
            msg = _("Tunneling cannot be enabled without a valid local_ip.")
            raise ValueError(msg)

    return kwargs
开发者ID:leftyLin,项目名称:networking-ofagent,代码行数:34,代码来源:ofa_neutron_agent.py


示例4: test_device_mappings

 def test_device_mappings(self):
     cfg.CONF.set_override('physical_device_mappings',
                           self.DEVICE_MAPPING_LIST,
                           'SRIOV_NIC')
     device_mappings = q_utils.parse_mappings(
         cfg.CONF.SRIOV_NIC.physical_device_mappings)
     self.assertEqual(device_mappings, self.DEVICE_MAPPING)
开发者ID:AsherBond,项目名称:quantum,代码行数:7,代码来源:test_sriov_agent_config.py


示例5: test_device_mappings_with_spaces

 def test_device_mappings_with_spaces(self):
     cfg.CONF.set_override('physical_device_mappings',
                           self.DEVICE_MAPPING_WITH_SPACES_LIST,
                           'SRIOV_NIC')
     device_mappings = n_utils.parse_mappings(
         cfg.CONF.SRIOV_NIC.physical_device_mappings, unique_keys=False)
     self.assertEqual(self.DEVICE_MAPPING, device_mappings)
开发者ID:21atlas,项目名称:neutron,代码行数:7,代码来源:test_config.py


示例6: __init__

 def __init__(self):
     try:
         self.physnet_mtus = utils.parse_mappings(
             cfg.CONF.ml2.physical_network_mtus
         )
     except Exception:
         self.physnet_mtus = []
开发者ID:Akanksha08,项目名称:neutron,代码行数:7,代码来源:helpers.py


示例7: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')

    # fix-neutron-agent-for-mtu-config hack
    cfg.CONF.register_opts(interface.OPTS)
    logging_config.setup_logging(cfg.CONF)
    LOG.info(_("network_device_mtu: %s"), str(cfg.CONF.network_device_mtu))
    try:
        interface_mappings = q_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_("Parsing physical_interface_mappings failed: %s."
                    " Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_("Interface mappings: %s"), interface_mappings)

    polling_interval = cfg.CONF.AGENT.polling_interval
    root_helper = cfg.CONF.AGENT.root_helper
    agent = LinuxBridgeNeutronAgentRPC(interface_mappings,
                                       polling_interval,
                                       root_helper)
    LOG.info(_("Agent initialized successfully, now running... "))
    agent.daemon_loop()
    sys.exit(0)
开发者ID:peresadam,项目名称:virl-salt,代码行数:25,代码来源:linuxbridge_neutron_agent.py


示例8: create_agent_config_map

def create_agent_config_map(config):
    """Create a map of agent config parameters.

    :param config: an instance of cfg.CONF
    :returns: a map of agent configuration parameters
    """
    try:
        bridge_mappings = q_utils.parse_mappings(config.OVS.bridge_mappings)
    except ValueError as e:
        raise ValueError(_("Parsing bridge_mappings failed: %s.") % e)

    kwargs = dict(
        integ_br=config.OVS.integration_bridge,
        tun_br=config.OVS.tunnel_bridge,
        local_ip=config.OVS.local_ip,
        bridge_mappings=bridge_mappings,
        root_helper=config.AGENT.root_helper,
        polling_interval=config.AGENT.polling_interval,
        tunnel_types=config.AGENT.tunnel_types,
    )

    # If enable_tunneling is TRUE, set tunnel_type to default to GRE
    if config.OVS.enable_tunneling and not kwargs['tunnel_types']:
        kwargs['tunnel_types'] = [constants.TYPE_GRE]

    # Verify the tunnel_types specified are valid
    for tun in kwargs['tunnel_types']:
        if tun not in constants.TUNNEL_NETWORK_TYPES:
            msg = _('Invalid tunnel type specificed: %s'), tun
            raise ValueError(msg)
        if not kwargs['local_ip']:
            msg = _('Tunneling cannot be enabled without a valid local_ip.')
            raise ValueError(msg)

    return kwargs
开发者ID:matrohon,项目名称:quantum,代码行数:35,代码来源:ovs_neutron_agent.py


示例9: __init__

 def __init__(self):
     LOG.debug(_('L2HighNeutronAgent init is STARTING'))
     self.conf = cfg.CONF
     try:
         self.bridge_mappings = common_utils.parse_mappings(self.conf.bridge_mappings)
     except ValueError as e:
         raise ValueError(_("Parsing bridge_mappings failed: %s.") % e)
     self.context = context.get_admin_context_without_session()
     self.agent_id = 'ovs-agent-%s' % self.conf.host
     self.l2_plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
     self.l2_state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
     self._set_l2_rpc_consumers()
     self.use_call = True
     self.local_vlan_map = {}
     self.tunnel_types = [p_const.TYPE_VXLAN]
     self.l2_pop = self.conf.l2_population
     self.local_ip = self.conf.local_ip
     self.arp_responder_enabled = self.conf.arp_responder and self.l2_pop
     self.l2pop_network_types = self.conf.l2pop_network_types or self.tunnel_types
     self.l2_agent_state = {
         'binary': 'neutron-openvswitch-agent',
         'host': self.conf.host,
         'topic': l3_constants.L2_AGENT_TOPIC,
         'configurations': {
                'bridge_mappings': self.bridge_mappings,
                'tunnel_types': self.tunnel_types,
                'tunneling_ip': self.local_ip.split('/')[0],
                'l2_population': self.l2_pop,
                'l2pop_network_types': self.l2pop_network_types,
                'arp_responder_enabled':self.arp_responder_enabled,
                'enable_distributed_routing': True
         },
         'agent_type': l3_constants.AGENT_TYPE_OVS,
         'start_flag': True}
     LOG.debug(_('RPC l2_state_report heartbeat start'))
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:35,代码来源:l3_highperformance_agent.py


示例10: get_chassis_hostname_and_physnets

 def get_chassis_hostname_and_physnets(self):
     chassis_info_dict = {}
     for ch in self.idl.tables['Chassis'].rows.values():
         bridge_mappings = ch.external_ids.get('ovn-bridge-mappings', '')
         mapping_dict = n_utils.parse_mappings(bridge_mappings.split(','))
         chassis_info_dict[ch.hostname] = mapping_dict.keys()
     return chassis_info_dict
开发者ID:hzhou8,项目名称:networking-ovn,代码行数:7,代码来源:impl_idl_ovn.py


示例11: main

def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()

    try:
        interface_mappings = utils.parse_mappings(
            cfg.CONF.ESWITCH.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_LI("Interface mappings: %s"), interface_mappings)

    try:
        agent = mlnx_eswitch_neutron_agent.MlnxEswitchNeutronAgent(
            interface_mappings)
    except Exception as e:
        LOG.error(_LE("Failed on Agent initialisation : %s. "
                      "Agent terminated!"), e)
        sys.exit(1)

    # Start everything.
    LOG.info(_LI("Agent initialised successfully, now running... "))
    agent.run()
    sys.exit(0)
开发者ID:bradleyjones,项目名称:neutron,代码行数:25,代码来源:eswitch_neutron_agent.py


示例12: _parse_physical_network_types

    def _parse_physical_network_types(self):
        """Parse physical network types configuration.

        Verify default physical network type is valid.
        Parse physical network mappings.
        """
        self.physical_net_type = cfg.CONF.MLNX.physical_network_type
        if self.physical_net_type not in (constants.TYPE_ETH,
                                          constants.TYPE_IB):
            LOG.error(_("Invalid physical network type %(type)s."
                      "Server terminated!"), {'type': self.physical_net_type})
            raise SystemExit(1)
        try:
            self.phys_network_type_maps = utils.parse_mappings(
                cfg.CONF.MLNX.physical_network_type_mappings)
        except ValueError as e:
            LOG.error(_("Parsing physical_network_type failed: %s."
                      " Server terminated!"), e)
            raise SystemExit(1)
        for network, type in self.phys_network_type_maps.iteritems():
            if type not in (constants.TYPE_ETH, constants.TYPE_IB):
                LOG.error(_("Invalid physical network type %(type)s "
                          " for network %(net)s. Server terminated!"),
                          {'net': network, 'type': type})
                raise SystemExit(1)
        LOG.info(_("Physical Network type mappings: %s"),
                 self.phys_network_type_maps)
开发者ID:leesurezen,项目名称:neutron,代码行数:27,代码来源:mlnx_plugin.py


示例13: main

def main():
    eventlet.monkey_patch()
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)

    try:
        interface_mappings = q_utils.parse_mappings(
            cfg.CONF.ESWITCH.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_("Parsing physical_interface_mappings failed: %s."
                    " Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_("Interface mappings: %s"), interface_mappings)

    try:
        agent = MlnxEswitchNeutronAgent(interface_mappings)
    except Exception as e:
        LOG.error(_("Failed on Agent initialisation : %s."
                    " Agent terminated!"), e)
        sys.exit(1)

    # Start everything.
    LOG.info(_("Agent initialised successfully, now running... "))
    agent.daemon_loop()
    sys.exit(0)
开发者ID:ChengZuo,项目名称:neutron,代码行数:25,代码来源:eswitch_neutron_agent.py


示例14: parse

    def parse(self):
        """Parses device_mappings and exclude_devices.

        Parse and validate the consistency in both mappings
        """
        self.device_mappings = n_utils.parse_mappings(cfg.CONF.SRIOV_NIC.physical_device_mappings)
        self.exclude_devices = config.parse_exclude_devices(cfg.CONF.SRIOV_NIC.exclude_devices)
        self._validate()
开发者ID:FedericoRessi,项目名称:neutron,代码行数:8,代码来源:sriov_nic_agent.py


示例15: __init__

 def __init__(self):
     try:
         self.physnet_mtus = utils.parse_mappings(
             cfg.CONF.ml2.physical_network_mtus, unique_values=False
         )
     except Exception as e:
         LOG.error(_LE("Failed to parse physical_network_mtus: %s"), e)
         self.physnet_mtus = []
开发者ID:21atlas,项目名称:neutron,代码行数:8,代码来源:helpers.py


示例16: parse_interface_mappings

def parse_interface_mappings():
    try:
        interface_mappings = n_utils.parse_mappings(
            cfg.CONF.macvtap.physical_interface_mappings)
        LOG.info(_LI("Interface mappings: %s"), interface_mappings)
        return interface_mappings
    except ValueError as e:
        LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
开发者ID:21atlas,项目名称:neutron,代码行数:10,代码来源:macvtap_neutron_agent.py


示例17: run

    def run(self, event, row, old):
        host = row.hostname
        phy_nets = []
        if event != self.ROW_DELETE:
            bridge_mappings = row.external_ids.get('ovn-bridge-mappings', '')
            mapping_dict = n_utils.parse_mappings(bridge_mappings.split(','))
            phy_nets = list(mapping_dict)

        self.driver.update_segment_host_mapping(host, phy_nets)
        if ovn_config.is_ovn_l3():
            self.l3_plugin.schedule_unhosted_routers()
开发者ID:net-ranger,项目名称:networking-ovn,代码行数:11,代码来源:ovsdb_monitor.py


示例18: create_agent_config_map

def create_agent_config_map(config):
    try:
        bridge_mappings = q_utils.parse_mappings(config.servicechain.bridge_mappings)
    except ValueError as e:
        raise ValueError(_("Parsing bridge_mappings failed: %s.") % e)

    kwargs = dict(
        integ_ebr="ebr-int",
        bridge_mappings=bridge_mappings,
        root_helper=config.AGENT.root_helper,
        polling_interval=config.AGENT.polling_interval,
        minimize_polling=config.AGENT.minimize_polling,
    )

    return kwargs
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:15,代码来源:servicechain_agent.py


示例19: __init__

    def __init__(self):
        self.bus = None
        self.cached_topology = {}
        self.providers = []

        try:
            bridge_mappings = q_utils.parse_mappings(cfg.CONF.OVS.bridge_mappings)
        except ValueError as e:
            raise ValueError(_("Parsing bridge_mappings failed: %s.") % e)

        self.integ_br = cfg.CONF.OVS.integration_bridge
        self.bridge_mappings = bridge_mappings
        self.root_helper = cfg.CONF.AGENT.root_helper

        self.int_br = ovs_lib.OVSBridge(self.integ_br, self.root_helper)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:15,代码来源:neutron_bus_client.py


示例20: create_agent_config_map

def create_agent_config_map(config):
    interface_mappings = n_utils.parse_mappings(
        config.SDNVE.interface_mappings)

    controller_ips = config.SDNVE.controller_ips
    LOG.info(_LI("Controller IPs: %s"), controller_ips)
    controller_ip = controller_ips[0]

    return {
        'integ_br': config.SDNVE.integration_bridge,
        'interface_mappings': interface_mappings,
        'controller_ip': controller_ip,
        'info': config.SDNVE.info,
        'polling_interval': config.SDNVE_AGENT.polling_interval,
        'reset_br': config.SDNVE.reset_bridge,
        'out_of_band': config.SDNVE.out_of_band}
开发者ID:bradleyjones,项目名称:neutron,代码行数:16,代码来源:sdnve_neutron_agent.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.str2dict函数代码示例发布时间:2022-05-27
下一篇:
Python utils.log_opt_values函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap