Skip to content

Commit 3d39e67

Browse files
theasianpianistshiraez
authored andcommitted
[DASH] Remove deprecated 'action_type' refs (sonic-net#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 <[email protected]>
1 parent af22413 commit 3d39e67

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

orchagent/dash/dashrouteorch.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@ bool DashRouteOrch::addOutboundRouting(const string& key, OutboundRoutingBulkCon
8181
auto& object_statuses = ctxt.object_statuses;
8282

8383
outbound_routing_attr.id = SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION;
84-
outbound_routing_attr.value.u32 = sOutboundAction[ctxt.metadata.action_type()];
84+
outbound_routing_attr.value.u32 = sOutboundAction[ctxt.metadata.routing_type()];
8585
outbound_routing_attrs.push_back(outbound_routing_attr);
8686

87-
if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_DIRECT)
87+
if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_DIRECT)
8888
{
89-
// Intentional empty line, To direct action type, don't need set extra attributes
89+
// Intentional empty line, for direct routing, don't need set extra attributes
9090
}
91-
else if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET
91+
else if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET
9292
&& ctxt.metadata.has_vnet()
9393
&& !ctxt.metadata.vnet().empty())
9494
{
9595
outbound_routing_attr.id = SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DST_VNET_ID;
9696
outbound_routing_attr.value.oid = gVnetNameToId[ctxt.metadata.vnet()];
9797
outbound_routing_attrs.push_back(outbound_routing_attr);
9898
}
99-
else if (ctxt.metadata.action_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET_DIRECT
99+
else if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_VNET_DIRECT
100100
&& ctxt.metadata.has_vnet_direct()
101101
&& !ctxt.metadata.vnet_direct().vnet().empty()
102102
&& (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)
266266
it = consumer.m_toSync.erase(it);
267267
continue;
268268
}
269+
if (ctxt.metadata.routing_type() == dash::route_type::RoutingType::ROUTING_TYPE_UNSPECIFIED)
270+
{
271+
// Route::action_type is deprecated in favor of Route::routing_type. For messages still using the old action_type field,
272+
// copy it to the new routing_type field. All subsequent operations will use the new field.
273+
#pragma GCC diagnostic push
274+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
275+
ctxt.metadata.set_routing_type(ctxt.metadata.action_type());
276+
#pragma GCC diagnostic pop
277+
}
269278
if (addOutboundRouting(key, ctxt))
270279
{
271280
it = consumer.m_toSync.erase(it);

tests/test_dash_vnet.py

-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ def test_inbound_routing(self, dvs):
306306
self.priority = "1"
307307
self.protocol = "0"
308308
pb = RouteRule()
309-
# pb.action_type = RoutingType.ROUTING_TYPE_DECAP
310309
pb.pa_validation = True
311310
pb.priority = int(self.priority)
312311
pb.protocol = int(self.protocol)

0 commit comments

Comments
 (0)