Skip to content

Commit

Permalink
Revert "[orchagent]: Publish identified events via structured-events …
Browse files Browse the repository at this point in the history
…channel (sonic-net#2446)"

This reverts commit 7cc035f.
  • Loading branch information
tjchadaga committed Nov 12, 2024
1 parent b7d8666 commit 5c1b8b3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 60 deletions.
9 changes: 1 addition & 8 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
extern sai_object_id_t gSwitchId;
extern sai_switch_api_t *sai_switch_api;
extern sai_acl_api_t *sai_acl_api;
extern event_handle_t g_events_handle;

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -1109,16 +1108,10 @@ void CrmOrch::checkCrmThresholds()

if ((utilization >= res.highThreshold) && (cnt.exceededLogCounter < CRM_EXCEEDED_MSG_MAX))
{
event_params_t params = {
{ "percent", to_string(percentageUtil) },
{ "used_cnt", to_string(cnt.usedCounter) },
{ "free_cnt", to_string(cnt.availableCounter) }};

SWSS_LOG_WARN("%s THRESHOLD_EXCEEDED for %s %u%% Used count %u free count %u",
res.name.c_str(), threshType.c_str(), percentageUtil, cnt.usedCounter, cnt.availableCounter);

event_publish(g_events_handle, "chk_crm_threshold", &params);
cnt.exceededLogCounter++;
res.exceededLogCounter++;
}
else if ((utilization <= res.lowThreshold) && (cnt.exceededLogCounter > 0) && (res.highThreshold != res.lowThreshold))
{
Expand Down
1 change: 0 additions & 1 deletion orchagent/crmorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <map>
#include "orch.h"
#include "port.h"
#include "events.h"

extern "C" {
#include "sai.h"
Expand Down
5 changes: 0 additions & 5 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ DebugCounterOrch *gDebugCounterOrch;
MonitorOrch *gMonitorOrch;

bool gIsNatSupported = false;
event_handle_t g_events_handle;

#define DEFAULT_MAX_BULK_SIZE 1000
size_t gMaxBulkSize = DEFAULT_MAX_BULK_SIZE;
Expand Down Expand Up @@ -96,8 +95,6 @@ OrchDaemon::~OrchDaemon()
delete(*it);
}
delete m_select;

events_deinit_publisher(g_events_handle);
}

bool OrchDaemon::init()
Expand All @@ -106,8 +103,6 @@ bool OrchDaemon::init()

string platform = getenv("platform") ? getenv("platform") : "";

g_events_handle = events_init_publisher("sonic-events-swss");

gCrmOrch = new CrmOrch(m_configDb, CFG_CRM_TABLE_NAME);

TableConnector stateDbSwitchTable(m_stateDb, STATE_SWITCH_CAPABILITY_TABLE_NAME);
Expand Down
57 changes: 18 additions & 39 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ extern sai_switch_api_t* sai_switch_api;
extern sai_port_api_t *sai_port_api;
extern sai_queue_api_t *sai_queue_api;

extern event_handle_t g_events_handle;

extern SwitchOrch *gSwitchOrch;
extern PortsOrch *gPortsOrch;

Expand Down Expand Up @@ -947,40 +945,6 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(SelectableTimer &timer)

}

template <typename DropHandler, typename ForwardHandler>
void PfcWdSwOrch<DropHandler, ForwardHandler>::report_pfc_storm(
sai_object_id_t id, const PfcWdQueueEntry *entry, const string &info)
{
event_params_t params = {
{ "ifname", entry->portAlias },
{ "queue_index", to_string(entry->index) },
{ "queue_id", to_string(id) },
{ "port_id", to_string(entry->portId) }};

if (info.empty())
{
SWSS_LOG_NOTICE(
"PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64,
entry->portAlias.c_str(),
entry->index,
id,
entry->portId);
}
else
{
SWSS_LOG_NOTICE(
"PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 ", additional info: %s.",
entry->portAlias.c_str(),
entry->index,
id,
entry->portId,
info.c_str());
params["additional_info"] = info;
}

event_publish(g_events_handle, "pfc-storm", &params);
}

template <typename DropHandler, typename ForwardHandler>
bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string &event, sai_object_id_t queueId, const string &info)
{
Expand All @@ -1003,7 +967,12 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
{
if (entry->second.handler == nullptr)
{
report_pfc_storm(entry->first, &entry->second, info);
SWSS_LOG_NOTICE(
"PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 ".",
entry->second.portAlias.c_str(),
entry->second.index,
entry->first,
entry->second.portId);

entry->second.handler = make_shared<PfcWdActionHandler>(
entry->second.portId,
Expand All @@ -1020,7 +989,12 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
{
if (entry->second.handler == nullptr)
{
report_pfc_storm(entry->first, &entry->second, info);
SWSS_LOG_NOTICE(
"PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 ".",
entry->second.portAlias.c_str(),
entry->second.index,
entry->first,
entry->second.portId);

entry->second.handler = make_shared<DropHandler>(
entry->second.portId,
Expand All @@ -1037,7 +1011,12 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
{
if (entry->second.handler == nullptr)
{
report_pfc_storm(entry->first, &entry->second, info);
SWSS_LOG_NOTICE(
"PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 ".",
entry->second.portAlias.c_str(),
entry->second.index,
entry->first,
entry->second.portId);

entry->second.handler = make_shared<ForwardHandler>(
entry->second.portId,
Expand Down
4 changes: 1 addition & 3 deletions orchagent/pfcwdorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "producertable.h"
#include "notificationconsumer.h"
#include "timer.h"
#include "events.h"

extern "C" {
#include "sai.h"
Expand Down Expand Up @@ -62,6 +61,7 @@ class PfcWdOrch: public Orch
protected:
virtual bool startWdActionOnQueue(const string &event, sai_object_id_t queueId, const string &info="") = 0;
string m_platform = "";

private:

shared_ptr<DBConnector> m_countersDb = nullptr;
Expand Down Expand Up @@ -128,8 +128,6 @@ class PfcWdSwOrch: public PfcWdOrch<DropHandler, ForwardHandler>
void enableBigRedSwitchMode();
void setBigRedSwitchMode(string value);

void report_pfc_storm(sai_object_id_t id, const PfcWdQueueEntry *, const string&);

map<sai_object_id_t, PfcWdQueueEntry> m_entryMap;
map<sai_object_id_t, PfcWdQueueEntry> m_brsEntryMap;

Expand Down
3 changes: 0 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ extern string gMySwitchType;
extern int32_t gVoqMySwitchId;
extern string gMyHostName;
extern string gMyAsicName;
extern event_handle_t g_events_handle;

// defines ------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -2998,8 +2997,6 @@ bool PortsOrch::setHostIntfsOperStatus(const Port& port, bool isUp) const
SWSS_LOG_NOTICE("Set operation status %s to host interface %s",
isUp ? "UP" : "DOWN", port.m_alias.c_str());

event_params_t params = {{"ifname",port.m_alias},{"status",isUp ? "up" : "down"}};
event_publish(g_events_handle, "if-state", &params);
return true;
}

Expand Down
1 change: 0 additions & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "saihelper.h"
#include "lagid.h"
#include "flexcounterorch.h"
#include "events.h"

#include "port/port_capabilities.h"
#include "port/porthlpr.h"
Expand Down

0 comments on commit 5c1b8b3

Please sign in to comment.