Class: Cisco::RouterBgp

Inherits:
NodeUtil show all
Defined in:
lib/cisco_node_utils/bgp.rb

Overview

RouterBgp - node utility class for BGP general config management

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NodeUtil

client, #client, config_get, #config_get, #config_get_default, config_get_default, config_set, #config_set, #get, #ios_xr?, #nexus?, #node, node, platform, #platform, supports?, #supports?

Constructor Details

#initialize(asnum, vrf = 'default', instantiate = true) ⇒ RouterBgp

Returns a new instance of RouterBgp.



27
28
29
30
31
32
33
34
# File 'lib/cisco_node_utils/bgp.rb', line 27

def initialize(asnum, vrf='default', instantiate=true)
  fail ArgumentError unless vrf.is_a? String
  fail ArgumentError unless vrf.length > 0
  @asnum = RouterBgp.validate_asnum(asnum)
  @vrf = vrf
  set_args_keys_default
  create if instantiate
end

Instance Attribute Details

#asnumObject (readonly)

Returns the value of attribute asnum.



25
26
27
# File 'lib/cisco_node_utils/bgp.rb', line 25

def asnum
  @asnum
end

#vrfObject (readonly)

Returns the value of attribute vrf.



25
26
27
# File 'lib/cisco_node_utils/bgp.rb', line 25

def vrf
  @vrf
end

Class Method Details

.routersObject

Create a hash of all router bgp default and non-default vrf instances



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cisco_node_utils/bgp.rb', line 42

def self.routers
  asnum = config_get('bgp', 'router')
  return {} if asnum.nil?

  hash_final = {}
  asnum = asnum.to_i unless /\d+.\d+/.match(asnum)
  hash_tmp = {
    asnum => { 'default' => RouterBgp.new(asnum, 'default', false) }
  }
  vrf_ids = config_get('bgp', 'vrf', asnum: asnum)
  unless vrf_ids.nil?
    vrf_ids.each do |vrf|
      hash_tmp[asnum][vrf] = RouterBgp.new(asnum, vrf, false)
    end
  end
  hash_final.merge!(hash_tmp)
  return hash_final
rescue Cisco::CliError => e
  # cmd will syntax reject when feature is not enabled
  raise unless e.clierror =~ /Syntax error/
  return {}
end

.validate_asnum(asnum) ⇒ Object



65
66
67
68
69
70
71
72
73
74
# File 'lib/cisco_node_utils/bgp.rb', line 65

def self.validate_asnum(asnum)
  err_msg = 'BGP asnum must be type String or Integer'
  fail ArgumentError, err_msg unless asnum.is_a?(Integer) ||
                                     asnum.is_a?(String)
  if asnum.is_a? String
    # Match ASDOT '1.5' or ASPLAIN '55' strings
    fail ArgumentError unless /^(\d+|\d+\.\d+)$/.match(asnum)
  end
  asnum.to_s
end

Instance Method Details

#bestpath_always_compare_medObject

Bestpath Getters



132
133
134
# File 'lib/cisco_node_utils/bgp.rb', line 132

def bestpath_always_compare_med
  config_get('bgp', 'bestpath_always_compare_med', @get_args)
end

#bestpath_always_compare_med=(enable) ⇒ Object

Bestpath Setters



173
174
175
176
177
# File 'lib/cisco_node_utils/bgp.rb', line 173

def bestpath_always_compare_med=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_always_compare_med', @set_args)
  set_args_keys_default
end

#bestpath_aspath_multipath_relaxObject



136
137
138
# File 'lib/cisco_node_utils/bgp.rb', line 136

def bestpath_aspath_multipath_relax
  config_get('bgp', 'bestpath_aspath_multipath_relax', @get_args)
end

#bestpath_aspath_multipath_relax=(enable) ⇒ Object



179
180
181
182
183
# File 'lib/cisco_node_utils/bgp.rb', line 179

def bestpath_aspath_multipath_relax=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_aspath_multipath_relax', @set_args)
  set_args_keys_default
end

#bestpath_compare_routeridObject



140
141
142
# File 'lib/cisco_node_utils/bgp.rb', line 140

def bestpath_compare_routerid
  config_get('bgp', 'bestpath_compare_routerid', @get_args)
end

#bestpath_compare_routerid=(enable) ⇒ Object



185
186
187
188
189
# File 'lib/cisco_node_utils/bgp.rb', line 185

def bestpath_compare_routerid=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_compare_routerid', @set_args)
  set_args_keys_default
end

#bestpath_cost_community_ignoreObject



144
145
146
# File 'lib/cisco_node_utils/bgp.rb', line 144

def bestpath_cost_community_ignore
  config_get('bgp', 'bestpath_cost_community_ignore', @get_args)
end

#bestpath_cost_community_ignore=(enable) ⇒ Object



191
192
193
194
195
# File 'lib/cisco_node_utils/bgp.rb', line 191

def bestpath_cost_community_ignore=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_cost_community_ignore', @set_args)
  set_args_keys_default
end

#bestpath_med_confedObject



148
149
150
151
# File 'lib/cisco_node_utils/bgp.rb', line 148

def bestpath_med_confed
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'bestpath_med_confed', @get_args)
end

#bestpath_med_confed=(enable) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/cisco_node_utils/bgp.rb', line 197

def bestpath_med_confed=(enable)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'bestpath_med_confed', 'set',
                                     'bestpath_med_confed is not ' \
                                     'configurable on a per-VRF basis ' \
                                     'on IOS XR')
  end
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_med_confed', @set_args)
  set_args_keys_default
end

#bestpath_med_missing_as_worstObject



153
154
155
# File 'lib/cisco_node_utils/bgp.rb', line 153

def bestpath_med_missing_as_worst
  config_get('bgp', 'bestpath_med_missing_as_worst', @get_args)
end

#bestpath_med_missing_as_worst=(enable) ⇒ Object



209
210
211
212
213
# File 'lib/cisco_node_utils/bgp.rb', line 209

def bestpath_med_missing_as_worst=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_med_missing_as_worst', @set_args)
  set_args_keys_default
end

#bestpath_med_non_deterministicObject



157
158
159
# File 'lib/cisco_node_utils/bgp.rb', line 157

def bestpath_med_non_deterministic
  config_get('bgp', 'bestpath_med_non_deterministic', @get_args)
end

#bestpath_med_non_deterministic=(enable) ⇒ Object



215
216
217
218
219
# File 'lib/cisco_node_utils/bgp.rb', line 215

def bestpath_med_non_deterministic=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'bestpath_med_non_deterministic', @set_args)
  set_args_keys_default
end

#cluster_idObject

Cluster Id (Getter/Setter/Default)



258
259
260
261
# File 'lib/cisco_node_utils/bgp.rb', line 258

def cluster_id
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'cluster_id', @get_args)
end

#cluster_id=(id) ⇒ Object



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/cisco_node_utils/bgp.rb', line 263

def cluster_id=(id)
  # In order to remove a bgp cluster_id you cannot simply issue
  # 'no bgp cluster-id'.  IMO this should be possible because you
  # can only configure a single bgp cluster-id.
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'cluster_id', 'set',
                                     'cluster-id is not configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  # HACK: specify a dummy id when removing the property.
  dummy_id = 1
  if id == default_cluster_id
    @set_args[:state] = 'no'
    @set_args[:id] = dummy_id
  else
    @set_args[:state] = ''
    @set_args[:id] = id
  end
  config_set('bgp', 'cluster_id', @set_args)
  set_args_keys_default
end

#confederation_idObject

Confederation Id (Getter/Setter/Default)



291
292
293
294
# File 'lib/cisco_node_utils/bgp.rb', line 291

def confederation_id
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'confederation_id', @get_args)
end

#confederation_id=(id) ⇒ Object



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/cisco_node_utils/bgp.rb', line 296

def confederation_id=(id)
  # In order to remove a bgp confed id you cannot simply issue
  # 'no bgp confederation id'.  IMO this should be possible
  # because you can only configure a single bgp confed id.
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'confederation_id', 'set',
                                     'confederation-id is not ' \
                                     'configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  # HACK: specify a dummy id when removing the property.
  dummy_id = 1
  if id == default_confederation_id
    @set_args[:state] = 'no'
    @set_args[:id] = dummy_id
  else
    @set_args[:state] = ''
    @set_args[:id] = id
  end
  config_set('bgp', 'confederation_id', @set_args)
  set_args_keys_default
end

#confederation_peersObject

Confederation Peers (Getter/Setter/Default)



623
624
625
626
627
628
629
630
631
632
# File 'lib/cisco_node_utils/bgp.rb', line 623

def confederation_peers
  # NX: confederation peers is retrieved as a string '1 2 3'
  # XR: retrieved as an array.
  # So make it an array in the NX case.
  # Sort the end results to make it consistent across both platforms.
  return nil if platform == :ios_xr && @vrf != 'default'
  peers = config_get('bgp', 'confederation_peers', @get_args)
  peers = peers.split(' ') if peers.is_a?(String)
  peers.sort
end

#confederation_peers=(should) ⇒ Object



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/cisco_node_utils/bgp.rb', line 634

def confederation_peers=(should)
  # confederation peers are additive. So create a delta hash of entries
  # and only apply the changes
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'confederation_peers', 'set',
                                     'confederation-peers is not ' \
                                     'configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  should = should.flatten
  is = confederation_peers

  delta_hash = Utils.delta_add_remove(should, is)
  return if delta_hash.values.flatten.empty?
  [:add, :remove].each do |action|
    Cisco::Logger.debug('confederation_peers delta ' \
                        "#{@get_args}\n #{action}: " \
                        "#{delta_hash[action]}")
    delta_hash[action].each do |peer|
      state = (action == :add) ? '' : 'no'
      @set_args[:state] = state
      @set_args[:peer] = peer

      config_set('bgp', 'confederation_peers', @set_args)
    end
  end
end

#createObject

Create one router bgp instance



87
88
89
90
91
# File 'lib/cisco_node_utils/bgp.rb', line 87

def create
  Feature.bgp_enable if platform == :nexus
  router_bgp
  wait_for_process_initialized
end

#default_bestpath_always_compare_medObject

Bestpath Defaults



228
229
230
# File 'lib/cisco_node_utils/bgp.rb', line 228

def default_bestpath_always_compare_med
  config_get_default('bgp', 'bestpath_always_compare_med')
end

#default_bestpath_aspath_multipath_relaxObject



232
233
234
# File 'lib/cisco_node_utils/bgp.rb', line 232

def default_bestpath_aspath_multipath_relax
  config_get_default('bgp', 'bestpath_aspath_multipath_relax')
end

#default_bestpath_compare_routeridObject



236
237
238
# File 'lib/cisco_node_utils/bgp.rb', line 236

def default_bestpath_compare_routerid
  config_get_default('bgp', 'bestpath_compare_routerid')
end

#default_bestpath_cost_community_ignoreObject



240
241
242
# File 'lib/cisco_node_utils/bgp.rb', line 240

def default_bestpath_cost_community_ignore
  config_get_default('bgp', 'bestpath_cost_community_ignore')
end

#default_bestpath_med_confedObject



244
245
246
247
# File 'lib/cisco_node_utils/bgp.rb', line 244

def default_bestpath_med_confed
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'bestpath_med_confed')
end

#default_bestpath_med_missing_as_worstObject



249
250
251
# File 'lib/cisco_node_utils/bgp.rb', line 249

def default_bestpath_med_missing_as_worst
  config_get_default('bgp', 'bestpath_med_missing_as_worst')
end

#default_bestpath_med_non_deterministicObject



253
254
255
# File 'lib/cisco_node_utils/bgp.rb', line 253

def default_bestpath_med_non_deterministic
  config_get_default('bgp', 'bestpath_med_non_deterministic')
end

#default_cluster_idObject



285
286
287
288
# File 'lib/cisco_node_utils/bgp.rb', line 285

def default_cluster_id
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'cluster_id')
end

#default_confederation_idObject



319
320
321
322
# File 'lib/cisco_node_utils/bgp.rb', line 319

def default_confederation_id
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'confederation_id')
end

#default_confederation_peersObject



662
663
664
665
# File 'lib/cisco_node_utils/bgp.rb', line 662

def default_confederation_peers
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'confederation_peers')
end

#default_disable_policy_batchingObject



337
338
339
# File 'lib/cisco_node_utils/bgp.rb', line 337

def default_disable_policy_batching
  config_get_default('bgp', 'disable_policy_batching')
end

#default_disable_policy_batching_ipv4Object



361
362
363
# File 'lib/cisco_node_utils/bgp.rb', line 361

def default_disable_policy_batching_ipv4
  config_get_default('bgp', 'disable_policy_batching_ipv4')
end

#default_disable_policy_batching_ipv6Object



385
386
387
# File 'lib/cisco_node_utils/bgp.rb', line 385

def default_disable_policy_batching_ipv6
  config_get_default('bgp', 'disable_policy_batching_ipv6')
end

#default_enforce_first_asObject



408
409
410
# File 'lib/cisco_node_utils/bgp.rb', line 408

def default_enforce_first_as
  config_get_default('bgp', 'enforce_first_as')
end

#default_event_history_cliObject



435
436
437
# File 'lib/cisco_node_utils/bgp.rb', line 435

def default_event_history_cli
  config_get_default('bgp', 'event_history_cli')
end

#default_event_history_detailObject



462
463
464
# File 'lib/cisco_node_utils/bgp.rb', line 462

def default_event_history_detail
  config_get_default('bgp', 'event_history_detail')
end

#default_event_history_errorsObject



488
489
490
# File 'lib/cisco_node_utils/bgp.rb', line 488

def default_event_history_errors
  config_get_default('bgp', 'event_history_errors')
end

#default_event_history_eventsObject



514
515
516
517
518
519
520
521
# File 'lib/cisco_node_utils/bgp.rb', line 514

def default_event_history_events
  if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
     Utils.chassis_pid?(/N(5|6|7|8)/)
    config_get_default('bgp', 'event_history_events')
  else
    config_get('bgp', 'event_history_events_bytes', @get_args)
  end
end

#default_event_history_objstoreObject



546
547
548
# File 'lib/cisco_node_utils/bgp.rb', line 546

def default_event_history_objstore
  config_get_default('bgp', 'event_history_objstore')
end

#default_event_history_periodicObject



575
576
577
578
579
580
581
582
# File 'lib/cisco_node_utils/bgp.rb', line 575

def default_event_history_periodic
  if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
     Utils.chassis_pid?(/N(5|6|7|8)/)
    config_get_default('bgp', 'event_history_periodic')
  else
    config_get('bgp', 'event_history_periodic_bytes', @get_args)
  end
end

#default_fast_external_falloverObject



603
604
605
# File 'lib/cisco_node_utils/bgp.rb', line 603

def default_fast_external_fallover
  config_get_default('bgp', 'fast_external_fallover')
end

#default_flush_routesObject



618
619
620
# File 'lib/cisco_node_utils/bgp.rb', line 618

def default_flush_routes
  config_get_default('bgp', 'flush_routes')
end

#default_graceful_restartObject

Graceful Restart Defaults



755
756
757
758
# File 'lib/cisco_node_utils/bgp.rb', line 755

def default_graceful_restart
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'graceful_restart')
end

#default_graceful_restart_helperObject



770
771
772
773
# File 'lib/cisco_node_utils/bgp.rb', line 770

def default_graceful_restart_helper
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'graceful_restart_helper')
end

#default_graceful_restart_timers_restartObject



760
761
762
763
# File 'lib/cisco_node_utils/bgp.rb', line 760

def default_graceful_restart_timers_restart
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'graceful_restart_timers_restart')
end

#default_graceful_restart_timers_stalepath_timeObject



765
766
767
768
# File 'lib/cisco_node_utils/bgp.rb', line 765

def default_graceful_restart_timers_stalepath_time
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'graceful_restart_timers_stalepath_time')
end

#default_isolateObject



786
787
788
# File 'lib/cisco_node_utils/bgp.rb', line 786

def default_isolate
  config_get_default('bgp', 'isolate')
end

#default_log_neighbor_changesObject



829
830
831
# File 'lib/cisco_node_utils/bgp.rb', line 829

def default_log_neighbor_changes
  config_get_default('bgp', 'log_neighbor_changes')
end

#default_maxas_limitObject



807
808
809
# File 'lib/cisco_node_utils/bgp.rb', line 807

def default_maxas_limit
  config_get_default('bgp', 'maxas_limit')
end

#default_neighbor_down_fib_accelerateObject



844
845
846
# File 'lib/cisco_node_utils/bgp.rb', line 844

def default_neighbor_down_fib_accelerate
  config_get_default('bgp', 'neighbor_down_fib_accelerate')
end

#default_nsrObject

nsr Default



222
223
224
225
# File 'lib/cisco_node_utils/bgp.rb', line 222

def default_nsr
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'nsr')
end

#default_reconnect_intervalObject



865
866
867
# File 'lib/cisco_node_utils/bgp.rb', line 865

def default_reconnect_interval
  config_get_default('bgp', 'reconnect_interval')
end

#default_route_distinguisherObject



901
902
903
904
# File 'lib/cisco_node_utils/bgp.rb', line 901

def default_route_distinguisher
  return nil if @vrf.nil? || @vrf == 'default'
  config_get_default('bgp', 'route_distinguisher')
end

#default_router_idObject



928
929
930
# File 'lib/cisco_node_utils/bgp.rb', line 928

def default_router_id
  config_get_default('bgp', 'router_id')
end

#default_shutdownObject



943
944
945
# File 'lib/cisco_node_utils/bgp.rb', line 943

def default_shutdown
  config_get_default('bgp', 'shutdown')
end

#default_suppress_fib_pendingObject



959
960
961
# File 'lib/cisco_node_utils/bgp.rb', line 959

def default_suppress_fib_pending
  config_get_default('bgp', 'suppress_fib_pending')
end

#default_timer_bestpath_limitObject



1035
1036
1037
1038
# File 'lib/cisco_node_utils/bgp.rb', line 1035

def default_timer_bestpath_limit
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'timer_bestpath_limit')
end

#default_timer_bestpath_limit_alwaysObject



1040
1041
1042
1043
# File 'lib/cisco_node_utils/bgp.rb', line 1040

def default_timer_bestpath_limit_always
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get_default('bgp', 'timer_bestpath_limit_always')
end

#default_timer_bgp_holdtimeObject



1031
1032
1033
# File 'lib/cisco_node_utils/bgp.rb', line 1031

def default_timer_bgp_holdtime
  config_get_default('bgp', 'timer_bgp_hold')
end

#default_timer_bgp_keepaliveObject



1027
1028
1029
# File 'lib/cisco_node_utils/bgp.rb', line 1027

def default_timer_bgp_keepalive
  config_get_default('bgp', 'timer_bgp_keepalive')
end

#default_timer_bgp_keepalive_holdObject

BGP Timers Defaults



1023
1024
1025
# File 'lib/cisco_node_utils/bgp.rb', line 1023

def default_timer_bgp_keepalive_hold
  ["#{default_timer_bgp_keepalive}", "#{default_timer_bgp_holdtime}"]
end

#destroyObject

Destroy router bgp instance



94
95
96
# File 'lib/cisco_node_utils/bgp.rb', line 94

def destroy
  router_bgp('no')
end

#disable_policy_batchingObject

disable-policy-batching (Getter/Setter/Default)



327
328
329
# File 'lib/cisco_node_utils/bgp.rb', line 327

def disable_policy_batching
  config_get('bgp', 'disable_policy_batching', @get_args)
end

#disable_policy_batching=(enable) ⇒ Object



331
332
333
334
335
# File 'lib/cisco_node_utils/bgp.rb', line 331

def disable_policy_batching=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'disable_policy_batching', @set_args)
  set_args_keys_default
end

#disable_policy_batching_ipv4Object

disable-policy-batching ipv4 prefix-list <prefix_list>



344
345
346
# File 'lib/cisco_node_utils/bgp.rb', line 344

def disable_policy_batching_ipv4
  config_get('bgp', 'disable_policy_batching_ipv4', @get_args)
end

#disable_policy_batching_ipv4=(prefix_list) ⇒ Object



348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/cisco_node_utils/bgp.rb', line 348

def disable_policy_batching_ipv4=(prefix_list)
  dummy_prefixlist = 'x'
  if prefix_list == default_disable_policy_batching_ipv4
    @set_args[:state] = 'no'
    @set_args[:prefix_list] = dummy_prefixlist
  else
    @set_args[:state] = ''
    @set_args[:prefix_list] = prefix_list
  end
  config_set('bgp', 'disable_policy_batching_ipv4', @set_args)
  set_args_keys_default
end

#disable_policy_batching_ipv6Object

disable-policy-batching ipv6 prefix-list <prefix_list>



368
369
370
# File 'lib/cisco_node_utils/bgp.rb', line 368

def disable_policy_batching_ipv6
  config_get('bgp', 'disable_policy_batching_ipv6', @get_args)
end

#disable_policy_batching_ipv6=(prefix_list) ⇒ Object



372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/cisco_node_utils/bgp.rb', line 372

def disable_policy_batching_ipv6=(prefix_list)
  dummy_prefixlist = 'x'
  if prefix_list == default_disable_policy_batching_ipv6
    @set_args[:state] = 'no'
    @set_args[:prefix_list] = dummy_prefixlist
  else
    @set_args[:state] = ''
    @set_args[:prefix_list] = prefix_list
  end
  config_set('bgp', 'disable_policy_batching_ipv6', @set_args)
  set_args_keys_default
end

#enforce_first_asObject

Enforce First As (Getter/Setter/Default)



390
391
392
# File 'lib/cisco_node_utils/bgp.rb', line 390

def enforce_first_as
  config_get('bgp', 'enforce_first_as', @get_args)
end

#enforce_first_as=(enable) ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/cisco_node_utils/bgp.rb', line 394

def enforce_first_as=(enable)
  # TODO: write a helper method for this repeated logic
  # enforce_first_as is on by default (=>true)
  # XR=>true  = enable enforce_first_as  = 'no bgp enforce-first-as disable'
  # XR=>false = disable enforce_first_as = 'bgp enforce-first-as disable'
  # Nexus nvgens the 'no' command.
  # Nexus=>true  = enable enforce_first_as  = 'enforce-first-as'
  # Nexus=>false = disable enforce_first_as = 'no enforce-first-as'
  enable = !enable if platform == :ios_xr
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'enforce_first_as', @set_args)
  set_args_keys_default
end

#event_history_cliObject

event-history event-history cli [ size <size> ] Nvgen as True With optional ‘size <size>



415
416
417
418
419
420
421
422
423
424
425
# File 'lib/cisco_node_utils/bgp.rb', line 415

def event_history_cli
  match = config_get('bgp', 'event_history_cli', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
  end
  default_event_history_cli
end

#event_history_cli=(val) ⇒ Object



427
428
429
430
431
432
433
# File 'lib/cisco_node_utils/bgp.rb', line 427

def event_history_cli=(val)
  size = val[/small|medium|large|disable|\A\d+\z/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_cli', @set_args)
  set_args_keys_default
end

#event_history_detailObject

event-history detail [ size <size> ] Nvgen as True With optional ‘size <size>



441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/cisco_node_utils/bgp.rb', line 441

def event_history_detail
  match = config_get('bgp', 'event_history_detail', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
    return 'true'
  end
  default_event_history_detail
end

#event_history_detail=(val) ⇒ Object



454
455
456
457
458
459
460
# File 'lib/cisco_node_utils/bgp.rb', line 454

def event_history_detail=(val)
  size = val[/small|medium|large|disable|\A\d+\z/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_detail', @set_args)
  set_args_keys_default
end

#event_history_errorsObject

event-history errors [ size <size> ] Nvgen as True With optional ‘size <size>



468
469
470
471
472
473
474
475
476
477
478
# File 'lib/cisco_node_utils/bgp.rb', line 468

def event_history_errors
  match = config_get('bgp', 'event_history_errors', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
  end
  default_event_history_errors
end

#event_history_errors=(val) ⇒ Object



480
481
482
483
484
485
486
# File 'lib/cisco_node_utils/bgp.rb', line 480

def event_history_errors=(val)
  size = val[/small|medium|large|disable|\A\d+\z/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_errors', @set_args)
  set_args_keys_default
end

#event_history_eventsObject

event-history events [ size <size> ] Nvgen as True With optional ‘size <size>



494
495
496
497
498
499
500
501
502
503
504
# File 'lib/cisco_node_utils/bgp.rb', line 494

def event_history_events
  match = config_get('bgp', 'event_history_events', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
  end
  default_event_history_events
end

#event_history_events=(val) ⇒ Object



506
507
508
509
510
511
512
# File 'lib/cisco_node_utils/bgp.rb', line 506

def event_history_events=(val)
  size = val[/small|medium|large|disable|\A\d+\z/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_events', @set_args)
  set_args_keys_default
end

#event_history_objstoreObject

event-history objstore [ size <size> ] Nvgen as True With optional ‘size <size>



525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/cisco_node_utils/bgp.rb', line 525

def event_history_objstore
  match = config_get('bgp', 'event_history_objstore', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
    return 'true'
  end
  default_event_history_objstore
end

#event_history_objstore=(val) ⇒ Object



538
539
540
541
542
543
544
# File 'lib/cisco_node_utils/bgp.rb', line 538

def event_history_objstore=(val)
  size = val[/small|medium|large|disable|\A\d+\z/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_objstore', @set_args)
  set_args_keys_default
end

#event_history_periodicObject

event-history periodic [ size <size> ] Nvgen as True With optional ‘size <size>



552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/cisco_node_utils/bgp.rb', line 552

def event_history_periodic
  match = config_get('bgp', 'event_history_periodic', @get_args)
  if match.is_a?(Array)
    return 'false' if match[0] == 'no '
    if match[1]
      return match[1] if match[1][/\A\d+\z/]
      return 'size_' + match[1]
    end
  else
    return default_event_history_periodic
  end
  return 'true' unless default_event_history_periodic[/size/]
  default_event_history_periodic
end

#event_history_periodic=(val) ⇒ Object



567
568
569
570
571
572
573
# File 'lib/cisco_node_utils/bgp.rb', line 567

def event_history_periodic=(val)
  size = val[/small|medium|large|disable|\A\d+\z/] unless val[/false|true/]
  @set_args[:size] = size.nil? ? '' : "size #{size}"
  @set_args[:state] = val[/false/] ? 'no' : ''
  config_set('bgp', 'event_history_periodic', @set_args)
  set_args_keys_default
end

#fast_external_falloverObject

Fast External fallover (Getter/Setter/Default)



585
586
587
# File 'lib/cisco_node_utils/bgp.rb', line 585

def fast_external_fallover
  config_get('bgp', 'fast_external_fallover', @get_args)
end

#fast_external_fallover=(enable) ⇒ Object



589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/cisco_node_utils/bgp.rb', line 589

def fast_external_fallover=(enable)
  # TODO: write a helper method for this repeated logic
  # fast_external_fallover is on by default (=>true)
  # XR=>true  = 'no bgp fast-external-fallover disable'
  # XR=>false = 'bgp fast-external-fallover disable'
  # Nexus nvgens the 'no' command.
  # Nexus=>true  = 'fast-external-fallover'
  # Nexus=>false = 'no fast-external-fallover'
  enable = !enable if platform == :ios_xr
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'fast_external_fallover', @set_args)
  set_args_keys_default
end

#flush_routesObject

Flush Routes (Getter/Setter/Default)



608
609
610
# File 'lib/cisco_node_utils/bgp.rb', line 608

def flush_routes
  config_get('bgp', 'flush_routes', @get_args)
end

#flush_routes=(enable) ⇒ Object



612
613
614
615
616
# File 'lib/cisco_node_utils/bgp.rb', line 612

def flush_routes=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'flush_routes', @set_args)
  set_args_keys_default
end

#graceful_restartObject

Graceful Restart Getters



668
669
670
671
# File 'lib/cisco_node_utils/bgp.rb', line 668

def graceful_restart
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'graceful_restart', @get_args)
end

#graceful_restart=(enable) ⇒ Object

Graceful Restart Setters



689
690
691
692
693
694
695
696
697
698
699
# File 'lib/cisco_node_utils/bgp.rb', line 689

def graceful_restart=(enable)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'graceful_restart', 'set',
                                     'graceful_restart is not ' \
                                     'configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'graceful_restart', @set_args)
  set_args_keys_default
end

#graceful_restart_helperObject



683
684
685
686
# File 'lib/cisco_node_utils/bgp.rb', line 683

def graceful_restart_helper
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'graceful_restart_helper', @get_args)
end

#graceful_restart_helper=(enable) ⇒ Object



741
742
743
744
745
746
747
748
749
750
751
752
# File 'lib/cisco_node_utils/bgp.rb', line 741

def graceful_restart_helper=(enable)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp',
                                     'graceful_restart_helper', 'set',
                                     'graceful_restart_helper ' \
                                     'is not configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'graceful_restart_helper', @set_args)
  set_args_keys_default
end

#graceful_restart_timers_restartObject



673
674
675
676
# File 'lib/cisco_node_utils/bgp.rb', line 673

def graceful_restart_timers_restart
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'graceful_restart_timers_restart', @get_args)
end

#graceful_restart_timers_restart=(seconds) ⇒ Object



701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/cisco_node_utils/bgp.rb', line 701

def graceful_restart_timers_restart=(seconds)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp',
                                     'graceful_restart_timers_restart',
                                     'set',
                                     'graceful_restart_timers_restart is ' \
                                     'not configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  if seconds == default_graceful_restart_timers_restart
    @set_args[:state] = 'no'
    @set_args[:seconds] = ''
  else
    @set_args[:state] = ''
    @set_args[:seconds] = seconds
  end
  config_set('bgp', 'graceful_restart_timers_restart', @set_args)
  set_args_keys_default
end

#graceful_restart_timers_stalepath_timeObject



678
679
680
681
# File 'lib/cisco_node_utils/bgp.rb', line 678

def graceful_restart_timers_stalepath_time
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'graceful_restart_timers_stalepath_time', @get_args)
end

#graceful_restart_timers_stalepath_time=(seconds) ⇒ Object



721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/cisco_node_utils/bgp.rb', line 721

def graceful_restart_timers_stalepath_time=(seconds)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp',
                                     'graceful_restart_timers_' \
                                     'stalepath_time', 'set',
                                     'graceful_restart_timers_' \
                                     'stalepath_time is not configurable ' \
                                     'on a per-VRF basis on IOS XR')
  end
  if seconds == default_graceful_restart_timers_stalepath_time
    @set_args[:state] = 'no'
    @set_args[:seconds] = ''
  else
    @set_args[:state] = ''
    @set_args[:seconds] = seconds
  end
  config_set('bgp', 'graceful_restart_timers_stalepath_time', @set_args)
  set_args_keys_default
end

#isolateObject

Isolate (Getter/Setter/Default)



776
777
778
# File 'lib/cisco_node_utils/bgp.rb', line 776

def isolate
  config_get('bgp', 'isolate', @get_args)
end

#isolate=(enable) ⇒ Object



780
781
782
783
784
# File 'lib/cisco_node_utils/bgp.rb', line 780

def isolate=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'isolate', @set_args)
  set_args_keys_default
end

#log_neighbor_changesObject

Log Neighbor Changes (Getter/Setter/Default)



812
813
814
# File 'lib/cisco_node_utils/bgp.rb', line 812

def log_neighbor_changes
  config_get('bgp', 'log_neighbor_changes', @get_args)
end

#log_neighbor_changes=(enable) ⇒ Object



816
817
818
819
820
821
822
823
824
825
826
827
# File 'lib/cisco_node_utils/bgp.rb', line 816

def log_neighbor_changes=(enable)
  # XR logging is on by default (=>true)
  # XR=>true  = enable logging  = 'no bgp log neighbor changes disable'
  # XR=>false = disable logging = 'bgp log neighbor changes disable'
  # Nexus logging is off by default (=>false)
  # Nexus=>true  = enable logging  = 'log-neighbor-changes'
  # Nexus=>false = disable logging = 'no log-neighbor-changes'
  enable = !enable if platform == :ios_xr
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'log_neighbor_changes', @set_args)
  set_args_keys_default
end

#maxas_limitObject

MaxAs Limit (Getter/Setter/Default)



791
792
793
# File 'lib/cisco_node_utils/bgp.rb', line 791

def maxas_limit
  config_get('bgp', 'maxas_limit', @get_args)
end

#maxas_limit=(limit) ⇒ Object



795
796
797
798
799
800
801
802
803
804
805
# File 'lib/cisco_node_utils/bgp.rb', line 795

def maxas_limit=(limit)
  if limit == default_maxas_limit
    @set_args[:state] = 'no'
    @set_args[:limit] = ''
  else
    @set_args[:state] = ''
    @set_args[:limit] = limit
  end
  config_set('bgp', 'maxas_limit', @set_args)
  set_args_keys_default
end

#neighbor_down_fib_accelerateObject

Neighbor down fib accelerate (Getter/Setter/Default)



834
835
836
# File 'lib/cisco_node_utils/bgp.rb', line 834

def neighbor_down_fib_accelerate
  config_get('bgp', 'neighbor_down_fib_accelerate', @get_args)
end

#neighbor_down_fib_accelerate=(enable) ⇒ Object



838
839
840
841
842
# File 'lib/cisco_node_utils/bgp.rb', line 838

def neighbor_down_fib_accelerate=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'neighbor_down_fib_accelerate', @set_args)
  set_args_keys_default
end

#nsrObject

nsr Getter



126
127
128
129
# File 'lib/cisco_node_utils/bgp.rb', line 126

def nsr
  return nil if platform == :ios_xr && @vrf != 'default'
  config_get('bgp', 'nsr', @get_args)
end

#nsr=(enable) ⇒ Object

nsr Setter



162
163
164
165
166
167
168
169
170
# File 'lib/cisco_node_utils/bgp.rb', line 162

def nsr=(enable)
  if platform == :ios_xr && @vrf != 'default'
    fail Cisco::UnsupportedError.new('bgp', 'nsr', 'set', 'nsr is not ' \
              'configurable on a per-VRF basis on ios_xr')
  end
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'nsr', @set_args)
  set_args_keys_default
end

#process_initialized?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/cisco_node_utils/bgp.rb', line 98

def process_initialized?
  config_get('bgp', 'process_initialized')
end

#reconnect_intervalObject

Reconnect Interval (Getter/Setter/Default)



849
850
851
# File 'lib/cisco_node_utils/bgp.rb', line 849

def reconnect_interval
  config_get('bgp', 'reconnect_interval', @get_args)
end

#reconnect_interval=(seconds) ⇒ Object



853
854
855
856
857
858
859
860
861
862
863
# File 'lib/cisco_node_utils/bgp.rb', line 853

