Пример #1
0
	def setUp (self):
		"""
		setUp unittesting

		l2vpn:endpoint:3:base:262145:offset:1:size:8: route-distinguisher 172.30.5.4:13
		l2vpn:endpoint:3:base:262145:offset:1:size:8: route-distinguisher 172.30.5.3:11
		"""
		self.encoded_l2vpn_nlri1 = bytearray.fromhex('0011 0001 AC1E 0504 000D 0003 0001 0008 4000 11')
		self.encoded_l2vpn_nlri2 = bytearray.fromhex('0011 0001 AC1E 0503 000B 0003 0001 0008 4000 11')
		self.decoded_l2vpn_nlri1 = VPLS(TestL2VPN.generate_rd('172.30.5.4:13'),3,262145,1,8)
		self.decoded_l2vpn_nlri2 = VPLS(TestL2VPN.generate_rd('172.30.5.3:11'),3,262145,1,8)
		"""
		output from Juniper
		Communities: target:54591:6 Layer2-info: encaps: VPLS, control flags:[0x0] , mtu: 0, site preference: 100
		"""
		self.encoded_ext_community = bytearray.fromhex('0002 D53F 0000 0006 800A 1300 0000 0064')
Пример #2
0
    def test_l2vpn_encode(self):
        '''
		we are encoding routes and testing em against what we have recvd from
		Juniper
		'''
        encoded_l2vpn = VPLS(None, None, None, None, None)
        encoded_l2vpn = self.decoded_l2vpn_nlri1
        self.assertEqual(encoded_l2vpn.pack().encode('hex'),
                         str(self.encoded_l2vpn_nlri1).encode('hex'))
        encoded_l2vpn.nlri = self.decoded_l2vpn_nlri2
        encoded_l2vpn.rd = self.decoded_l2vpn_nlri2.rd
        self.assertEqual(encoded_l2vpn.pack().encode('hex'),
                         str(self.encoded_l2vpn_nlri2).encode('hex'))