diff --git a/deployment/puppet/osnailyfacter/lib/puppet/parser/functions/get_routable_networks_for_network_role.rb b/deployment/puppet/osnailyfacter/lib/puppet/parser/functions/get_routable_networks_for_network_role.rb index 97eb07587a..b3b134490c 100644 --- a/deployment/puppet/osnailyfacter/lib/puppet/parser/functions/get_routable_networks_for_network_role.rb +++ b/deployment/puppet/osnailyfacter/lib/puppet/parser/functions/get_routable_networks_for_network_role.rb @@ -16,7 +16,7 @@ EOS e_point_name = net_scheme['roles'][net_role] return [] if e_point_name.nil? e_point = net_scheme['endpoints'][e_point_name] - return [] if e_point.nil? or !e_point.is_a?(Hash) + return [] if e_point.nil? or !e_point.is_a?(Hash) or e_point['IP'] == 'none' #collect subnets for aliases e_point['IP'].each do |cidr| masklen = cidr.split('/')[-1] @@ -36,4 +36,4 @@ EOS return rv end -# vim: set ts=2 sw=2 et : \ No newline at end of file +# vim: set ts=2 sw=2 et : diff --git a/deployment/puppet/osnailyfacter/spec/functions/get_routable_networks_for_network_role__spec.rb b/deployment/puppet/osnailyfacter/spec/functions/get_routable_networks_for_network_role__spec.rb index 76724a5ceb..05c48f3403 100644 --- a/deployment/puppet/osnailyfacter/spec/functions/get_routable_networks_for_network_role__spec.rb +++ b/deployment/puppet/osnailyfacter/spec/functions/get_routable_networks_for_network_role__spec.rb @@ -170,3 +170,65 @@ end end end + +describe 'get_routable_networks_for_network_role for network_scheme without public IP' do + +let(:network_scheme) do +""" +--- + version: '1.1' + provider: lnx + transformations: + - action: add-br + name: section_not_used_in_this_trst + roles: + management: br-mgmt + mgmt/database: br-mgmt + neutron/mesh: br-mesh + storage: br-storage + ex: br-ex + neutron/floating: br-floating + fw-admin: br-fw-admin + interfaces: + eth1: {} + endpoints: + br-fw-admin: + IP: + - 10.144.0.13/24 + br-mesh: + IP: + - 10.144.4.2/24 + br-floating: + IP: none + br-storage: + IP: + - 10.144.3.2/24 + br-mgmt: + IP: + - 10.144.2.4/24 + br-ex: + IP: none +""" +end + + let(:scope) { PuppetlabsSpec::PuppetInternals.scope } + + before(:each) do + puppet_debug_override() + end + + subject do + function_name = Puppet::Parser::Functions.function('get_routable_networks_for_network_role') + scope.method(function_name) + end + + it 'should exist' do + expect(subject).to eq scope.method('function_get_routable_networks_for_network_role') + end + + it 'should return empty list for public network' do + expect(scope.function_get_routable_networks_for_network_role([YAML.load(network_scheme), 'ex'])).to eq [] + end + +end +