def reconnect_interval=(seconds)
  if seconds == default_reconnect_interval
    @set_args[:state] = 'no'
    @set_args[:seconds] = ''
  else
    @set_args[:state] = ''
    @set_args[:seconds] = seconds
  end
  config_set('bgp', 'reconnect_interval', @set_args)
  set_args_keys_default
end

#route_distinguisherObject

route_distinguisher Note that this property is supported by both bgp and vrf providers.



871
872
873
874
# File 'lib/cisco_node_utils/bgp.rb', line 871

def route_distinguisher
  return nil if @vrf.nil? || @vrf == 'default'
  config_get('bgp', 'route_distinguisher', @get_args)
end

#route_distinguisher=(rd) ⇒ Object



876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
# File 'lib/cisco_node_utils/bgp.rb', line 876

def route_distinguisher=(rd)
  if @vrf.nil? || @vrf == 'default'
    fail Cisco::UnsupportedError.new('bgp', 'route_distinguisher', 'set',
                                     'route_distinguisher is not ' \
                                     'configurable on a default VRF')
  end

  # N3k I2 images require 'nv overlay evpn' for rd and also require
  # explicit values when removing the rd command. These restrictions are
  # not not needed in I3 and newer images.
  Feature.nv_overlay_evpn_enable if
    Utils.nexus_i2_image || node.product_id[/N7/]

  if rd == default_route_distinguisher
    return if route_distinguisher.empty?
    @set_args[:state] = 'no'
    @set_args[:rd] = route_distinguisher
  else
    @set_args[:state] = ''
    @set_args[:rd] = rd
  end
  config_set('bgp', 'route_distinguisher', @set_args)
  set_args_keys_default
end

#router_bgp(state = '') ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/cisco_node_utils/bgp.rb', line 76

def router_bgp(state='')
  @set_args[:state] = state
  if vrf == 'default'
    config_set('bgp', 'router', @set_args)
  else
    config_set('bgp', 'vrf', @set_args)
  end
  set_args_keys_default
end

#router_idObject

Router ID (Getter/Setter/Default)



907
908
909
# File 'lib/cisco_node_utils/bgp.rb', line 907

def router_id
  config_get('bgp', 'router_id', @get_args)
end

#router_id=(id) ⇒ Object



911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
# File 'lib/cisco_node_utils/bgp.rb', line 911

