Remove use of template based config from cisco ml2 nexus plugin.
Change to modify the cisco ml2 nexus section to remove the use of the erb template for configuring the per-nexus switch ML2 config sections. The change adds 2 new defined types which wrap neutron_plugin_ml2 resource usage. Change-Id: I401371c9e5176de7ce19d4d4e878e9f2e69aab80 Closes-bug: #1495537
This commit is contained in:
parent
11d0da3948
commit
6dc74ac0e6
@ -38,20 +38,28 @@ class {'::neutron::plugins::ml2::cisco::nexus':
|
||||
'nve_src_intf' => 1,
|
||||
'physnet' => 'physnet',
|
||||
'servers' => {
|
||||
'control1' => 'ethernet:1/1',
|
||||
'control2' => 'ethernet:1/2'
|
||||
'control1' => {
|
||||
'ports' => 'ethernet:1/1',
|
||||
},
|
||||
'control2' => {
|
||||
'ports' => 'ethernet:1/2',
|
||||
},
|
||||
}
|
||||
},
|
||||
'n9372-2' => {
|
||||
'username' => 'admin',
|
||||
'password' => 'password',
|
||||
'ssh_port' => 22,
|
||||
'ip_address' => '127.0.0.1',
|
||||
'ip_address' => '127.0.0.2',
|
||||
'nve_src_intf' => 1,
|
||||
'physnet' => 'physnet',
|
||||
'servers' => {
|
||||
'compute1' => 'ethernet:1/1',
|
||||
'compute2' => 'ethernet:1/2'
|
||||
'compute1' => {
|
||||
'ports' => 'ethernet:1/1',
|
||||
},
|
||||
'compute2' => {
|
||||
'ports' => 'ethernet:1/2',
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -16,8 +16,8 @@
|
||||
# 'nve_src_intf' => 1,
|
||||
# 'physnet' => "physnet1",
|
||||
# 'servers' => {
|
||||
# 'control01' => "portchannel:20",
|
||||
# 'control02' => "portchannel:10"
|
||||
# 'control01' => {"ports" => "portchannel:20"},
|
||||
# 'control02' => {"ports" => "portchannel:10"}
|
||||
# }}}
|
||||
#
|
||||
# [*managed_physical_network*]
|
||||
@ -124,13 +124,7 @@ class neutron::plugins::ml2::cisco::nexus (
|
||||
'ml2_cisco/host_key_checks' : value => $host_key_checks;
|
||||
}
|
||||
|
||||
file { 'nexus_config':
|
||||
path => $::neutron::params::cisco_ml2_mech_cisco_nexus_config_file,
|
||||
owner => 'root',
|
||||
group => 'neutron',
|
||||
mode => '0644',
|
||||
content => template('neutron/ml2_mech_cisco_nexus_conf.erb'),
|
||||
} ~> Service['neutron-server']
|
||||
create_resources(neutron::plugins::ml2::cisco::nexus_switch, $nexus_config)
|
||||
|
||||
create_resources(neutron::plugins::ml2::cisco::nexus_creds, $nexus_config)
|
||||
|
||||
|
105
manifests/plugins/ml2/cisco/nexus_switch.pp
Normal file
105
manifests/plugins/ml2/cisco/nexus_switch.pp
Normal file
@ -0,0 +1,105 @@
|
||||
# == Define: neutron::plugins::ml2::cisco::nexus_switch
|
||||
#
|
||||
# Defined type to configure the Cisco Nexus Switch parameters
|
||||
# for use by the ML2 Mech Driver for Cisco Nexus Switches.
|
||||
#
|
||||
# More info available here:
|
||||
# https://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus
|
||||
#
|
||||
#
|
||||
# neutron::plugins::ml2::cisco::nexus_switch used by
|
||||
# neutron::plugins::ml2::cisco::nexus
|
||||
#
|
||||
# === Parameters:
|
||||
# [*username*]
|
||||
# (required) The username for logging into the switch to manage it.
|
||||
#
|
||||
# [*password*]
|
||||
# (required) The password for logging into the switch to manage it.
|
||||
#
|
||||
# [*ip_address*]
|
||||
# (required) The IP address of the switch.
|
||||
#
|
||||
# [*ssh_port*]
|
||||
# (required) The SSH port to use when connecting to the switch.
|
||||
#
|
||||
# [*servers*]
|
||||
# (required) A hash of server names (key) mapped to the switch's
|
||||
# interfaces (value). For each host connected to a port on the
|
||||
# switch, specify the hostname and the Nexus physical port/s
|
||||
# (interface/s) it is connected to. The values in the hash can
|
||||
# be a comma separated list of interfaces mapped to the server.
|
||||
#
|
||||
# Hash Format:
|
||||
#
|
||||
# {
|
||||
# <hostname1> => {"ports" => "<interfaceID1>,<interfaceID2>, ..."},
|
||||
# <hostname2> => {"ports" => "<interfaceID1>,<interfaceID2>, ..."},
|
||||
# }
|
||||
#
|
||||
# Interface ID format options:
|
||||
# "<intf_type>:<position>"
|
||||
# Valid intf_type's are 'ethernet' and 'port-channel'.
|
||||
# The default setting for <intf_type:> is 'ethernet' and need not be
|
||||
# added to this setting.
|
||||
#
|
||||
# Example:
|
||||
# {
|
||||
# 'control1' => {"ports" => 'ethernet:1/1'},
|
||||
# 'control2' => {"ports" => 'ethernet:1/2'},
|
||||
# 'compute1' => {"ports" => '1/3,1/4'}
|
||||
# }
|
||||
#
|
||||
# [*switchname*]
|
||||
# (required) An identifier for the switch--ie. hostname or IP
|
||||
# address of the switch.
|
||||
#
|
||||
# [*nve_src_intf*]
|
||||
# (optional) Only valid if VXLAN overlay is configured and
|
||||
# vxlan_global_config is set to True.
|
||||
#
|
||||
# The NVE source interface is a loopback interface that is configured on
|
||||
# the switch with valid /32 IP address. This /32 IP address must be known
|
||||
# by the transient devices in the transport network and the remote VTEPs.
|
||||
# This is accomplished by advertising it through a dynamic routing protocol
|
||||
# in the transport network. (NB: If no nve_src_intf is defined then a
|
||||
# default setting of 0 (creates "loopback0") will be used.)
|
||||
#
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*physnet*]
|
||||
# (optional) Only valid if VXLAN overlay is configured.
|
||||
# The physical network name defined in the network_vlan_ranges variable
|
||||
# (defined under the ml2_type_vlan section) that this switch is controlling.
|
||||
# The configured 'physnet' is the physical network domain that is connected
|
||||
# to this switch. The vlan ranges defined in network_vlan_ranges for a
|
||||
# a physical network are allocated dynamically and are unique per physical
|
||||
# network. These dynamic vlans may be reused across physical networks.
|
||||
#
|
||||
# Defaults to undef.
|
||||
#
|
||||
define neutron::plugins::ml2::cisco::nexus_switch(
|
||||
$username,
|
||||
$password,
|
||||
$ip_address,
|
||||
$ssh_port,
|
||||
$servers,
|
||||
$switchname = $title,
|
||||
$nve_src_intf = undef,
|
||||
$physnet = undef
|
||||
) {
|
||||
$section = "ML2_MECH_CISCO_NEXUS:${ip_address}"
|
||||
neutron_plugin_ml2 {
|
||||
"${section}/username": value => $username;
|
||||
"${section}/password": value => $password;
|
||||
"${section}/ssh_port": value => $ssh_port;
|
||||
"${section}/nve_src_intf": value => $nve_src_intf;
|
||||
"${section}/physnet": value => $physnet;
|
||||
}
|
||||
|
||||
$server_defaults = {
|
||||
'switch_ip_address' => $ip_address
|
||||
}
|
||||
create_resources(neutron::plugins::ml2::cisco::nexus_switch_server,
|
||||
$servers, $server_defaults)
|
||||
}
|
33
manifests/plugins/ml2/cisco/nexus_switch_server.pp
Normal file
33
manifests/plugins/ml2/cisco/nexus_switch_server.pp
Normal file
@ -0,0 +1,33 @@
|
||||
# == Define: neutron::plugins::ml2::cisco::nexus_switch
|
||||
#
|
||||
# Defined type to configure the Cisco Nexus Switch parameters
|
||||
# for servers connected to the switch for use by the ML2 Mech
|
||||
# Driver for Cisco Nexus Switches.
|
||||
#
|
||||
# More info available here:
|
||||
# https://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus
|
||||
#
|
||||
#
|
||||
# neutron::plugins::ml2::cisco::nexus_switch_server used by
|
||||
# neutron::plugins::ml2::cisco::nexus_switch
|
||||
#
|
||||
# === Parameters:
|
||||
# [*switch_ip_address*]
|
||||
# (required) The IP address for the switch.
|
||||
#
|
||||
# [*ports*]
|
||||
# (required) The switch ports connected to this server.
|
||||
#
|
||||
# [*hostname*]
|
||||
# (required) The hostname of a host connected to the switch.
|
||||
#
|
||||
define neutron::plugins::ml2::cisco::nexus_switch_server(
|
||||
$switch_ip_address,
|
||||
$ports,
|
||||
$hostname = $title,
|
||||
) {
|
||||
$section = "ML2_MECH_CISCO_NEXUS:${switch_ip_address}"
|
||||
neutron_plugin_ml2 {
|
||||
"${section}/${hostname}": value => $ports;
|
||||
}
|
||||
}
|
@ -24,8 +24,8 @@ describe 'neutron::plugins::ml2::cisco::nexus' do
|
||||
"nve_src_intf" => 1,
|
||||
"physnet" => "physnet1",
|
||||
"servers" => {
|
||||
"control02" => "portchannel:20",
|
||||
"control01" => "portchannel:10"
|
||||
"control02" => {"ports" => "portchannel:20"},
|
||||
"control01" => {"ports" => "portchannel:10"}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -76,9 +76,6 @@ describe 'neutron::plugins::ml2::cisco::nexus' do
|
||||
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/host_key_checks').with_value(params[:host_key_checks])
|
||||
end
|
||||
|
||||
it { is_expected.to contain_file('nexus_config').with({
|
||||
:path => platform_params[:cisco_ml2_config_file]}) }
|
||||
|
||||
it {
|
||||
# Stored as an array of arrays with the first element consisting of the name and
|
||||
# the second element consisting of the config hash
|
||||
|
@ -1,59 +0,0 @@
|
||||
# Cisco Nexus Switch configurations.
|
||||
# Each switch to be managed by Openstack Neutron must be configured here.
|
||||
#
|
||||
# Cisco Nexus Switch Format.
|
||||
# [ml2_mech_cisco_nexus:<IP address of switch>]
|
||||
# <hostname>=<intf_type:port> (1)
|
||||
# ssh_port=<ssh port> (2)
|
||||
# username=<credential username> (3)
|
||||
# password=<credential password> (4)
|
||||
# nve_src_intf=<loopback number> (5)
|
||||
# physnet=<physical network> (6)
|
||||
#
|
||||
# (1) For each host connected to a port on the switch, specify the hostname
|
||||
# and the Nexus physical port (interface) it is connected to.
|
||||
# Valid intf_type's are 'ethernet' and 'port-channel'.
|
||||
# The default setting for <intf_type:> is 'ethernet' and need not be
|
||||
# added to this setting.
|
||||
# (2) The TCP port for connecting via SSH to manage the switch. This is
|
||||
# port number 22 unless the switch has been configured otherwise.
|
||||
# (3) The username for logging into the switch to manage it.
|
||||
# (4) The password for logging into the switch to manage it.
|
||||
# (5) Only valid if VXLAN overlay is configured and vxlan_global_config is
|
||||
# set to True.
|
||||
# The NVE source interface is a loopback interface that is configured on
|
||||
# the switch with valid /32 IP address. This /32 IP address must be known
|
||||
# by the transient devices in the transport network and the remote VTEPs.
|
||||
# This is accomplished by advertising it through a dynamic routing protocol
|
||||
# in the transport network. (NB: If no nve_src_intf is defined then a
|
||||
# default setting of 0 (creates "loopback0") will be used.)
|
||||
# (6) Only valid if VXLAN overlay is configured.
|
||||
# The physical network name defined in the network_vlan_ranges variable
|
||||
# (defined under the ml2_type_vlan section) that this switch is controlling.
|
||||
# The configured 'physnet' is the physical network domain that is connected
|
||||
# to this switch. The vlan ranges defined in network_vlan_ranges for a
|
||||
# a physical network are allocated dynamically and are unique per physical
|
||||
# network. These dynamic vlans may be reused across physical networks.
|
||||
#
|
||||
# Example:
|
||||
# [ml2_mech_cisco_nexus:1.1.1.1]
|
||||
# compute1=1/1
|
||||
# compute2=ethernet:1/2
|
||||
# compute3=port-channel:1
|
||||
# ssh_port=22
|
||||
# username=admin
|
||||
# password=mySecretPassword
|
||||
# nve_src_intf=1
|
||||
# physnet=physnet1
|
||||
|
||||
<% @nexus_config.each do |switch_hostname, switch_data| %>
|
||||
[ML2_MECH_CISCO_NEXUS:<%= switch_data['ip_address'] %>]
|
||||
<%- switch_data['servers'].each do |host_name, port| -%>
|
||||
<%=host_name-%>=<%= port %>
|
||||
<%- end -%>
|
||||
ssh_port=<%= switch_data['ssh_port'] %>
|
||||
username=<%= switch_data['username'] %>
|
||||
password=<%= switch_data['password'] %>
|
||||
nve_src_intf=<%= switch_data['nve_src_intf'] %>
|
||||
physnet=<%= switch_data['physnet'] %>
|
||||
<% end %>
|
Loading…
Reference in New Issue
Block a user