Method: Cisco::RouteMap#set_extcommunity_cost_set

Defined in:
lib/cisco_node_utils/route_map.rb

#set_extcommunity_cost_set(igp, pre) ⇒ Object

set extcommunity cost igp 0 22 igp 3 23 set extcommunity cost pre-bestpath 1 222 pre-bestpath 2 54 set extcommunity cost pre-bestpath 1 222 pre-bestpath 2 54 igp 0 22



2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
# File 'lib/cisco_node_utils/route_map.rb', line 2475

def set_extcommunity_cost_set(igp, pre)
  str = ''
  # reset first
  if set_extcommunity_cost_device
    cpre = set_extcommunity_cost_pre_bestpath
    cigp = set_extcommunity_cost_igp
    cpre.each do |id, val|
      str.concat('pre-bestpath ' + id.to_s + ' ' + val.to_s + ' ')
    end
    cigp.each do |id, val|
      str.concat('igp ' + id.to_s + ' ' + val.to_s + ' ')
    end
  end
  set_args_keys(state: 'no', string: str)
  config_set('route_map', 'set_extcommunity_cost', @set_args)
  return if igp.empty? && pre.empty?
  str = ''
  pre.each do |id, val|
    str.concat('pre-bestpath ' + id.to_s + ' ' + val.to_s + ' ')
  end
  igp.each do |id, val|
    str.concat('igp ' + id.to_s + ' ' + val.to_s + ' ')
  end
  set_args_keys(state: '', string: str)
  config_set('route_map', 'set_extcommunity_cost', @set_args)
end