diff --git a/hooks/quantum_contexts.py b/hooks/quantum_contexts.py index 508bdac1..78f4f519 100644 --- a/hooks/quantum_contexts.py +++ b/hooks/quantum_contexts.py @@ -111,6 +111,7 @@ def _neutron_api_settings(): ''' neutron_settings = { 'l2_population': False, + 'enable_dvr': False, 'overlay_network_type': 'gre', } @@ -119,10 +120,11 @@ def _neutron_api_settings(): rdata = relation_get(rid=rid, unit=unit) if 'l2-population' not in rdata: continue - neutron_settings = { - 'l2_population': rdata['l2-population'], - 'overlay_network_type': rdata['overlay-network-type'], - } + neutron_settings['l2_population'] = rdata['l2-population'] + if 'overlay-network-type' in rdata: + neutron_settings['overlay_network_type'] = rdata['overlay-network-type'] + if 'enable-dvr' in rdata: + neutron_settings['enable_dvr'] = rdata['enable-dvr'] return neutron_settings return neutron_settings @@ -158,6 +160,7 @@ class NetworkServiceContext(OSContextGenerator): class L3AgentContext(OSContextGenerator): def __call__(self): + neutron_api_settings = _neutron_api_settings() ctxt = {} if config('run-internal-router') == 'leader': ctxt['handle_internal_only_router'] = eligible_leader(None) @@ -170,9 +173,12 @@ class L3AgentContext(OSContextGenerator): if config('external-network-id'): ctxt['ext_net_id'] = config('external-network-id') - if config('plugin'): ctxt['plugin'] = config('plugin') + if neutron_api_settings['enable_dvr'] == 'True': + ctxt['agent_mode'] = 'dvr_snat' + else: + ctxt['agent_mode'] = 'legacy' return ctxt @@ -243,6 +249,7 @@ class QuantumGatewayContext(OSContextGenerator): 'verbose': config('verbose'), 'instance_mtu': config('instance-mtu'), 'l2_population': neutron_api_settings['l2_population'], + 'enable_dvr': neutron_api_settings['enable_dvr'], 'overlay_network_type': neutron_api_settings['overlay_network_type'], } diff --git a/hooks/quantum_utils.py b/hooks/quantum_utils.py index 857f8d9a..eac92d50 100644 --- a/hooks/quantum_utils.py +++ b/hooks/quantum_utils.py @@ -413,6 +413,9 @@ def register_configs(): drop_config = NEUTRON_ML2_PLUGIN_CONF if release >= 'icehouse': drop_config = NEUTRON_OVS_PLUGIN_CONF + # NOTE(gnuoy) neutron-vpn-agent supercedes l3-agent for icehouse + CONFIG_FILES[name][plugin][NEUTRON_L3_AGENT_CONF]['services'] = \ + ['neutron-vpn-agent'] if drop_config in CONFIG_FILES[name][plugin]: CONFIG_FILES[name][plugin].pop(drop_config) diff --git a/templates/juno/l3_agent.ini b/templates/juno/l3_agent.ini new file mode 100644 index 00000000..6fd6cd4b --- /dev/null +++ b/templates/juno/l3_agent.ini @@ -0,0 +1,25 @@ +############################################################################### +# [ WARNING ] +# Configuration file maintained by Juju. Local changes may be overwritten. +############################################################################### +[DEFAULT] +interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver +auth_url = {{ service_protocol }}://{{ keystone_host }}:{{ service_port }}/v2.0 +auth_region = {{ region }} +admin_tenant_name = {{ service_tenant }} +admin_user = {{ service_username }} +admin_password = {{ service_password }} +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 ext_net_id -%} +gateway_external_network_id = {{ ext_net_id }} +{% endif -%} +agent_mode = {{ agent_mode }} diff --git a/templates/juno/ml2_conf.ini b/templates/juno/ml2_conf.ini new file mode 100644 index 00000000..5354b4c2 --- /dev/null +++ b/templates/juno/ml2_conf.ini @@ -0,0 +1,33 @@ +############################################################################### +# [ WARNING ] +# Configuration file maintained by Juju. Local changes may be overwritten. +############################################################################### +[ml2] +type_drivers = gre,vxlan,vlan,flat +tenant_network_types = gre,vxlan,vlan,flat +mechanism_drivers = openvswitch,l2population + +[ml2_type_gre] +tunnel_id_ranges = 1:1000 + +[ml2_type_vxlan] +vni_ranges = 1001:2000 + +[ml2_type_vlan] +network_vlan_ranges = physnet1:1000:2000 + +[ml2_type_flat] +flat_networks = physnet1 + +[ovs] +enable_tunneling = True +local_ip = {{ local_ip }} +bridge_mappings = physnet1:br-data + +[agent] +tunnel_types = {{ overlay_network_type }} +l2_population = {{ l2_population }} +enable_distributed_routing = {{ enable_dvr }} + +[securitygroup] +firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver