forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
orchagent: Adding port_status_change handling function (sonic-net#86)
* orchagent: Adding port_status_change notification handling function - Write back to APPL_DB to indicate port oper status - Fixing log levels in various places * orchagent: Adding setHostIntfsOperStatus function - Add unique_ptr
- Loading branch information
Showing
9 changed files
with
110 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "portsorch.h" | ||
|
||
extern "C" { | ||
#include "sai.h" | ||
} | ||
|
||
#include "logger.h" | ||
|
||
extern PortsOrch *gPortsOrch; | ||
|
||
void on_port_state_change(uint32_t count, sai_port_oper_status_notification_t *data) | ||
{ | ||
/* Wait until gPortsOrch is initialized */ | ||
if (!gPortsOrch || !gPortsOrch->isInitDone()) | ||
return; | ||
|
||
for (uint32_t i = 0; i < count; i++) | ||
{ | ||
sai_object_id_t id = data[i].port_id; | ||
sai_port_oper_status_t status = data[i].port_state; | ||
|
||
gPortsOrch->updateDbPortOperStatus(id, status); | ||
gPortsOrch->setHostIntfsOperStatus(id, status == SAI_PORT_OPER_STATUS_UP); | ||
} | ||
} | ||
|
||
sai_switch_notification_t switch_notifications | ||
{ | ||
NULL, | ||
NULL, | ||
on_port_state_change, | ||
NULL, | ||
NULL, | ||
NULL | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
extern "C" { | ||
#include "sai.h" | ||
#include "saistatus.h" | ||
} | ||
|
||
#include <set> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters