Skip to content

Lab5 - add tx error monitor #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
3 changes: 2 additions & 1 deletion orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ orchagent_SOURCES = \
lagid.cpp \
bfdorch.cpp \
srv6orch.cpp \
response_publisher.cpp
response_publisher.cpp \
txmonitororch.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp flex_counter/flow_counter_handler.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
18 changes: 16 additions & 2 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include "logger.h"
#include <sairedis.h>
#include "warm_restart.h"

#define SAI_SWITCH_ATTR_CUSTOM_RANGE_BASE SAI_SWITCH_ATTR_CUSTOM_RANGE_START
#include "sairedis.h"
#include "chassisorch.h"


using namespace std;
using namespace swss;

Expand Down Expand Up @@ -51,6 +51,7 @@ CoppOrch *gCoppOrch;
P4Orch *gP4Orch;
BfdOrch *gBfdOrch;
Srv6Orch *gSrv6Orch;
TxMonitorOrch* gTxMonitorOrch;

bool gIsNatSupported = false;

Expand Down Expand Up @@ -129,6 +130,7 @@ bool OrchDaemon::init()
TableConnector stateDbBfdSessionTable(m_stateDb, STATE_BFD_SESSION_TABLE_NAME);
gBfdOrch = new BfdOrch(m_applDb, APP_BFD_SESSION_TABLE_NAME, stateDbBfdSessionTable);


vector<string> vnet_tables = {
APP_VNET_RT_TABLE_NAME,
APP_VNET_RT_TUNNEL_TABLE_NAME
Expand Down Expand Up @@ -317,6 +319,16 @@ bool OrchDaemon::init()

gNhgMapOrch = new NhgMapOrch(m_applDb, APP_FC_TO_NHG_INDEX_MAP_TABLE_NAME);


TableConnector configueTxTableConnector(m_configDb,CFG_PORT_TX_ERROR_TABLE_NAME);
TableConnector stateTxTableConnector(m_stateDb,STATE_PORT_TX_ERROR_TABLE_NAME);
DBConnector counterDB(COUNTERS_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
TableConnector countersTableConnector(&counterDB,COUNTERS_TABLE);
TableConnector interfaceToOidTableConnector(&counterDB,COUNTERS_PORT_NAME_MAP);
gTxMonitorOrch = &TxMonitorOrch::getInstance(configueTxTableConnector,
stateTxTableConnector,
countersTableConnector,
interfaceToOidTableConnector);
/*
* The order of the orch list is important for state restore of warm start and
* the queued processing in m_toSync map after gPortsOrch->allPortsReady() is set.
Expand All @@ -325,7 +337,9 @@ bool OrchDaemon::init()
* when iterating ConsumerMap. This is ensured implicitly by the order of keys in ordered map.
* For cases when Orch has to process tables in specific order, like PortsOrch during warm start, it has to override Orch::doTask()
*/
m_orchList = { gSwitchOrch, gCrmOrch, gPortsOrch, gBufferOrch, mux_orch, mux_cb_orch, gIntfsOrch, gNeighOrch, gNhgMapOrch, gNhgOrch, gCbfNhgOrch, gRouteOrch, gCoppOrch, qos_orch, wm_orch, policer_orch, tunnel_decap_orch, sflow_orch, debug_counter_orch, gMacsecOrch, gBfdOrch, gSrv6Orch};
m_orchList = { gSwitchOrch, gCrmOrch, gPortsOrch, gBufferOrch, mux_orch, mux_cb_orch, gIntfsOrch, gNeighOrch,
gNhgMapOrch, gNhgOrch, gCbfNhgOrch, gRouteOrch, gCoppOrch, qos_orch, wm_orch, policer_orch,
tunnel_decap_orch, sflow_orch, debug_counter_orch, gMacsecOrch, gBfdOrch, gSrv6Orch, gTxMonitorOrch};

bool initialize_dtel = false;
if (platform == BFN_PLATFORM_SUBSTRING || platform == VS_PLATFORM_SUBSTRING)
Expand Down
1 change: 1 addition & 0 deletions orchagent/orchdaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "p4orch/p4orch.h"
#include "bfdorch.h"
#include "srv6orch.h"
#include "txmonitororch.h"

using namespace swss;

Expand Down
11 changes: 9 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
addSystemPorts();
m_initDone = true;
SWSS_LOG_INFO("Get PortInitDone notification from portsyncd.");
SWSS_LOG_NOTICE("TxMonitorOrchLogs: Get PortInitDone notification from portsyncd.");
}

it = consumer.m_toSync.erase(it);
Expand Down Expand Up @@ -4927,7 +4928,7 @@ bool PortsOrch::addLag(string lag_alias, uint32_t spa_id, int32_t switch_id)
auto lagport = m_portList.find(lag_alias);
if (lagport != m_portList.end())
{
/* The deletion of bridgeport attached to the lag may still be
/* The deletion of bridgeport attached to the lag may still be
* pending due to fdb entries still present on the lag. Wait
* until the cleanup is done.
*/
Expand Down Expand Up @@ -6490,6 +6491,7 @@ bool PortsOrch::getRecircPort(Port &port, string role)

bool PortsOrch::addSystemPorts()
{
SWSS_LOG_NOTICE("TxMonitorOrchLogs: in portsorc, addSystemPorts");
vector<string> keys;
vector<FieldValueTuple> spFv;

Expand Down Expand Up @@ -6533,10 +6535,12 @@ bool PortsOrch::addSystemPorts()

if(system_port_id < 0 || switch_id < 0 || core_index < 0 || core_port_index < 0)
{
SWSS_LOG_NOTICE("TxMonitorOrchLogs: in addSystemPorts in if statment");
SWSS_LOG_ERROR("Invalid or Missing field values for %s! system_port id:%d, switch_id:%d, core_index:%d, core_port_index:%d",
alias.c_str(), system_port_id, switch_id, core_index, core_port_index);
continue;
}
SWSS_LOG_NOTICE("TxMonitorOrchLogs: in addSystemPorts after if statment");

tuple<int, int, int> sp_key(switch_id, core_index, core_port_index);

Expand All @@ -6550,6 +6554,7 @@ bool PortsOrch::addSystemPorts()

//Retrive system port config info and enable
system_port_oid = m_systemPortOidMap[sp_key];
SWSS_LOG_NOTICE("TxMonitorOrchLogs: in portsorc, oid is: %lu", system_port_oid);

attr.id = SAI_SYSTEM_PORT_ATTR_TYPE;
attrs.push_back(attr);
Expand Down Expand Up @@ -6625,7 +6630,9 @@ bool PortsOrch::addSystemPorts()
//System port does not exist in the switch
//This can not happen since all the system ports are supposed to be created during switch creation itself

SWSS_LOG_ERROR("System port %s does not exist in switch. Port not added!", alias.c_str());
SWSS_LOG_ERROR("System port %s does not exist in switch. Poruh8t not added!", alias.c_str());
SWSS_LOG_NOTICE("TxMonitorOrchLogs: in portsorc, addSystemPorts hereeee");

continue;
}
}
Expand Down
Loading