def test_4_parse_update(self): txt = "".join( [ chr(c) for c in [ 0x0, 0x0, 0x0, 0x12, 0x40, 0x1, 0x1, 0x0, 0x40, 0x2, 0x4, 0x2, 0x1, 0x78, 0x14, 0x40, 0x3, 0x4, 0x52, 0xDB, 0x2, 0xB5, 0x0, ] ] ) updates = new_Update(txt) self.assertEqual(str(updates.added()[0]), "0.0.0.0/0 next-hop 82.219.2.181")
def test_3_parse_update (self): txt = ''.join([chr(c) for c in [0x0, 0x0, 0x0, 0x1c, 0x40, 0x1, 0x1, 0x2, 0x40, 0x2, 0x0, 0x40, 0x3, 0x4, 0xc0, 0x0, 0x2, 0xfe, 0x80, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x40, 0x5, 0x4, 0x0, 0x0, 0x1, 0x23, 0x20, 0x52, 0xdb, 0x0, 0x7, 0x20, 0x52, 0xdb, 0x0, 0x45, 0x20, 0x52, 0xdb, 0x0, 0x47]]) updates = new_Update(txt) routes = [str(route) for route in updates.added()] routes.sort() self.assertEqual(routes[0],'82.219.0.69/32 next-hop 192.0.2.254') self.assertEqual(routes[1],'82.219.0.7/32 next-hop 192.0.2.254') self.assertEqual(routes[2],'82.219.0.71/32 next-hop 192.0.2.254')
def test_4_parse_update (self): txt = ''.join([chr(c) for c in [0x0, 0x0, 0x0, 0x12, 0x40, 0x1, 0x1, 0x0, 0x40, 0x2, 0x4, 0x2, 0x1, 0x78, 0x14, 0x40, 0x3, 0x4, 0x52, 0xdb, 0x2, 0xb5, 0x0]]) updates = new_Update(txt) self.assertEqual(str(updates.added()[0]),'0.0.0.0/0 next-hop 82.219.2.181')
def test_3_parse_update(self): txt = "".join( [ chr(c) for c in [ 0x0, 0x0, 0x0, 0x1C, 0x40, 0x1, 0x1, 0x2, 0x40, 0x2, 0x0, 0x40, 0x3, 0x4, 0xC0, 0x0, 0x2, 0xFE, 0x80, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x40, 0x5, 0x4, 0x0, 0x0, 0x1, 0x23, 0x20, 0x52, 0xDB, 0x0, 0x7, 0x20, 0x52, 0xDB, 0x0, 0x45, 0x20, 0x52, 0xDB, 0x0, 0x47, ] ] ) updates = new_Update(txt) routes = [str(route) for route in updates.added()] routes.sort() self.assertEqual(routes[0], "82.219.0.69/32 next-hop 192.0.2.254") self.assertEqual(routes[1], "82.219.0.7/32 next-hop 192.0.2.254") self.assertEqual(routes[2], "82.219.0.71/32 next-hop 192.0.2.254")