Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iaas-ha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OCP-TOOLS
iaas-ha
Commits
adb6b2c0
Commit
adb6b2c0
authored
9 years ago
by
Alessandro Costantini
Browse files
Options
Downloads
Patches
Plain Diff
Classes added to configure Public/private network and router for the selected tenant.
parent
061be8de
No related branches found
No related tags found
1 merge request
!9
Development
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
manifests/profile/neutron/router.pp
+32
-21
32 additions, 21 deletions
manifests/profile/neutron/router.pp
manifests/setup/router.pp
+22
-0
22 additions, 0 deletions
manifests/setup/router.pp
manifests/setup/sharednetwork.pp
+67
-0
67 additions, 0 deletions
manifests/setup/sharednetwork.pp
with
121 additions
and
21 deletions
manifests/profile/neutron/router.pp
+
32
−
21
View file @
adb6b2c0
...
...
@@ -66,9 +66,7 @@ class iaas::profile::neutron::router (
}
if
$ipaddress_br_ex
==
''
{
#Costa
# $local_ip = $::facts["ipaddress_${public_interface}"]
$local_ip
=
$::ipaddress
$local_ip
=
$::facts
[
"ipaddress_
${public_interface}
"
]
}
else
{
$local_ip
=
$::ipaddress_br_ex
}
...
...
@@ -78,29 +76,38 @@ class iaas::profile::neutron::router (
enabled
=>
true
,
tunnel_types
=>
[
'gre'
],
bridge_mappings
=>
[
'external:br-ex'
],
#Costa
# require => File['etc_default_neutron-server'],
require
=>
File
[
'/etc/default/neutron-server'
],
require
=>
File
[
'etc_default_neutron-server'
],
}
#Costa
# $_external_device = device_for_network($external_network)
# if $_external_device != 'br_ex' {
$_external_device
=
'br-ex'
if
$_external_device
!=
'br-ex'
{
$_external_device
=
device_for_network
(
$external_network
)
#added alert for notification (debug)
#notify {"debug message: ${external_network}; ${_external_device}":
#loglevel => alert
#}
if
$_external_device
!=
'br_ex'
{
# Store initial configuration from the public interface (assigned by DHCP) to restore on br-ex
$public_ipaddress
=
$::facts
[
"ipaddress_
${public_interface}
"
]
$public_netmask
=
$::facts
[
"netmask_
${public_interface}
"
]
network_config
{
$external_device
:
ensure
=>
'present'
,
family
=>
'inet'
,
method
=>
'manual'
,
options
=>
{
'up'
=>
"ifconfig
${external_device}
promisc up"
,
'down'
=>
"ifconfig
${external_device}
promisc down"
,
},
}
->
#added alert for notification (debug)
#notify {"debug message: ${_external_device}; ${external_device}":
#loglevel => alert
#}
#Commented, external device left unchanged
# network_config { $_external_device:
# ensure => 'present',
# family => 'inet',
# method => 'manual',
# method => dhcp,
# options => {
# 'up' => "ifconfig ${external_device} promisc up",
# 'down' => "ifconfig ${external_device} promisc down",
# },
# } ->
network_config
{
'br-ex'
:
ensure
=>
'present'
,
family
=>
'inet'
,
...
...
@@ -108,7 +115,7 @@ class iaas::profile::neutron::router (
ipaddress
=>
$public_ipaddress
,
netmask
=>
$public_netmask
,
}
->
vs_port
{
$external_device
:
vs_port
{
$
_
external_device
:
ensure
=>
present
,
bridge
=>
'br-ex'
,
require
=>
Class
[
'::neutron::agents::ml2::ovs'
],
...
...
@@ -122,4 +129,8 @@ class iaas::profile::neutron::router (
require
=>
Package
[
'ifupdown-extra'
]
}
}
#Public/private network configuration for tenant - added
class
{
'::iaas::setup::sharednetwork'
:
}
}
This diff is collapsed.
Click to expand it.
manifests/setup/router.pp
0 → 100644
+
22
−
0
View file @
adb6b2c0
# A convenience method to set up a router between
# a private subnet and the public network. The
# $title of the resource is 'tenant:subnet',
# where tenant is the name of the tenant to assign
# the router to and subnet is the name of the
# subnet to connect the router to.
define
iaas::setup::router
{
$valarray
=
split
(
$title
,
':'
)
$tenant
=
$valarray
[
0
]
$subnet
=
$valarray
[
1
]
neutron_router
{
$tenant
:
tenant_name
=>
$tenant
,
gateway_network_name
=>
'public'
,
require
=>
[
Neutron_network
[
'public'
],
Neutron_subnet
[
$subnet
]]
}
->
neutron_router_interface
{
$title
:
ensure
=>
present
}
}
This diff is collapsed.
Click to expand it.
manifests/setup/sharednetwork.pp
0 → 100644
+
67
−
0
View file @
adb6b2c0
# A static class to set up a shared network. Should appear on the
# controller node. It sets up the public network, a private network,
# two subnets (one for admin, one for test), and the routers that
# connect the subnets to the public network.
#
# After this class has run, you should have a functional network
# avaiable for your test user to launch and connect machines to.
class
iaas::setup::sharednetwork
(
#New variable definition
# tenant where configure network defined as yaml variable
$tenant
=
hiera
(
'iaas::profile::network::tenant'
,
undef
),
$external_network
=
hiera
(
'iaas::profile::neutron::external_network'
,
undef
),
$gateway
=
hiera
(
'iaas::profile::neutron::external_gateway'
,
undef
),
# $dns = hiera('iaas::profile::base::dns_servers', undef),
$start_ip
=
hiera
(
'iaas::profile::neutron::network_external_ippool_start'
,
undef
),
$end_ip
=
hiera
(
'iaas::profile::neutron::network_external_ippool_end'
,
undef
),
$private_network
=
hiera
(
'iaas::profile::neutron::network_neutron_private'
,
undef
),
)
{
$ip_range
=
"start=
${start_ip}
,end=
${end_ip}
"
notify
{
"debug message:
${start_ip}
;
${end_ip}
;
${ip_range}
"
:
loglevel
=>
alert
}
neutron_network
{
'public'
:
tenant_name
=>
'services'
,
provider_network_type
=>
'gre'
,
router_external
=>
true
,
provider_segmentation_id
=>
3604
,
shared
=>
true
,
}
->
neutron_subnet
{
$external_network
:
cidr
=>
$external_network
,
ip_version
=>
'4'
,
gateway_ip
=>
$gateway
,
enable_dhcp
=>
false
,
network_name
=>
'public'
,
tenant_name
=>
'services'
,
allocation_pools
=>
[
$ip_range
],
#DNS commented
# dns_nameservers => [$dns],
}
neutron_network
{
'private'
:
tenant_name
=>
'services'
,
provider_network_type
=>
'gre'
,
router_external
=>
false
,
provider_segmentation_id
=>
4063
,
shared
=>
true
,
}
->
neutron_subnet
{
$private_network
:
cidr
=>
$private_network
,
ip_version
=>
'4'
,
enable_dhcp
=>
true
,
network_name
=>
'private'
,
tenant_name
=>
'services'
,
#DNS commented
# dns_nameservers => [$dns],
}
# router setup for the selected tenant
iaas::setup::router
{
"
${tenant}
:
${private_network}
"
:
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment