Browse Source

Merge "Fix get/update/delete of non-OVN agents" into stable/train

changes/32/764632/1
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
5373868362
2 changed files with 22 additions and 1 deletions
  1. +1
    -1
      networking_ovn/ml2/mech_driver.py
  2. +21
    -0
      networking_ovn/tests/functional/test_mech_driver.py

+ 1
- 1
networking_ovn/ml2/mech_driver.py View File

@ -1055,7 +1055,7 @@ class OVNMechanismDriver(api.MechanismDriver):
new_method = types.MethodType(new_fn, self._plugin)
try:
return new_method(*args, _driver=self, **kwargs)
except KeyError:
except n_exc.NotFound:
return old_method(*args, **kwargs)
setattr(self._plugin, method_name, types.MethodType(fn, self._plugin))


+ 21
- 0
networking_ovn/tests/functional/test_mech_driver.py View File

@ -670,3 +670,24 @@ class TestProvnetPorts(base.TestOVNFunctionalBase):
ovn_localnetport = self._find_port_row_by_name(
utils.ovn_provnet_port_name(seg_2['id']))
self.assertIsNone(ovn_localnetport)
class TestAgentApi(base.TestOVNFunctionalBase):
def setUp(self):
super(TestAgentApi, self).setUp()
self.host = 'test-host'
self.add_fake_chassis(self.host)
self.plugin = self.mech_driver._plugin
agent = {'agent_type': 'test', 'binary': '/bin/test',
'host': self.host, 'topic': 'test_topic'}
self.plugin.create_or_update_agent(self.context, agent)
def get_agent(self, agent_type):
return next(iter(self.plugin.get_agents(
self.context, filters={'agent_type': agent_type})))
def test_agent_show(self):
for agent_type in ('test', ovn_const.OVN_CONTROLLER_AGENT):
agent = self.get_agent(agent_type)
self.assertTrue(self.plugin.get_agent(self.context, agent['id']))

Loading…
Cancel
Save