def router_id=(id)
  # In order to remove a bgp router-id you cannot simply issue
  # 'no bgp router-id'. On some platforms you can specify a dummy
  # value, but on N7K at least you need the current router_id.
  if id == default_router_id
    # Nothing to do if router_id is already set to default.
    return if router_id == default_router_id
    @set_args[:state] = 'no'
    @set_args[:id] = router_id
  else
    @set_args[:state] = ''
    @set_args[:id] = id
  end
  config_set('bgp', 'router_id', @set_args)
  set_args_keys_default
end

#set_args_keys_defaultObject

Helper method to delete @set_args hash keys



117
118
119
120
121
# File 'lib/cisco_node_utils/bgp.rb', line 117

def set_args_keys_default
  @set_args = { asnum: @asnum }
  @set_args[:vrf] = @vrf unless @vrf == 'default'
  @get_args = @set_args
end

#shutdownObject

Shutdown (Getter/Setter/Default)



933
934
935
# File 'lib/cisco_node_utils/bgp.rb', line 933

def shutdown
  config_get('bgp', 'shutdown', @asnum)
end

#shutdown=(enable) ⇒ Object



937
938
939
940
941
# File 'lib/cisco_node_utils/bgp.rb', line 937

def shutdown=(enable)
  @set_args[:state] = (enable ? '' : 'no')
  config_set('bgp', 'shutdown', @set_args)
  set_args_keys_default
end

#suppress_fib_pendingObject

Supress Fib Pending (Getter/Setter/Default)



948
949
950
951
# File 'lib/cisco_node_utils/bgp.rb', line 948

def suppress_fib_pending
  val = config_get('bgp', 'suppress_fib_pending', @get_args)
  val.nil? ? false : val
end

#suppress_fib_pending=(enable) ⇒ Object



953
954
955
956
957
# File 'lib/cisco_node_utils/bgp.rb', line 953

def suppress_fib_pending=(enable)
  enable == true ? @set_args[:state] = '' : @set_args[:state] = 'no'
  config_set('bgp', 'suppress_fib_pending', @set_args)
  set_args_keys_default
end

#timer_bestpath_limitObject



981
982
983
# File 'lib/cisco_node_utils/bgp.rb', line 981

def timer_bestpath_limit
  config_get('bgp', 'timer_bestpath_limit', @get_args)
end

#timer_bestpath_limit_alwaysObject



985
986
987
# File 'lib/cisco_node_utils/bgp.rb', line 985

def timer_bestpath_limit_always
  config_get('bgp', 'timer_bestpath_limit_always', @get_args)
end

#timer_bestpath_limit_set(seconds, always = false) ⇒ Object



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/cisco_node_utils/bgp.rb', line 1005

def timer_bestpath_limit_set(seconds, always=false)
  if always
    opt = 'timer_bestpath_limit_always'
  else
    opt = 'timer_bestpath_limit'
  end
  if seconds == default_timer_bestpath_limit
    @set_args[:state] = 'no'
    @set_args[:seconds] = ''
  else
    @set_args[:state] = ''
    @set_args[:seconds] = seconds
  end
  config_set('bgp', opt, @set_args)
  set_args_keys_default
end

#timer_bgp_holdtimeObject



975
976
977
978
979
# File 'lib/cisco_node_utils/bgp.rb', line 975

def timer_bgp_holdtime
  _keepalive, hold = timer_bgp_keepalive_hold
  return default_timer_bgp_holdtime if hold.nil?
  hold.to_i
end

#timer_bgp_keepaliveObject



969
970
971
972
973
# File 'lib/cisco_node_utils/bgp.rb', line 969

def timer_bgp_keepalive
  keepalive, _hold = timer_bgp_keepalive_hold
  return default_timer_bgp_keepalive if keepalive.nil?
  keepalive.to_i
end

#timer_bgp_keepalive_holdObject

BGP Timers Getters



964
965
966
967
# File 'lib/cisco_node_utils/bgp.rb', line 964

def timer_bgp_keepalive_hold
  match = config_get('bgp', 'timer_bgp_keepalive_hold', @get_args)
  match.nil? ? default_timer_bgp_keepalive_hold : match
end

#timer_bgp_keepalive_hold_set(keepalive, hold) ⇒ Object

BGP Timers Setters



990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
# File 'lib/cisco_node_utils/bgp.rb', line 990

def timer_bgp_keepalive_hold_set(keepalive, hold)
  if keepalive == default_timer_bgp_keepalive &&
     hold == default_timer_bgp_holdtime
    @set_args[:state] = 'no'
    @set_args[:keepalive] = keepalive
    @set_args[:hold] = hold
  else
    @set_args[:state] = ''
    @set_args[:keepalive] = keepalive
    @set_args[:hold] = hold
  end
  config_set('bgp', 'timer_bgp_keepalive_hold', @set_args)
  set_args_keys_default
end

#to_sObject



36
37
38
# File 'lib/cisco_node_utils/bgp.rb', line 36

def to_s
  "BGP #{asnum} VRF '#{vrf}'"
end

#wait_for_process_initializedObject



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cisco_node_utils/bgp.rb', line 102

def wait_for_process_initialized
  return unless node.product_id[/N(5|6|8)/]

  # Hack for slow-start platforms which will have setter failures if the
  # bgp instance is still initializing. To see this problem in a sandbox
  # do 'router bgp 1 ; router bgp 1 ; shutdown'.
  4.times do
    return if process_initialized?
    sleep 1
    node.cache_flush
  end
  fail 'BGP process is not initialized yet'
end