From b7b6f3fe823994fdacde6e87a6a1f62692508fbe Mon Sep 17 00:00:00 2001 From: Haim Daniel Date: Thu, 24 Sep 2015 18:53:40 +0300 Subject: [PATCH] ovs_neutron_agent: display loaded extensions Currently neutron agent-show command does not provide the visibility for the loaded extensions. This commit fixes that. DocImpact Change-Id: Iab101682df4676ad3ca2531356a1de8f2a2d4f14 Closes-Bug: #1497969 --- .../openvswitch/agent/ovs_neutron_agent.py | 35 ++++++++++--------- .../functional/agent/test_l2_ovs_agent.py | 12 +++++++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index 1a584b607..e63392ddd 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -201,23 +201,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.arp_responder_enabled = arp_responder and self.l2_pop self.prevent_arp_spoofing = prevent_arp_spoofing - self.agent_state = { - 'binary': 'neutron-openvswitch-agent', - 'host': self.conf.host, - 'topic': n_const.L2_AGENT_TOPIC, - 'configurations': {'bridge_mappings': bridge_mappings, - 'tunnel_types': self.tunnel_types, - 'tunneling_ip': local_ip, - 'l2_population': self.l2_pop, - 'arp_responder_enabled': - self.arp_responder_enabled, - 'enable_distributed_routing': - self.enable_distributed_routing, - 'log_agent_heartbeats': - self.conf.AGENT.log_agent_heartbeats}, - 'agent_type': self.conf.AGENT.agent_type, - 'start_flag': True} - if tunnel_types: self.enable_tunneling = True else: @@ -282,6 +265,24 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.enable_tunneling, self.enable_distributed_routing) + self.agent_state = { + 'binary': 'neutron-openvswitch-agent', + 'host': self.conf.host, + 'topic': n_const.L2_AGENT_TOPIC, + 'configurations': {'bridge_mappings': bridge_mappings, + 'tunnel_types': self.tunnel_types, + 'tunneling_ip': local_ip, + 'l2_population': self.l2_pop, + 'arp_responder_enabled': + self.arp_responder_enabled, + 'enable_distributed_routing': + self.enable_distributed_routing, + 'log_agent_heartbeats': + self.conf.AGENT.log_agent_heartbeats, + 'extensions': self.ext_manager.names()}, + 'agent_type': self.conf.AGENT.agent_type, + 'start_flag': True} + report_interval = self.conf.AGENT.report_interval if report_interval: heartbeat = loopingcall.FixedIntervalLoopingCall( diff --git a/neutron/tests/functional/agent/test_l2_ovs_agent.py b/neutron/tests/functional/agent/test_l2_ovs_agent.py index 33aa11a31..c1baa8baf 100644 --- a/neutron/tests/functional/agent/test_l2_ovs_agent.py +++ b/neutron/tests/functional/agent/test_l2_ovs_agent.py @@ -104,3 +104,15 @@ class TestOVSAgent(base.OVSAgentTestFramework): while not done(): self.agent.setup_integration_br() time.sleep(0.25) + + +class TestOVSAgentExtensionConfig(base.OVSAgentTestFramework): + def setUp(self): + super(TestOVSAgentExtensionConfig, self).setUp() + self.config.set_override('extensions', ['qos'], 'agent') + self.agent = self.create_agent(create_tunnels=False) + + def test_report_loaded_extension(self): + self.agent._report_state() + agent_state = self.agent.state_rpc.report_state.call_args[0][1] + self.assertEqual(['qos'], agent_state['configurations']['extensions']) -- 2.45.2