Class: Cisco::RouterBgpNeighbor

Inherits:
NodeUtil
  • Object
show all
Defined in:
lib/cisco_node_utils/bgp_neighbor.rb

Overview

RouterBgpNeighbor - node utility class for BGP neighbor configs

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(asn, vrf, nbr, ra = nil, instantiate = true) ⇒ RouterBgpNeighbor

Returns a new instance of RouterBgpNeighbor.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 30

def initialize(asn, vrf, nbr, ra=nil, instantiate=true)
  fail TypeError unless nbr.is_a?(String)
  # for IP/prefix format, such as "1.1.1.1/24" or "2000:123:38::34/64",
  # we need to mask the address using prefix length, so that it becomes
  # something like "1.1.1.0/24" or "2000:123:38::/64"
  @nbr = Utils.process_network_mask(nbr)
  @asn = RouterBgp.validate_asnum(asn)
  @vrf = vrf
  @ra = ra
  @get_args = @set_args = { asnum: @asn, nbr: @nbr, ra: @ra }
  @get_args[:vrf] = @set_args[:vrf] = vrf if vrf != 'default'

  create if instantiate
end

Instance Attribute Details

#asnObject (readonly)

Returns the value of attribute asn.



28
29
30
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 28

def asn
  @asn
end

#nbrObject (readonly)

Returns the value of attribute nbr.



28
29
30
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 28

def nbr
  @nbr
end

#vrfObject (readonly)

Returns the value of attribute vrf.



28
29
30
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 28

def vrf
  @vrf
end

Class Method Details

.neighborsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 45

def self.neighbors
  hash = {}
  RouterBgp.routers.each do |asn, vrf|
    hash[asn] = {}
    vrf.each_key do |vrf_id|
      get_args = { asnum: asn }
      get_args[:vrf] = vrf_id unless vrf_id == 'default'
      neighbor_list = config_get('bgp_neighbor', 'all_neighbors', get_args)
      next if neighbor_list.nil?

      hash[asn][vrf_id] = {}
      neighbor_list.each do |nbr, ra|
        hash[asn][vrf_id][nbr] = RouterBgpNeighbor.new(asn, vrf_id,
                                                       nbr, ra, false)
      end
    end
  end
  hash
rescue Cisco::CliError => e
  # Raise the error unless the error message contains "Syntax error", which
  # means the error was caused by feature is not enabled.
  raise unless e.clierror =~ /Syntax error/
  return {}
end

Instance Method Details

#bfdObject



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

def bfd
  config_get('bgp_neighbor', 'bfd', @get_args)
end

#bfd=(val) ⇒ Object



92
93
94
95
96
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 92

def bfd=(val)
  set_args_keys(state: (val) ? '' : 'no')
  Feature.bfd_enable
  config_set('bgp_neighbor', 'bfd', @set_args)
end

#capability_negotiationObject



145
146
147
148
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 145

def capability_negotiation
  result = config_get('bgp_neighbor', 'capability_negotiation', @get_args)
  result ? false : default_capability_negotiation
end

#capability_negotiation=(val) ⇒ Object



138
139
140
141
142
143
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 138

def capability_negotiation=(val)
  # the cli is "dont-capability-negotiate". Therefore when val is true, we
  # need to set state to "no"
  set_args_keys(state: (val) ? 'no' : '')
  config_set('bgp_neighbor', 'capability_negotiation', @set_args)
end

#connected_checkObject



129
130
131
132
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 129

def connected_check
  result = config_get('bgp_neighbor', 'connected_check', @get_args)
  result ? false : default_connected_check
end

#connected_check=(val) ⇒ Object



122
123
124
125
126
127
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 122

def connected_check=(val)
  # the cli is "disable-connected-check", therefore when val is true, we
  # need to set set state to "no"
  set_args_keys(state: (val) ? 'no' : '')
  config_set('bgp_neighbor', 'connected_check', @set_args)
end

#createObject



