]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ovs_neutron_agent: display loaded extensions
authorHaim Daniel <hdaniel@redhat.com>
Thu, 24 Sep 2015 15:53:40 +0000 (18:53 +0300)
committerAssaf Muller <amuller@redhat.com>
Mon, 19 Oct 2015 20:14:43 +0000 (16:14 -0400)
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

neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/functional/agent/test_l2_ovs_agent.py

index 1a584b60778214433e106788ca6ff8aa7f0e161b..e63392ddded944365405ab7511913b6f7d392ed3 100644 (file)
@@ -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(
index 33aa11a31b55d7dcc1029ae35d5626702165ed67..c1baa8bafa245903238d2eb69c9707295b3765c9 100644 (file)
@@ -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'])