From 4280036ad8e16020713a391fb08b0a9d3478be3a Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Wed, 30 Jan 2019 11:37:53 -0800 Subject: [PATCH] [teammgrd] Fix inconsistent port admin status (#755) Signed-off-by: Jipan Yang --- cfgmgr/portmgr.cpp | 4 ---- cfgmgr/portmgr.h | 4 ++++ cfgmgr/teammgr.cpp | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cfgmgr/portmgr.cpp b/cfgmgr/portmgr.cpp index 8d8f710c5f24..03b2e61eb69e 100644 --- a/cfgmgr/portmgr.cpp +++ b/cfgmgr/portmgr.cpp @@ -10,10 +10,6 @@ using namespace std; using namespace swss; -/* Port default admin status is down */ -#define DEFAULT_ADMIN_STATUS_STR "down" -#define DEFAULT_MTU_STR "9100" - PortMgr::PortMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector &tableNames) : Orch(cfgDb, tableNames), m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME), diff --git a/cfgmgr/portmgr.h b/cfgmgr/portmgr.h index 95bc21519ecd..eae407d13c4d 100644 --- a/cfgmgr/portmgr.h +++ b/cfgmgr/portmgr.h @@ -10,6 +10,10 @@ namespace swss { +/* Port default admin status is down */ +#define DEFAULT_ADMIN_STATUS_STR "down" +#define DEFAULT_MTU_STR "9100" + class PortMgr : public Orch { public: diff --git a/cfgmgr/teammgr.cpp b/cfgmgr/teammgr.cpp index c3c5f53d3d50..aa70127641e3 100644 --- a/cfgmgr/teammgr.cpp +++ b/cfgmgr/teammgr.cpp @@ -4,6 +4,7 @@ #include "shellcmd.h" #include "tokenize.h" #include "warm_restart.h" +#include "portmgr.h" #include #include @@ -16,8 +17,6 @@ using namespace std; using namespace swss; -#define DEFAULT_ADMIN_STATUS_STR "up" -#define DEFAULT_MTU_STR "9100" TeamMgr::TeamMgr(DBConnector *confDb, DBConnector *applDb, DBConnector *statDb, const vector &tables) : @@ -480,7 +479,7 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe vector fvs; m_cfgPortTable.get(member, fvs); - // Get the member admin status (by default up) + // Get the member admin status auto it = find_if(fvs.begin(), fvs.end(), [](const FieldValueTuple &fv) { return fv.first == "admin_status"; }); @@ -510,9 +509,7 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe EXEC_WITH_ERROR_THROW(cmd.str(), res); fvs.clear(); - FieldValueTuple fv("admin_status", admin_status); - fvs.push_back(fv); - fv = FieldValueTuple("mtu", mtu); + FieldValueTuple fv("mtu", mtu); fvs.push_back(fv); m_appPortTable.set(member, fvs);