70
71
72
73
74
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 70

def create
  Feature.bgp_enable if platform == :nexus
  set_args_keys(state: '')
  config_set('bgp', 'create_destroy_neighbor', @set_args)
end

#default_bfdObject



102
103
104
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 102

def default_bfd
  config_get_default('bgp_neighbor', 'bfd')
end

#default_capability_negotiationObject



150
151
152
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 150

def default_capability_negotiation
  config_get_default('bgp_neighbor', 'capability_negotiation')
end

#default_connected_checkObject



134
135
136
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 134

def default_connected_check
  config_get_default('bgp_neighbor', 'connected_check')
end

#default_descriptionObject



118
119
120
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 118

def default_description
  config_get_default('bgp_neighbor', 'description')
end

#default_dynamic_capabilityObject



163
164
165
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 163

def default_dynamic_capability
  config_get_default('bgp_neighbor', 'dynamic_capability')
end

#default_ebgp_multihopObject



178
179
180
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 178

def default_ebgp_multihop
  config_get_default('bgp_neighbor', 'ebgp_multihop')
end

#default_local_asObject



195
196
197
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 195

def default_local_as
  config_get_default('bgp_neighbor', 'local_as').to_s
end

#default_log_neighbor_changesObject



217
218
219
220
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 217

def default_log_neighbor_changes
  result = config_get_default('bgp_neighbor', 'log_neighbor_changes')
  result.to_sym unless result.nil?
end

#default_low_memory_exemptObject



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

def default_low_memory_exempt
  config_get_default('bgp_neighbor', 'low_memory_exempt')
end

#default_maximum_peersObject



246
247
248
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 246

def default_maximum_peers
  config_get_default('bgp_neighbor', 'maximum_peers')
end

#default_passwordObject



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

def default_password
  config_get_default('bgp_neighbor', 'password')
end

#default_password_typeObject



295
296
297
298
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 295

def default_password_type
  result = config_get_default('bgp_neighbor', 'password_type')
  Encryption.cli_to_symbol(result)
end

#default_peer_typeObject



507
508
509
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 507

def default_peer_type
  config_get_default('bgp_neighbor', 'peer_type')
end

#default_remote_asObject



315
316
317
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 315

def default_remote_as
  config_get_default('bgp_neighbor', 'remote_as').to_s
end

#default_remove_private_asObject



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

def default_remove_private_as
  result = config_get_default('bgp_neighbor', 'remove_private_as')
  result.nil? ? nil : result.to_sym
end

#default_shutdownObject



351
352
353
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 351

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

#default_suppress_4_byte_asObject



365
366
367
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 365

def default_suppress_4_byte_as
  config_get_default('bgp_neighbor', 'suppress_4_byte_as')
end

#default_timers_holdtimeObject



402
403
404
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 402

def default_timers_holdtime
  config_get_default('bgp_neighbor', 'timers_holdtime')
end

#default_timers_keepaliveObject



398
399
400
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 398

def default_timers_keepalive
  config_get_default('bgp_neighbor', 'timers_keepalive')
end

#default_timers_keepalive_holdObject



406
407
408
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 406

def default_timers_keepalive_hold
  ["#{default_timers_keepalive}", "#{default_timers_holdtime}"]
end

#default_transport_passive_modeObject



436
437
438
439
440
441
442
443
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 436

def default_transport_passive_mode
  result = config_get_default('bgp_neighbor', 'transport_passive_mode')
  if platform == :nexus
    result ? :passive_only : :none
  else
    mode_cli_to_symbol(result)
  end
end

#default_transport_passive_onlyObject



454
455
456
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 454

def default_transport_passive_only
  default_transport_passive_mode == :passive_only
end

#default_update_sourceObject



472
473
474
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 472

def default_update_source
  config_get_default('bgp_neighbor', 'update_source')
end

#descriptionObject



114
115
116
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 114

def description
  config_get('bgp_neighbor', 'description', @get_args)
end

