mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-05 20:32:15 +00:00
fix(monitor): preserve an OVS VLAN tag of zero
This commit is contained in:
@@ -31,7 +31,7 @@ def _rows(table):
|
|||||||
|
|
||||||
|
|
||||||
def _list(value):
|
def _list(value):
|
||||||
return value if isinstance(value, list) else [value] if value else []
|
return value if isinstance(value, list) else [] if value is None or value == '' else [value]
|
||||||
|
|
||||||
|
|
||||||
def parse_topology(bridges, ports, interfaces):
|
def parse_topology(bridges, ports, interfaces):
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ class OvsTopology(unittest.TestCase):
|
|||||||
self.assertIsNone(data['bonds']['uplink']['bond_active_slave'])
|
self.assertIsNone(data['bonds']['uplink']['bond_active_slave'])
|
||||||
self.assertEqual(data['ports']['eno2']['bond_master'], 'uplink')
|
self.assertEqual(data['ports']['eno2']['bond_master'], 'uplink')
|
||||||
|
|
||||||
|
def test_zero_vlan_tag_is_preserved(self):
|
||||||
|
tables = fixture()
|
||||||
|
tables[1]['data'][3][4] = 0
|
||||||
|
self.assertEqual(ovs.parse_topology(*tables)['ports']['vlan100']['ovs_tag'], 0)
|
||||||
|
|
||||||
def test_no_ovs_does_not_spawn_any_process(self):
|
def test_no_ovs_does_not_spawn_any_process(self):
|
||||||
with patch.object(ovs.shutil, 'which', return_value=None), patch.object(ovs.subprocess, 'run') as run:
|
with patch.object(ovs.shutil, 'which', return_value=None), patch.object(ovs.subprocess, 'run') as run:
|
||||||
self.assertEqual(ovs.get_topology(), {})
|
self.assertEqual(ovs.get_topology(), {})
|
||||||
|
|||||||
Reference in New Issue
Block a user