Merge "Remove unused netmask_to_cider function"

This commit is contained in:
Zuul 2022-05-25 17:45:46 +00:00 committed by Gerrit Code Review
commit ccc6719a73
2 changed files with 0 additions and 21 deletions

View File

@ -1,15 +0,0 @@
# Custom function to transform netmask from IP notation to
# CIDR format. Input is an IP address, output a CIDR:
# 255.255.255.0 = 24
# The CIDR formated netmask is needed for some
# Contrail configuration files
require 'ipaddr'
Puppet::Functions.create_function(:netmask_to_cidr) do
dispatch :netmask_to_cidr do
param 'String', :netmask
end
def netmask_to_cidr(netmask)
IPAddr.new(netmask).to_i.to_s(2).count("1")
end
end

View File

@ -1,6 +0,0 @@
require 'spec_helper'
require 'puppet'
describe 'netmask_to_cidr' do
it { should run.with_params('255.255.255.0').and_return(24) }
end