#description=(desc) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 106

def description=(desc)
  fail TypeError unless desc.is_a?(String)
  desc.strip!
  set_args_keys(state: desc.empty? ? 'no' : '',
                desc:  desc)
  config_set('bgp_neighbor', 'description', @set_args)
end

#destroyObject



76
77
78
79
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 76

def destroy
  set_args_keys(state: 'no')
  config_set('bgp', 'create_destroy_neighbor', @set_args)
end

#dynamic_capabilityObject



159
160
161
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 159

def dynamic_capability
  config_get('bgp_neighbor', 'dynamic_capability', @get_args)
end

#dynamic_capability=(val) ⇒ Object



154
155
156
157
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 154

def dynamic_capability=(val)
  set_args_keys(state: (val) ? '' : 'no')
  config_set('bgp_neighbor', 'dynamic_capability', @set_args)
end

#ebgp_multihopObject



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

def ebgp_multihop
  result = config_get('bgp_neighbor', 'ebgp_multihop', @get_args)
  result.nil? ? default_ebgp_multihop : result.to_i
end

#ebgp_multihop=(ttl) ⇒ Object



167
168
169
170
171
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 167

def ebgp_multihop=(ttl)
  set_args_keys(state: (ttl == default_ebgp_multihop) ? 'no' : '',
                ttl:   (ttl == default_ebgp_multihop) ? '' : ttl)
  config_set('bgp_neighbor', 'ebgp_multihop', @set_args)
end

#local_asObject



191
192
193
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 191

def local_as
  config_get('bgp_neighbor', 'local_as', @get_args).to_s
end

#local_as=(val) ⇒ Object



182
183
184
185
186
187
188
189
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 182

def local_as=(val)
  if val == default_local_as
    set_args_keys(state: 'no', local_as: '')
  else
    set_args_keys(state: '', local_as: val)
  end
  config_set('bgp_neighbor', 'local_as', @set_args)
end

#log_neighbor_changesObject



210
211
212
213
214
215
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 210

def log_neighbor_changes
  result = config_get('bgp_neighbor', 'log_neighbor_changes', @get_args)
  return default_log_neighbor_changes if result.nil?
  return :disable if /disable/.match(result.first)
  :enable
end

#log_neighbor_changes=(val) ⇒ Object



199
200
201
202
203
204
205
206
207
208
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 199

def log_neighbor_changes=(val)
  val = val.to_sym
  if val == default_log_neighbor_changes
    set_args_keys(state: 'no', disable: '')
  else
    set_args_keys(state:   '',
                  disable: (val == :enable) ? '' : 'disable')
  end
  config_set('bgp_neighbor', 'log_neighbor_changes', @set_args)
end

#low_memory_exemptObject



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

def low_memory_exempt
  result = config_get('bgp_neighbor', 'low_memory_exempt', @get_args)
  result ? true : default_low_memory_exempt
end

#low_memory_exempt=(val) ⇒ Object



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

def low_memory_exempt=(val)
  set_args_keys(state: (val) ? '' : 'no')
  config_set('bgp_neighbor', 'low_memory_exempt', @set_args)
end

#maximum_peersObject



242
243
244
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 242

def maximum_peers
  config_get('bgp_neighbor', 'maximum_peers', @get_args)
end

#maximum_peers=(val) ⇒ Object



236
237
238
239
240
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 236

def maximum_peers=(val)
  set_args_keys(state: (val == default_maximum_peers) ? 'no' : '',
                num:   (val == default_maximum_peers) ? '' : val)
  config_set('bgp_neighbor', 'maximum_peers', @set_args)
end

#mode_cli_to_symbol(cli) ⇒ Object



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

def mode_cli_to_symbol(cli)
  case cli
  when 'active-only'
    :active_only
  when 'passive-only'
    :passive_only
  when 'both'
    :both
  when ''
    :none
  else
    fail KeyError
  end
end

#mode_symbol_to_cli(symbol) ⇒ Object



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 476

