Browse Source

CiscoNexus: Update and Remove deprecated vars

Backward compatible backport (modified by hand).

Update and Remove deprecated variables from Cisco Nexus Config.
* Deprecated variables include vlan_name_prefix, svi_round_robin,
  provider_vlan_name_prefix, persistent_switch_config,
  never_cache_ssh_connection, ssh_port, switch_replay_count,
  nexus_driver, and host_key_checks.
* Change config replay to on by defaulting switch_heartbeat_time=30.
* Replaced method of configurating host_ports_mapping config.

Change-Id: Iee2f869c4054f1120d224994aba8c827f981e6c0
Closes-bug:  #1793379
(cherry picked from commit f45169f38d)
changes/17/699417/2
Emilien Macchi 2 months ago
parent
commit
f1ac3e32ea
6 changed files with 25 additions and 45 deletions
  1. +0
    -2
      examples/cisco_ml2.pp
  2. +15
    -16
      manifests/plugins/ml2/cisco/nexus.pp
  3. +2
    -1
      manifests/plugins/ml2/cisco/nexus_creds.pp
  4. +2
    -6
      manifests/plugins/ml2/cisco/nexus_switch.pp
  5. +5
    -20
      spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb
  6. +1
    -0
      templates/nexus_switch_port_mappings.erb

+ 0
- 2
examples/cisco_ml2.pp View File

