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


Python core_manager.CORE_MANAGER类代码示例

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


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

示例1: _init_signal_listeners

 def _init_signal_listeners(self):
     CORE_MANAGER.get_core_service()._signal_bus.register_listener(
         BgpSignalBus.BGP_BEST_PATH_CHANGED,
         lambda _, info:
             self._notify_best_path_changed(info['path'],
                                            info['is_withdraw'])
     )
开发者ID:javarange,项目名称:ryu,代码行数:7,代码来源:bgpspeaker.py

示例2: stop

def stop(**kwargs):
    """Stops current context is one is active.

    Raises RuntimeConfigError if runtime is not active or initialized yet.
    """
    if not CORE_MANAGER.started:
        raise RuntimeConfigError('No runtime is active. Call start to create '
                                 'a runtime')
    CORE_MANAGER.stop()
    return True
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:10,代码来源:core.py

示例3: add_evpn_local

def add_evpn_local(route_type, route_dist, next_hop, **kwargs):
    """Adds EVPN route from VRF identified by *route_dist*.
    """

    if(route_type in [EVPN_ETH_AUTO_DISCOVERY, EVPN_ETH_SEGMENT]
       and kwargs['esi'] == 0):
        raise ConfigValueError(conf_name=EVPN_ESI,
                               conf_value=kwargs['esi'])

    try:
        # Create new path and insert into appropriate VRF table.
        tm = CORE_MANAGER.get_core_service().table_manager
        label = tm.update_vrf_table(route_dist, next_hop=next_hop,
                                    route_family=VRF_RF_L2_EVPN,
                                    route_type=route_type, **kwargs)
        # Currently we only allocate one label per local route,
        # so we share first label from the list.
        if label:
            label = label[0]

        # Send success response with new label.
        return [{EVPN_ROUTE_TYPE: route_type,
                 ROUTE_DISTINGUISHER: route_dist,
                 VRF_RF: VRF_RF_L2_EVPN,
                 VPN_LABEL: label}.update(kwargs)]
    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:vinaykothiyal,项目名称:ryu,代码行数:27,代码来源:prefix.py

示例4: delete_evpn_local

def delete_evpn_local(route_type, route_dist, **kwargs):
    """Deletes/withdraws EVPN route from VRF identified by *route_dist*.
    """
    try:
        tm = CORE_MANAGER.get_core_service().table_manager
        tm.update_vrf_table(route_dist, route_family=VRF_RF_L2_EVPN, route_type=route_type, is_withdraw=True, **kwargs)
        # Send success response.
        return [{EVPN_ROUTE_TYPE: route_type, ROUTE_DISTINGUISHER: route_dist, VRF_RF: VRF_RF_L2_EVPN}.update(kwargs)]
    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:fkakuma,项目名称:ryu,代码行数:10,代码来源:prefix.py

示例5: _create_rt_match_importmap

def _create_rt_match_importmap(name, value):
    core_service = CORE_MANAGER.get_core_service()
    importmap_manager = core_service.importmap_manager
    try:
        importmap_manager.create_rt_import_map(name, value)
    except ImportMapAlreadyExistsError:
        raise RuntimeConfigError(
            'Map with this name already exists'
        )

    return True
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:11,代码来源:import_map.py

示例6: delete_local

def delete_local(route_dist, prefix, route_family=VRF_RF_IPV4):
    """Deletes/withdraws *prefix* from VRF identified by *route_dist* and
    source as network controller.
    """
    try:
        tm = CORE_MANAGER.get_core_service().table_manager
        tm.update_vrf_table(route_dist, prefix, route_family=route_family, is_withdraw=True)
        # Send success response.
        return [{ROUTE_DISTINGUISHER: route_dist, PREFIX: prefix, VRF_RF: route_family}]
    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:fkakuma,项目名称:ryu,代码行数:11,代码来源:prefix.py

示例7: get_neighbor_attribute_map

def get_neighbor_attribute_map(neigh_ip_address, route_dist=None,
                               route_family=VRF_RF_IPV4):
    """Returns a neighbor attribute_map for given ip address if exists."""
    core = CORE_MANAGER.get_core_service()
    peer = core.peer_manager.get_by_addr(neigh_ip_address)
    at_maps_key = const.ATTR_MAPS_LABEL_DEFAULT

    if route_dist is not None:
        at_maps_key = ':'.join([route_dist, route_family])
    at_maps = peer.attribute_maps.get(at_maps_key)
    if at_maps:
        return at_maps.get(const.ATTR_MAPS_ORG_KEY)
    else:
        return []
开发者ID:BennyE,项目名称:ryu,代码行数:14,代码来源:rtconf.py

示例8: add_flowspec_local

def add_flowspec_local(flowspec_family, route_dist, rules, **kwargs):
    """Adds Flow Specification route from VRF identified by *route_dist*.
    """
    try:
        # Create new path and insert into appropriate VRF table.
        tm = CORE_MANAGER.get_core_service().table_manager
        tm.update_flowspec_vrf_table(
            flowspec_family=flowspec_family, route_dist=route_dist,
            rules=rules, **kwargs)

        # Send success response.
        return [{FLOWSPEC_FAMILY: flowspec_family,
                 ROUTE_DISTINGUISHER: route_dist,
                 FLOWSPEC_RULES: rules}.update(kwargs)]

    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:17,代码来源:prefix.py

