本文整理汇总了Python中exabgp.protocol.family.SAFI.pack方法的典型用法代码示例。如果您正苦于以下问题:Python SAFI.pack方法的具体用法?Python SAFI.pack怎么用?Python SAFI.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exabgp.protocol.family.SAFI
的用法示例。
在下文中一共展示了SAFI.pack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RouteRefresh
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
ID = Message.ID.ROUTE_REFRESH
TYPE = chr(Message.ID.ROUTE_REFRESH)
request = 0
start = 1
end = 2
def __init__ (self,afi,safi,reserved=0):
self.afi = AFI(afi)
self.safi = SAFI(safi)
self.reserved = Reserved(reserved)
def messages (self,negotitated):
return [self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack())),]
def __str__ (self):
return "REFRESH"
def extensive (self):
return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)
def families (self):
return self._families[:]
@classmethod
def unpack_message (cls,data,negotitated):
try:
afi,reserved,safi = unpack('!HBB',data)
except error:
raise Notify(7,1,'invalid route-refresh message')
if reserved not in (0,1,2):
raise Notify(7,2,'invalid route-refresh message subtype')
return RouteRefresh(afi,safi,reserved)
示例2: OperationalFamily
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class OperationalFamily (Operational):
def __init__ (self,what,afi,safi,data=''):
self.afi = AFI(afi)
self.safi = SAFI(afi)
Operational.__init__(
self,what,
'%s%s%s' % (self.afi.pack(),self.safi.pack(),data)
)
def family (self):
return (self.afi,self.safi)
示例3: RouteRefresh
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
ID = Message.CODE.ROUTE_REFRESH
TYPE = chr(Message.CODE.ROUTE_REFRESH)
request = 0
start = 1
end = 2
def __init__ (self, afi, safi, reserved=0):
self.afi = AFI(afi)
self.safi = SAFI(safi)
self.reserved = Reserved(reserved)
def message (self,negotiated=None):
return self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack()))
def __str__ (self):
return "REFRESH"
def extensive (self):
return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)
def families (self):
return self._families[:]
@classmethod
def unpack_message (cls, data, _):
try:
afi,reserved,safi = unpack('!HBB',data)
except error:
raise Notify(7,1,'invalid route-refresh message')
if reserved not in (0,1,2):
raise Notify(7,2,'invalid route-refresh message subtype')
return RouteRefresh(afi,safi,reserved)
def __eq__ (self, other):
if not isinstance(other, RouteRefresh):
return False
if self.afi != other.afi:
return False
if self.safi != other.safi:
return False
if self.reserved != other.reserved:
return False
return True
def __ne__ (self, other):
return not self.__eq__(other)
示例4: OperationalFamily
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class OperationalFamily (Operational):
has_family = True
def __init__ (self,what,afi,safi,data=''):
Operational.__init__(self,what)
self.afi = AFI(afi)
self.safi = SAFI(afi)
self.data = data
def family (self):
return (self.afi,self.safi)
def _message (self,data):
return Operational._message(self,"%s%s%s" % (
self.afi.pack(),
self.safi.pack(),
data
))
def message (self,negotiated):
return self._message(self.data)
示例5: RouteRefresh
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
TYPE = chr(Message.Type.ROUTE_REFRESH)
request = 0
start = 1
end = 2
def __init__ (self,afi,safi,reserved=0):
self.afi = AFI(afi)
self.safi = SAFI(safi)
self.reserved = Reserved(reserved)
def messages (self,negotitated):
return [self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack())),]
def __str__ (self):
return "REFRESH"
def extensive (self):
return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)
def families (self):
return self._families[:]