From 7562a598b5ad4a931fb306b32121a45d97ec70e2 Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Wed, 15 Apr 2015 14:16:46 -0500 Subject: [PATCH] ml2_conf.ini OVS values were missing On ubuntu, the openvswitch template is rendered into the ml2 template. Some of openvswitch template variables were missing from the ml2 template definition. Change-Id: I62274d2a1c15e6d7e2a5079b0182513ee18f67b2 Closes-Bug: #1444647 --- recipes/default.rb | 23 ++++++++------ spec/default_spec.rb | 76 +++++++++++++++++++++++++++++--------------- 2 files changed, 65 insertions(+), 34 deletions(-) diff --git a/recipes/default.rb b/recipes/default.rb index 9000f51f..72026c32 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -226,6 +226,16 @@ end template_file = nil +# Common template values (between ML2 and Openvswitch) +tunnel_types = node['openstack']['network']['openvswitch']['tunnel_types'] +l2_population = 'False' +enable_distributed_routing = 'False' +if ['auto', 'true', true].include?(node['openstack']['network']['l3']['router_distributed']) + tunnel_types = 'gre, vxlan' + l2_population = 'True' + enable_distributed_routing = 'True' +end + case main_plugin when 'bigswitch' @@ -341,7 +351,10 @@ when 'ml2' mode 00644 variables( mechanism_drivers: mechanism_drivers, - local_ip: openvswitch_endpoint.host + local_ip: openvswitch_endpoint.host, + tunnel_types: tunnel_types, + l2_population: l2_population, + enable_distributed_routing: enable_distributed_routing ) notifies :restart, 'service[neutron-server]', :delayed if role_match @@ -380,14 +393,6 @@ when 'openvswitch' openvswitch_endpoint = endpoint 'network-openvswitch' template_file = '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini' - tunnel_types = node['openstack']['network']['openvswitch']['tunnel_types'] - l2_population = 'False' - enable_distributed_routing = 'False' - if ['auto', 'true', true].include?(node['openstack']['network']['l3']['router_distributed']) - tunnel_types = 'gre, vxlan' - l2_population = 'True' - enable_distributed_routing = 'True' - end template template_file do source 'plugins/openvswitch/ovs_neutron_plugin.ini.erb' diff --git a/spec/default_spec.rb b/spec/default_spec.rb index 8b194ff0..f6ca800d 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -71,31 +71,57 @@ describe 'openstack-network' do PLUGIN_MAP['brocade'], physical_interface_mappings: '' - it_behaves_like 'core plugin common configurator', - 'ml2', - PLUGIN_MAP['ml2'], - type_drivers: 'local,flat,vlan,gre,vxlan', - tenant_network_types: 'local', - mechanism_drivers: 'openvswitch', - flat_networks: '', - network_vlan_ranges: '', - tunnel_id_ranges: '', - vni_ranges: '', - vxlan_group: '', - enable_security_group: 'True', - enable_ipset: 'True' - # TODO: MRV - # OVS section is in there, need refactor this code to be able to - # handle sections and different attribute namespaces - # - # tenant_network_type: 'local', - # enable_tunneling: 'False', - # integration_bridge: 'br-int', - # tunnel_bridge: 'br-tun', - # local_ip: 'openvswitch_host', - # polling_interval: '2', - # veth_mtu: '1500', - # firewall_driver: 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver' + describe 'ml2' do + let(:file) { chef_run.template('/etc/neutron/plugins/ml2/ml2_conf.ini') } + + it_behaves_like 'core plugin common configurator', + 'ml2', + PLUGIN_MAP['ml2'], + type_drivers: 'local,flat,vlan,gre,vxlan', + tenant_network_types: 'local', + mechanism_drivers: 'openvswitch', + flat_networks: '', + network_vlan_ranges: '', + tunnel_id_ranges: '', + vni_ranges: '', + vxlan_group: '', + enable_security_group: 'True', + enable_ipset: 'True' + + it 'sets related attributes for openvswitch section' do + [ + /^tenant_network_type = local$/, + /^enable_tunneling = False$/, + /^tunnel_type = $/, + /^integration_bridge = br-int$/, + /^tunnel_bridge = br-tun$/, + /^local_ip = 127.0.0.1$/ + ].each do |line| + expect(chef_run).to render_config_file(file.name).with_section_content('OVS', line) + end + end + + it 'sets related attributes for agent section' do + [ + /^polling_interval = 2$/, + /^tunnel_types = $/, + /^veth_mtu = 1500$/, + /^l2_population = False$/, + /^enable_distributed_routing = False$/ + ].each do |line| + expect(chef_run).to render_config_file(file.name).with_section_content('agent', line) + end + end + + it 'sets related attributes for securitygroup section' do + [ + /^firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver$/, + /^enable_security_group = True$/ + ].each do |line| + expect(chef_run).to render_config_file(file.name).with_section_content('securitygroup', line) + end + end + end describe 'cisco' do let(:nexus_switch_value) do {