From ffc4ca8e715cf70f165e5d8b4a9cb8d01ecf0f92 Mon Sep 17 00:00:00 2001 From: Wojciech Dec Date: Wed, 25 Apr 2018 08:53:44 -0700 Subject: [PATCH] Treat IP address as optional in Cisco VTS ML2 configuration Bug #1766949 Change-Id: I5d8b7f05a2d8d7bff608c8bbe9bd0d837bd1e3dc Signed-off-by: Wojciech Dec --- .../profile/base/neutron/plugins/ml2/vts.pp | 16 +++++++++------- .../tripleo_profile_base_neutron_ml2_vts_spec.rb | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/manifests/profile/base/neutron/plugins/ml2/vts.pp b/manifests/profile/base/neutron/plugins/ml2/vts.pp index f7f2e52cb..cc5ebddf2 100644 --- a/manifests/profile/base/neutron/plugins/ml2/vts.pp +++ b/manifests/profile/base/neutron/plugins/ml2/vts.pp @@ -20,11 +20,11 @@ # # # [*vts_url_ip*] -# IP address for VTS Api Service -# Defaults to hiera('vts_ip') +# (Optional) IP address of the VTS Server +# Defaults to undefined # # [*vts_port*] -# (Optional) VTS server Neutron service port +# (Optional) VTS Server Neutron service port # Defaults to '8888' # # [*step*] @@ -33,17 +33,19 @@ # Defaults to hiera('step') # class tripleo::profile::base::neutron::plugins::ml2::vts ( - $vts_url_ip = hiera('vts::vts_ip'), + $vts_url_ip = hiera('vts::vts_ip', undef), $vts_port = hiera('vts::vts_port', 8888), $step = hiera('step'), ) { if $step >= 4 { - $vts_url_ip_out = normalize_ip_for_uri($vts_url_ip) + if $vts_url_ip != undef { + $vts_url_ip_out = normalize_ip_for_uri($vts_url_ip) - class { '::neutron::plugins::ml2::cisco::vts': - vts_url => "https://${vts_url_ip_out}:${vts_port}/api/running/openstack" + class { '::neutron::plugins::ml2::cisco::vts': + vts_url => "https://${vts_url_ip_out}:${vts_port}/api/running/openstack" + } } } } diff --git a/spec/classes/tripleo_profile_base_neutron_ml2_vts_spec.rb b/spec/classes/tripleo_profile_base_neutron_ml2_vts_spec.rb index a51dda355..06a3bea38 100644 --- a/spec/classes/tripleo_profile_base_neutron_ml2_vts_spec.rb +++ b/spec/classes/tripleo_profile_base_neutron_ml2_vts_spec.rb @@ -48,6 +48,12 @@ describe 'tripleo::profile::base::neutron::plugins::ml2::vts' do end end + context 'with no IP address' do + it 'should not configure vts ml2 plugin' do + is_expected.not_to contain_class('neutron::plugins::ml2::cisco::vts') + end + end + context 'with VTS IPv4 and port 9999' do before do params.merge!({