diff options
author | Michael Henkel <mhenkel@juniper.net> | 2017-06-16 10:49:57 -0700 |
---|---|---|
committer | Michael Henkel <mhenkel@juniper.net> | 2017-07-05 22:52:58 +0200 |
commit | 8b9e2b3c6ca5221249b8aa7dc792e756ee92209a (patch) | |
tree | 4a48415cf30e540fae4a28ed135448dd8320cd74 /lib/puppet | |
parent | 0aad4142bea287265c22ea252c4adeff5ff69721 (diff) |
Contrail: Fix controlplane/dataplane network asignments & enable optional dpdk
This patch will move the Contrail roles communication towards
OpenStack APIs from the public/external network to the
internal_api network. I will also add the option to enable
dpdk for Contrail.
Change-Id: Ia835df656031cdf28de20f41ec6ab1c028dced23
Closes-Bug: 1698422
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/netmask_to_cidr.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/netmask_to_cidr.rb b/lib/puppet/parser/functions/netmask_to_cidr.rb new file mode 100644 index 0000000..68ee4cf --- /dev/null +++ b/lib/puppet/parser/functions/netmask_to_cidr.rb @@ -0,0 +1,14 @@ +# 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' +module Puppet::Parser::Functions + newfunction(:netmask_to_cidr, :type => :rvalue) do |args| + if args[0].class != String + raise Puppet::ParseError, "Syntax error: #{args[0]} must be a String" + end + IPAddr.new(args[0]).to_i.to_s(2).count("1") + end +end |