示例#1
0
    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.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, 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)
示例#2
0
    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)