Change authentication method for Mellanox sdn controller

Change sdn authentication from basic(username, password) to token
authentication, deprecate username and password and add a new
parameter token

Depends-on: https://review.opendev.org/814557
Change-Id: Ie8b347a4705045dfa0363284ec41e9e519ec19f9
This commit is contained in:
waleedm 2021-10-19 11:02:14 +00:00 committed by Takashi Kajinami
parent dc2bdfd72c
commit 8ce1ea3d93
3 changed files with 49 additions and 17 deletions

View File

@ -4,20 +4,15 @@
#
# === Parameters
#
# [*sdn_username*]
# (optional) The Mellanox controller username
# [*sdn_token*]
# (optional) The Mellanox controller token
# Defaults to $::os_service_default
# Example: 'admin'
#
# [*sdn_password*]
# (optional) The Mellanox controller password
# Defaults to $::os_service_default
# Example: 'admin'
# Example: 'abcdef'
#
# [*sdn_url*]
# (optional) The Mellanox controller neutron URL
# Defaults to $::os_service_default
# Example: 'http://127.0.0.1/neo'
# Example: 'http://127.0.0.1/ufmRestV3/'
#
# [*sdn_domain*]
# (optional) The Mellanox controller domain
@ -41,22 +36,48 @@
# The list must be a subset of physical_networks
# Defaults to []
#
# DEPRECATED PARAMETERS
#
# [*sdn_username*]
# (optional) The Mellanox controller username
# Defaults to undef.
#
# [*sdn_password*]
# (optional) The Mellanox controller password
# Defaults to undef.
#
class neutron::plugins::ml2::mellanox::mlnx_sdn_assist (
$sdn_username = $::os_service_default,
$sdn_password = $::os_service_default,
$sdn_token = $::os_service_default,
$sdn_url = $::os_service_default,
$sdn_domain = $::os_service_default,
$sync_enabled = true,
$bind_normal_ports = false,
$bind_normal_ports_physnets = [],
# DEPRECATED PARAMETERS
$sdn_username = undef,
$sdn_password = undef,
) {
include neutron::deps
require neutron::plugins::ml2
if $sdn_username != undef {
warning('neutron::plugins::ml2::mellanox::mlnx_sdn_assist::sdn_username is now deprecated \
and has no effect.')
}
if $sdn_password != undef {
warning('neutron::plugins::ml2::mellanox::mlnx_sdn_assist::sdn_password is now deprecated \
and has no effect.')
}
neutron_plugin_ml2 {
'sdn/username': value => $sdn_username;
'sdn/password': value => $sdn_password, secret => true;
'sdn/username': ensure => absent;
'sdn/password ': ensure => absent;
}
neutron_plugin_ml2 {
'sdn/token': value => $sdn_token, secret => true;
'sdn/url': value => $sdn_url;
'sdn/domain': value => $sdn_domain;
'sdn/sync_enabled': value => $sync_enabled;

View File

@ -0,0 +1,13 @@
---
features:
- The new ``sdn_token`` parameter to authenticate sdn has been added to
the ``neutron::plugins::ml2::mellanox::mlnx_sdn_assist`` class.
deprecations:
- |
The following two parameters of
the ``neutron::plugins::ml2::mellanox::mlnx_sdn_assist`` class have been
deprecated and have no effect now.
- ``sdn_username``
- ``sdn_password``

View File

@ -19,8 +19,7 @@ describe 'neutron::plugins::ml2::mellanox::mlnx_sdn_assist' do
let :params do
{
:sdn_username => 'user',
:sdn_password => 'password',
:sdn_token => 'token',
}
end
@ -30,8 +29,7 @@ describe 'neutron::plugins::ml2::mellanox::mlnx_sdn_assist' do
end
it 'configures sdn settings' do
should contain_neutron_plugin_ml2('sdn/password').with_value(params[:sdn_password]).with_secret(true)
should contain_neutron_plugin_ml2('sdn/username').with_value(params[:sdn_username])
should contain_neutron_plugin_ml2('sdn/token').with_value(params[:sdn_token]).with_secret(true)
should contain_neutron_plugin_ml2('sdn/url').with_value(params[:sdn_url])
should contain_neutron_plugin_ml2('sdn/sync_enabled').with_value('true')
should contain_neutron_plugin_ml2('sdn/bind_normal_ports').with_value('false')