Skip to content

Commit

Permalink
[macsecmgr]: Wait for port up before enabling macsec (sonic-net#2032)
Browse files Browse the repository at this point in the history
What I did
Change the prerequisite of enabling macsec to port up

Why I did it
The macsec-related API calls have to be executed after the API calls for gearbox port setup have been done. For that reason, before this change, enabling macsec through config_db.json after reboot cannot succeed. To fix it by this change, the API calls for enabling macsec are executed only after the port is up.

How I verified it

Details if related
  • Loading branch information
byu343 authored Nov 16, 2021
1 parent 4912a77 commit 8f1d035
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cfgmgr/macsecmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,13 @@ bool MACsecMgr::isPortStateOk(const std::string & port_name)

std::vector<FieldValueTuple> temp;
std::string state;
std::string oper_status;

if (m_statePortTable.get(port_name, temp)
&& get_value(temp, "state", state)
&& state == "ok")
&& state == "ok"
&& get_value(temp, "netdev_oper_status", oper_status)
&& oper_status == "up")
{
SWSS_LOG_DEBUG("Port '%s' is ready", port_name.c_str());
return true;
Expand Down

0 comments on commit 8f1d035

Please sign in to comment.