本文整理汇总了Python中exabgp.protocol.family.SAFI.unpack方法的典型用法代码示例。如果您正苦于以下问题:Python SAFI.unpack方法的具体用法?Python SAFI.unpack怎么用?Python SAFI.unpack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exabgp.protocol.family.SAFI
的用法示例。
在下文中一共展示了SAFI.unpack方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unpack_capability
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack_capability (instance, data, capability=None): # pylint: disable=W0613
# XXX: FIXME: should check that we have not yet seen the capability
while data:
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[2])
sr = ord(data[3])
instance.add_path(afi,safi,sr)
data = data[4:]
return instance
示例2: unpack
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack (capability,instance,data):
# XXX: FIXME: should check that we have not yet seen the capability
while data:
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[2])
sr = ord(data[3])
instance.add_path(afi,safi,sr)
data = data[4:]
return instance
示例3: unpack_capability
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack_capability (instance, data, capability=None): # pylint: disable=W0613
# XXX: FIXME: we should complain if we have twice the same AFI/SAFI
# XXX: FIXME: should check that we have not yet seen the capability
while data:
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[3])
nexthop = AFI.unpack(data[4:6])
instance.add_nexthop(afi, safi, nexthop)
data = data[6:]
return instance
示例4: unpack_capability
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack_capability (instance, data, capability=None): # pylint: disable=W0613
# XXX: FIXME: should raise if instance was already setup
restart = unpack('!H',data[:2])[0]
restart_flag = restart >> 12
restart_time = restart & Graceful.TIME_MASK
data = data[2:]
families = []
while data:
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[2])
flag_family = ord(data[3])
families.append((afi,safi,flag_family))
data = data[4:]
return instance.set(restart_flag,restart_time,families)
示例5: unpack
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack (what,instance,data):
# XXX: FIXME: should raise if instance was already setup
restart = unpack('!H',data[:2])[0]
restart_flag = restart >> 12
restart_time = restart & Graceful.TIME_MASK
data = data[2:]
families = []
while data:
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[2])
flag_family = ord(data[0])
families.append((afi,safi,flag_family))
data = data[4:]
return instance.set(restart_flag,restart_time,families)
示例6: unpack_capability
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack_capability (instance, data, capability=None): # pylint: disable=W0613
# XXX: FIXME: we should raise if we have twice the same AFI/SAFI
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[3])
instance.append((afi,safi))
return instance
示例7: unpack
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack (what,instance,data):
# XXX: FIXME: we should raise if we have twice the same AFI/SAFI
afi = AFI.unpack(data[:2])
safi = SAFI.unpack(data[3])
instance.append((afi,safi))
return instance
示例8: unpack_message
# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import unpack [as 别名]
def unpack_message (cls, data, negotiated):
header_length = len(EOR.NLRI.PREFIX)
return cls(AFI.unpack(data[header_length:header_length+2]),SAFI.unpack(data[header_length+2]))