Exemplo n.º 1
0
 def test_parse_prefix_list(self):
     prefix_hex = b'\x13\xb8\x9d\xe0\x18E\xb3\xdd\x18E\xb3\xdc\x18\xd1f\xb2\x16Bpd\x18\xd06\xc2'
     nlri = [
         '184.157.224.0/19', '69.179.221.0/24', '69.179.220.0/24',
         '209.102.178.0/24', '66.112.100.0/22', '208.54.194.0/24'
     ]
     self.assertEqual(nlri, Update.parse_prefix_list(prefix_hex))
Exemplo n.º 2
0
 def test_parse_prefix_list_with_addpath(self):
     prefix_hex = b'\x00\x00\x00\x01\x20\x05\x05\x05\x05\x00\x00\x00\x01\x20\xc0\xa8\x01\x05'
     nlri = [
         {'prefix': '5.5.5.5/32', 'path_id': 1},
         {'prefix': '192.168.1.5/32', 'path_id': 1}
     ]
     self.assertEqual(nlri, Update.parse_prefix_list(prefix_hex, True))
Exemplo n.º 3
0
 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))
Exemplo n.º 4
0
 def test_parse_prefix_list_with_addpath(self):
     prefix_hex = b'\x00\x00\x00\x01\x20\x05\x05\x05\x05\x00\x00\x00\x01\x20\xc0\xa8\x01\x05'
     nlri = [{
         'prefix': '5.5.5.5/32',
         'path_id': 1
     }, {
         'prefix': '192.168.1.5/32',
         'path_id': 1
     }]
     self.assertEqual(nlri, Update.parse_prefix_list(prefix_hex, True))
Exemplo n.º 5
0
 def test_construct_prefix_v4(self):
     nlri = [
         "184.157.224.0/19",
         "69.179.221.0/24",
         "69.179.220.0/24",
         "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))
Exemplo n.º 6
0
 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))
Exemplo n.º 7
0
    def test_parse_prefix_list(self):

        prefix_hex = b'\x13\xb8\x9d\xe0\x18E\xb3\xdd\x18E\xb3\xdc\x18\xd1f\xb2\x16Bpd\x18\xd06\xc2'
        nlri = ['184.157.224.0/19', '69.179.221.0/24', '69.179.220.0/24',
                '209.102.178.0/24', '66.112.100.0/22', '208.54.194.0/24']
        self.assertEqual(nlri, Update.parse_prefix_list(prefix_hex))