Fix some misspellings in the l23network module
Contain only fix for some misspellings and puppet code cleanup. Change-Id: I1e042048ab438b4254ee4a8d02aecdcaa6bb9332 Closes-Bug: #1533357 Partial-Bug: #1533240
This commit is contained in:
parent
af93a3a3eb
commit
a69187ccd8
@ -3,11 +3,10 @@ class l23network::examples::run_network_scheme (
|
|||||||
$settings_yaml
|
$settings_yaml
|
||||||
){
|
){
|
||||||
|
|
||||||
class {'l23network': }
|
class {'::l23network': }
|
||||||
|
|
||||||
$config = parseyaml($settings_yaml)
|
$config = parseyaml($settings_yaml)
|
||||||
prepare_network_config($config['network_scheme'])
|
prepare_network_config($config['network_scheme'])
|
||||||
$sdn = generate_network_config()
|
$sdn = generate_network_config()
|
||||||
notice("SDN ${sdn}")
|
notice("SDN ${sdn}")
|
||||||
}
|
}
|
||||||
###
|
|
@ -41,10 +41,10 @@ class l23network (
|
|||||||
$disable_hotplug = true,
|
$disable_hotplug = true,
|
||||||
){
|
){
|
||||||
|
|
||||||
include stdlib
|
include ::stdlib
|
||||||
include ::l23network::params
|
include ::l23network::params
|
||||||
|
|
||||||
class { 'l23network::l2':
|
class { '::l23network::l2':
|
||||||
ensure_package => $ensure_package,
|
ensure_package => $ensure_package,
|
||||||
use_ovs => $use_ovs,
|
use_ovs => $use_ovs,
|
||||||
use_lnx => $use_lnx,
|
use_lnx => $use_lnx,
|
||||||
@ -60,24 +60,24 @@ class l23network (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $::l23network::params::interfaces_file {
|
if $::l23network::params::interfaces_file {
|
||||||
if ! defined(File["${::l23network::params::interfaces_file}"]) {
|
if ! defined(File[$::l23network::params::interfaces_file]) {
|
||||||
file {"${::l23network::params::interfaces_file}":
|
file { $::l23network::params::interfaces_file:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => 'puppet:///modules/l23network/interfaces',
|
source => 'puppet:///modules/l23network/interfaces',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File<| title == "${::l23network::params::interfaces_file}" |> -> File<| title == "${::l23network::params::interfaces_dir}" |>
|
File<| title == $::l23network::params::interfaces_file |> -> File<| title == $::l23network::params::interfaces_dir |>
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! defined(File["${::l23network::params::interfaces_dir}"]) {
|
if ! defined(File[$::l23network::params::interfaces_dir]) {
|
||||||
file {"${::l23network::params::interfaces_dir}":
|
file { $::l23network::params::interfaces_dir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
} -> Anchor['l23network::init']
|
} -> Anchor['l23network::init']
|
||||||
}
|
}
|
||||||
Anchor['l23network::l2::init'] -> File<| title == "${::l23network::params::interfaces_dir}" |>
|
Anchor['l23network::l2::init'] -> File<| title == $::l23network::params::interfaces_dir |>
|
||||||
Anchor['l23network::l2::init'] -> File<| title == "${::l23network::params::interfaces_file}" |>
|
Anchor['l23network::l2::init'] -> File<| title == $::l23network::params::interfaces_file |>
|
||||||
|
|
||||||
# Centos interface up-n-down scripts
|
# Centos interface up-n-down scripts
|
||||||
if $::l23_os =~ /(?i:redhat|centos)/ {
|
if $::l23_os =~ /(?i:redhat|centos)/ {
|
||||||
|
@ -23,7 +23,8 @@ class l23network::l2 (
|
|||||||
$ovs_datapath_package_name = $::l23network::params::ovs_datapath_package_name,
|
$ovs_datapath_package_name = $::l23network::params::ovs_datapath_package_name,
|
||||||
$ovs_common_package_name = $::l23network::params::ovs_common_package_name,
|
$ovs_common_package_name = $::l23network::params::ovs_common_package_name,
|
||||||
){
|
){
|
||||||
include stdlib
|
|
||||||
|
include ::stdlib
|
||||||
include ::l23network::params
|
include ::l23network::params
|
||||||
|
|
||||||
if $use_ovs {
|
if $use_ovs {
|
||||||
@ -31,15 +32,15 @@ class l23network::l2 (
|
|||||||
if $install_ovs {
|
if $install_ovs {
|
||||||
if $use_ovs_dkms_datapath_module {
|
if $use_ovs_dkms_datapath_module {
|
||||||
package { 'openvswitch-datapath':
|
package { 'openvswitch-datapath':
|
||||||
name => $ovs_datapath_package_name,
|
|
||||||
ensure => $ensure_package,
|
ensure => $ensure_package,
|
||||||
|
name => $ovs_datapath_package_name,
|
||||||
}
|
}
|
||||||
Package['openvswitch-datapath'] -> Service['openvswitch-service']
|
Package['openvswitch-datapath'] -> Service['openvswitch-service']
|
||||||
}
|
}
|
||||||
if $ovs_common_package_name {
|
if $ovs_common_package_name {
|
||||||
package { 'openvswitch-common':
|
package { 'openvswitch-common':
|
||||||
name => $ovs_common_package_name,
|
|
||||||
ensure => $ensure_package,
|
ensure => $ensure_package,
|
||||||
|
name => $ovs_common_package_name,
|
||||||
}
|
}
|
||||||
Package['openvswitch-common'] ~> Service['openvswitch-service']
|
Package['openvswitch-common'] ~> Service['openvswitch-service']
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,11 @@
|
|||||||
# downdelay
|
# downdelay
|
||||||
#
|
#
|
||||||
# [*provider*]
|
# [*provider*]
|
||||||
# This manifest supports lnx or ovs providers.
|
# This manifest supports lnx or ovs providers.
|
||||||
|
#
|
||||||
|
# [*interface_properties*]
|
||||||
|
# Configuration options for included interfaces (mtu, ethtool, etc...)
|
||||||
|
#
|
||||||
|
|
||||||
define l23network::l2::bond (
|
define l23network::l2::bond (
|
||||||
$ensure = present,
|
$ensure = present,
|
||||||
@ -38,7 +42,7 @@ define l23network::l2::bond (
|
|||||||
$onboot = undef,
|
$onboot = undef,
|
||||||
$delay_while_up = undef,
|
$delay_while_up = undef,
|
||||||
$bond_properties = {},
|
$bond_properties = {},
|
||||||
$interface_properties = undef, # configuration options for included interfaces (mtu, ethtool, etc...)
|
$interface_properties = undef,
|
||||||
$vendor_specific = undef,
|
$vendor_specific = undef,
|
||||||
$monolith_bond_providers = undef,
|
$monolith_bond_providers = undef,
|
||||||
$provider = undef,
|
$provider = undef,
|
||||||
@ -167,7 +171,7 @@ define l23network::l2::bond (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $delay_while_up and ! is_numeric($delay_while_up) {
|
if $delay_while_up and ! is_numeric($delay_while_up) {
|
||||||
fail("Delay for waiting after UP interface ${port} should be numeric, not an ${delay_while_up}.")
|
fail("Delay for waiting after UP interface ${bond} should be numeric, not an ${delay_while_up}.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! $bridge and $provider == 'ovs' {
|
if ! $bridge and $provider == 'ovs' {
|
||||||
@ -202,8 +206,8 @@ define l23network::l2::bond (
|
|||||||
|
|
||||||
if (! defined(L23network::L2::Bridge[$bridge]) and $provider == 'ovs') {
|
if (! defined(L23network::L2::Bridge[$bridge]) and $provider == 'ovs') {
|
||||||
l23network::l2::bridge { $bridge:
|
l23network::l2::bridge { $bridge:
|
||||||
ensure => 'present',
|
ensure => 'present',
|
||||||
provider => $provider,
|
provider => $provider,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,4 +44,3 @@ define l23network::l2::bond_interface (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
###
|
|
@ -18,7 +18,7 @@ define l23network::l2::bridge (
|
|||||||
$stp = undef,
|
$stp = undef,
|
||||||
$bpdu_forward = true,
|
$bpdu_forward = true,
|
||||||
# $bridge_id = undef, # will be implemented later
|
# $bridge_id = undef, # will be implemented later
|
||||||
$external_ids = { 'bridge-id' => "${name}" },
|
$external_ids = { 'bridge-id' => $name },
|
||||||
$delay_while_up = undef,
|
$delay_while_up = undef,
|
||||||
$vendor_specific = undef,
|
$vendor_specific = undef,
|
||||||
$provider = undef,
|
$provider = undef,
|
||||||
@ -34,7 +34,7 @@ define l23network::l2::bridge (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $delay_while_up and ! is_numeric($delay_while_up) {
|
if $delay_while_up and ! is_numeric($delay_while_up) {
|
||||||
fail("Delay for waiting after UP bridge ${name} should be numeric, not an '$delay_while_up'.")
|
fail("Delay for waiting after UP bridge ${name} should be numeric, not an '${delay_while_up}'.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! defined (L23_stored_config[$name]) {
|
if ! defined (L23_stored_config[$name]) {
|
||||||
@ -74,7 +74,7 @@ define l23network::l2::bridge (
|
|||||||
ensure => present,
|
ensure => present,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
content => template("l23network/centos_post_up.erb"),
|
content => template('l23network/centos_post_up.erb'),
|
||||||
} -> L23_stored_config <| title == $name |>
|
} -> L23_stored_config <| title == $name |>
|
||||||
} else {
|
} else {
|
||||||
file {"${::l23network::params::interfaces_dir}/interface-up-script-${name}":
|
file {"${::l23network::params::interfaces_dir}/interface-up-script-${name}":
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
# see http://tech.serbinn.net/2012/custom-script-on-interface-up-down-centos-and-rhel/
|
# see http://tech.serbinn.net/2012/custom-script-on-interface-up-down-centos-and-rhel/
|
||||||
class l23network::l2::centos_upndown_scripts {
|
class l23network::l2::centos_upndown_scripts {
|
||||||
file {'/sbin/ifup-local':
|
file {'/sbin/ifup-local':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
source => 'puppet:///modules/l23network/centos_ifup-local',
|
source => 'puppet:///modules/l23network/centos_ifup-local',
|
||||||
} ->
|
} ->
|
||||||
file {'/sbin/ifdown-local':
|
file {'/sbin/ifdown-local':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
source => 'puppet:///modules/l23network/centos_ifdown-local',
|
source => 'puppet:///modules/l23network/centos_ifdown-local',
|
||||||
} ->
|
} ->
|
||||||
file {'/sbin/ifup-pre-local':
|
file {'/sbin/ifup-pre-local':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
source => 'puppet:///modules/l23network/centos_ifup-pre-local',
|
source => 'puppet:///modules/l23network/centos_ifup-pre-local',
|
||||||
} ->
|
} ->
|
||||||
anchor { 'l23network::l2::centos_upndown_scripts': }
|
anchor { 'l23network::l2::centos_upndown_scripts': }
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,13 @@
|
|||||||
# IP address for interface. Can contain IP address, 'dhcp'
|
# IP address for interface. Can contain IP address, 'dhcp'
|
||||||
# or 'none' (with no IP address).
|
# or 'none' (with no IP address).
|
||||||
# Can be an array of CIDR IP addresses ['192.168.1.3/24','10.0.0.4/16']
|
# Can be an array of CIDR IP addresses ['192.168.1.3/24','10.0.0.4/16']
|
||||||
# for multiple IPs on an interface. In this case netmask parameter is ignored.
|
# for multiple IPs on an interface.
|
||||||
#
|
|
||||||
# [*netmask*]
|
|
||||||
# Specify network mask. Default is '255.255.255.0'.
|
|
||||||
#
|
#
|
||||||
# [*gateway*]
|
# [*gateway*]
|
||||||
# Specify default gateway if need.
|
# Specify default gateway if need.
|
||||||
# You can specify IP address, or 'save' for save default route
|
# You can specify IP address, or 'save' for save default route
|
||||||
# if it lies through this interface now.
|
# if it lies through this interface now.
|
||||||
#
|
#
|
||||||
## [*default_gateway*]
|
|
||||||
## Specify if this nic and gateway should become the default route.
|
|
||||||
## requires that gateway is also set.
|
|
||||||
##
|
|
||||||
## [*other_nets*]
|
## [*other_nets*]
|
||||||
## Optional. Defines additional networks that this inteface can reach in CIDR
|
## Optional. Defines additional networks that this inteface can reach in CIDR
|
||||||
## format.
|
## format.
|
||||||
@ -69,7 +62,6 @@ define l23network::l3::ifconfig (
|
|||||||
$dns_search = undef,
|
$dns_search = undef,
|
||||||
$dns_domain = undef,
|
$dns_domain = undef,
|
||||||
$dhcp_hostname = undef,
|
$dhcp_hostname = undef,
|
||||||
# $dhcp_nowait = false,
|
|
||||||
$check_by_ping = 'gateway',
|
$check_by_ping = 'gateway',
|
||||||
$check_by_ping_timeout = 30,
|
$check_by_ping_timeout = 30,
|
||||||
#todo: label => "XXX", # -- "ip addr add..... label XXX"
|
#todo: label => "XXX", # -- "ip addr add..... label XXX"
|
||||||
@ -92,23 +84,16 @@ define l23network::l3::ifconfig (
|
|||||||
$ipaddr_aliases = undef
|
$ipaddr_aliases = undef
|
||||||
case $ipaddr {
|
case $ipaddr {
|
||||||
'dhcp': {
|
'dhcp': {
|
||||||
$method = 'dhcp'
|
$method = 'dhcp'
|
||||||
$ipaddr_list = ['dhcp']
|
$ipaddr_list = ['dhcp']
|
||||||
}
|
}
|
||||||
'none': {
|
'none': {
|
||||||
$method = 'manual'
|
$method = 'manual'
|
||||||
$ipaddr_list = ['none']
|
$ipaddr_list = ['none']
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
$method = 'static'
|
$method = 'static'
|
||||||
if $ipaddr =~ /\/\d{1,2}\s*$/ {
|
$ipaddr_list = [$ipaddr]
|
||||||
# ipaddr can be cidr-notated
|
|
||||||
$ipaddr_list = [$ipaddr]
|
|
||||||
} else {
|
|
||||||
# or classic pair of ipaddr+netmask
|
|
||||||
$cidr_notated_effective_netmask = netmask_to_cidr($netmask)
|
|
||||||
$ipaddr_list = ["${ipaddr}/${cidr_notated_effective_netmask}"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user