本文整理汇总了Python中exabgp.bgp.message.update.nlri.evpn.nlri.EVPN.unpack_nlri方法的典型用法代码示例。如果您正苦于以下问题:Python EVPN.unpack_nlri方法的具体用法?Python EVPN.unpack_nlri怎么用?Python EVPN.unpack_nlri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exabgp.bgp.message.update.nlri.evpn.nlri.EVPN
的用法示例。
在下文中一共展示了EVPN.unpack_nlri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test99_EVPNMACCreatePackUnpack
# 需要导入模块: from exabgp.bgp.message.update.nlri.evpn.nlri import EVPN [as 别名]
# 或者: from exabgp.bgp.message.update.nlri.evpn.nlri.EVPN import unpack_nlri [as 别名]
def test99_EVPNMACCreatePackUnpack(self):
'''Test pack/unpack for E-VPN MAC routes'''
nlri = EVPNMAC(RouteDistinguisher.fromElements("42.42.42.42", 5),
ESI(),
EthernetTag(111),
MAC("01:02:03:04:05:06"), 6*8,
Labels([42], True),
IP.create("1.1.1.1"))
packed = nlri.pack()
unpacked,leftover = EVPN.unpack_nlri(AFI(AFI.l2vpn), SAFI(SAFI.evpn),
packed, OUT.UNSET, None)
self.assertEqual(0, len(leftover))
# TODO: compare packed with a reference encoding verified
# as conformant with RFC7432
self.assertTrue(isinstance(unpacked, EVPNMAC))
self.assertEqual("42.42.42.42:5", unpacked.rd._str())
self.assertEqual(ESI.DEFAULT, unpacked.esi.esi)
self.assertEqual(EthernetTag(111), unpacked.etag)
self.assertEqual(MAC("01:02:03:04:05:06"), unpacked.mac)
self.assertEqual(IP.create("1.1.1.1"), unpacked.ip)
self.assertEqual(1, len(unpacked.label.labels))
self.assertEqual(42, unpacked.label.labels[0])
示例2: test99_EVPNPrefixCreatePackUnpack
# 需要导入模块: from exabgp.bgp.message.update.nlri.evpn.nlri import EVPN [as 别名]
# 或者: from exabgp.bgp.message.update.nlri.evpn.nlri.EVPN import unpack_nlri [as 别名]
def test99_EVPNPrefixCreatePackUnpack(self):
'''Test pack/unpack for E-VPN Prefix routes'''
nlri = EVPNPrefix(RouteDistinguisher.fromElements("42.42.42.42", 5),
ESI(),
EthernetTag(111),
Labels([42], True),
IP.create("1.1.1.0"),24,
IP.create("2.2.2.2"),
)
packed = nlri.pack()
unpacked,leftover = EVPN.unpack_nlri(AFI.l2vpn, SAFI.evpn,
packed, OUT.UNSET, None)
self.assertEqual(0, len(leftover))
# TODO: compare packed with a reference encoding verified
# as conformant with RFC7432
self.assertTrue(isinstance(unpacked, EVPNPrefix))
self.assertEqual("42.42.42.42:5", unpacked.rd._str())
self.assertEqual(ESI.DEFAULT, unpacked.esi.esi)
self.assertEqual(EthernetTag(111), unpacked.etag)
self.assertEqual(IP.create("1.1.1.0"), unpacked.ip)
self.assertEqual(24, unpacked.iplen)
self.assertEqual(IP.create("2.2.2.2"), unpacked.gwip)
self.assertEqual(1, len(unpacked.label.labels))
self.assertEqual(42, unpacked.label.labels[0])
示例3: test99_EVPNMulticastCreatePackUnpack
# 需要导入模块: from exabgp.bgp.message.update.nlri.evpn.nlri import EVPN [as 别名]
# 或者: from exabgp.bgp.message.update.nlri.evpn.nlri.EVPN import unpack_nlri [as 别名]
def test99_EVPNMulticastCreatePackUnpack(self):
'''Test pack/unpack for E-VPN Multicast routes'''
nlri = EVPNMulticast(RouteDistinguisher.fromElements("42.42.42.42", 5),
EthernetTag(111),
IP.create("1.1.1.1"))
packed = nlri.pack()
unpacked,leftover = EVPN.unpack_nlri(AFI(AFI.l2vpn), SAFI(SAFI.evpn),
packed, OUT.UNSET, None)
self.assertEqual(0, len(leftover))
# TODO: compare packed with a reference encoding verified
# as conformant with RFC7432
self.assertTrue(isinstance(unpacked, EVPNMulticast))
self.assertEqual("42.42.42.42:5", unpacked.rd._str())
self.assertEqual(EthernetTag(111), unpacked.etag)
self.assertEqual(IP.create("1.1.1.1"), unpacked.ip)