Exemplo n.º 1
0
 def test_parse_attributes_ipv4(self):
     attr_hex = b'@\x01\x01\x00@\x02\x08\x02\x03\x00\x01\x00\x02\x00\x03@\x03\x04\xac\x10\x01\x0e\x80\x04\x04' \
                b'\x00\x00\x00\x00@\x05\x04\x00\x00\x00d\x80\t\x04\xac\x10\x01\x0e\x80\n\x08\x02\x02\x02\x02dddd'
     attributes = {1: 0,
                   2: [(2, [1, 2, 3])],
                   3: '172.16.1.14',
                   4: 0,
                   5: 100,
                   9: '172.16.1.14',
                   10: ['2.2.2.2', '100.100.100.100']}
     self.assertEqual(attributes, Update.parse_attributes(attr_hex, False))
     self.assertRaises(UpdateMessageError, Update.parse_attributes, attr_hex, True)
Exemplo n.º 2
0
 def test_construct_attributes_ipv4(self):
     attr = {
         1: 2,
         2: [(2, [701, 71])],
         3: '219.158.1.204',
         5: 100,
         6: b'',
         7: (71, '16.96.243.103'),
         8: ['4837:701', '4837:2100'],
         9: '219.158.1.204',
         10: ['219.158.1.209', '0.0.0.30']}
     attr_hex = Update.construct_attributes(attr, asn4=True)
     self.assertEqual(attr, Update.parse_attributes(attr_hex, asn4=True))
Exemplo n.º 3
0
 def test_construct_attributes_ipv4(self):
     attr = {
         1: 2,
         2: [(2, [701, 71])],
         3: '219.158.1.204',
         5: 100,
         6: b'',
         7: (71, '16.96.243.103'),
         8: ['4837:701', '4837:2100'],
         9: '219.158.1.204',
         10: ['219.158.1.209', '0.0.0.30']
     }
     attr_hex = Update.construct_attributes(attr, asn4=True)
     self.assertEqual(attr, Update.parse_attributes(attr_hex, asn4=True))
Exemplo n.º 4
0
 def test_parse_attributes_ipv4(self):
     attr_hex = b'@\x01\x01\x00@\x02\x08\x02\x03\x00\x01\x00\x02\x00\x03@\x03\x04\xac\x10\x01\x0e\x80\x04\x04' \
                b'\x00\x00\x00\x00@\x05\x04\x00\x00\x00d\x80\t\x04\xac\x10\x01\x0e\x80\n\x08\x02\x02\x02\x02dddd'
     attributes = {
         1: 0,
         2: [(2, [1, 2, 3])],
         3: '172.16.1.14',
         4: 0,
         5: 100,
         9: '172.16.1.14',
         10: ['2.2.2.2', '100.100.100.100']
     }
     self.assertEqual(attributes, Update.parse_attributes(attr_hex, False))
     self.assertRaises(UpdateMessageError, Update.parse_attributes,
                       attr_hex, True)