Skip to content

Commit

Permalink
Merge "[OVN] Fix get/update/delete of non-OVN agents"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Sep 19, 2020
2 parents f65712f + 0a785e9 commit 9b02bc8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py
Expand Up @@ -1145,7 +1145,7 @@ def fn(slf, *args, **kwargs):
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))
Expand Down
Expand Up @@ -742,3 +742,24 @@ def test_network_segments_localnet_ports(self):
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().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']))

0 comments on commit 9b02bc8

Please sign in to comment.