Skip to content
Snippets Groups Projects
Commit 4bdeb9f5 authored by Riccardo Bucchi's avatar Riccardo Bucchi
Browse files

Merge branch 'network_extdouble' into 'master'

Network extdouble



See merge request !13
parents e992050f bf0c4a3b
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,8 @@ class iaas::profile::neutron::router ( ...@@ -51,6 +51,8 @@ class iaas::profile::neutron::router (
} }
class { '::neutron::agents::l3': class { '::neutron::agents::l3':
#double_external_network
# external_network_bridge => 'br-ex',
external_network_bridge => ' ', external_network_bridge => ' ',
use_namespaces => true, use_namespaces => true,
router_delete_namespaces => true, router_delete_namespaces => true,
...@@ -73,6 +75,8 @@ class iaas::profile::neutron::router ( ...@@ -73,6 +75,8 @@ class iaas::profile::neutron::router (
} }
class { '::neutron::agents::vpnaas': class { '::neutron::agents::vpnaas':
#double_external_network
# external_network_bridge => "br-ex",
external_network_bridge => ' ', external_network_bridge => ' ',
} }
class { '::neutron::agents::lbaas': } class { '::neutron::agents::lbaas': }
...@@ -110,20 +114,25 @@ class iaas::profile::neutron::router ( ...@@ -110,20 +114,25 @@ class iaas::profile::neutron::router (
local_ip => $local_ip, local_ip => $local_ip,
enabled => true, enabled => true,
tunnel_types => ['gre'], tunnel_types => ['gre'],
#double_external_network, variable modified
#ori bridge_mappings => ['external:br-ex'],
# bridge_mappings => [$bridge_mappings],
bridge_mappings => [$bridge_mappings1,$bridge_mappings2], bridge_mappings => [$bridge_mappings1,$bridge_mappings2],
require => File['etc_default_neutron-server'], require => File['etc_default_neutron-server'],
} }
# $_external_device1 = device_for_network($external_network1)
# notify { "br-ex1: $::brex1_eval": notify { "br-ex1: $::brex1_eval":
# loglevel => alert, loglevel => alert,
# } }
# notify { "br-ex2: $::brex2_eval": notify { "br-ex2: $::brex2_eval":
# loglevel => alert, loglevel => alert,
# } }
# notify { "external device1: $_external_device1 -- external network: $external_network1":
# loglevel => alert, #notify { "external device1: $_external_device1 -- external network: $external_network1":
# } # loglevel => alert,
#}
# Set public network if public_interface != $external_device1 # Set public network if public_interface != $external_device1
if $public_gateway { if $public_gateway {
...@@ -151,6 +160,8 @@ class iaas::profile::neutron::router ( ...@@ -151,6 +160,8 @@ class iaas::profile::neutron::router (
} }
# if $_external_device1 != 'br_ex1' {
# Evaluate br-ex1, if present set it # Evaluate br-ex1, if present set it
if $::brex1_eval != 'br-ex1' { if $::brex1_eval != 'br-ex1' {
...@@ -225,9 +236,11 @@ class iaas::profile::neutron::router ( ...@@ -225,9 +236,11 @@ class iaas::profile::neutron::router (
if $external_device2 { if $external_device2 {
# notify { "external device2: $_external_device2 -- external network: $external_network2": # $_external_device2 = device_for_network($external_network2)
# loglevel => alert, #notify { "external device2: $_external_device2 -- external network: $external_network2":
# } # loglevel => alert,
#}
# if $_external_device2 != 'br_ex2' {
# Evaluate br-ex2, if presetn set it # Evaluate br-ex2, if presetn set it
if $::brex2_eval != 'br-ex2' { if $::brex2_eval != 'br-ex2' {
...@@ -237,29 +250,73 @@ class iaas::profile::neutron::router ( ...@@ -237,29 +250,73 @@ class iaas::profile::neutron::router (
$public_netmask2 = $::facts["netmask_${external_device2}"] $public_netmask2 = $::facts["netmask_${external_device2}"]
$public_macaddr2 = $::facts["macaddress_${external_device2}"] $public_macaddr2 = $::facts["macaddress_${external_device2}"]
network_config { $external_device2: # if $public_ipaddress2 {
ensure => 'present', # network_config { $external_device2:
family => 'inet', # ensure => 'present',
method => 'manual', # family => 'inet',
options => { # method => 'manual',
'up' => "ifconfig ${external_device2} 0.0.0.0 promisc up", # options => {
'down' => "ifconfig ${external_device2} promisc down", # 'up' => "ifconfig ${external_device2} 0.0.0.0 promisc up",
}, # 'down' => "ifconfig ${external_device2} promisc down",
} -> # },
vs_port { $external_device2: # } ->
ensure => present, # network_config { 'br-ex2':
bridge => 'br-ex2', # ensure => 'present',
require => Class['::neutron::agents::ml2::ovs'], # family => 'inet',
} -> # method => 'static',
exec { "set_br-ex2_hwaddr": # ipaddress => $public_ipaddress2,
command => "ovs-vsctl set bridge br-ex2 other-config:hwaddr=$public_macaddr2", # netmask => $public_netmask2,
path => "/usr/local/bin/:/bin/:/usr/bin:/sbin/:/usr/sbin/", # } ->
} # vs_port { $external_device2:
# ensure => present,
# bridge => 'br-ex2',
# require => Class['::neutron::agents::ml2::ovs'],
# } ->
# network_route { 'route_ext2':
# ensure => 'present',
# gateway => $external_gateway2,
# interface => 'br-ex2',
# netmask => '0.0.0.0',
# network => $external_network2,
# require => Package['ifupdown-extra']
# } ->
# exec { "set_br-ex2_hwaddr":
# command => "ovs-vsctl set bridge br-ex2 other-config:hwaddr=$public_macaddr2",
# path => "/usr/local/bin/:/bin/:/usr/bin:/sbin/:/usr/sbin/",
# } ->
# exec { "restart_external2":
# command => "ifconfig $external_device2 0.0.0.0 promisc",
# path => "/usr/local/bin/:/bin/:/sbin/:/usr/sbin/",
# } ->
# exec { "restart_br-ex2":
# command => "ifdown br-ex2 && ifup br-ex2",
# path => "/usr/local/bin/:/bin/:/sbin/:/usr/sbin/",
# }
# } else {
network_config { $external_device2:
ensure => 'present',
family => 'inet',
method => 'manual',
options => {
'up' => "ifconfig ${external_device2} 0.0.0.0 promisc up",
'down' => "ifconfig ${external_device2} promisc down",
},
} ->
vs_port { $external_device2:
ensure => present,
bridge => 'br-ex2',
require => Class['::neutron::agents::ml2::ovs'],
} ->
exec { "set_br-ex2_hwaddr":
command => "ovs-vsctl set bridge br-ex2 other-config:hwaddr=$public_macaddr2",
path => "/usr/local/bin/:/bin/:/usr/bin:/sbin/:/usr/sbin/",
}
# }
} }
} }
##Public/private network configuration for tenant - added ##Public/private network configuration for tenant - added
#class { '::iaas::setup::sharednetwork': } class { '::iaas::setup::sharednetwork': }
} }
# A convenience method to set up a router between # A convenience method to set up a router between
# a private subnet and the public network. The # a private subnet and the public network. The
# $title of the resource is 'tenant:subnet', # $title of the resource is 'routername:subnet',
# where tenant is the name of the tenant to assign # where tenant is the name of the tenant to assign
# the router to and subnet is the name of the # the router to and subnet is the name of the
# subnet to connect the router to. # subnet to connect the router to.
define iaas::setup::router { define iaas::setup::router {
$valarray = split($title, ':') $valarray = split($title, ':')
$tenant = $valarray[0] $tenant = 'test'
$rname = $valarray[0]
$subnet = $valarray[1] $subnet = $valarray[1]
neutron_router { $tenant: if $rname == 'test1' {
tenant_name => $tenant,
gateway_network_name => 'public1',
require => [Neutron_network['public1'], Neutron_subnet[$subnet]]
} ->
neutron_router_interface { $title: neutron_router { $rname:
ensure => present tenant_name => $tenant,
gateway_network_name => 'public1',
require => [Neutron_network['public1'], Neutron_subnet[$subnet]]
} ->
neutron_router_interface { $title:
ensure => present
}
} }
if $rname == 'test2' {
neutron_router { $rname:
tenant_name => $tenant,
gateway_network_name => 'public2',
require => [Neutron_network['public2'], Neutron_subnet[$subnet]]
} ->
neutron_router_interface { $title:
ensure => present
}
}
} }
...@@ -31,7 +31,7 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}" ...@@ -31,7 +31,7 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}"
provider_physical_network => 'physnet1', provider_physical_network => 'physnet1',
shared => false, shared => false,
} -> } ->
neutron_subnet { $external_network1: neutron_subnet { "public1-$external_network1":
cidr => $external_network1, cidr => $external_network1,
ip_version => '4', ip_version => '4',
gateway_ip => $gateway1, gateway_ip => $gateway1,
...@@ -64,7 +64,7 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}" ...@@ -64,7 +64,7 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}"
provider_physical_network => 'physnet2', provider_physical_network => 'physnet2',
shared => false, shared => false,
} -> } ->
neutron_subnet { $external_network2: neutron_subnet { "public2-$external_network2":
cidr => $external_network2, cidr => $external_network2,
ip_version => '4', ip_version => '4',
gateway_ip => $gateway2, gateway_ip => $gateway2,
...@@ -91,9 +91,9 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}" ...@@ -91,9 +91,9 @@ $ip_range2 = "start=${start_ip2},end=${end_ip2}"
} }
# router setup for the tenant test # router setup for the tenant test
# iaas::setup::router { "test:${private_network1}": } iaas::setup::router { "test1:${private_network1}": }
# if $external_network2 { if $external_network2 {
# iaas::setup::router { "test:${private_network2}": } iaas::setup::router { "test2:${private_network2}": }
# } }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment