本文整理汇总了Python中exabgp.bgp.message.update.nlri.nlri.NLRI类的典型用法代码示例。如果您正苦于以下问题:Python NLRI类的具体用法?Python NLRI怎么用?Python NLRI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NLRI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__ (self,afi=AFI.ipv4,safi=SAFI.flow_ip,nexthop=None,rd=None):
NLRI.__init__(self,afi,safi)
self.rules = {}
self.action = OUT.announce
self.nexthop = IP.unpack(nexthop) if nexthop else NoIP
self.rd = rd
self.unique = unique.next()
示例2: __init__
def __init__(self,afi,safi,packed,mask,nexthop,action):
self.labels = Labels.NOLABEL
self.rd = RouteDistinguisher.NORD
self.nexthop = IP.unpack(nexthop) if nexthop else NoIP
self.action = action
NLRI.__init__(self,afi,safi)
CIDR.__init__(self,packed,mask)
示例3: __init__
def __init__ (self, afi=AFI.ipv4,safi=SAFI.flow_ip,nexthop=None,rd=None):
NLRI.__init__(self,afi,safi)
self.rules = {}
self.action = OUT.UNSET
self.nexthop = IP.unpack(nexthop) if nexthop else NoNextHop
self.rd = rd if rd else RouteDistinguisher.NORD
self.unique = unique.next()
示例4: __init__
def __init__ (self, afi, safi, packed, mask, nexthop, action,path=None):
self.path_info = PathInfo.NOPATH if path is None else path
self.labels = Labels.NOLABEL
self.rd = RouteDistinguisher.NORD
self.nexthop = IP.unpack(nexthop) if nexthop else NoNextHop
self.action = action
NLRI.__init__(self,afi,safi)
CIDR.__init__(self,packed,mask)
示例5: __init__
def __init__ (self,rd,ve,base,offset,size):
NLRI.__init__(self,AFI.l2vpn,SAFI.vpls)
self.action = OUT.announce
self.nexthop = None
self.rd = rd
self.base = base
self.offset = offset
self.size = size
self.ve = ve
self.unique = unique.next()
示例6: __init__
def __init__ (self, rd, endpoint, base, offset, size):
NLRI.__init__(self,AFI.l2vpn,SAFI.vpls)
self.action = OUT.ANNOUNCE
self.nexthop = None
self.rd = rd
self.base = base
self.offset = offset
self.size = size
self.endpoint = endpoint
self.unique = unique.next()
示例7: __init__
def __init__ (self, local_node, protocol, remote_node, link_local_identifier, link_remote_identifier, ipv4_interface_address, ipv4_neighbor_address):
NLRI.__init__(self,AFI.traffic_engineering,SAFI.ls_unicast)
self.action = OUT.ANNOUNCE
self.nexthop = None
self.local_node = local_node
self.protocol = protocol
self.remote_node = remote_node
self.link_local_identifier = link_local_identifier
self.link_remote_identifier = link_remote_identifier
self.ipv4_interface_address = ipv4_interface_address
self.ipv4_neighbor_address = ipv4_neighbor_address
self.unique = unique.next()
示例8: __init__
def __init__ (self, local_node_id, local_asn, remote_node_id, remote_asn, local_ipv4, remote_ipv4, action):
NLRI.__init__(self,AFI.bgpls,SAFI.bgp_ls)
self.action = OUT.ANNOUNCE
self.nexthop = None
self.local_node_id = local_node_id
self.local_asn = local_asn
self.remote_node_id = remote_node_id
self.remote_asn = remote_asn
self.local_ipv4 = local_ipv4
self.remote_ipv4 = remote_ipv4
if action == 1:
self.action_str = "update"
elif action == 2:
self.action_str = "withdraw"
else:
self.action_str = "unknown"
示例9: __eq__
def __eq__ (self, other):
return \
NLRI.__eq__(self,other) and \
self.action == other.action and \
self.nexthop == other.action and \
self.origin == other.origin and \
self.rt == other.rt
示例10: unpack
def unpack (cls,afi,safi,bgp,addpath,nexthop,action):
labels,rd,mask,size,prefix,left = NLRI._nlri(afi,safi,bgp,action)
nlri = cls(afi,safi,prefix,mask,nexthop,action)
if labels: nlri.labels = Labels(labels)
if rd: nlri.rd = RouteDistinguisher(rd)
return len(bgp) - len(left),nlri
示例11: unpack
def unpack (cls,afi,safi,bgp,addpath,nexthop,action):
labels,rd,path_identifier,mask,size,prefix,left = NLRI._nlri(afi,safi,bgp,action,addpath)
nlri = cls(afi,safi,prefix,mask,nexthop,action)
if labels: nlri.labels = Labels(labels)
if rd: nlri.rd = RouteDistinguisher(rd)
if path_identifier: nlri.path_info = PathInfo(None,None,path_identifier)
return len(bgp) - len(left),nlri
示例12: __eq__
def __eq__ (self, other):
return \
NLRI.__eq__(self, other) and \
CIDR.__eq__(self, other) and \
self.path_info == other.path_info and \
self.labels == other.labels and \
self.rd == other.rd and \
self.nexthop == other.nexthop and \
self.action == other.action
示例13: unpack
def unpack (cls,afi,safi,data,addpath,nexthop,action):
if addpath:
path_identifier = PathInfo(None,None,data[:4])
data = data[4:]
length = 4
else:
path_identifier = None
length = 0
labels,rd,mask,size,prefix,left = NLRI._nlri(afi,safi,data,action)
nlri = cls(afi,safi,prefix,mask,nexthop,action)
if addpath:
nlri.path_info = path_identifier
return length + len(data) - len(left),nlri
示例14: unpack
def unpack (cls, data, negotiated):
nlris = []
# -- Reading AFI/SAFI
afi,safi = unpack('!HB',data[:3])
offset = 3
data = data[offset:]
if negotiated and (afi,safi) not in negotiated.families:
raise Notify(3,0,'presented a non-negotiated family %s %s' % (AFI(afi),SAFI(safi)))
# Is the peer going to send us some Path Information with the route (AddPath)
addpath = negotiated.addpath.receive(afi,safi)
while data:
length,nlri = NLRI.unpack(afi,safi,data,addpath,None,IN.WITHDRAWN)
nlris.append(nlri)
data = data[length:]
# logger.parser(LazyFormat("parsed withdraw mp nlri %s payload " % nlri,data[:length]))
return cls(afi,safi,nlris)
示例15: Copyright
Created by Thomas Mangin on 2013-08-07.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.protocol.family import AFI
from exabgp.protocol.family import SAFI
from exabgp.bgp.message.update.nlri.prefix import Prefix
from exabgp.bgp.message.update.nlri.nlri import NLRI
from exabgp.bgp.message.update.nlri.mpls import MPLS
from exabgp.bgp.message.update.nlri.vpls import VPLS
from exabgp.bgp.message.update.nlri.flow import Flow
NLRI.register_nlri(Prefix,AFI.ipv4,SAFI.unicast)
NLRI.register_nlri(Prefix,AFI.ipv6,SAFI.unicast)
NLRI.register_nlri(Prefix,AFI.ipv4,SAFI.multicast)
NLRI.register_nlri(Prefix,AFI.ipv6,SAFI.multicast)
NLRI.register_nlri(MPLS,AFI.ipv4,SAFI.nlri_mpls)
NLRI.register_nlri(MPLS,AFI.ipv6,SAFI.nlri_mpls)
NLRI.register_nlri(MPLS,AFI.ipv4,SAFI.mpls_vpn)
NLRI.register_nlri(MPLS,AFI.ipv6,SAFI.mpls_vpn)
NLRI.register_nlri(VPLS,AFI.l2vpn,SAFI.vpls)
NLRI.register_nlri(Flow,AFI.ipv4,SAFI.flow_ip)
NLRI.register_nlri(Flow,AFI.ipv6,SAFI.flow_ip)
NLRI.register_nlri(Flow,AFI.ipv4,SAFI.flow_vpn)
NLRI.register_nlri(Flow,AFI.ipv6,SAFI.flow_vpn)