Adding support for networking-ansible's mac parameter

Depends-On: Ic0090a9950552c33a79018ebf40a2c0d0260c667
Change-Id: I2bed158326651b8bf07a917efb73ca03e1caeaa3
(cherry picked from commit 1d23f59454)
This commit is contained in:
Dan Radez 2018-11-06 15:09:10 -05:00
parent 06ef92f27e
commit 2246751df2
4 changed files with 17 additions and 2 deletions

View File

@ -17,6 +17,7 @@
# "ansible_host" => "10.0.0.2",
# "ansible_user" => 'ansible',
# "ansible_ssh_pass" => "***",
# "mac" => "01:23:45:67:89:AB",
# "manage_vlans" => false},
# }
#

View File

@ -17,10 +17,14 @@
# (required) SSH password to connect to the network device
#
# [*hostname*]
# (required) The hostname of a host connected to the switch.
# (required) The hostname of a host connected to the switch.
#
# [*mac*]
# Chassis MAC ID of the network device. Used to map lldp provided value
# to the hostname when using ironic introspection.
#
# [*manage_vlans*]
# Should networking-ansible create and delete VLANs on the device.
# Should networking-ansible create and delete VLANs on the device.
#
define neutron::plugins::ml2::networking_ansible_host(
$ansible_network_os,
@ -29,6 +33,7 @@ define neutron::plugins::ml2::networking_ansible_host(
$ansible_ssh_pass,
$hostname = $title,
$manage_vlans = undef,
$mac = undef,
) {
include ::neutron::deps
require ::neutron::plugins::ml2
@ -39,6 +44,7 @@ define neutron::plugins::ml2::networking_ansible_host(
"${section}/ansible_host": value => $ansible_host;
"${section}/ansible_user": value => $ansible_user;
"${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true;
"${section}/mac": value => $mac;
"${section}/manage_vlans": value => $manage_vlans;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
Added support for networking-ansible's mac parameter

View File

@ -22,6 +22,7 @@ describe 'neutron::plugins::ml2::networking_ansible' do
'ansible_host' => '10.0.0.1',
'ansible_user' => 'ansible',
'ansible_ssh_pass' => 'password2',
'mac' => '01:23:45:67:89:AB',
'manage_vlans' => false},}
}
end
@ -46,6 +47,9 @@ describe 'neutron::plugins::ml2::networking_ansible' do
params[:host_configs].each do |host_config|
is_expected.to contain_neutron__plugins__ml2__networking_ansible_host(host_config.first)
is_expected.to contain_neutron_plugin_ml2('ansible:host1/mac').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/mac').with_value('01:23:45:67:89:AB')
is_expected.to contain_neutron_plugin_ml2('ansible:host1/manage_vlans').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
end