-
Notifications
You must be signed in to change notification settings - Fork 689
Remove update of mgmt oper status in swss #3439
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
03f60ad
Remove update of mgmt oper status in swss
SuvarnaMeenakshi e42b344
Fix as per review comments to cleanly remove changes added
SuvarnaMeenakshi ad67960
Merge branch 'master' into mgmt_oper
SuvarnaMeenakshi 04869bb
Merge branch 'master' into mgmt_oper
SuvarnaMeenakshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -38,8 +38,7 @@ extern string g_switchType; | |
| LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) : | ||
| m_portTableProducer(appl_db, APP_PORT_TABLE_NAME), | ||
| m_portTable(appl_db, APP_PORT_TABLE_NAME), | ||
| m_statePortTable(state_db, STATE_PORT_TABLE_NAME), | ||
| m_stateMgmtPortTable(state_db, STATE_MGMT_PORT_TABLE_NAME) | ||
| m_statePortTable(state_db, STATE_PORT_TABLE_NAME) | ||
| { | ||
| std::shared_ptr<struct if_nameindex> if_ni(if_nameindex(), if_freenameindex); | ||
| struct if_nameindex *idx_p; | ||
|
|
@@ -50,43 +49,6 @@ LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) : | |
| { | ||
| string key = idx_p->if_name; | ||
|
|
||
| /* Explicitly store management ports oper status into the state database. | ||
| * This piece of information is used by SNMP. */ | ||
| if (!key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX)) | ||
| { | ||
| ostringstream cmd; | ||
| string res; | ||
| cmd << "cat /sys/class/net/" << shellquote(key) << "/operstate"; | ||
| try | ||
| { | ||
| EXEC_WITH_ERROR_THROW(cmd.str(), res); | ||
| } | ||
| catch (...) | ||
| { | ||
| SWSS_LOG_WARN("Failed to get %s oper status", key.c_str()); | ||
| continue; | ||
| } | ||
|
|
||
| /* Remove the trailing newline */ | ||
| if (res.length() >= 1 && res.at(res.length() - 1) == '\n') | ||
| { | ||
| res.erase(res.length() - 1); | ||
| /* The value of operstate will be either up or down */ | ||
| if (res != "up" && res != "down") | ||
| { | ||
| SWSS_LOG_WARN("Unknown %s oper status %s", | ||
| key.c_str(), res.c_str()); | ||
| } | ||
| FieldValueTuple fv("oper_status", res); | ||
| vector<FieldValueTuple> fvs; | ||
| fvs.push_back(fv); | ||
|
|
||
| m_stateMgmtPortTable.set(key, fvs); | ||
| SWSS_LOG_INFO("Store %s oper status %s to state DB", | ||
| key.c_str(), res.c_str()); | ||
| } | ||
| continue; | ||
| } | ||
| } | ||
|
|
||
| if (!WarmStart::isWarmStart()) | ||
|
|
@@ -197,17 +159,6 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj) | |
| nlmsg_type, key.c_str(), admin, oper, addrStr, ifindex, master); | ||
| } | ||
|
|
||
| if (!key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX)) | ||
|
Collaborator
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. I think we should remove the check at line 134 as well
Contributor
Author
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. Removed this : key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX) |
||
| { | ||
| FieldValueTuple fv("oper_status", oper ? "up" : "down"); | ||
| vector<FieldValueTuple> fvs; | ||
| fvs.push_back(fv); | ||
| m_stateMgmtPortTable.set(key, fvs); | ||
| SWSS_LOG_INFO("Store %s oper status %s to state DB", | ||
| key.c_str(), oper ? "up" : "down"); | ||
| return; | ||
| } | ||
|
|
||
| /* teamd instances are dealt in teamsyncd */ | ||
| if (type && !strcmp(type, TEAM_DRV_NAME)) | ||
| { | ||
|
|
||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need to keep the
for loopas this was also added as part of #630There 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.
Yes, we don't need this, removed to match initial PR changes