Class: Cisco::RouterBgp
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
config_get, #config_get, config_get_default, #config_get_default, #config_set, config_set, #node, node, #show
Constructor Details
#initialize(asnum, vrf = 'default', instantiate = true) ⇒ RouterBgp
Returns a new instance of RouterBgp.
26
27
28
29
30
31
32
33
|
# File 'lib/cisco_node_utils/bgp.rb', line 26
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
#asnum ⇒ Object
Returns the value of attribute asnum.
24
25
26
|
# File 'lib/cisco_node_utils/bgp.rb', line 24
def asnum
@asnum
end
|
#vrf ⇒ Object
Returns the value of attribute vrf.
24
25
26
|
# File 'lib/cisco_node_utils/bgp.rb', line 24
def vrf
@vrf
end
|
Class Method Details
.routers ⇒ Object
Create a hash of all router bgp default and non-default vrf instances
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/cisco_node_utils/bgp.rb', line 37
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
raise unless e.clierror =~ /Syntax error/
return {}
end
|
.validate_asnum(asnum) ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/cisco_node_utils/bgp.rb', line 60
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
fail ArgumentError unless /^(\d+|\d+\.\d+)$/.match(asnum)
end
asnum.to_s
end
|
Instance Method Details
#bestpath_always_compare_med ⇒ Object
102
103
104
|
# File 'lib/cisco_node_utils/bgp.rb', line 102
def bestpath_always_compare_med
config_get('bgp', 'bestpath_always_compare_med', @get_args)
end
|
#bestpath_always_compare_med=(enable) ⇒ Object
131
132
133
134
135
|
# File 'lib/cisco_node_utils/bgp.rb', line 131
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_relax ⇒ Object
106
107
108
|
# File 'lib/cisco_node_utils/bgp.rb', line 106
def bestpath_aspath_multipath_relax
config_get('bgp', 'bestpath_aspath_multipath_relax', @get_args)
end
|
#bestpath_aspath_multipath_relax=(enable) ⇒ Object
137
138
139
140
141
|
# File 'lib/cisco_node_utils/bgp.rb', line 137
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_routerid ⇒ Object
110
111
112
|
# File 'lib/cisco_node_utils/bgp.rb', line 110
def bestpath_compare_routerid
config_get('bgp', 'bestpath_compare_routerid', @get_args)
end
|
#bestpath_compare_routerid=(enable) ⇒ Object
143
144
145
146
147
|
# File 'lib/cisco_node_utils/bgp.rb', line 143
def bestpath_compare_routerid=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'bestpath_compare_routerid', @set_args)
set_args_keys_default
end
|
114
115
116
|
# File 'lib/cisco_node_utils/bgp.rb', line 114
def
config_get('bgp', 'bestpath_cost_community_ignore', @get_args)
end
|
149
150
151
152
153
|
# File 'lib/cisco_node_utils/bgp.rb', line 149
def (enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'bestpath_cost_community_ignore', @set_args)
set_args_keys_default
end
|
#bestpath_med_confed ⇒ Object
118
119
120
|
# File 'lib/cisco_node_utils/bgp.rb', line 118
def bestpath_med_confed
config_get('bgp', 'bestpath_med_confed', @get_args)
end
|
#bestpath_med_confed=(enable) ⇒ Object
155
156
157
158
159
|
# File 'lib/cisco_node_utils/bgp.rb', line 155
def bestpath_med_confed=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'bestpath_med_confed', @set_args)
set_args_keys_default
end
|
#bestpath_med_missing_as_worst ⇒ Object
122
123
124
|
# File 'lib/cisco_node_utils/bgp.rb', line 122
def bestpath_med_missing_as_worst
config_get('bgp', 'bestpath_med_missing_as_worst', @get_args)
end
|
#bestpath_med_missing_as_worst=(enable) ⇒ Object
161
162
163
164
165
|
# File 'lib/cisco_node_utils/bgp.rb', line 161
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_deterministic ⇒ Object
126
127
128
|
# File 'lib/cisco_node_utils/bgp.rb', line 126
def bestpath_med_non_deterministic
config_get('bgp', 'bestpath_med_non_deterministic', @get_args)
end
|
#bestpath_med_non_deterministic=(enable) ⇒ Object
167
168
169
170
171
|
# File 'lib/cisco_node_utils/bgp.rb', line 167
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_id ⇒ Object
Cluster Id (Getter/Setter/Default)
203
204
205
|
# File 'lib/cisco_node_utils/bgp.rb', line 203
def cluster_id
config_get('bgp', 'cluster_id', @get_args)
end
|
#cluster_id=(id) ⇒ Object
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/cisco_node_utils/bgp.rb', line 207
def cluster_id=(id)
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_id ⇒ Object
Confederation Id (Getter/Setter/Default)
230
231
232
|
# File 'lib/cisco_node_utils/bgp.rb', line 230
def confederation_id
config_get('bgp', 'confederation_id', @get_args)
end
|
#confederation_id=(id) ⇒ Object
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
# File 'lib/cisco_node_utils/bgp.rb', line 234
def confederation_id=(id)
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_peers ⇒ Object
Confederation Peers (Getter/Setter/Default)
461
462
463
|
# File 'lib/cisco_node_utils/bgp.rb', line 461
def confederation_peers
config_get('bgp', 'confederation_peers', @get_args)
end
|
#confederation_peers_set(peers) ⇒ Object
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
|
# File 'lib/cisco_node_utils/bgp.rb', line 465
def confederation_peers_set(peers)
unless confederation_peers.empty?
@set_args[:state] = 'no'
@set_args[:peer_list] = confederation_peers
config_set('bgp', 'confederation_peers', @set_args)
end
unless peers == default_confederation_peers
@set_args[:state] = ''
@set_args[:peer_list] = peers
config_set('bgp', 'confederation_peers', @set_args)
end
set_args_keys_default
end
|
#create ⇒ Object
Create one router bgp instance
82
83
84
85
|
# File 'lib/cisco_node_utils/bgp.rb', line 82
def create
Feature.bgp_enable
router_bgp
end
|
#default_bestpath_always_compare_med ⇒ Object
174
175
176
|
# File 'lib/cisco_node_utils/bgp.rb', line 174
def default_bestpath_always_compare_med
config_get_default('bgp', 'bestpath_always_compare_med')
end
|
#default_bestpath_aspath_multipath_relax ⇒ Object
178
179
180
|
# File 'lib/cisco_node_utils/bgp.rb', line 178
def default_bestpath_aspath_multipath_relax
config_get_default('bgp', 'bestpath_aspath_multipath_relax')
end
|
#default_bestpath_compare_routerid ⇒ Object
182
183
184
|
# File 'lib/cisco_node_utils/bgp.rb', line 182
def default_bestpath_compare_routerid
config_get_default('bgp', 'bestpath_compare_routerid')
end
|
186
187
188
|
# File 'lib/cisco_node_utils/bgp.rb', line 186
def
config_get_default('bgp', 'bestpath_cost_community_ignore')
end
|
#default_bestpath_med_confed ⇒ Object
190
191
192
|
# File 'lib/cisco_node_utils/bgp.rb', line 190
def default_bestpath_med_confed
config_get_default('bgp', 'bestpath_med_confed')
end
|
#default_bestpath_med_missing_as_worst ⇒ Object
194
195
196
|
# File 'lib/cisco_node_utils/bgp.rb', line 194
def default_bestpath_med_missing_as_worst
config_get_default('bgp', 'bestpath_med_missing_as_worst')
end
|
#default_bestpath_med_non_deterministic ⇒ Object
198
199
200
|
# File 'lib/cisco_node_utils/bgp.rb', line 198
def default_bestpath_med_non_deterministic
config_get_default('bgp', 'bestpath_med_non_deterministic')
end
|
#default_cluster_id ⇒ Object
225
226
227
|
# File 'lib/cisco_node_utils/bgp.rb', line 225
def default_cluster_id
config_get_default('bgp', 'cluster_id')
end
|
#default_confederation_id ⇒ Object
252
253
254
|
# File 'lib/cisco_node_utils/bgp.rb', line 252
def default_confederation_id
config_get_default('bgp', 'confederation_id')
end
|
#default_confederation_peers ⇒ Object
481
482
483
|
# File 'lib/cisco_node_utils/bgp.rb', line 481
def default_confederation_peers
config_get_default('bgp', 'confederation_peers')
end
|
#default_disable_policy_batching ⇒ Object
269
270
271
|
# File 'lib/cisco_node_utils/bgp.rb', line 269
def default_disable_policy_batching
config_get_default('bgp', 'disable_policy_batching')
end
|
#default_disable_policy_batching_ipv4 ⇒ Object
293
294
295
|
# File 'lib/cisco_node_utils/bgp.rb', line 293
def default_disable_policy_batching_ipv4
config_get_default('bgp', 'disable_policy_batching_ipv4')
end
|
#default_disable_policy_batching_ipv6 ⇒ Object
317
318
319
|
# File 'lib/cisco_node_utils/bgp.rb', line 317
def default_disable_policy_batching_ipv6
config_get_default('bgp', 'disable_policy_batching_ipv6')
end
|
#default_enforce_first_as ⇒ Object
332
333
334
|
# File 'lib/cisco_node_utils/bgp.rb', line 332
def default_enforce_first_as
config_get_default('bgp', 'enforce_first_as')
end
|
#default_event_history_cli ⇒ Object
356
357
358
|
# File 'lib/cisco_node_utils/bgp.rb', line 356
def default_event_history_cli
config_get_default('bgp', 'event_history_cli')
end
|
#default_event_history_detail ⇒ Object
380
381
382
|
# File 'lib/cisco_node_utils/bgp.rb', line 380
def default_event_history_detail
config_get_default('bgp', 'event_history_detail')
end
|
#default_event_history_events ⇒ Object
403
404
405
|
# File 'lib/cisco_node_utils/bgp.rb', line 403
def default_event_history_events
config_get_default('bgp', 'event_history_events')
end
|
#default_event_history_periodic ⇒ Object
426
427
428
|
# File 'lib/cisco_node_utils/bgp.rb', line 426
def default_event_history_periodic
config_get_default('bgp', 'event_history_periodic')
end
|
#default_fast_external_fallover ⇒ Object
441
442
443
|
# File 'lib/cisco_node_utils/bgp.rb', line 441
def default_fast_external_fallover
config_get_default('bgp', 'fast_external_fallover')
end
|
#default_flush_routes ⇒ Object
456
457
458
|
# File 'lib/cisco_node_utils/bgp.rb', line 456
def default_flush_routes
config_get_default('bgp', 'flush_routes')
end
|
#default_graceful_restart ⇒ Object
Graceful Restart Defaults
540
541
542
|
# File 'lib/cisco_node_utils/bgp.rb', line 540
def default_graceful_restart
config_get_default('bgp', 'graceful_restart')
end
|
#default_graceful_restart_helper ⇒ Object
552
553
554
|
# File 'lib/cisco_node_utils/bgp.rb', line 552
def default_graceful_restart_helper
config_get_default('bgp', 'graceful_restart_helper')
end
|
#default_graceful_restart_timers_restart ⇒ Object
544
545
546
|
# File 'lib/cisco_node_utils/bgp.rb', line 544
def default_graceful_restart_timers_restart
config_get_default('bgp', 'graceful_restart_timers_restart')
end
|
#default_graceful_restart_timers_stalepath_time ⇒ Object
548
549
550
|
# File 'lib/cisco_node_utils/bgp.rb', line 548
def default_graceful_restart_timers_stalepath_time
config_get_default('bgp', 'graceful_restart_timers_stalepath_time')
end
|
#default_isolate ⇒ Object
567
568
569
|
# File 'lib/cisco_node_utils/bgp.rb', line 567
def default_isolate
config_get_default('bgp', 'isolate')
end
|
#default_log_neighbor_changes ⇒ Object
603
604
605
|
# File 'lib/cisco_node_utils/bgp.rb', line 603
def default_log_neighbor_changes
config_get_default('bgp', 'log_neighbor_changes')
end
|
#default_maxas_limit ⇒ Object
588
589
590
|
# File 'lib/cisco_node_utils/bgp.rb', line 588
def default_maxas_limit
config_get_default('bgp', 'maxas_limit')
end
|
#default_neighbor_down_fib_accelerate ⇒ Object
618
619
620
|
# File 'lib/cisco_node_utils/bgp.rb', line 618
def default_neighbor_down_fib_accelerate
config_get_default('bgp', 'neighbor_down_fib_accelerate')
end
|
#default_reconnect_interval ⇒ Object
639
640
641
|
# File 'lib/cisco_node_utils/bgp.rb', line 639
def default_reconnect_interval
config_get_default('bgp', 'reconnect_interval')
end
|
#default_route_distinguisher ⇒ Object
662
663
664
|
# File 'lib/cisco_node_utils/bgp.rb', line 662
def default_route_distinguisher
config_get_default('bgp', 'route_distinguisher')
end
|
#default_router_id ⇒ Object
688
689
690
|
# File 'lib/cisco_node_utils/bgp.rb', line 688
def default_router_id
config_get_default('bgp', 'router_id')
end
|
#default_shutdown ⇒ Object
703
704
705
|
# File 'lib/cisco_node_utils/bgp.rb', line 703
def default_shutdown
config_get_default('bgp', 'shutdown')
end
|
#default_suppress_fib_pending ⇒ Object
718
719
720
|
# File 'lib/cisco_node_utils/bgp.rb', line 718
def default_suppress_fib_pending
config_get_default('bgp', 'suppress_fib_pending')
end
|
#default_timer_bestpath_limit ⇒ Object
794
795
796
|
# File 'lib/cisco_node_utils/bgp.rb', line 794
def default_timer_bestpath_limit
config_get_default('bgp', 'timer_bestpath_limit')
end
|
#default_timer_bestpath_limit_always ⇒ Object
798
799
800
|
# File 'lib/cisco_node_utils/bgp.rb', line 798
def default_timer_bestpath_limit_always
config_get_default('bgp', 'timer_bestpath_limit_always')
end
|
#default_timer_bgp_holdtime ⇒ Object
790
791
792
|
# File 'lib/cisco_node_utils/bgp.rb', line 790
def default_timer_bgp_holdtime
config_get_default('bgp', 'timer_bgp_hold')
end
|
#default_timer_bgp_keepalive ⇒ Object
786
787
788
|
# File 'lib/cisco_node_utils/bgp.rb', line 786
def default_timer_bgp_keepalive
config_get_default('bgp', 'timer_bgp_keepalive')
end
|
#default_timer_bgp_keepalive_hold ⇒ Object
782
783
784
|
# File 'lib/cisco_node_utils/bgp.rb', line 782
def default_timer_bgp_keepalive_hold
["#{default_timer_bgp_keepalive}", "#{default_timer_bgp_holdtime}"]
end
|
#destroy ⇒ Object
Destroy router bgp instance
88
89
90
|
# File 'lib/cisco_node_utils/bgp.rb', line 88
def destroy
router_bgp('no')
end
|
#disable_policy_batching ⇒ Object
disable-policy-batching (Getter/Setter/Default)
259
260
261
|
# File 'lib/cisco_node_utils/bgp.rb', line 259
def disable_policy_batching
config_get('bgp', 'disable_policy_batching', @get_args)
end
|
#disable_policy_batching=(enable) ⇒ Object
263
264
265
266
267
|
# File 'lib/cisco_node_utils/bgp.rb', line 263
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_ipv4 ⇒ Object
disable-policy-batching ipv4 prefix-list <prefix_list>
276
277
278
|
# File 'lib/cisco_node_utils/bgp.rb', line 276
def disable_policy_batching_ipv4
config_get('bgp', 'disable_policy_batching_ipv4', @get_args)
end
|
#disable_policy_batching_ipv4=(prefix_list) ⇒ Object
280
281
282
283
284
285
286
287
288
289
290
291
|
# File 'lib/cisco_node_utils/bgp.rb', line 280
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_ipv6 ⇒ Object
disable-policy-batching ipv6 prefix-list <prefix_list>
300
301
302
|
# File 'lib/cisco_node_utils/bgp.rb', line 300
def disable_policy_batching_ipv6
config_get('bgp', 'disable_policy_batching_ipv6', @get_args)
end
|
#disable_policy_batching_ipv6=(prefix_list) ⇒ Object
304
305
306
307
308
309
310
311
312
313
314
315
|
# File 'lib/cisco_node_utils/bgp.rb', line 304
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_as ⇒ Object
Enforce First As (Getter/Setter/Default)
322
323
324
|
# File 'lib/cisco_node_utils/bgp.rb', line 322
def enforce_first_as
config_get('bgp', 'enforce_first_as', @get_args)
end
|
#enforce_first_as=(enable) ⇒ Object
326
327
328
329
330
|
# File 'lib/cisco_node_utils/bgp.rb', line 326
def enforce_first_as=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'enforce_first_as', @set_args)
set_args_keys_default
end
|
#event_history_cli ⇒ Object
event-history event-history cli [ size <size> ] Nvgen as True With optional ‘size <size>
339
340
341
342
343
344
345
346
|
# File 'lib/cisco_node_utils/bgp.rb', line 339
def event_history_cli
match = config_get('bgp', 'event_history_cli', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
end
default_event_history_cli
end
|
#event_history_cli=(val) ⇒ Object
348
349
350
351
352
353
354
|
# File 'lib/cisco_node_utils/bgp.rb', line 348
def event_history_cli=(val)
size = val[/small|medium|large|disable/]
@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_detail ⇒ Object
event-history detail [ size <size> ] Nvgen as True With optional ‘size <size>
362
363
364
365
366
367
368
369
370
|
# File 'lib/cisco_node_utils/bgp.rb', line 362
def event_history_detail
match = config_get('bgp', 'event_history_detail', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
end
default_event_history_detail
end
|
#event_history_detail=(val) ⇒ Object
372
373
374
375
376
377
378
|
# File 'lib/cisco_node_utils/bgp.rb', line 372
def event_history_detail=(val)
size = val[/small|medium|large|disable/]
@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_events ⇒ Object
event-history events [ size <size> ] Nvgen as True With optional ‘size <size>
386
387
388
389
390
391
392
393
|
# File 'lib/cisco_node_utils/bgp.rb', line 386
def event_history_events
match = config_get('bgp', 'event_history_events', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
end
default_event_history_events
end
|
#event_history_events=(val) ⇒ Object
395
396
397
398
399
400
401
|
# File 'lib/cisco_node_utils/bgp.rb', line 395
def event_history_events=(val)
size = val[/small|medium|large|disable/]
@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_periodic ⇒ Object
event-history periodic [ size <size> ] Nvgen as True With optional ‘size <size>
409
410
411
412
413
414
415
416
|
# File 'lib/cisco_node_utils/bgp.rb', line 409
def event_history_periodic
match = config_get('bgp', 'event_history_periodic', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
end
default_event_history_periodic
end
|
#event_history_periodic=(val) ⇒ Object
418
419
420
421
422
423
424
|
# File 'lib/cisco_node_utils/bgp.rb', line 418
def event_history_periodic=(val)
size = val[/small|medium|large|disable/]
@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_fallover ⇒ Object
Fast External fallover (Getter/Setter/Default)
431
432
433
|
# File 'lib/cisco_node_utils/bgp.rb', line 431
def fast_external_fallover
config_get('bgp', 'fast_external_fallover', @get_args)
end
|
#fast_external_fallover=(enable) ⇒ Object
435
436
437
438
439
|
# File 'lib/cisco_node_utils/bgp.rb', line 435
def fast_external_fallover=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'fast_external_fallover', @set_args)
set_args_keys_default
end
|
#flush_routes ⇒ Object
Flush Routes (Getter/Setter/Default)
446
447
448
|
# File 'lib/cisco_node_utils/bgp.rb', line 446
def flush_routes
config_get('bgp', 'flush_routes', @get_args)
end
|
#flush_routes=(enable) ⇒ Object
450
451
452
453
454
|
# File 'lib/cisco_node_utils/bgp.rb', line 450
def flush_routes=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'flush_routes', @set_args)
set_args_keys_default
end
|
#graceful_restart ⇒ Object
486
487
488
|
# File 'lib/cisco_node_utils/bgp.rb', line 486
def graceful_restart
config_get('bgp', 'graceful_restart', @get_args)
end
|
#graceful_restart=(enable) ⇒ Object
503
504
505
506
507
|
# File 'lib/cisco_node_utils/bgp.rb', line 503
def graceful_restart=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'graceful_restart', @set_args)
set_args_keys_default
end
|
#graceful_restart_helper ⇒ Object
498
499
500
|
# File 'lib/cisco_node_utils/bgp.rb', line 498
def graceful_restart_helper
config_get('bgp', 'graceful_restart_helper', @get_args)
end
|
#graceful_restart_helper=(enable) ⇒ Object
533
534
535
536
537
|
# File 'lib/cisco_node_utils/bgp.rb', line 533
def graceful_restart_helper=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'graceful_restart_helper', @set_args)
set_args_keys_default
end
|
#graceful_restart_timers_restart ⇒ Object
490
491
492
|
# File 'lib/cisco_node_utils/bgp.rb', line 490
def graceful_restart_timers_restart
config_get('bgp', 'graceful_restart_timers_restart', @get_args)
end
|
#graceful_restart_timers_restart=(seconds) ⇒ Object
509
510
511
512
513
514
515
516
517
518
519
|
# File 'lib/cisco_node_utils/bgp.rb', line 509
def graceful_restart_timers_restart=(seconds)
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_time ⇒ Object
494
495
496
|
# File 'lib/cisco_node_utils/bgp.rb', line 494
def graceful_restart_timers_stalepath_time
config_get('bgp', 'graceful_restart_timers_stalepath_time', @get_args)
end
|
#graceful_restart_timers_stalepath_time=(seconds) ⇒ Object
521
522
523
524
525
526
527
528
529
530
531
|
# File 'lib/cisco_node_utils/bgp.rb', line 521
def graceful_restart_timers_stalepath_time=(seconds)
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
|
#isolate ⇒ Object
Isolate (Getter/Setter/Default)
557
558
559
|
# File 'lib/cisco_node_utils/bgp.rb', line 557
def isolate
config_get('bgp', 'isolate', @get_args)
end
|
#isolate=(enable) ⇒ Object
561
562
563
564
565
|
# File 'lib/cisco_node_utils/bgp.rb', line 561
def isolate=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'isolate', @set_args)
set_args_keys_default
end
|
#log_neighbor_changes ⇒ Object
Log Neighbor Changes (Getter/Setter/Default)
593
594
595
|
# File 'lib/cisco_node_utils/bgp.rb', line 593
def log_neighbor_changes
config_get('bgp', 'log_neighbor_changes', @get_args)
end
|
#log_neighbor_changes=(enable) ⇒ Object
597
598
599
600
601
|
# File 'lib/cisco_node_utils/bgp.rb', line 597
def log_neighbor_changes=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'log_neighbor_changes', @set_args)
set_args_keys_default
end
|
#maxas_limit ⇒ Object
MaxAs Limit (Getter/Setter/Default)
572
573
574
|
# File 'lib/cisco_node_utils/bgp.rb', line 572
def maxas_limit
config_get('bgp', 'maxas_limit', @get_args)
end
|
#maxas_limit=(limit) ⇒ Object
576
577
578
579
580
581
582
583
584
585
586
|
# File 'lib/cisco_node_utils/bgp.rb', line 576
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_accelerate ⇒ Object
Neighbor down fib accelerate (Getter/Setter/Default)
608
609
610
|
# File 'lib/cisco_node_utils/bgp.rb', line 608
def neighbor_down_fib_accelerate
config_get('bgp', 'neighbor_down_fib_accelerate', @get_args)
end
|
#neighbor_down_fib_accelerate=(enable) ⇒ Object
612
613
614
615
616
|
# File 'lib/cisco_node_utils/bgp.rb', line 612
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
|
#reconnect_interval ⇒ Object
Reconnect Interval (Getter/Setter/Default)
623
624
625
|
# File 'lib/cisco_node_utils/bgp.rb', line 623
def reconnect_interval
config_get('bgp', 'reconnect_interval', @get_args)
end
|
#reconnect_interval=(seconds) ⇒ Object
627
628
629
630
631
632
633
634
635
636
637
|
# File 'lib/cisco_node_utils/bgp.rb', line 627
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_distinguisher ⇒ Object
route_distinguisher Note that this property is supported by both bgp and vrf providers.
645
646
647
|
# File 'lib/cisco_node_utils/bgp.rb', line 645
def route_distinguisher
config_get('bgp', 'route_distinguisher', @get_args)
end
|
#route_distinguisher=(rd) ⇒ Object
649
650
651
652
653
654
655
656
657
658
659
660
|
# File 'lib/cisco_node_utils/bgp.rb', line 649
def route_distinguisher=(rd)
Feature.nv_overlay_evpn_enable
if rd == default_route_distinguisher
@set_args[:state] = 'no'
@set_args[:rd] = ''
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
71
72
73
74
75
76
77
78
79
|
# File 'lib/cisco_node_utils/bgp.rb', line 71
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_id ⇒ Object
Router ID (Getter/Setter/Default)
667
668
669
|
# File 'lib/cisco_node_utils/bgp.rb', line 667
def router_id
config_get('bgp', 'router_id', @get_args)
end
|
#router_id=(id) ⇒ Object
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
# File 'lib/cisco_node_utils/bgp.rb', line 671
def router_id=(id)
if id == default_router_id
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_default ⇒ Object
Helper method to delete @set_args hash keys
93
94
95
96
97
|
# File 'lib/cisco_node_utils/bgp.rb', line 93
def set_args_keys_default
@set_args = { asnum: @asnum }
@set_args[:vrf] = @vrf unless @vrf == 'default'
@get_args = @set_args
end
|
#shutdown ⇒ Object
Shutdown (Getter/Setter/Default)
693
694
695
|
# File 'lib/cisco_node_utils/bgp.rb', line 693
def shutdown
config_get('bgp', 'shutdown', @asnum)
end
|
#shutdown=(enable) ⇒ Object
697
698
699
700
701
|
# File 'lib/cisco_node_utils/bgp.rb', line 697
def shutdown=(enable)
@set_args[:state] = (enable ? '' : 'no')
config_set('bgp', 'shutdown', @set_args)
set_args_keys_default
end
|
#suppress_fib_pending ⇒ Object
Supress Fib Pending (Getter/Setter/Default)
708
709
710
|
# File 'lib/cisco_node_utils/bgp.rb', line 708
def suppress_fib_pending
config_get('bgp', 'suppress_fib_pending', @get_args)
end
|
#suppress_fib_pending=(enable) ⇒ Object
712
713
714
715
716
|
# File 'lib/cisco_node_utils/bgp.rb', line 712
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_limit ⇒ Object
740
741
742
|
# File 'lib/cisco_node_utils/bgp.rb', line 740
def timer_bestpath_limit
config_get('bgp', 'timer_bestpath_limit', @get_args)
end
|
#timer_bestpath_limit_always ⇒ Object
744
745
746
|
# File 'lib/cisco_node_utils/bgp.rb', line 744
def timer_bestpath_limit_always
config_get('bgp', 'timer_bestpath_limit_always', @get_args)
end
|
#timer_bestpath_limit_set(seconds, always = false) ⇒ Object
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
|
# File 'lib/cisco_node_utils/bgp.rb', line 764
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_holdtime ⇒ Object
734
735
736
737
738
|
# File 'lib/cisco_node_utils/bgp.rb', line 734
def timer_bgp_holdtime
_keepalive, hold = timer_bgp_keepalive_hold
return default_timer_bgp_holdtime if hold.nil?
hold.to_i
end
|
#timer_bgp_keepalive ⇒ Object
728
729
730
731
732
|
# File 'lib/cisco_node_utils/bgp.rb', line 728
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_hold ⇒ Object
723
724
725
726
|
# File 'lib/cisco_node_utils/bgp.rb', line 723
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
749
750
751
752
753
754
755
756
757
758
759
760
761
762
|
# File 'lib/cisco_node_utils/bgp.rb', line 749
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
|