Merge "lb-agent: fix get_interfaces_on_bridge returning None"
This commit is contained in:
commit
ca2a3fc08a
@ -143,6 +143,8 @@ class LinuxBridgeManager:
|
|||||||
bridge_interface_path = BRIDGE_INTERFACES_FS.replace(
|
bridge_interface_path = BRIDGE_INTERFACES_FS.replace(
|
||||||
BRIDGE_NAME_PLACEHOLDER, bridge_name)
|
BRIDGE_NAME_PLACEHOLDER, bridge_name)
|
||||||
return os.listdir(bridge_interface_path)
|
return os.listdir(bridge_interface_path)
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
def get_tap_devices_count(self, bridge_name):
|
def get_tap_devices_count(self, bridge_name):
|
||||||
bridge_interface_path = BRIDGE_INTERFACES_FS.replace(
|
bridge_interface_path = BRIDGE_INTERFACES_FS.replace(
|
||||||
|
@ -229,6 +229,10 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
|||||||
self.assertEqual(self.lbm.get_interfaces_on_bridge("br0"),
|
self.assertEqual(self.lbm.get_interfaces_on_bridge("br0"),
|
||||||
["qbr1"])
|
["qbr1"])
|
||||||
|
|
||||||
|
def test_get_interfaces_on_bridge_not_existing(self):
|
||||||
|
self.lbm.device_exists = mock.Mock(return_value=False)
|
||||||
|
self.assertEqual([], self.lbm.get_interfaces_on_bridge("br0"))
|
||||||
|
|
||||||
def test_get_tap_devices_count(self):
|
def test_get_tap_devices_count(self):
|
||||||
with mock.patch.object(os, 'listdir') as listdir_fn:
|
with mock.patch.object(os, 'listdir') as listdir_fn:
|
||||||
listdir_fn.return_value = ['tap2101', 'eth0.100', 'vxlan-1000']
|
listdir_fn.return_value = ['tap2101', 'eth0.100', 'vxlan-1000']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user