From 29cea04a0b98cc440fd5730c758a9b73ac95362c Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Mon, 12 Aug 2024 17:09:04 -0700 Subject: [PATCH] [DASH] Remove deprecated 'action_type' refs (#3257) What I did For DASH_ROUTE_TABLE entries, change action_type references to routing_type references. Why I did it sonic-net/sonic-dash-api#20 deprecates action_type in DASH_ROUTE_TABLE in favor of routing_type to more accurately describe the field. Any downstream repositories which build SWSS will see a deprecation warning for action_type and builds with -Werror set will not compile. Signed-off-by: Lawrence Lee --- orchagent/dash/dashrouteorch.cpp | 19 ++++++++++++++----- tests/test_dash_vnet.py | 1 - 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/orchagent/dash/dashrouteorch.cpp b/orchagent/dash/dashrouteorch.cpp index c8678c5a8d..cb3eedbfdc 100644 --- a/orchagent/dash/dashrouteorch.cpp +++ b/orchagent/dash/dashrouteorch.cpp @@ -81,14 +81,14 @@ bool DashRouteOrch::addOutboundRouting(const string& key, OutboundRoutingBulkCon auto& object_statuses = ctxt.object_statuses; outbound_routing_attr.id = SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION; - outbound_routing_attr.value.u32 = sOutboundAction[ctxt.metadata.action_type()]; + outbound_routing_attr.value.u32 = sOutboundAction[ctxt.metadata.routing_type()]; outbound_routing_attrs.push_back(outbound_routing_attr); - if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_DIRECT) + if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_DIRECT) { - // Intentional empty line, To direct action type, don't need set extra attributes + // Intentional empty line, for direct routing, don't need set extra attributes } - else if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET + else if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET && ctxt.metadata.has_vnet() && !ctxt.metadata.vnet().empty()) { @@ -96,7 +96,7 @@ bool DashRouteOrch::addOutboundRouting(const string& key, OutboundRoutingBulkCon outbound_routing_attr.value.oid = gVnetNameToId[ctxt.metadata.vnet()]; outbound_routing_attrs.push_back(outbound_routing_attr); } - else if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET_DIRECT + else if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET_DIRECT && ctxt.metadata.has_vnet_direct() && !ctxt.metadata.vnet_direct().vnet().empty() && (ctxt.metadata.vnet_direct().overlay_ip().has_ipv4() || ctxt.metadata.vnet_direct().overlay_ip().has_ipv6())) @@ -266,6 +266,15 @@ void DashRouteOrch::doTaskRouteTable(ConsumerBase& consumer) it = consumer.m_toSync.erase(it); continue; } + if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_UNSPECIFIED) + { + // Route::action_type is deprecated in favor of Route::routing_type. For messages still using the old action_type field, + // copy it to the new routing_type field. All subsequent operations will use the new field. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + ctxt.metadata.set_routing_type(ctxt.metadata.action_type()); + #pragma GCC diagnostic pop + } if (addOutboundRouting(key, ctxt)) { it = consumer.m_toSync.erase(it); diff --git a/tests/test_dash_vnet.py b/tests/test_dash_vnet.py index e3b8eb4da0..5a38fb2d15 100644 --- a/tests/test_dash_vnet.py +++ b/tests/test_dash_vnet.py @@ -306,7 +306,6 @@ def test_inbound_routing(self, dvs): self.priority = "1" self.protocol = "0" pb = RouteRule() -# pb.action_type = RoutingType.ROUTING_TYPE_DECAP pb.pa_validation = True pb.priority = int(self.priority) pb.protocol = int(self.protocol)