Skip to content

Commit 44952c3

Browse files
author
Shu0T1an ChenG
committed
[vlanmgrd]: Create a dummy interface and put into the Bridge
In order to maintain the interface Bridge to be UP all the time, the dummy interface is needed to be the member of the Bridge. Refactored test_vlan.py so that each test is independent from each other and intermediate state will be cleaned up afterwards. Add test_MultipleVlan test to cover scenarios with VLAN and VLAN members change. Before the change of the vlanmgrd, this test would fail when all the VLAN members were removed out of the master. Interface Bridge would show NO-CARRIER and new VLAN cannot be created afterwards. After adding the dummy interface, this test will pass. Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
1 parent 4f5436f commit 44952c3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

cfgmgr/vlanmgr.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@ VlanMgr::VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
3333

3434
// Initialize Linux dot1q bridge and enable vlan filtering
3535
// The command should be generated as:
36-
// /bin/bash -c "/sbin/ip link del Bridge 2>/dev/null ;
36+
// /bin/bash -c "/sbin/ip link del Bridge 2>/dev/null;
3737
// /sbin/ip link add Bridge up type bridge &&
38-
// /sbin/bridge vlan del vid 1 dev Bridge self"
38+
// /sbin/bridge vlan del vid 1 dev Bridge self;
39+
// /sbin/ip link del dummy 2>/dev/null;
40+
// /sbin/ip link add dummy type dummy &&"
41+
// /sbin/ip link set dummy master Bridge"
3942

4043
const std::string cmds = std::string("")
4144
+ BASH_CMD + " -c \""
4245
+ IP_CMD + " link del " + DOT1Q_BRIDGE_NAME + " 2>/dev/null; "
4346
+ IP_CMD + " link add " + DOT1Q_BRIDGE_NAME + " up type bridge && "
44-
+ BRIDGE_CMD + " vlan del vid " + DEFAULT_VLAN_ID + " dev " + DOT1Q_BRIDGE_NAME + " self\"";
47+
+ BRIDGE_CMD + " vlan del vid " + DEFAULT_VLAN_ID + " dev " + DOT1Q_BRIDGE_NAME + " self; "
48+
+ IP_CMD + " link del dummy 2>/dev/null; "
49+
+ IP_CMD + " link add dummy type dummy && "
50+
+ IP_CMD + " link set dummy up master Bridge\"";
4551

4652
std::string res;
4753
EXEC_WITH_ERROR_THROW(cmds, res);

0 commit comments

Comments
 (0)