From 0ea6a7a5d1ac9378136481cc6844dac5d78f590c Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 17 Oct 2018 12:58:52 +0100 Subject: [PATCH] Allow the networking_ansible plugin to set manage_vlans This is required if neworks already exist and the driver doesn't need too (or can't) create them. Change-Id: Iff08440feb5727d436514ceaf072faed7fcdf763 --- manifests/plugins/ml2/networking_ansible.pp | 3 ++- manifests/plugins/ml2/networking_ansible_host.pp | 5 +++++ .../notes/net-ansible-manage-vlans-46dde6651bf47897.yaml | 4 ++++ spec/classes/neutron_plugins_ml2_networking_ansible_spec.rb | 6 +++++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/net-ansible-manage-vlans-46dde6651bf47897.yaml diff --git a/manifests/plugins/ml2/networking_ansible.pp b/manifests/plugins/ml2/networking_ansible.pp index 00e110420..e3c235552 100644 --- a/manifests/plugins/ml2/networking_ansible.pp +++ b/manifests/plugins/ml2/networking_ansible.pp @@ -16,7 +16,8 @@ # => {"ansible_network_os" => "junos", # "ansible_host" => "10.0.0.2", # "ansible_user" => 'ansible', -# "ansible_ssh_private_key_file" => "/private/key"}, +# "ansible_ssh_private_key_file" => "/private/key", +# "manage_vlans" => false}, # } # # [*package_ensure*] diff --git a/manifests/plugins/ml2/networking_ansible_host.pp b/manifests/plugins/ml2/networking_ansible_host.pp index 1c165bc9d..d45737391 100644 --- a/manifests/plugins/ml2/networking_ansible_host.pp +++ b/manifests/plugins/ml2/networking_ansible_host.pp @@ -24,6 +24,9 @@ # [*hostname*] # (required) The hostname of a host connected to the switch. # +# [*manage_vlans*] +# Should networking-ansible create and delete VLANs on the device. +# define neutron::plugins::ml2::networking_ansible_host( $ansible_network_os, $ansible_host, @@ -31,6 +34,7 @@ define neutron::plugins::ml2::networking_ansible_host( $ansible_ssh_pass = undef, $ansible_ssh_private_key_file = undef, $hostname = $title, + $manage_vlans = undef, ) { include ::neutron::deps require ::neutron::plugins::ml2 @@ -47,5 +51,6 @@ define neutron::plugins::ml2::networking_ansible_host( "${section}/ansible_user": value => $ansible_user; "${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true; "${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file; + "${section}/manage_vlans": value => $manage_vlans; } } diff --git a/releasenotes/notes/net-ansible-manage-vlans-46dde6651bf47897.yaml b/releasenotes/notes/net-ansible-manage-vlans-46dde6651bf47897.yaml new file mode 100644 index 000000000..5e040f039 --- /dev/null +++ b/releasenotes/notes/net-ansible-manage-vlans-46dde6651bf47897.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added support for networking-ansible's manage_vlans parameter diff --git a/spec/classes/neutron_plugins_ml2_networking_ansible_spec.rb b/spec/classes/neutron_plugins_ml2_networking_ansible_spec.rb index 594107362..1cb4fcda1 100644 --- a/spec/classes/neutron_plugins_ml2_networking_ansible_spec.rb +++ b/spec/classes/neutron_plugins_ml2_networking_ansible_spec.rb @@ -21,7 +21,8 @@ describe 'neutron::plugins::ml2::networking_ansible' do 'host2' => { 'ansible_network_os' => 'junos', 'ansible_host' => '10.0.0.1', 'ansible_user' => 'ansible', - 'ansible_ssh_private_key_file' => '/path/to/key'},} + 'ansible_ssh_private_key_file' => '/path/to/key', + 'manage_vlans' => false},} } end @@ -50,6 +51,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_pass').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) end } end