[Ironic] Add baremetal network for Ironic

This change introduces configuration of new flat network in Neutron.
In case if network settings contains information about 'physnet-ironic'
physnet then Ironic is enabled and 'baremetal' flat network should be
configured in neutron settings.

Partially Implemets: blueprint fuel-integrate-ironic

Change-Id: Icdb557063bbaf5bb0b5b6ac6c8233e3c3b17e94c
This commit is contained in:
Andrey Shestakov
2015-09-17 15:31:09 +03:00
committed by vsaienko
parent 76fc67e271
commit 09a968226f
6 changed files with 122 additions and 4 deletions

View File

@@ -86,4 +86,35 @@ if $use_neutron {
dns_nameservers => try_get_value($nets, 'net04/L3/nameservers'),
}
if has_key($nets, 'baremetal') {
$baremetal_physnet = try_get_value($nets, 'baremetal/L2/physnet', false)
$baremetal_segment_id = try_get_value($nets, 'baremetal/L2/segment_id')
$baremetal_router_external = try_get_value($nets, 'baremetal/L2/router_ext')
$baremetal_shared = try_get_value($nets, 'baremetal/shared', false)
neutron_network { 'baremetal' :
ensure => 'present',
provider_physical_network => $baremetal_physnet,
provider_network_type => 'flat',
provider_segmentation_id => $baremetal_segment_id,
router_external => $baremetal_router_external,
tenant_name => $tenant_name,
shared => $baremetal_shared
} ->
neutron_subnet { 'baremetal__subnet' :
ensure => 'present',
cidr => try_get_value($nets, 'baremetal/L3/subnet'),
network_name => 'baremetal',
tenant_name => $tenant_name,
gateway_ip => try_get_value($nets, 'baremetal/L3/gateway'),
enable_dhcp => true,
dns_nameservers => try_get_value($nets, 'baremetal/L3/nameservers'),
} ->
neutron_router_interface { "router04:baremetal__subnet":
ensure => 'present',
}
}
}

View File

@@ -45,7 +45,16 @@ if $use_neutron {
$network_vlan_ranges = ["physnet2:${$network_vlan_ranges_physnet2}"]
$physnet2_bridge = try_get_value($neutron_config, 'L2/phys_nets/physnet2/bridge')
$physnet2 = "physnet2:${physnet2_bridge}"
$bridge_mappings = [$physnet2]
$physnet_ironic_bridge = try_get_value($neutron_config, 'L2/phys_nets/physnet-ironic/bridge', false)
if $physnet_ironic_bridge {
$physnet_ironic = "physnet-ironic:${physnet_ironic_bridge}"
}else {
$physnet_ironic = []
}
$physnets_array = [$physnet2, $physnet_ironic]
$bridge_mappings = delete_undef_values($physnets_array)
$physical_network_mtus = ["physnet2:${physical_net_mtu}"]
$tunnel_id_ranges = []
$network_type = 'vlan'

View File

@@ -20,9 +20,9 @@
- id: openstack-network-common-config
type: puppet
groups: [primary-controller,controller,compute]
groups: [primary-controller,controller,compute,ironic]
required_for: [openstack-network]
requires: [neutron-keystone, neutron-db, netconfig, openstack-controller, top-role-compute]
requires: [neutron-keystone, neutron-db, netconfig, openstack-controller, top-role-compute, ironic-compute]
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-network/common-config.pp
puppet_modules: /etc/puppet/modules
@@ -40,7 +40,7 @@
- id: openstack-network-plugins-l2
type: puppet
groups: [primary-controller,controller,compute]
groups: [primary-controller,controller,compute,ironic]
required_for: [openstack-network]
requires: [openstack-network-common-config,openstack-network-server-config,netconfig]
parameters:

View File

@@ -3,5 +3,37 @@ require 'shared-examples'
manifest = 'openstack-network/networks.pp'
describe manifest do
shared_examples 'catalog' do
if Noop.hiera('use_neutron')
neutron_config = Noop.hiera 'neutron_config'
nets = neutron_config['predefined_networks']
if Noop.hiera 'primary_controller' and nets.has_key?('baremetal')
it 'should create baremetal network' do
should contain_neutron_network('baremetal').with(
'ensure' => 'present',
'provider_physical_network' => nets['baremetal']['L2']['physnet'],
'provider_network_type' => 'flat',
'provider_segmentation_id' => nets['baremetal']['L2']['segment_id'],
'router_external' => nets['baremetal']['L2']['router_ext'],
'shared' => nets['baremetal']['shared'],
)
end
it 'should create baremetal network_subnet' do
should contain_neutron_subnet('baremetal__subnet').with(
'ensure' => 'present',
'cidr' => nets['baremetal']['L3']['subnet'],
'network_name' => 'baremetal',
'gateway_ip' => nets['baremetal']['L3']['gateway'],
'enable_dhcp' => 'true',
'dns_nameservers' => nets['baremetal']['L3']['nameservers'],
)
should contain_neutron_subnet('baremetal__subnet').that_comes_before(
'neutron_router_interface[router04:baremetal__subnet]'
)
end
end
end
end #end of shared_examples
test_ubuntu_and_centos manifest
end

View File

@@ -236,6 +236,26 @@ describe manifest do
)
end
end
if Noop.hiera('use_neutron')
neutron_config = Noop.hiera_structure 'quantum_settings'
pnets = neutron_config['L2']['phys_nets']
if pnets['physnet1']
physnet1 = "physnet1:#{pnets['physnet1']['bridge']}"
end
if pnets['physnet2']
physnet2 = "physnet2:#{pnets['physnet2']['bridge']}"
end
if pnets['physnet-ironic']
physnet_ironic = "physnet-ironic:#{pnets['physnet-ironic']['bridge']}"
end
physnets_array = [physnet1, physnet2, physnet_ironic]
bridge_mappings = physnets_array.compact
it 'should declare neutron::agents::ml2::ovs with ironic bridge_mappings' do
should contain_class('neutron::agents::ml2::ovs').with(
'bridge_mappings' => bridge_mappings
)
end
end
end
enable = Noop.hiera('use_neutron')

View File

@@ -3,6 +3,32 @@ require 'shared-examples'
manifest = 'openstack-network/plugins/ml2.pp'
describe manifest do
shared_examples 'catalog' do
if Noop.hiera('use_neutron')
neutron_config = Noop.hiera_structure 'quantum_settings'
pnets = neutron_config['L2']['phys_nets']
segmentation_type = neutron_config['L2']['segmentation_type']
if segmentation_type == 'vlan'
physnet2 = "physnet2:#{pnets['physnet2']['bridge']}"
if pnets['physnet-ironic']
physnet_ironic = "physnet-ironic:#{pnets['physnet-ironic']['bridge']}"
else
physnet_ironic = []
end
physnets_array = [physnet2, physnet_ironic]
bridge_mappings = physnets_array.compact
it 'should declare neutron::agents::ml2::ovs with bridge_mappings' do
should contain_class('neutron::agents::ml2::ovs').with(
'bridge_mappings' => bridge_mappings
)
end
end
end
end
test_ubuntu_and_centos manifest
end