示例9: del_flowspec_local

def del_flowspec_local(flowspec_family, route_dist, rules):
    """Deletes/withdraws Flow Specification route from VRF identified
    by *route_dist*.
    """
    try:
        tm = CORE_MANAGER.get_core_service().table_manager
        tm.update_flowspec_vrf_table(
            flowspec_family=flowspec_family, route_dist=route_dist,
            rules=rules, is_withdraw=True)

        # Send success response.
        return [{FLOWSPEC_FAMILY: flowspec_family,
                 ROUTE_DISTINGUISHER: route_dist,
                 FLOWSPEC_RULES: rules}]

    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:17,代码来源:prefix.py

示例10: add_local

def add_local(route_dist, prefix, next_hop, route_family=VRF_RF_IPV4):
    """Adds *prefix* from VRF identified by *route_dist* and sets the source as
    network controller.
    """
    try:
        # Create new path and insert into appropriate VRF table.
        tm = CORE_MANAGER.get_core_service().table_manager
        label = tm.update_vrf_table(route_dist, prefix, next_hop, route_family)
        # Currently we only allocate one label per local_prefix,
        # so we share first label from the list.
        if label:
            label = label[0]

        # Send success response with new label.
        return [{ROUTE_DISTINGUISHER: route_dist, PREFIX: prefix, VRF_RF: route_family, VPN_LABEL: label}]
    except BgpCoreError as e:
        raise PrefixError(desc=e)
开发者ID:fkakuma,项目名称:ryu,代码行数:17,代码来源:prefix.py

示例11: _create_prefix_match_importmap

def _create_prefix_match_importmap(name, value, route_family):
    core_service = CORE_MANAGER.get_core_service()
    importmap_manager = core_service.importmap_manager
    try:
        if route_family == 'ipv4':
            importmap_manager.create_vpnv4_nlri_import_map(name, value)
        elif route_family == 'ipv6':
            importmap_manager.create_vpnv6_nlri_import_map(name, value)
        else:
            raise RuntimeConfigError(
                'Unknown address family %s. it should be ipv4 or ipv6'
                % route_family
            )
    except ImportMapAlreadyExistsError:
        raise RuntimeConfigError(
            'Map with this name already exists'
        )

    return True
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:19,代码来源:import_map.py

示例12: route_refresh

    def route_refresh(self, peer_ip=None, afi=None, safi=None):
        if not peer_ip:
            peer_ip = 'all'

        try:
            route_families = []
            if afi is None and safi is None:
                route_families.extend(SUPPORTED_GLOBAL_RF)
            else:
                route_family = nlri.get_rf(afi, safi)
                if (route_family not in SUPPORTED_GLOBAL_RF):
                    raise WrongParamError('Not supported address-family'
                                          ' %s, %s' % (afi, safi))
                route_families.append(route_family)

            pm = CORE_MANAGER.get_core_service().peer_manager
            pm.make_route_refresh_request(peer_ip, *route_families)
        except Exception as e:
            LOG.error(traceback.format_exc())
            raise WrongParamError(str(e))
        return None
开发者ID:alextwl,项目名称:ryu,代码行数:21,代码来源:internal_api.py

示例13: set_neighbor_attribute_map

def set_neighbor_attribute_map(neigh_ip_address, at_maps,
                               route_dist=None, route_family=VRF_RF_IPV4):
    """set attribute_maps to the neighbor."""
    core = CORE_MANAGER.get_core_service()
    peer = core.peer_manager.get_by_addr(neigh_ip_address)

    at_maps_key = const.ATTR_MAPS_LABEL_DEFAULT
    at_maps_dict = {}

    if route_dist is not None:
        vrf_conf =\
            CORE_MANAGER.vrfs_conf.get_vrf_conf(route_dist, route_family)
        if vrf_conf:
            at_maps_key = ':'.join([route_dist, route_family])
        else:
            raise RuntimeConfigError(desc='No VrfConf with rd %s' %
                                          route_dist)

    at_maps_dict[const.ATTR_MAPS_LABEL_KEY] = at_maps_key
    at_maps_dict[const.ATTR_MAPS_VALUE] = at_maps
    peer.attribute_maps = at_maps_dict

    return True
开发者ID:BennyE,项目名称:ryu,代码行数:23,代码来源:rtconf.py

示例14: _get_vrf_tables

 def _get_vrf_tables(self):
     return CORE_MANAGER.get_core_service().table_manager.get_vrf_tables()
开发者ID:alextwl,项目名称:ryu,代码行数:2,代码来源:internal_api.py

示例15: set_neighbor_out_filter

def set_neighbor_out_filter(neigh_ip_address, filters):
    """Sets the out_filter of a neighbor."""
    core = CORE_MANAGER.get_core_service()
    peer = core.peer_manager.get_by_addr(neigh_ip_address)
    peer.out_filters = filters
    return True
开发者ID:Aries-Sushi,项目名称:ryu,代码行数:6,代码来源:rtconf.py


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