-
Notifications
You must be signed in to change notification settings - Fork 539
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
[orchagent]: Publish identified events via structured-events channel #2446
Changes from 10 commits
d0f90cf
d2a770a
d06d4a3
9cc12ed
bc77624
50f125c
d159800
8a66584
d8f6fa1
74ff2dc
69a9662
460a7ec
a248ba5
3229496
082a260
e7d4d4d
46f535f
a3dd21c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
#include "crmorch.h" | ||
|
||
CrmOrch::CrmOrch(swss::DBConnector *db, std::string tableName) : Orch(db, std::vector<std::string>{}) | ||
CrmOrch::CrmOrch(swss::DBConnector *db, std::string tableName, event_handle_t) : Orch(db, std::vector<std::string>{}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to revert this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
{ | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,8 +352,10 @@ static bool isValidPortTypeForLagMember(const Port& port) | |
* bridge. By design, SONiC switch starts with all bridge ports removed from | ||
* default VLAN and all ports removed from .1Q bridge. | ||
*/ | ||
PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_with_pri_t> &tableNames, DBConnector *chassisAppDb) : | ||
PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_with_pri_t> &tableNames, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please revert this change if its not modified? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
DBConnector *chassisAppDb, event_handle_t events_handle) : | ||
Orch(db, tableNames), | ||
m_events_handle(events_handle), | ||
m_portStateTable(stateDb, STATE_PORT_TABLE_NAME), | ||
port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false), | ||
gb_port_stat_manager("GB_FLEX_COUNTER_DB", | ||
|
@@ -2537,6 +2539,10 @@ 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"}}; | ||
if (0 != event_publish(m_events_handle, "if-state", ¶ms)) { | ||
SWSS_LOG_WARN("Failed to publish event for if-state"); | ||
} | ||
return true; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have this as a global variable so that we don't have to pass for each orch and change the signature in all places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to declare this as extern in orch.h or in the .cpp files that uses it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the right approach. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern in the .cpp file that uses it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done