Method: Cisco::RouterBgpAF#inject_map=

Defined in:
lib/cisco_node_utils/bgp_af.rb

#inject_map=(should_list) ⇒ Object



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/cisco_node_utils/bgp_af.rb', line 382

def inject_map=(should_list)
  c = inject_map
  fail_unsupported(__callee__) if c.nil?
  delta_hash = Utils.delta_add_remove(should_list, c)
  return if delta_hash.values.flatten.empty?
  [:add, :remove].each do |action|
    Cisco::Logger.debug("inject_map delta #{@get_args}\n #{action}: " \
                        "#{delta_hash[action]}")
    delta_hash[action].each do |inject, exist, copy|
      # inject & exist are mandatory, copy is optional
      state = (action == :add) ? '' : 'no'
      copy = 'copy-attributes' unless copy.nil?
      set_args_keys(state: state, inject: inject, exist: exist, copy: copy)
      config_set('bgp_af', 'inject_map', @set_args)
    end
  end
end