@@ -30,7 +30,6 @@ class {'::neutron::plugins::ml2::cisco::nexus':
'n9372-1' => {
'username' => 'admin',
'password' => 'password',
'ssh_port' => 22,
'ip_address' => '127.0.0.1',
'nve_src_intf' => 1,
'physnet' => 'physnet',
@@ -46,7 +45,6 @@ class {'::neutron::plugins::ml2::cisco::nexus':
'n9372-2' => {
'username' => 'admin',
'password' => 'password',
'ssh_port' => 22,
'ip_address' => '127.0.0.2',
'nve_src_intf' => 1,
'physnet' => 'physnet',

+ 15
- 16
manifests/plugins/ml2/cisco/nexus.pp View File

@@ -10,7 +10,6 @@
# (required) Nexus switch configuration for neutron configuration file
# Example nexus config format:
# { 'switch_hostname' => {'username' => 'admin',
# 'ssh_port' => 22,
# 'password' => "password",
# 'ip_address' => "172.18.117.28",
# 'nve_src_intf' => 1,
@@ -69,12 +68,12 @@
# VLAN 2001 it will be named 'q-2001' using the default prefix.
# The total length allowed for the prefix name and VLAN is 32 characters,
# the prefix will be truncated if the total length is greater than 32.
# Defaults to 'q-'
# Defaults to $::os_service_default
#
# [*svi_round_robin*]
# (optional) This configuration item is OBSOLETE.
# A flag to enable round robin scheduling of routers for SVI.
# Defaults to false
# Defaults to $::os_service_default
#
# [*provider_vlan_name_prefix*]
# (optional) This configuration item is OBSOLETE.
@@ -83,7 +82,7 @@
# for provider VLAN 3003 it will be named 'p-3003' using the default prefix.
# The total length allowed for the prefix name and VLAN is 32 characters,
# the prefix will be truncated if the total length is greater than 32.
# Defaults to 'p-'
# Defaults to $::os_service_default
#
# [*persistent_switch_config*]
# (optional) This will be deprecated. This variable makes
@@ -91,7 +90,7 @@
# after applying successful configurations.
# (default) This flag defaults to False keep consistent with
# existing functionality.
# Defaults to false
# Defaults to $::os_service_default
#
# [*never_cache_ssh_connection*]
# (optional) This will be deprecated. This configuration prevents
@@ -99,7 +98,7 @@
# (default) This defaults to False which indicates that ssh
# connections to Nexus switch are cached when the neutron
# controller has fewer than 8 processes.
# Defaults to false
# Defaults to $::os_service_default
#
# [*switch_replay_count*]
# (optional) This configuration item is OBSOLETE. The Nexus driver replay
@@ -114,29 +113,29 @@
# choice of driver methods to configure Nexus devices.
# (default) This value defaults to 'restapi' but can be configured
# to legacy driver 'ncclient' temporarily until it is deprecated.
# Defaults to 'restapi'
# Defaults to $::os_service_default
#
# [*host_key_checks*]
# (optional) This will be deprecated. This flag indicates whether or
# not to enable strict host key checks when connecting to Nexus switches.
# Defaults to false
# Defaults to $::os_service_default
#

class neutron::plugins::ml2::cisco::nexus (
$nexus_config,
$managed_physical_network,
$vlan_name_prefix = 'q-',
$svi_round_robin = false,
$provider_vlan_name_prefix = 'p-',
$persistent_switch_config = false,
$switch_heartbeat_time = 0,
$never_cache_ssh_connection = false,
$vlan_name_prefix = $::os_service_default,
$svi_round_robin = $::os_service_default,
$provider_vlan_name_prefix = $::os_service_default,
$persistent_switch_config = $::os_service_default,
$switch_heartbeat_time = 30,
$never_cache_ssh_connection = $::os_service_default,
$switch_replay_count = $::os_service_default,
$nexus_driver = 'restapi',
$nexus_driver = $::os_service_default,
$provider_vlan_auto_create = true,
$provider_vlan_auto_trunk = true,
$vxlan_global_config = true,
$host_key_checks = false
$host_key_checks = $::os_service_default
) {

include ::neutron::deps

+ 2
- 1
manifests/plugins/ml2/cisco/nexus_creds.pp View File

@@ -49,6 +49,7 @@
#
# [*ssh_port*]
# (not used) The SSH port to use when connecting to the switch.
# Defaults to undef.
#
# [*nve_src_intf*]
# (not used) Only valid if VXLAN overlay is configured and
@@ -113,7 +114,7 @@ define neutron::plugins::ml2::cisco::nexus_creds(
$username,
$password,
$servers,
$ssh_port,
$ssh_port = undef,
# Used parameters
$ip_address,
$nve_src_intf = undef,

+ 2
- 6
manifests/plugins/ml2/cisco/nexus_switch.pp View File

@@ -103,6 +103,7 @@
# [*ssh_port*]
# (optional) This configuration item is deprecated.
# The SSH port to use when connecting to the switch.
# Defaults to $::os_service_default
#
define neutron::plugins::ml2::cisco::nexus_switch(
$username,
@@ -122,6 +123,7 @@ define neutron::plugins::ml2::cisco::nexus_switch(
include ::neutron::deps

$section = "ML2_MECH_CISCO_NEXUS:${ip_address}"
$port_mappings = template("neutron/nexus_switch_port_mappings.erb")
neutron_plugin_ml2 {
"${section}/username": value => $username;
"${section}/password": value => $password, secret => true;
@@ -134,10 +136,4 @@ define neutron::plugins::ml2::cisco::nexus_switch(
#DEPRECATED ARGS
"${section}/ssh_port": value => $ssh_port;
}

$server_defaults = {
'switch_ip_address' => $ip_address
}
create_resources(neutron::plugins::ml2::cisco::nexus_switch_server,
$servers, $server_defaults)
}

+ 5
- 20
spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb View File

@@ -20,7 +20,6 @@ describe 'neutron::plugins::ml2::cisco::nexus' do
:nexus_config => {
'cvf2leaff2' => {
'username' => 'prad',
"ssh_port" => 22,
"password" => "password",
"ip_address" => "172.18.117.28",
"nve_src_intf" => 1,
@@ -30,24 +29,18 @@ describe 'neutron::plugins::ml2::cisco::nexus' do
"https_verify" => false,
"https_local_certificate" => "",
"servers" => {
"control02" => {"ports" => "portchannel:20"},
"control01" => {"ports" => "portchannel:10"}
"control02" => {"hostname"=> "control02",
"ports" => "portchannel:20"},
"control01" => {"hostname"=> "control01",
"ports" => "portchannel:10"}
}
}
},
:managed_physical_network => 'physnet1',
:vlan_name_prefix => 'q-',
:svi_round_robin => false,
:provider_vlan_name_prefix => 'p-',
:persistent_switch_config => false,
:never_cache_ssh_connection => false,
:switch_heartbeat_time => 30,
:switch_replay_count => 3,
:nexus_driver => 'restapi',
:provider_vlan_auto_create => true,
:provider_vlan_auto_trunk => true,
:vxlan_global_config => true,
:host_key_checks => false
:vxlan_global_config => true
}
end

@@ -72,18 +65,10 @@ describe 'neutron::plugins::ml2::cisco::nexus' do

it do
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/managed_physical_network').with_value(params[:managed_physical_network])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/vlan_name_prefix').with_value(params[:vlan_name_prefix])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/svi_round_robin').with_value(params[:svi_round_robin])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_name_prefix').with_value(params[:provider_vlan_name_prefix])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/persistent_switch_config').with_value(params[:persistent_switch_config])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/never_cache_ssh_connection').with_value(params[:never_cache_ssh_connection])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/switch_heartbeat_time').with_value(params[:switch_heartbeat_time])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/switch_replay_count').with_value(params[:switch_replay_count])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/nexus_driver').with_value(params[:nexus_driver])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_create').with_value(params[:provider_vlan_auto_create])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_trunk').with_value(params[:provider_vlan_auto_trunk])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/vxlan_global_config').with_value(params[:vxlan_global_config])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/host_key_checks').with_value(params[:host_key_checks])
end

it {

+ 1
- 0
templates/nexus_switch_port_mappings.erb View File

@@ -0,0 +1 @@
<%- @servers.each_with_index do |(server, value), index| -%><%= value['hostname'] -%><%= ':' %>[<%= value['ports'] %>]<%= ',' if index < (@servers.size - 1) %><%- end -%>

Loading…
Cancel
Save