def mode_symbol_to_cli(symbol)
  symbol = symbol.downcase if symbol.is_a? String
  case symbol
  when :active_only
    'active-only'
  when :passive_only
    'passive-only'
  when :both
    'both'
  when :none
    ''
  else
    fail KeyError
  end
end

#passwordObject



282
283
284
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 282

def password
  config_get('bgp_neighbor', 'password', @get_args)
end

#password_set(val, type = nil) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 250

def password_set(val, type=nil)
  val = val.to_s
  if val.strip.empty?
    set_args_keys(state: 'no', type: '', passwd: '')
  elsif type.nil?
    set_args_keys(state:  '',
                  type:   Encryption.symbol_to_cli(default_password_type),
                  passwd: val.to_s)
  else
    cli_type = nil
    if platform == :ios_xr
      case type
      when :cleartext
        cli_type = 'clear'
      when :md5
        cli_type = 'encrypted'
      else
        fail Cisco::UnsupportedError.new(
          'RouterBgpNeighbor', 'password',
          nil, "type '#{type}'")
      end
    else
      cli_type = Encryption.symbol_to_cli(type)
    end

    set_args_keys(state:  '',
                  type:   cli_type,
                  passwd: val.to_s)
  end
  config_set('bgp_neighbor', 'password', @set_args)
end

#password_typeObject



290
291
292
293
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 290

def password_type
  result = config_get('bgp_neighbor', 'password_type', @get_args)
  Encryption.cli_to_symbol(result.to_s)
end

#peer_typeObject



523
524
525
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 523

def peer_type
  config_get('bgp_neighbor', 'peer_type', @get_args)
end

#peer_type=(val) ⇒ Object



511
512
513
514
515
516
517
518
519
520
521
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 511

def peer_type=(val)
  if val == default_peer_type
    @set_args[:state] = 'no'
    @set_args[:peer_type] = ''
  else
    Feature.nv_overlay_evpn_enable
    @set_args[:peer_type] = val
    @set_args[:state] = ''
  end
  config_set('bgp_neighbor', 'peer_type', @set_args)
end

#remote_asObject



309
310
311
312
313
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 309

def remote_as
  tra = config_get('bgp_neighbor', 'remote_as', @get_args).to_s
  tra = @ra if tra == default_remote_as && !@ra.nil?
  tra
end

#remote_as=(val) ⇒ Object



300
301
302
303
304
305
306
307
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 300

def remote_as=(val)
  if val == default_remote_as
    set_args_keys(state: 'no', remote_as: '')
  else
    set_args_keys(state: '', remote_as: val)
  end
  config_set('bgp_neighbor', 'remote_as', @set_args)
end

#remove_private_asObject



330
331
332
333
334
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 330

def remove_private_as
  result = config_get('bgp_neighbor', 'remove_private_as', @get_args)
  return default_remove_private_as if result.nil?
  result.first.nil? ? :enable : result.first.to_sym
end

#remove_private_as=(val) ⇒ Object



319
320
321
322
323
324
325
326
327
328
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 319

def remove_private_as=(val)
  val = val.to_sym
  if val == default_remove_private_as
    set_args_keys(state: 'no', option: '')
  else
    set_args_keys(state:  '',
                  option: (val == :enable) ? '' : val.to_s)
  end
  config_set('bgp_neighbor', 'remove_private_as', @set_args)
end

#set_args_keys(hash = {}) ⇒ Object

rubocop:disable Style/AccessorMethodName



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

def set_args_keys(hash={}) # rubocop:disable Style/AccessorMethodName
  set_args_keys_default
  @set_args = @set_args.merge!(hash) unless hash.empty?
end

#set_args_keys_defaultObject



81
82
83
84
85
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 81

def set_args_keys_default
  keys = { asnum: @asn, nbr: @nbr }
  keys[:vrf] = @vrf unless @vrf == 'default'
  @set_args = keys
end

