@@ -1204,6 +1204,7 @@ bool IntfsOrch::removeRouterIntfs(Port &port)
1204
1204
1205
1205
const auto id = sai_serialize_object_id (port.m_rif_id );
1206
1206
removeRifFromFlexCounter (id, port.m_alias );
1207
+ cleanUpRifFromCounterDb (id, port.m_alias );
1207
1208
1208
1209
sai_status_t status = sai_router_intfs_api->remove_router_interface (port.m_rif_id );
1209
1210
if (status != SAI_STATUS_SUCCESS)
@@ -1426,11 +1427,40 @@ void IntfsOrch::removeRifFromFlexCounter(const string &id, const string &name)
1426
1427
SWSS_LOG_DEBUG (" Unregistered interface %s from Flex counter" , name.c_str ());
1427
1428
}
1428
1429
1430
+ void IntfsOrch::cleanUpRifFromCounterDb (const string &id, const string &name)
1431
+ {
1432
+ SWSS_LOG_ENTER ();
1433
+ string counter_key = getRifCounterTableKey (id);
1434
+ string rate_key = getRifRateTableKey (id);
1435
+ string rate_init_key = getRifRateInitTableKey (id);
1436
+ m_counter_db->del (counter_key);
1437
+ m_counter_db->del (rate_key);
1438
+ m_counter_db->del (rate_init_key);
1439
+ SWSS_LOG_NOTICE (" CleanUp interface %s oid %s from counter db" , name.c_str (),id.c_str ());
1440
+ }
1441
+
1429
1442
string IntfsOrch::getRifFlexCounterTableKey (string key)
1430
1443
{
1431
1444
return string (RIF_STAT_COUNTER_FLEX_COUNTER_GROUP) + " :" + key;
1432
1445
}
1433
1446
1447
+ string IntfsOrch::getRifCounterTableKey (string key)
1448
+ {
1449
+ return " COUNTERS:" + key;
1450
+ }
1451
+
1452
+ string IntfsOrch::getRifRateTableKey (string key)
1453
+ {
1454
+ return " RATES:" + key;
1455
+ }
1456
+
1457
+ string IntfsOrch::getRifRateInitTableKey (string key)
1458
+ {
1459
+ return " RATES:" + key + " :RIF" ;
1460
+ }
1461
+
1462
+
1463
+
1434
1464
void IntfsOrch::generateInterfaceMap ()
1435
1465
{
1436
1466
m_updateMapsTimer->start ();
0 commit comments