def test_construct_prefix_v4(self): nlri = [ '184.157.224.1/32', '32.65.243.12/30', '89.232.254.0/23', '69.179.221.0/24', '61.172.0.0/16', '202.223.128.0/17', '156.152.0.0/15', '15.0.0.0/8', '209.102.178.0/24', '66.112.100.0/22', '208.54.194.0/24' ] nlri_hex = Update.construct_prefix_v4(nlri) self.assertEqual(nlri, Update.parse_prefix_list(nlri_hex))
def test_construct_prefix_v4_addpath(self): nlri = [{'path_id': 1, 'prefix': '99.99.99.99/32'}] nlri_hex = Update.construct_prefix_v4(nlri, add_path=True) self.assertEqual(b'\x00\x00\x00\x01\x20\x63\x63\x63\x63', nlri_hex)
def test_construct_prefix_v4(self): nlri = ['184.157.224.1/32', '32.65.243.12/30', '89.232.254.0/23', '69.179.221.0/24', '61.172.0.0/16', '202.223.128.0/17', '156.152.0.0/15', '15.0.0.0/8', '209.102.178.0/24', '66.112.100.0/22', '208.54.194.0/24'] nlri_hex = Update.construct_prefix_v4(nlri) self.assertEqual(nlri, Update.parse_prefix_list(nlri_hex))