#shutdownObject



346
347
348
349
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 346

def shutdown
  result = config_get('bgp_neighbor', 'shutdown', @get_args)
  result ? true : false
end

#shutdown=(val) ⇒ Object



341
342
343
344
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 341

def shutdown=(val)
  set_args_keys(state: (val) ? '' : 'no')
  config_set('bgp_neighbor', 'shutdown', @set_args)
end

#suppress_4_byte_asObject



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

def suppress_4_byte_as
  result = config_get('bgp_neighbor', 'suppress_4_byte_as', @get_args)
  result ? true : false
end

#suppress_4_byte_as=(val) ⇒ Object



355
356
357
358
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 355

def suppress_4_byte_as=(val)
  set_args_keys(state: (val) ? '' : 'no')
  config_set('bgp_neighbor', 'suppress_4_byte_as', @set_args)
end

#timers_holdtimeObject



392
393
394
395
396
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 392

def timers_holdtime
  _keepalive, hold = timers_keepalive_hold
  return default_timers_holdtime if hold.nil?
  hold.to_i
end

#timers_keepaliveObject



386
387
388
389
390
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 386

def timers_keepalive
  keepalive, _hold = timers_keepalive_hold
  return default_timers_keepalive if keepalive.nil?
  keepalive.to_i
end

#timers_keepalive_holdObject



381
382
383
384
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 381

def timers_keepalive_hold
  match = config_get('bgp_neighbor', 'timers_keepalive_hold', @get_args)
  match.nil? ? default_timers_keepalive_hold : match
end

#timers_set(keepalive, hold) ⇒ Object



369
370
371
372
373
374
375
376
377
378
379
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 369

def timers_set(keepalive, hold)
  if keepalive == default_timers_keepalive &&
     hold == default_timers_holdtime
    set_args_keys(state: 'no', keepalive: timers_keepalive,
                  hold: timers_holdtime)
  else
    set_args_keys(state: '', keepalive: keepalive,
                  hold: hold)
  end
  config_set('bgp_neighbor', 'timers_keepalive_hold', @set_args)
end

#transport_passive_modeObject



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

def transport_passive_mode
  result = config_get('bgp_neighbor', 'transport_passive_mode', @get_args)
  if platform == :nexus
    result ? :passive_only : :none
  else
    mode_cli_to_symbol(result)
  end
end

#transport_passive_mode=(val) ⇒ Object



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 410

def transport_passive_mode=(val)
  if platform == :nexus
    if val == :active_only
      fail Cisco::UnsupportedError.new(
        'RouterBgpNeighbor', 'transport_passive_mode',
        nil, "value '#{val}'")
    else
      set_args_keys(state: (val == :passive_only) ? '' : 'no')
      config_set('bgp_neighbor', 'transport_passive_mode', @set_args)
    end
  else
    set_args_keys(mode:  mode_symbol_to_cli(val),
                  state: (val == :none) ? 'no' : '')
    config_set('bgp_neighbor', 'transport_passive_mode', @set_args)
  end
end

#transport_passive_onlyObject



450
451
452
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 450

def transport_passive_only
  transport_passive_mode == :passive_only
end

#transport_passive_only=(val) ⇒ Object



445
446
447
448
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 445

def transport_passive_only=(val)
  # TODO: add "deprecated" warning?
  self.transport_passive_mode = (val ? :passive_only : :none)
end

#update_sourceObject



467
468
469
470
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 467

def update_source
  result = config_get('bgp_neighbor', 'update_source', @get_args)
  result.downcase.strip
end

#update_source=(val) ⇒ Object



458
459
460
461
462
463
464
465
# File 'lib/cisco_node_utils/bgp_neighbor.rb', line 458

def update_source=(val)
  if val.strip == default_update_source
    set_args_keys(state: 'no', interface: update_source)
  else
    set_args_keys(state: '', interface: val)
  end
  config_set('bgp_neighbor', 'update_source', @set_args)
end