Adds l3_extension_plugins to L3AgentContext ctx
* get a list of l3 plugins to enable based on relation data coming from neutron-api; * refactor adding fwaasv2 service plugins to the l3 agent to accommodate the l3_extension_plugins change. See https://github.com/juju/charm-helpers/pull/370 See LP: #1842353 Change-Id: Ic3a8e302942ed331bc3d80223e123c13d61db3b2 Closes-Bug: #1842353
This commit is contained in:
parent
07865bd62c
commit
5ec43f6dbe
@ -110,6 +110,21 @@ class L3AgentContext(OSContextGenerator):
|
||||
ctxt['rpc_response_timeout'] = api_settings['rpc_response_timeout']
|
||||
ctxt['report_interval'] = api_settings['report_interval']
|
||||
ctxt['use_l3ha'] = api_settings['enable_l3ha']
|
||||
|
||||
cmp_os_release = CompareOpenStackReleases(os_release('neutron-common'))
|
||||
|
||||
l3_extension_plugins = api_settings.get('l3_extension_plugins', [])
|
||||
# per Change-Id If1b332eb0f581e9acba111f79ba578a0b7081dd2
|
||||
# only enable it for stein although fwaasv2 was added in Queens
|
||||
is_stein = cmp_os_release >= 'stein'
|
||||
if is_stein:
|
||||
l3_extension_plugins.append('fwaas_v2')
|
||||
|
||||
if (is_stein and api_settings.get('enable_nfg_logging')):
|
||||
l3_extension_plugins.append('fwaas_v2_log')
|
||||
|
||||
ctxt['l3_extension_plugins'] = ','.join(l3_extension_plugins)
|
||||
|
||||
return ctxt
|
||||
|
||||
|
||||
|
33
templates/rocky/l3_agent.ini
Normal file
33
templates/rocky/l3_agent.ini
Normal file
@ -0,0 +1,33 @@
|
||||
# newton
|
||||
###############################################################################
|
||||
# [ WARNING ]
|
||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||
###############################################################################
|
||||
[DEFAULT]
|
||||
interface_driver = openvswitch
|
||||
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
handle_internal_only_routers = {{ handle_internal_only_router }}
|
||||
{% if plugin == 'n1kv' %}
|
||||
l3_agent_manager = neutron.agent.l3_agent.L3NATAgentWithStateReport
|
||||
external_network_bridge = br-int
|
||||
ovs_use_veth = False
|
||||
use_namespaces = True
|
||||
{% else %}
|
||||
ovs_use_veth = True
|
||||
{% endif %}
|
||||
{% if external_configuration_new -%}
|
||||
gateway_external_network_id =
|
||||
external_network_bridge =
|
||||
{% elif ext_net_id %}
|
||||
gateway_external_network_id = {{ ext_net_id }}
|
||||
{% else %}
|
||||
# Set default to deprecated external networking config
|
||||
external_network_bridge = br-ex
|
||||
{% endif -%}
|
||||
agent_mode = {{ agent_mode }}
|
||||
{% if use_l3ha -%}
|
||||
ha_vrrp_health_check_interval = 30
|
||||
{% endif -%}
|
||||
|
||||
[AGENT]
|
||||
extensions = {{ l3_extension_plugins }}
|
@ -30,8 +30,8 @@ ha_vrrp_health_check_interval = 30
|
||||
{% endif -%}
|
||||
|
||||
[AGENT]
|
||||
extensions = {{ l3_extension_plugins }}
|
||||
{% if enable_nfg_logging -%}
|
||||
extensions = fwaas_v2,fwaas_v2_log
|
||||
[network_log]
|
||||
{% if nfg_log_rate_limit -%}
|
||||
rate_limit = {{ nfg_log_rate_limit }}
|
||||
@ -40,6 +40,4 @@ burst_limit = {{ nfg_log_burst_limit }}
|
||||
{% if nfg_log_output_base -%}
|
||||
local_output_log_base = {{ nfg_log_output_base }}
|
||||
{% endif -%}
|
||||
{% else %}
|
||||
extensions = fwaas_v2
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
@ -59,6 +59,7 @@ class TestL3AgentContext(CharmTestCase):
|
||||
|
||||
@patch('neutron_contexts.NeutronAPIContext')
|
||||
def test_new_ext_network(self, _NeutronAPIContext):
|
||||
self.os_release.return_value = 'stein'
|
||||
_NeutronAPIContext.return_value = \
|
||||
DummyNeutronAPIContext(return_value={'enable_dvr': False,
|
||||
'report_interval': 30,
|
||||
@ -75,10 +76,13 @@ class TestL3AgentContext(CharmTestCase):
|
||||
'use_l3ha': True,
|
||||
'external_configuration_new': True,
|
||||
'handle_internal_only_router': False,
|
||||
'plugin': 'ovs'})
|
||||
'plugin': 'ovs',
|
||||
'l3_extension_plugins': 'fwaas_v2',
|
||||
})
|
||||
|
||||
@patch('neutron_contexts.NeutronAPIContext')
|
||||
def test_old_ext_network(self, _NeutronAPIContext):
|
||||
self.os_release.return_value = 'rocky'
|
||||
_NeutronAPIContext.return_value = \
|
||||
DummyNeutronAPIContext(return_value={'enable_dvr': False,
|
||||
'report_interval': 30,
|
||||
@ -94,15 +98,19 @@ class TestL3AgentContext(CharmTestCase):
|
||||
'rpc_response_timeout': 60,
|
||||
'use_l3ha': True,
|
||||
'handle_internal_only_router': False,
|
||||
'plugin': 'ovs'})
|
||||
'plugin': 'ovs',
|
||||
'l3_extension_plugins': '',
|
||||
})
|
||||
|
||||
@patch('neutron_contexts.NeutronAPIContext')
|
||||
def test_hior_leader(self, _NeutronAPIContext):
|
||||
self.os_release.return_value = 'rocky'
|
||||
_NeutronAPIContext.return_value = \
|
||||
DummyNeutronAPIContext(return_value={'enable_dvr': False,
|
||||
'report_interval': 30,
|
||||
'rpc_response_timeout': 60,
|
||||
'enable_l3ha': True,
|
||||
'l3_extension_plugins': '',
|
||||
})
|
||||
self.test_config.set('run-internal-router', 'leader')
|
||||
self.test_config.set('external-network-id', 'netid')
|
||||
@ -114,10 +122,13 @@ class TestL3AgentContext(CharmTestCase):
|
||||
'use_l3ha': True,
|
||||
'handle_internal_only_router': True,
|
||||
'ext_net_id': 'netid',
|
||||
'plugin': 'ovs'})
|
||||
'plugin': 'ovs',
|
||||
'l3_extension_plugins': '',
|
||||
})
|
||||
|
||||
@patch('neutron_contexts.NeutronAPIContext')
|
||||
def test_hior_all(self, _NeutronAPIContext):
|
||||
self.os_release.return_value = 'rocky'
|
||||
_NeutronAPIContext.return_value = \
|
||||
DummyNeutronAPIContext(return_value={'enable_dvr': False,
|
||||
'report_interval': 30,
|
||||
@ -134,10 +145,13 @@ class TestL3AgentContext(CharmTestCase):
|
||||
'use_l3ha': True,
|
||||
'handle_internal_only_router': True,
|
||||
'ext_net_id': 'netid',
|
||||
'plugin': 'ovs'})
|
||||
'plugin': 'ovs',
|
||||
'l3_extension_plugins': '',
|
||||
})
|
||||
|
||||
@patch('neutron_contexts.NeutronAPIContext')
|
||||
def test_dvr(self, _NeutronAPIContext):
|
||||
self.os_release.return_value = 'rocky'
|
||||
_NeutronAPIContext.return_value = \
|
||||
DummyNeutronAPIContext(return_value={'enable_dvr': True,
|
||||
'report_interval': 30,
|
||||
@ -305,6 +319,7 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
@patch('charmhelpers.contrib.openstack.context.relation_ids')
|
||||
@patch.object(neutron_contexts, 'get_shared_secret')
|
||||
def test_dhcp_settings(self, _secret, _rids, _runits, _rget):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
self.test_config.set('enable-isolated-metadata', True)
|
||||
self.test_config.set('enable-metadata-network', True)
|
||||
self.network_get_primary_address.return_value = '192.168.20.2'
|
||||
@ -318,6 +333,7 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
@patch('charmhelpers.contrib.openstack.context.relation_ids')
|
||||
@patch.object(neutron_contexts, 'get_shared_secret')
|
||||
def test_dhcp_setting_plug_override(self, _secret, _rids, _runits, _rget):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
self.test_config.set('plugin', 'nsx')
|
||||
self.test_config.set('enable-isolated-metadata', False)
|
||||
self.test_config.set('enable-metadata-network', False)
|
||||
@ -335,6 +351,8 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
def test_availability_zone_no_juju_with_env(self, _secret, _rids,
|
||||
_runits, _rget,
|
||||
mock_get):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
|
||||
def environ_get_side_effect(key):
|
||||
return {
|
||||
'JUJU_AVAILABILITY_ZONE': 'az1',
|
||||
@ -358,6 +376,8 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
def test_availability_zone_no_juju_no_env(self, _secret, _rids,
|
||||
_runits, _rget,
|
||||
mock_get, mock_config):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
|
||||
def environ_get_side_effect(key):
|
||||
return {
|
||||
'JUJU_AVAILABILITY_ZONE': '',
|
||||
@ -386,6 +406,8 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
def test_availability_zone_juju(self, _secret, _rids,
|
||||
_runits, _rget,
|
||||
mock_get, mock_config):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
|
||||
def environ_get_side_effect(key):
|
||||
return {
|
||||
'JUJU_AVAILABILITY_ZONE': 'az1',
|
||||
@ -404,6 +426,7 @@ class TestNeutronGatewayContext(CharmTestCase):
|
||||
@patch('charmhelpers.contrib.openstack.context.relation_ids')
|
||||
@patch.object(neutron_contexts, 'get_shared_secret')
|
||||
def test_nfg_min_settings(self, _secret, _rids, _runits, _rget):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
self.test_config.set('firewall-group-log-rate-limit', 90)
|
||||
self.test_config.set('firewall-group-log-burst-limit', 20)
|
||||
self.network_get_primary_address.return_value = '192.168.20.2'
|
||||
|
Loading…
x
Reference in New Issue
Block a user