From 1427cae51f2d44519aeacf3b6b6d56eb4383a660 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 19 Nov 2024 22:53:00 +0000 Subject: [PATCH 1/3] Leave some OUTBOUND_CA_TO_PA attrs unset Signed-off-by: Lawrence Lee --- orchagent/dash/dashvnetorch.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/orchagent/dash/dashvnetorch.cpp b/orchagent/dash/dashvnetorch.cpp index a143c31484..512b03396d 100644 --- a/orchagent/dash/dashvnetorch.cpp +++ b/orchagent/dash/dashvnetorch.cpp @@ -349,13 +349,19 @@ bool DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr); } - outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OVERLAY_DMAC; - memcpy(outbound_ca_to_pa_attr.value.mac, ctxt.metadata.mac_address().c_str(), sizeof(sai_mac_t)); - outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr); + if (ctxt.metadata.has_mac_address()) + { + outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OVERLAY_DMAC; + memcpy(outbound_ca_to_pa_attr.value.mac, ctxt.metadata.mac_address().c_str(), sizeof(sai_mac_t)); + outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr); + } - outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_USE_DST_VNET_VNI; - outbound_ca_to_pa_attr.value.booldata = ctxt.metadata.use_dst_vni(); - outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr); + if (ctxt.metadata.has_use_dst_vni()) + { + outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_USE_DST_VNET_VNI; + outbound_ca_to_pa_attr.value.booldata = ctxt.metadata.use_dst_vni(); + outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr); + } object_statuses.emplace_back(); outbound_ca_to_pa_bulker_.create_entry(&object_statuses.back(), &outbound_ca_to_pa_entry, From c022d5016839aa6b89a83b834a72752fdad71472 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 19 Nov 2024 22:53:26 +0000 Subject: [PATCH 2/3] remove unused MAC from test config Signed-off-by: Lawrence Lee --- tests/dash/dash_configs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/dash/dash_configs.py b/tests/dash/dash_configs.py index 0635631b41..ef57c039c9 100644 --- a/tests/dash/dash_configs.py +++ b/tests/dash/dash_configs.py @@ -93,7 +93,6 @@ } VNET_MAPPING_CONFIG_PRIVATELINK = { - "mac_address": bytes.fromhex(MAC_STRING), "action_type": RoutingType.ROUTING_TYPE_PRIVATELINK, "underlay_ip": { "ipv4": socket.htonl(int(IP(UNDERLAY_IP))) From b364cd12e54fce809485aa576b77ffcb887540e5 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Wed, 27 Nov 2024 21:02:32 +0000 Subject: [PATCH 3/3] fix code coverage Signed-off-by: Lawrence Lee --- tests/dash/test_dash_vnet.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/dash/test_dash_vnet.py b/tests/dash/test_dash_vnet.py index 05646cd796..fa8f457bb8 100644 --- a/tests/dash/test_dash_vnet.py +++ b/tests/dash/test_dash_vnet.py @@ -125,6 +125,7 @@ def test_vnet_map(self, dash_db: DashDB): pb.mac_address = bytes.fromhex(self.mac_address.replace(":", "")) pb.action_type = RoutingType.ROUTING_TYPE_VNET_ENCAP pb.underlay_ip.ipv4 = socket.htonl(int(ipaddress.ip_address(self.underlay_ip))) + pb.use_dst_vni = False dash_db.create_vnet_mapping(self.vnet, self.ip1, {"pb": pb.SerializeToString()}) dash_db.create_vnet_mapping(self.vnet, self.ip2, {"pb": pb.SerializeToString()})