Skip to content

Commit

Permalink
[DASH] Remove deprecated 'action_type' refs (sonic-net#3257)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
theasianpianist authored Aug 13, 2024
1 parent 465391d commit 29cea04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 14 additions & 5 deletions orchagent/dash/dashrouteorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ 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())
{
outbound_routing_attr.id = SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DST_VNET_ID;
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()))
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tests/test_dash_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 29cea04

Please sign in to comment.