Merge "SimpleInterfaceMonitor handle case when ofport is an empty set"
This commit is contained in:
commit
3cdd2f3afd
|
@ -104,6 +104,8 @@ class SimpleInterfaceMonitor(OvsdbMonitor):
|
|||
for ovs_id, action, name, ofport, external_ids in json:
|
||||
if external_ids:
|
||||
external_ids = ovsdb.val_to_py(external_ids)
|
||||
if ofport:
|
||||
ofport = ovsdb.val_to_py(ofport)
|
||||
device = {'name': name,
|
||||
'ofport': ofport,
|
||||
'external_ids': external_ids}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import mock
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import ovsdb_monitor
|
||||
from neutron.tests import base
|
||||
|
||||
|
@ -93,3 +94,13 @@ class TestSimpleInterfaceMonitor(base.BaseTestCase):
|
|||
self.monitor.get_events()
|
||||
self.assertTrue(process_events.called)
|
||||
self.assertFalse(self.monitor.has_updates)
|
||||
|
||||
def process_event_unassigned_of_port(self):
|
||||
output = '{"data":[["e040fbec-0579-4990-8324-d338da33ae88","insert",'
|
||||
output += '"m50",["set",[]],["map",[]]]],"headings":["row","action",'
|
||||
output += '"name","ofport","external_ids"]}'
|
||||
with mock.patch.object(
|
||||
self.monitor, 'iter_stdout', return_value=[output]):
|
||||
self.monitor.process_events()
|
||||
self.assertEqual(self.monitor.new_events['added'][0]['ofport'],
|
||||
ovs_lib.UNASSIGNED_OFPORT)
|
||||
|
|
Loading…
Reference in New Issue