Skip to content

Commit

Permalink
Bridge mac setting, fix statedb time format (#1844)
Browse files Browse the repository at this point in the history
*Set bridge mac same as Vlan mac
*Format state_db entries to have six digit precision for microseconds
  • Loading branch information
prsunny authored Aug 2, 2021
1 parent 237b89c commit e65aec9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cfgmgr/vlanmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ bool VlanMgr::setHostVlanMac(int vlan_id, const string &mac)
// The command should be generated as:
// /sbin/ip link set Vlan{{vlan_id}} address {{mac}}
ostringstream cmds;
cmds << IP_CMD " link set " VLAN_PREFIX + std::to_string(vlan_id) + " address " << shellquote(mac);
cmds << IP_CMD " link set " VLAN_PREFIX + std::to_string(vlan_id) + " address " << shellquote(mac) << " && "
IP_CMD " link set " DOT1Q_BRIDGE_NAME " address " << shellquote(mac);

std::string res;
EXEC_WITH_ERROR_THROW(cmds.str(), res);
Expand Down
12 changes: 11 additions & 1 deletion orchagent/muxorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,17 @@ void MuxCableOrch::updateMuxMetricState(string portName, string muxState, bool s
char buf[256];
std::strftime(buf, 256, "%Y-%b-%d %H:%M:%S.", &now_tm);

string time = string(buf) + to_string(micros);
/*
* Prepend '0's for 6 point precision
*/
const int precision = 6;
auto ms = to_string(micros);
if (ms.length() < precision)
{
ms.insert(ms.begin(), precision - ms.length(), '0');
}

string time = string(buf) + ms;

mux_metric_table_.hset(portName, msg, time);
}
Expand Down

0 comments on commit e65aec9

Please sign in to comment.