diff --git a/hooks/neutron_contexts.py b/hooks/neutron_contexts.py index f4f32c98..5bcb9a2e 100644 --- a/hooks/neutron_contexts.py +++ b/hooks/neutron_contexts.py @@ -77,6 +77,7 @@ class L3AgentContext(OSContextGenerator): ctxt['agent_mode'] = 'legacy' ctxt['rpc_response_timeout'] = api_settings['rpc_response_timeout'] ctxt['report_interval'] = api_settings['report_interval'] + ctxt['use_l3ha'] = api_settings['enable_l3ha'] return ctxt diff --git a/templates/newton/l3_agent.ini b/templates/newton/l3_agent.ini index 27d06c3c..4ff0c2cc 100644 --- a/templates/newton/l3_agent.ini +++ b/templates/newton/l3_agent.ini @@ -30,6 +30,9 @@ gateway_external_network_id = {{ ext_net_id }} external_network_bridge = br-ex {% endif -%} agent_mode = {{ agent_mode }} +{% if use_l3ha -%} +ha_vrrp_health_check_interval = 30 +{% endif -%} [AGENT] extensions = fwaas diff --git a/templates/queens/l3_agent.ini b/templates/queens/l3_agent.ini index 94f590fd..d5e003e3 100644 --- a/templates/queens/l3_agent.ini +++ b/templates/queens/l3_agent.ini @@ -25,6 +25,9 @@ gateway_external_network_id = {{ ext_net_id }} external_network_bridge = br-ex {% endif -%} agent_mode = {{ agent_mode }} +{% if use_l3ha -%} +ha_vrrp_health_check_interval = 30 +{% endif -%} [AGENT] extensions = fwaas diff --git a/unit_tests/test_neutron_contexts.py b/unit_tests/test_neutron_contexts.py index ca86eb57..8e3e0988 100644 --- a/unit_tests/test_neutron_contexts.py +++ b/unit_tests/test_neutron_contexts.py @@ -63,6 +63,7 @@ class TestL3AgentContext(CharmTestCase): DummyNeutronAPIContext(return_value={'enable_dvr': False, 'report_interval': 30, 'rpc_response_timeout': 60, + 'enable_l3ha': True, }) self.test_config.set('run-internal-router', 'none') self.test_config.set('external-network-id', '') @@ -71,6 +72,7 @@ class TestL3AgentContext(CharmTestCase): {'agent_mode': 'legacy', 'report_interval': 30, 'rpc_response_timeout': 60, + 'use_l3ha': True, 'external_configuration_new': True, 'handle_internal_only_router': False, 'plugin': 'ovs'}) @@ -81,6 +83,7 @@ class TestL3AgentContext(CharmTestCase): DummyNeutronAPIContext(return_value={'enable_dvr': False, 'report_interval': 30, 'rpc_response_timeout': 60, + 'enable_l3ha': True, }) self.test_config.set('run-internal-router', 'none') self.test_config.set('ext-port', 'eth1') @@ -89,6 +92,7 @@ class TestL3AgentContext(CharmTestCase): {'agent_mode': 'legacy', 'report_interval': 30, 'rpc_response_timeout': 60, + 'use_l3ha': True, 'handle_internal_only_router': False, 'plugin': 'ovs'}) @@ -98,6 +102,7 @@ class TestL3AgentContext(CharmTestCase): DummyNeutronAPIContext(return_value={'enable_dvr': False, 'report_interval': 30, 'rpc_response_timeout': 60, + 'enable_l3ha': True, }) self.test_config.set('run-internal-router', 'leader') self.test_config.set('external-network-id', 'netid') @@ -106,6 +111,7 @@ class TestL3AgentContext(CharmTestCase): {'agent_mode': 'legacy', 'report_interval': 30, 'rpc_response_timeout': 60, + 'use_l3ha': True, 'handle_internal_only_router': True, 'ext_net_id': 'netid', 'plugin': 'ovs'}) @@ -116,6 +122,7 @@ class TestL3AgentContext(CharmTestCase): DummyNeutronAPIContext(return_value={'enable_dvr': False, 'report_interval': 30, 'rpc_response_timeout': 60, + 'enable_l3ha': True, }) self.test_config.set('run-internal-router', 'all') self.test_config.set('external-network-id', 'netid') @@ -124,6 +131,7 @@ class TestL3AgentContext(CharmTestCase): {'agent_mode': 'legacy', 'report_interval': 30, 'rpc_response_timeout': 60, + 'use_l3ha': True, 'handle_internal_only_router': True, 'ext_net_id': 'netid', 'plugin': 'ovs'}) @@ -134,6 +142,7 @@ class TestL3AgentContext(CharmTestCase): DummyNeutronAPIContext(return_value={'enable_dvr': True, 'report_interval': 30, 'rpc_response_timeout': 60, + 'enable_l3ha': True, }) self.assertEqual(neutron_contexts.L3AgentContext()()['agent_mode'], 'dvr_snat')