Skip to content

Commit

Permalink
Address comments: Handling all default values for fields at the IntfMgr
Browse files Browse the repository at this point in the history
level

Signed-off-by: Wenda Ni <wenni@microsoft.com>
  • Loading branch information
wendani committed Nov 6, 2019
1 parent 0011b12 commit 7f59f07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 12 additions & 1 deletion cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,

string vrf_name = "";
uint32_t mtu = 0;
string adminStatus = "up";
string adminStatus = "";
for (auto idx : data)
{
const auto &field = fvField(idx);
Expand Down Expand Up @@ -356,7 +356,18 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
return false;
}
}
else
{
FieldValueTuple fvTuple("mtu", std::to_string(mtu));
data.push_back(fvTuple);
}

if (adminStatus.empty())
{
adminStatus = "up";
FieldValueTuple fvTuple("admin_status", adminStatus);
data.push_back(fvTuple);
}
try
{
setHostSubIntfAdminStatus(subIntfAlias, adminStatus);
Expand Down
7 changes: 2 additions & 5 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ void IntfsOrch::doTask(Consumer &consumer)

const vector<FieldValueTuple>& data = kfvFieldsValues(t);
string vrf_name = "", vnet_name = "";
uint32_t mtu = 0;
bool adminUp = true;
uint32_t mtu;
bool adminUp;
for (auto idx : data)
{
const auto &field = fvField(idx);
Expand Down Expand Up @@ -407,9 +407,6 @@ void IntfsOrch::doTask(Consumer &consumer)
SWSS_LOG_ERROR("Out of range argument %s to %s()", value.c_str(), e.what());
continue;
}

// Inherit mtu from parent port or port channel
mtu = 0;
}
else if (field == "admin_status")
{
Expand Down

0 comments on commit 7f59f07

Please # to comment.