def test_update4_process(self, update=update4_1, test_prefix="1.2.3.0/24"): """Check if IPv4 UPDATES are correcty processed.""" rib = EmulatedRIB() rib.set_access_time(2807) # Process route = Route(rib) message = route.process(update) # Compare the message that was returned if update == update4_1: assert message == [expected_message4] elif update == update6: assert message == [expected_message6] else: assert None == "Unknown abstracted BGP UPDATE !" # Retrieve the node from the radix tee node = rib.search_exact(test_prefix) # The node is in the tree assert node != None # Verify the internal structure integrity route_key = dict() route_key[RouteInformation(64497, 64496, "127.0.0.1")] = 2807 assert node.data.get("routes_information", None) == route_key
def test_update4_process(self, update=update4_1, test_prefix="1.2.3.0/24"): """Check if IPv4 UPDATES are correcty processed.""" rib = EmulatedRIB() rib.set_access_time(2807) # Process route = Route(rib) message = route.process(update) # Compare the message that was returned if update == update4_1: assert message == [ expected_message4 ] elif update == update6: assert message == [ expected_message6 ] else: assert None == "Unknown abstracted BGP UPDATE !" # Retrieve the node from the radix tee node = rib.search_exact(test_prefix) # The node is in the tree assert node != None # Verify the internal structure integrity route_key = dict() route_key[RouteInformation(64497, 64496, "127.0.0.1")] = 2807 assert node.data.get("routes_information", None) == route_key
def test_search_exact(self): """Check search_exact() behavior.""" rib = EmulatedRIB() rib.update("192.168.0.0/24", "value", "key") rib.update("192.168.0.0/16", "value", "key") node = rib.search_exact("192.168.0.0/24") assert node.prefix == "192.168.0.0/24"
def test_update4_origins_process(self): """Check if IPv4 UPDATES from several origins are correcty processed.""" rib = EmulatedRIB() rib.set_access_time(2807) # Process then retrieve the node from the radix tee route = Route(rib) route.process(update4_1) # Process the same UPDATE and pretend that it was inserted later route = Route(rib) route.process(update4_2) node = rib.search_exact("1.2.3.0/24") # Verify the internal structure integrity route_keys = dict() route_keys[RouteInformation(64497, 64496, "127.0.0.1")] = 2807 route_keys[RouteInformation(64500, 64496, "127.0.0.1")] = 2807 assert node.data.get("routes_information", None) == route_keys