class Snmp2mkr::ConfigTypes::InterfacesDefinition

Attributes

keys[R]
match[R]
values[R]

Public Instance Methods

collect_children() click to toggle source
# File lib/snmp2mkr/config_types/interfaces_definition.rb, line 27
def collect_children
  [*@keys.values, *@match.values, *@values.values]
end
setup(h) click to toggle source
# File lib/snmp2mkr/config_types/interfaces_definition.rb, line 8
def setup(h)
  raise TypeError, "#{self.class} must be given a Hash" unless h.kind_of?(Hash)
  raise ArgumentError, "#{self.class} hash must have 'keys' (Hash)" unless h['keys'].kind_of?(Hash)
  raise ArgumentError, "#{self.class} hash must have 'match' (Hash)" unless h['match'].kind_of?(Hash)
  raise ArgumentError, "#{self.class} hash must have 'values' (Hash)" unless h['values'].kind_of?(Hash)

  @keys = h['keys'].map do |k, v|
    [k, Oid.new(v)]
  end.to_h
  @match = h['match'].map do |k, v|
    [k, TemplateString.new(v)]
  end.to_h
  @values = h['values'].map do |k, v|
    [k, ValueDefinition.new([k,v])]
  end.to_h
end