Adding support for networking-ansible's mac parameter

Change-Id: I2bed158326651b8bf07a917efb73ca03e1caeaa3
This commit is contained in:
Dan Radez 2018-11-06 15:09:10 -05:00
parent 14f275bc45
commit 1d23f59454
4 changed files with 17 additions and 2 deletions

View File

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

View File

@ -22,10 +22,14 @@
# This or ansible_ssh_pass should be provided # This or ansible_ssh_pass should be provided
# #
# [*hostname*] # [*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*] # [*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( define neutron::plugins::ml2::networking_ansible_host(
$ansible_network_os, $ansible_network_os,
@ -33,6 +37,7 @@ define neutron::plugins::ml2::networking_ansible_host(
$ansible_user, $ansible_user,
$ansible_ssh_pass = undef, $ansible_ssh_pass = undef,
$ansible_ssh_private_key_file = undef, $ansible_ssh_private_key_file = undef,
$mac = undef,
$hostname = $title, $hostname = $title,
$manage_vlans = undef, $manage_vlans = undef,
) { ) {
@ -51,6 +56,7 @@ define neutron::plugins::ml2::networking_ansible_host(
"${section}/ansible_user": value => $ansible_user; "${section}/ansible_user": value => $ansible_user;
"${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true; "${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true;
"${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file; "${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file;
"${section}/mac": value => $mac;
"${section}/manage_vlans": value => $manage_vlans; "${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_host' => '10.0.0.1',
'ansible_user' => 'ansible', 'ansible_user' => 'ansible',
'ansible_ssh_private_key_file' => '/path/to/key', 'ansible_ssh_private_key_file' => '/path/to/key',
'mac' => '01:23:45:67:89:AB',
'manage_vlans' => false},} 'manage_vlans' => false},}
} }
end end
@ -52,6 +53,9 @@ describe 'neutron::plugins::ml2::networking_ansible' do
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key') is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key')
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil) is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil)
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:host1/manage_vlans').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false) is_expected.to contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
end end