Skip to content

Commit

Permalink
Fix compile error; IntfMgr change variable mtu to type string
Browse files Browse the repository at this point in the history
Signed-off-by: Wenda Ni <wenni@microsoft.com>
  • Loading branch information
wendani committed Nov 6, 2019
1 parent 7f59f07 commit c4bd373
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ using namespace swss;
#define LAG_PREFIX "PortChannel"
#define LOOPBACK_PREFIX "Loopback"
#define VNET_PREFIX "Vnet"
#define MTU_INHERITANCE "0"

IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
Orch(cfgDb, tableNames),
Expand Down Expand Up @@ -99,7 +100,7 @@ void IntfMgr::addHostSubIntf(const string&intf, const string &subIntf, const str
EXEC_WITH_ERROR_THROW(cmd.str(), res);
}

void IntfMgr::setHostSubIntfMtu(const string &subIntf, const uint32_t &mtu)
void IntfMgr::setHostSubIntfMtu(const string &subIntf, const string &mtu)
{
// TODO: remove when validation check at mgmt is in place
size_t found = subIntf.find(VLAN_SUB_INTERFACE_SEPARATOR);
Expand Down Expand Up @@ -127,7 +128,7 @@ void IntfMgr::setHostSubIntfMtu(const string &subIntf, const uint32_t &mtu)
stringstream cmd;
string res;

cmd << IP_CMD << " link set " << subIntf << " mtu " << std::to_string(mtu);
cmd << IP_CMD << " link set " << subIntf << " mtu " << mtu;
EXEC_WITH_ERROR_THROW(cmd.str(), res);
}

Expand Down Expand Up @@ -265,7 +266,7 @@ bool IntfMgr::isIntfStateOk(const string &alias)
}

bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
const vector<FieldValueTuple>& data,
vector<FieldValueTuple> data,
const string& op)
{
SWSS_LOG_ENTER();
Expand All @@ -286,7 +287,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
bool is_lo = !alias.compare(0, strlen(LOOPBACK_PREFIX), LOOPBACK_PREFIX);

string vrf_name = "";
uint32_t mtu = 0;
string mtu = "";
string adminStatus = "";
for (auto idx : data)
{
Expand Down Expand Up @@ -344,7 +345,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
m_subIntfList.insert(subIntfAlias);
}

if (mtu)
if (!mtu.empty())
{
try
{
Expand All @@ -358,7 +359,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
}
else
{
FieldValueTuple fvTuple("mtu", std::to_string(mtu));
FieldValueTuple fvTuple("mtu", MTU_INHERITANCE);
data.push_back(fvTuple);
}

Expand Down
4 changes: 2 additions & 2 deletions cfgmgr/intfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class IntfMgr : public Orch

void setIntfIp(const std::string &alias, const std::string &opCmd, const IpPrefix &ipPrefix);
void setIntfVrf(const std::string &alias, const std::string vrfName);
bool doIntfGeneralTask(const std::vector<std::string>& keys, const std::vector<FieldValueTuple>& data, const std::string& op);
bool doIntfGeneralTask(const std::vector<std::string>& keys, std::vector<FieldValueTuple> data, const std::string& op);
bool doIntfAddrTask(const std::vector<std::string>& keys, const std::vector<FieldValueTuple>& data, const std::string& op);
void doTask(Consumer &consumer);
bool isIntfStateOk(const std::string &alias);

void addHostSubIntf(const std::string&intf, const std::string &subIntf, const std::string &vlan);
void setHostSubIntfMtu(const std::string &subIntf, const uint32_t &mtu);
void setHostSubIntfMtu(const std::string &subIntf, const std::string &mtu);
void setHostSubIntfAdminStatus(const std::string &subIntf, const std::string &admin_status);
void removeHostSubIntf(const std::string &subIntf);
void setSubIntfStateOk(const std::string &alias);
Expand Down

0 comments on commit c4bd373

Please # to comment.