Skip to content

Commit

Permalink
[teammgrd] Fix inconsistent port admin status (sonic-net#755)
Browse files Browse the repository at this point in the history
Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
  • Loading branch information
jipanyang authored and lguohan committed Jan 30, 2019
1 parent cf12bdf commit 4280036
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 0 additions & 4 deletions cfgmgr/portmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> &tableNames) :
Orch(cfgDb, tableNames),
m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME),
Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/portmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 3 additions & 6 deletions cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "shellcmd.h"
#include "tokenize.h"
#include "warm_restart.h"
#include "portmgr.h"

#include <algorithm>
#include <sstream>
Expand All @@ -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<TableConnector> &tables) :
Expand Down Expand Up @@ -480,7 +479,7 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe
vector<FieldValueTuple> 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";
});
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 4280036

Please sign in to comment.