From 907d9c826cd39ad5ae255cae5161b4022fd0676b Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Mon, 12 Aug 2024 20:58:57 +0000 Subject: [PATCH] fix tests Signed-off-by: Lawrence Lee --- tests/_test_dash_crm.py | 2 +- tests/test_dash_vnet.py | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/tests/_test_dash_crm.py b/tests/_test_dash_crm.py index 761733bff6..8064946cfd 100644 --- a/tests/_test_dash_crm.py +++ b/tests/_test_dash_crm.py @@ -272,7 +272,7 @@ def configure(self): prefix = f"20.2.{i}.0/24" if self.addr_family == 'ipv6': prefix = f'2002::{i}:1011/126' - self.route_table.add(f"eni1:{prefix}", {"routing_type":"vnet", "vnet":"vnet1"}) + self.route_table.add(f"eni1:{prefix}", {"action_type":"vnet", "vnet":"vnet1"}) def clear(self): self.route_table.remove_all() diff --git a/tests/test_dash_vnet.py b/tests/test_dash_vnet.py index bbc8b6d93a..5a38fb2d15 100644 --- a/tests/test_dash_vnet.py +++ b/tests/test_dash_vnet.py @@ -246,7 +246,7 @@ def test_vnet_map(self, dvs): self.underlay_ip = "101.1.2.3" pb = VnetMapping() pb.mac_address = bytes.fromhex(self.mac_address.replace(":", "")) - pb.routing_type = RoutingType.ROUTING_TYPE_VNET_ENCAP + pb.action_type = RoutingType.ROUTING_TYPE_VNET_ENCAP pb.underlay_ip.ipv4 = socket.htonl(int(ipaddress.ip_address(self.underlay_ip))) dashobj.create_vnet_map(self.vnet, self.ip1, {"pb": pb.SerializeToString()}) @@ -275,34 +275,24 @@ def test_outbound_routing(self, dvs): self.vnet = "Vnet1" self.mac_string = "F4939FEFC47E" self.ip = "10.1.0.0/24" - self.routing_type = "vnet_direct" + self.action_type = "vnet_direct" self.overlay_ip= "10.0.0.6" pb = Route() - pb.routing_type = RoutingType.ROUTING_TYPE_VNET_DIRECT - pb.vnet_direct.vnet = self.vnet - pb.vnet_direct.overlay_ip.ipv4 = socket.htonl(int(ipaddress.ip_address(self.overlay_ip))) - dashobj.create_outbound_routing(self.mac_string, self.ip, {"pb": pb.SerializeToString()}) - - route_prefix = "10.8.0.0/24" - pb = Route() - # action_type is deprecated in favor of routing_type. Test action_type for backward compatibility pb.action_type = RoutingType.ROUTING_TYPE_VNET_DIRECT pb.vnet_direct.vnet = self.vnet pb.vnet_direct.overlay_ip.ipv4 = socket.htonl(int(ipaddress.ip_address(self.overlay_ip))) - dashobj.create_outbound_routing(self.mac_string, route_prefix, {"pb": pb.SerializeToString()}) + dashobj.create_outbound_routing(self.mac_string, self.ip, {"pb": pb.SerializeToString()}) time.sleep(3) outbound_routing_entries = dashobj.asic_outbound_routing_table.get_keys() assert outbound_routing_entries - for entry in outbound_routing_entries: - fvs = dashobj.asic_outbound_routing_table[entry] - for fv in fvs.items(): - if fv[0] == "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION": - assert fv[1] == "SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT" - if fv[0] == "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_OVERLAY_IP": - assert fv[1] == "10.0.0.6" - assert "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DST_VNET_ID" in fvs - + fvs = dashobj.asic_outbound_routing_table[outbound_routing_entries[0]] + for fv in fvs.items(): + if fv[0] == "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION": + assert fv[1] == "SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT" + if fv[0] == "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_OVERLAY_IP": + assert fv[1] == "10.0.0.6" + assert "SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DST_VNET_ID" in fvs return dashobj def test_inbound_routing(self, dvs):