diff options
author | 2017-07-18 13:35:13 -0400 | |
---|---|---|
committer | 2017-07-27 11:12:01 -0400 | |
commit | 8131692770530c9a7687718e7620fc4fb583b935 (patch) | |
tree | e60cf9433bcda48b57904c22a2583e6f1d546a5a /lib | |
parent | e5c62346823df230beac221a8a413dd57810f3e8 (diff) |
Add VPP and honeycomb services
Change-Id: I6ed724f4c81a230a17584c33cc4de8b4000d525e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/honeycomb_int_role_mapping.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/honeycomb_int_role_mapping.rb b/lib/puppet/parser/functions/honeycomb_int_role_mapping.rb new file mode 100644 index 0000000..ff9739b --- /dev/null +++ b/lib/puppet/parser/functions/honeycomb_int_role_mapping.rb @@ -0,0 +1,21 @@ +module Puppet::Parser::Functions + newfunction(:honeycomb_int_role_mapping, :type => :rvalue, :doc => "Convert Honeycomb role mapping from kernel nic name (eth1) to VPP name (GigabitEthernet0/7/0).") do |arg| + mapping_list = arg[0] + mapping_list.map! do |item| + mapping = item.split(':') + unless mapping.length == 2 + raise Puppet::ParseError, "Invalid physnet mapping format: #{item}. Expecting 'interface_name:role_name'" + end + if defined? call_function + vpp_int = call_function('hiera', [mapping[0]]) + else + vpp_int = function_hiera([mapping[0]]) + end + if vpp_int.to_s.strip.empty? + raise Puppet::ParseError, "VPP interface mapped to #{mapping[0]} is not found." + end + vpp_int+':'+mapping[1] + end + return mapping_list + end +end |