Skip to content

Commit e65aec9

Browse files
authored
Bridge mac setting, fix statedb time format (#1844)
*Set bridge mac same as Vlan mac *Format state_db entries to have six digit precision for microseconds
1 parent 237b89c commit e65aec9

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

cfgmgr/vlanmgr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ bool VlanMgr::setHostVlanMac(int vlan_id, const string &mac)
196196
// The command should be generated as:
197197
// /sbin/ip link set Vlan{{vlan_id}} address {{mac}}
198198
ostringstream cmds;
199-
cmds << IP_CMD " link set " VLAN_PREFIX + std::to_string(vlan_id) + " address " << shellquote(mac);
199+
cmds << IP_CMD " link set " VLAN_PREFIX + std::to_string(vlan_id) + " address " << shellquote(mac) << " && "
200+
IP_CMD " link set " DOT1Q_BRIDGE_NAME " address " << shellquote(mac);
200201

201202
std::string res;
202203
EXEC_WITH_ERROR_THROW(cmds.str(), res);

orchagent/muxorch.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,17 @@ void MuxCableOrch::updateMuxMetricState(string portName, string muxState, bool s
13001300
char buf[256];
13011301
std::strftime(buf, 256, "%Y-%b-%d %H:%M:%S.", &now_tm);
13021302

1303-
string time = string(buf) + to_string(micros);
1303+
/*
1304+
* Prepend '0's for 6 point precision
1305+
*/
1306+
const int precision = 6;
1307+
auto ms = to_string(micros);
1308+
if (ms.length() < precision)
1309+
{
1310+
ms.insert(ms.begin(), precision - ms.length(), '0');
1311+
}
1312+
1313+
string time = string(buf) + ms;
13041314

13051315
mux_metric_table_.hset(portName, msg, time);
13061316
}

0 commit comments

Comments
 (0)