Class: Cisco::StpGlobal

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

Overview

node_utils class for stp_global

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(name) ⇒ StpGlobal

Returns a new instance of StpGlobal.



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

def initialize(name)
  fail TypeError unless name.is_a?(String)
  fail ArgumentError unless name == 'default'
  @name = name.downcase
  @bdr = config_get('stp_global', 'bd_range')
  @mr = config_get('stp_global', 'mst_range')
  @mir = config_get('stp_global', 'mst_inst_range')
  @vr = config_get('stp_global', 'vlan_range')
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/cisco_node_utils/stp_global.rb', line 24

def name
  @name
end

Class Method Details

.globalsObject



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

def self.globals
  { 'default' => StpGlobal.new('default') }
end

Instance Method Details

#bd_designated_priorityObject

Getter: Builds an array of bd designated priority commands currently on the device. cli: bridge-domain 2-42 designated priority 40960

bridge-domain 83-92,1000-2300 designated priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



50
51
52
# File 'lib/cisco_node_utils/stp_global.rb', line 50

def bd_designated_priority
  config_get('stp_global', 'bd_designated_priority')
end

#bd_designated_priority=(list) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/cisco_node_utils/stp_global.rb', line 54

def bd_designated_priority=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_designated_priority',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_designated_priority')
end

#bd_forward_timeObject

Getter: Builds an array of bd forward time commands currently on the device. cli: spanning-tree bridge-domain 2-42 forward-time 4

spanning-tree bridge-domain 83-92,1000-2300 forward-time 30

array: [[‘2-42’, ‘4’], [‘83-92,1000-2300’, ‘30’]]



73
74
75
# File 'lib/cisco_node_utils/stp_global.rb', line 73

def bd_forward_time
  config_get('stp_global', 'bd_forward_time')
end

#bd_forward_time=(list) ⇒ Object



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

def bd_forward_time=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_forward_time',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_forward_time')
end

#bd_hello_timeObject

Getter: Builds an array of bd hello time commands currently on the device. cli: spanning-tree bridge-domain 2-42 hello-time 6

spanning-tree bridge-domain 83-92,1000-2300 hello-time 9

array: [[‘2-42’, ‘6’], [‘83-92,1000-2300’, ‘9’]]



96
97
98
# File 'lib/cisco_node_utils/stp_global.rb', line 96

def bd_hello_time
  config_get('stp_global', 'bd_hello_time')
end

#bd_hello_time=(list) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/cisco_node_utils/stp_global.rb', line 100

def bd_hello_time=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_hello_time',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_hello_time')
end

#bd_max_ageObject

Getter: Builds an array of bd max age commands currently on the device. cli: spanning-tree bridge-domain 2-42 max-age 10

spanning-tree bridge-domain 83-92,1000-2300 max-age 40

array: [[‘2-42’, ‘10’], [‘83-92,1000-2300’, ‘40’]]



119
120
121
# File 'lib/cisco_node_utils/stp_global.rb', line 119

def bd_max_age
  config_get('stp_global', 'bd_max_age')
end

#bd_max_age=(list) ⇒ Object



123
124
125
126
127
128
129
130
# File 'lib/cisco_node_utils/stp_global.rb', line 123

def bd_max_age=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_max_age',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_max_age')
end

#bd_priorityObject

Getter: Builds an array of bd priority commands currently on the device. cli: spanning-tree bridge-domain 2-42 priority 40960

spanning-tree bridge-domain 83-92,1000-2300 priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



142
143
144
# File 'lib/cisco_node_utils/stp_global.rb', line 142

def bd_priority
  config_get('stp_global', 'bd_priority')
end

#bd_priority=(list) ⇒ Object



146
147
148
149
150
151
152
153
# File 'lib/cisco_node_utils/stp_global.rb', line 146

def bd_priority=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_priority',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_priority')
end

#bd_root_priorityObject

Getter: Builds an array of bd root priority commands currently on the device. cli: bridge-domain 2-42 root priority 40960

bridge-domain 83-92,1000-2300 root priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



165
166
167
# File 'lib/cisco_node_utils/stp_global.rb', line 165

def bd_root_priority
  config_get('stp_global', 'bd_root_priority')
end

#bd_root_priority=(list) ⇒ Object



169
170
171
172
173
174
175
176
# File 'lib/cisco_node_utils/stp_global.rb', line 169

def bd_root_priority=(list)
  vlans = bd_total_range_with_vlans
  config_set('stp_global', 'bd_root_priority',
             state: 'no',
             range: Utils.get_reset_range(@bdr, vlans),
             val:   '') if list.empty?
  set_range_based_params(list, 'bd_root_priority')
end

#bd_total_range_with_vlansObject

bridge-domain and vlans are mutually exclusive so when there are vlans, we need to remove them from the bd range while restting



652
653
654
655
656
657
658
659
660
661
# File 'lib/cisco_node_utils/stp_global.rb', line 652

def bd_total_range_with_vlans
  hash = Vlan.vlans
  arr = []
  hash.keys.each do |id|
    arr << id.to_i
  end
  Utils.array_to_str(arr)
  ret_arr = []
  ret_arr << Utils.array_to_str(arr)
end

#bpdufilterObject



182
183
184
# File 'lib/cisco_node_utils/stp_global.rb', line 182

def bpdufilter
  config_get('stp_global', 'bpdufilter')
end

#bpdufilter=(state) ⇒ Object



186
187
188
189
190
# File 'lib/cisco_node_utils/stp_global.rb', line 186

def bpdufilter=(state)
  fail TypeError unless state == true || state == false
  no_cmd = (state ? '' : 'no')
  config_set('stp_global', 'bpdufilter', state: no_cmd)
end

#bpduguardObject



196
197
198
# File 'lib/cisco_node_utils/stp_global.rb', line 196

def bpduguard
  config_get('stp_global', 'bpduguard')
end

#bpduguard=(state) ⇒ Object



200
201
202
203
204
# File 'lib/cisco_node_utils/stp_global.rb', line 200

def bpduguard=(state)
  fail TypeError unless state == true || state == false
  no_cmd = (state ? '' : 'no')
  config_set('stp_global', 'bpduguard', state: no_cmd)
end

#bridge_assuranceObject



210
211
212
# File 'lib/cisco_node_utils/stp_global.rb', line 210

def bridge_assurance
  config_get('stp_global', 'bridge_assurance')
end

#bridge_assurance=(state) ⇒ Object



214
215
216
217
218
# File 'lib/cisco_node_utils/stp_global.rb', line 214

def bridge_assurance=(state)
  fail TypeError unless state == true || state == false
  no_cmd = (state ? '' : 'no')
  config_set('stp_global', 'bridge_assurance', state: no_cmd)
end

#check_stp_mode_mstObject



644
645
646
647
# File 'lib/cisco_node_utils/stp_global.rb', line 644

def check_stp_mode_mst
  fail "#{caller[0][/`.*'/][1..-2]} cannot be set unless spanning-tree" \
    ' mode is mst' unless mode == 'mst'
end

#default_bd_designated_priorityObject



63
64
65
# File 'lib/cisco_node_utils/stp_global.rb', line 63

def default_bd_designated_priority
  config_get_default('stp_global', 'bd_designated_priority')
end

#default_bd_forward_timeObject



86
87
88
# File 'lib/cisco_node_utils/stp_global.rb', line 86

def default_bd_forward_time
  config_get_default('stp_global', 'bd_forward_time')
end

#default_bd_hello_timeObject



109
110
111
# File 'lib/cisco_node_utils/stp_global.rb', line 109

def default_bd_hello_time
  config_get_default('stp_global', 'bd_hello_time')
end

#default_bd_max_ageObject



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

def default_bd_max_age
  config_get_default('stp_global', 'bd_max_age')
end

#default_bd_priorityObject



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

def default_bd_priority
  config_get_default('stp_global', 'bd_priority')
end

#default_bd_root_priorityObject



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

def default_bd_root_priority
  config_get_default('stp_global', 'bd_root_priority')
end

#default_bpdufilterObject



192
193
194
# File 'lib/cisco_node_utils/stp_global.rb', line 192

def default_bpdufilter
  config_get_default('stp_global', 'bpdufilter')
end

#default_bpduguardObject



206
207
208
# File 'lib/cisco_node_utils/stp_global.rb', line 206

def default_bpduguard
  config_get_default('stp_global', 'bpduguard')
end

#default_bridge_assuranceObject



220
221
222
# File 'lib/cisco_node_utils/stp_global.rb', line 220

def default_bridge_assurance
  config_get_default('stp_global', 'bridge_assurance')
end

#default_domainObject



239
240
241
# File 'lib/cisco_node_utils/stp_global.rb', line 239

def default_domain
  config_get_default('stp_global', 'domain')
end

#default_fcoeObject



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

def default_fcoe
  config_get_default('stp_global', 'fcoe')
end

#default_loopguardObject



267
268
269
# File 'lib/cisco_node_utils/stp_global.rb', line 267

def default_loopguard
  config_get_default('stp_global', 'loopguard')
end

#default_modeObject



283
284
285
# File 'lib/cisco_node_utils/stp_global.rb', line 283

def default_mode
  config_get_default('stp_global', 'mode')
end

#default_mst_designated_priorityObject



304
305
306
# File 'lib/cisco_node_utils/stp_global.rb', line 304

def default_mst_designated_priority
  config_get_default('stp_global', 'mst_designated_priority')
end

#default_mst_forward_timeObject



324
325
326
# File 'lib/cisco_node_utils/stp_global.rb', line 324

def default_mst_forward_time
  config_get_default('stp_global', 'mst_forward_time')
end

#default_mst_hello_timeObject



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

def default_mst_hello_time
  config_get_default('stp_global', 'mst_hello_time')
end

#default_mst_inst_vlan_mapObject



374
375
376
# File 'lib/cisco_node_utils/stp_global.rb', line 374

def default_mst_inst_vlan_map
  config_get_default('stp_global', 'mst_inst_vlan_map')
end

#default_mst_max_ageObject



394
395
396
# File 'lib/cisco_node_utils/stp_global.rb', line 394

def default_mst_max_age
  config_get_default('stp_global', 'mst_max_age')
end

#default_mst_max_hopsObject



414
415
416
# File 'lib/cisco_node_utils/stp_global.rb', line 414

def default_mst_max_hops
  config_get_default('stp_global', 'mst_max_hops')
end

#default_mst_nameObject



434
435
436
# File 'lib/cisco_node_utils/stp_global.rb', line 434

def default_mst_name
  config_get_default('stp_global', 'mst_name')
end

#default_mst_priorityObject



455
456
457
# File 'lib/cisco_node_utils/stp_global.rb', line 455

def default_mst_priority
  config_get_default('stp_global', 'mst_priority')
end

#default_mst_revisionObject



475
476
477
# File 'lib/cisco_node_utils/stp_global.rb', line 475

def default_mst_revision
  config_get_default('stp_global', 'mst_revision')
end

#default_mst_root_priorityObject



496
497
498
# File 'lib/cisco_node_utils/stp_global.rb', line 496

def default_mst_root_priority
  config_get_default('stp_global', 'mst_root_priority')
end

#default_pathcostObject



512
513
514
# File 'lib/cisco_node_utils/stp_global.rb', line 512

def default_pathcost
  config_get_default('stp_global', 'pathcost')
end

#default_vlan_designated_priorityObject



532
533
534
# File 'lib/cisco_node_utils/stp_global.rb', line 532

def default_vlan_designated_priority
  config_get_default('stp_global', 'vlan_designated_priority')
end

#default_vlan_forward_timeObject



552
553
554
# File 'lib/cisco_node_utils/stp_global.rb', line 552

def default_vlan_forward_time
  config_get_default('stp_global', 'vlan_forward_time')
end

#default_vlan_hello_timeObject



580
581
582
# File 'lib/cisco_node_utils/stp_global.rb', line 580

def default_vlan_hello_time
  config_get_default('stp_global', 'vlan_hello_time')
end

#default_vlan_max_ageObject



600
601
602
# File 'lib/cisco_node_utils/stp_global.rb', line 600

def default_vlan_max_age
  config_get_default('stp_global', 'vlan_max_age')
end

#default_vlan_priorityObject



620
621
622
# File 'lib/cisco_node_utils/stp_global.rb', line 620

def default_vlan_priority
  config_get_default('stp_global', 'vlan_priority')
end

#default_vlan_root_priorityObject



640
641
642
# File 'lib/cisco_node_utils/stp_global.rb', line 640

def default_vlan_root_priority
  config_get_default('stp_global', 'vlan_root_priority')
end

#domainObject



224
225
226
# File 'lib/cisco_node_utils/stp_global.rb', line 224

def domain
  config_get('stp_global', 'domain')
end

#domain=(val) ⇒ Object



228
229
230
231
232
233
234
235
236
237
# File 'lib/cisco_node_utils/stp_global.rb', line 228

def domain=(val)
  if val
    state = ''
  else
    state = 'no'
    val = '1' # dummy val to satisfy the CLI
  end
  config_set('stp_global',
             'domain', state: state, domain: val)
end

#fcoeObject



243
244
245
# File 'lib/cisco_node_utils/stp_global.rb', line 243

def fcoe
  config_get('stp_global', 'fcoe')
end

#fcoe=(state) ⇒ Object



247
248
249
250
251
# File 'lib/cisco_node_utils/stp_global.rb', line 247

def fcoe=(state)
  fail TypeError unless state == true || state == false
  no_cmd = (state ? '' : 'no')
  config_set('stp_global', 'fcoe', state: no_cmd)
end

#loopguardObject



257
258
259
# File 'lib/cisco_node_utils/stp_global.rb', line 257

def loopguard
  config_get('stp_global', 'loopguard')
end

#loopguard=(state) ⇒ Object



261
262
263
264
265
# File 'lib/cisco_node_utils/stp_global.rb', line 261

def loopguard=(state)
  fail TypeError unless state == true || state == false
  no_cmd = (state ? '' : 'no')
  config_set('stp_global', 'loopguard', state: no_cmd)
end

#modeObject



271
272
273
# File 'lib/cisco_node_utils/stp_global.rb', line 271

def mode
  config_get('stp_global', 'mode')
end

#mode=(val) ⇒ Object



275
276
277
278
279
280
281
# File 'lib/cisco_node_utils/stp_global.rb', line 275

def mode=(val)
  if val == default_mode
    config_set('stp_global', 'mode', state: 'no', mode: '')
  else
    config_set('stp_global', 'mode', state: '', mode: val)
  end
end

#mst_designated_priorityObject

Getter: Builds an array of mst designated priority commands currently on the device. cli: spanning-tree mst 2-42 designated priority 40960

spanning-tree mst 83-92,1000-2300 designated priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



293
294
295
# File 'lib/cisco_node_utils/stp_global.rb', line 293

def mst_designated_priority
  config_get('stp_global', 'mst_designated_priority')
end

#mst_designated_priority=(list) ⇒ Object



297
298
299
300
301
302
# File 'lib/cisco_node_utils/stp_global.rb', line 297

def mst_designated_priority=(list)
  check_stp_mode_mst
  config_set('stp_global', 'mst_designated_priority',
             state: 'no', range: @mr, val: '') if list.empty?
  set_range_based_params(list, 'mst_designated_priority')
end

#mst_forward_timeObject



308
309
310
# File 'lib/cisco_node_utils/stp_global.rb', line 308

def mst_forward_time
  config_get('stp_global', 'mst_forward_time')
end

#mst_forward_time=(val) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
# File 'lib/cisco_node_utils/stp_global.rb', line 312

def mst_forward_time=(val)
  check_stp_mode_mst
  if val == default_mst_forward_time
    state = 'no'
    val = ''
  else
    state = ''
  end
  config_set('stp_global',
             'mst_forward_time', state: state, ft: val)
end

#mst_hello_timeObject



328
329
330
# File 'lib/cisco_node_utils/stp_global.rb', line 328

def mst_hello_time
  config_get('stp_global', 'mst_hello_time')
end

#mst_hello_time=(val) ⇒ Object



332
333
334
335
336
337
338
339
340
341
342
# File 'lib/cisco_node_utils/stp_global.rb', line 332

def mst_hello_time=(val)
  check_stp_mode_mst
  if val == default_mst_hello_time
    state = 'no'
    val = ''
  else
    state = ''
  end
  config_set('stp_global',
             'mst_hello_time', state: state, ht: val)
end

#mst_inst_vlan_mapObject

Getter: Builds an array of mst instance to vlan range commands currently on the device. cli: instance 2 vlan 6-47

instance 3000 vlan 1000-3200

array: [[‘2’, ‘6-47’], [‘3000’, ‘1000-3200’]]



354
355
356
# File 'lib/cisco_node_utils/stp_global.rb', line 354

def mst_inst_vlan_map
  config_get('stp_global', 'mst_inst_vlan_map')
end

#mst_inst_vlan_map=(list) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/cisco_node_utils/stp_global.rb', line 358

def mst_inst_vlan_map=(list)
  check_stp_mode_mst
  config_set('stp_global', 'mst_inst_vlan_map', state: '',
             instance: '0', vlan: 'vlan', range: @mir) if list.empty?
  list.each do |inst, range|
    # if a particular range is set to default, use 'no' cmd
    if range == 'default'
      config_set('stp_global', 'mst_inst_vlan_map', state: 'no',
                 instance: inst, vlan: '', range: '')
    else
      config_set('stp_global', 'mst_inst_vlan_map', state: '',
                 instance: inst, vlan: 'vlan', range: range)
    end
  end
end

#mst_max_ageObject



378
379
380
# File 'lib/cisco_node_utils/stp_global.rb', line 378

def mst_max_age
  config_get('stp_global', 'mst_max_age')
end

#mst_max_age=(val) ⇒ Object



382
383
384
385
386
387
388
389
390
391
392
# File 'lib/cisco_node_utils/stp_global.rb', line 382

def mst_max_age=(val)
  check_stp_mode_mst
  if val == default_mst_max_age
    state = 'no'
    val = ''
  else
    state = ''
  end
  config_set('stp_global',
             'mst_max_age', state: state, ma: val)
end

#mst_max_hopsObject



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

def mst_max_hops
  config_get('stp_global', 'mst_max_hops')
end

#mst_max_hops=(val) ⇒ Object



402
403
404
405
406
407
408
409
410
411
412
# File 'lib/cisco_node_utils/stp_global.rb', line 402

def mst_max_hops=(val)
  check_stp_mode_mst
  if val == default_mst_max_hops
    state = 'no'
    val = ''
  else
    state = ''
  end
  config_set('stp_global',
             'mst_max_hops', state: state, mh: val)
end

#mst_nameObject



418
419
420
# File 'lib/cisco_node_utils/stp_global.rb', line 418

def mst_name
  config_get('stp_global', 'mst_name')
end

#mst_name=(val) ⇒ Object



422
423
424
425
426
427
428
429
430
431
432
# File 'lib/cisco_node_utils/stp_global.rb', line 422

def mst_name=(val)
  check_stp_mode_mst
  if val
    state = ''
  else
    state = 'no'
    val = ''
  end
  config_set('stp_global',
             'mst_name', state: state, name: val)
end

#mst_priorityObject

Getter: Builds an array of mst priority commands currently on the device. cli: spanning-tree mst 2-42 priority 40960

spanning-tree mst 83-92,1000-2300 priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



444
445
446
# File 'lib/cisco_node_utils/stp_global.rb', line 444

def mst_priority
  config_get('stp_global', 'mst_priority')
end

#mst_priority=(list) ⇒ Object



448
449
450
451
452
453
# File 'lib/cisco_node_utils/stp_global.rb', line 448

def mst_priority=(list)
  check_stp_mode_mst
  config_set('stp_global', 'mst_priority',
             state: 'no', range: @mr, val: '') if list.empty?
  set_range_based_params(list, 'mst_priority')
end

#mst_revisionObject



459
460
461
# File 'lib/cisco_node_utils/stp_global.rb', line 459

def mst_revision
  config_get('stp_global', 'mst_revision')
end

#mst_revision=(val) ⇒ Object



463
464
465
466
467
468
469
470
471
472
473
# File 'lib/cisco_node_utils/stp_global.rb', line 463

def mst_revision=(val)
  check_stp_mode_mst
  if val.zero?
    state = 'no'
    val = ''
  else
    state = ''
  end
  config_set('stp_global',
             'mst_revision', state: state, rev: val)
end

#mst_root_priorityObject

Getter: Builds an array of mst root priority commands currently on the device. cli: spanning-tree mst 2-42 root priority 40960

spanning-tree mst 83-92,1000-2300 root priority 53248

array: [[‘2-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



485
486
487
# File 'lib/cisco_node_utils/stp_global.rb', line 485

def mst_root_priority
  config_get('stp_global', 'mst_root_priority')
end

#mst_root_priority=(list) ⇒ Object



489
490
491
492
493
494
# File 'lib/cisco_node_utils/stp_global.rb', line 489

def mst_root_priority=(list)
  check_stp_mode_mst
  config_set('stp_global', 'mst_root_priority',
             state: 'no', range: @mr, val: '') if list.empty?
  set_range_based_params(list, 'mst_root_priority')
end

#pathcostObject



500
501
502
# File 'lib/cisco_node_utils/stp_global.rb', line 500

def pathcost
  config_get('stp_global', 'pathcost')
end

#pathcost=(val) ⇒ Object



504
505
506
507
508
509
510
# File 'lib/cisco_node_utils/stp_global.rb', line 504

def pathcost=(val)
  if val == default_pathcost
    config_set('stp_global', 'pathcost', state: 'no', method: '')
  else
    config_set('stp_global', 'pathcost', state: '', method: val)
  end
end

#set_range_based_params(list, param_name) ⇒ Object



663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/cisco_node_utils/stp_global.rb', line 663

def set_range_based_params(list, param_name)
  list.each do |range, property_value|
    # if a particular range is set to default, use 'no' cmd
    if property_value == 'default'
      config_set('stp_global', param_name,
                 state: 'no', range: range, val: '')
    else
      config_set('stp_global', param_name,
                 state: '', range: range, val: property_value)
    end
  end
end

#vlan_designated_priorityObject

Getter: Builds an array of vlan designated priority commands currently on the device. cli: vlan 1-42 designated priority 40960

vlan 83-92,1000-2300 designated priority 53248

array: [[‘1-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



522
523
524
# File 'lib/cisco_node_utils/stp_global.rb', line 522

def vlan_designated_priority
  config_get('stp_global', 'vlan_designated_priority')
end

#vlan_designated_priority=(list) ⇒ Object



526
527
528
529
530
# File 'lib/cisco_node_utils/stp_global.rb', line 526

def vlan_designated_priority=(list)
  config_set('stp_global', 'vlan_designated_priority',
             state: 'no', range: @vr, val: '') if list.empty?
  set_range_based_params(list, 'vlan_designated_priority')
end

#vlan_forward_timeObject

Getter: Builds an array of vlan forward time commands currently on the device. cli: spanning-tree vlan 1-42 forward-time 19

spanning-tree vlan 3000-3700 forward-time 13

array: [[‘1-42’, ‘19’], [‘3000-3700’, ‘13’]]



542
543
544
# File 'lib/cisco_node_utils/stp_global.rb', line 542

def vlan_forward_time
  config_get('stp_global', 'vlan_forward_time')
end

#vlan_forward_time=(list) ⇒ Object



546
547
548
549
550
# File 'lib/cisco_node_utils/stp_global.rb', line 546

def vlan_forward_time=(list)
  config_set('stp_global', 'vlan_forward_time',
             state: 'no', range: @vr, val: '') if list.empty?
  set_range_based_params(list, 'vlan_forward_time')
end

#vlan_hello_timeObject

Getter: Builds an array of vlan hello time commands currently on the device. cli: spanning-tree vlan 1-42 hello-time 10

spanning-tree vlan 3000-3700 hello-time 6

array: [[‘1-42’, ‘10’], [‘3000-3700’, ‘6’]]



562
563
564
# File 'lib/cisco_node_utils/stp_global.rb', line 562

def vlan_hello_time
  config_get('stp_global', 'vlan_hello_time')
end

#vlan_hello_time=(list) ⇒ Object



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/cisco_node_utils/stp_global.rb', line 566

def vlan_hello_time=(list)
  config_set('stp_global', 'vlan_hello_time',
             state: '', range: @vr, val: '2') if list.empty?
  list.each do |range, property_value|
    if property_value == 'default'
      config_set('stp_global', 'vlan_hello_time',
                 state: '', range: range, val: '2')
    else
      config_set('stp_global', 'vlan_hello_time',
                 state: '', range: range, val: property_value)
    end
  end
end

#vlan_max_ageObject

Getter: Builds an array of vlan max-age commands currently on the device. cli: spanning-tree vlan 1-42 max-age 21

spanning-tree vlan 3000-3700 max-age 13

array: [[‘1-42’, ‘21’], [‘3000-3700’, ‘13’]]



590
591
592
# File 'lib/cisco_node_utils/stp_global.rb', line 590

def vlan_max_age
  config_get('stp_global', 'vlan_max_age')
end

#vlan_max_age=(list) ⇒ Object



594
595
596
597
598
# File 'lib/cisco_node_utils/stp_global.rb', line 594

def vlan_max_age=(list)
  config_set('stp_global', 'vlan_max_age',
             state: 'no', range: @vr, val: '') if list.empty?
  set_range_based_params(list, 'vlan_max_age')
end

#vlan_priorityObject

Getter: Builds an array of vlan priority commands currently on the device. cli: spanning-tree vlan 1-42 priority 40960

spanning-tree vlan 83-92,1000-2300 priority 53248

array: [[‘1-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



610
611
612
# File 'lib/cisco_node_utils/stp_global.rb', line 610

def vlan_priority
  config_get('stp_global', 'vlan_priority')
end

#vlan_priority=(list) ⇒ Object



614
615
616
617
618
# File 'lib/cisco_node_utils/stp_global.rb', line 614

def vlan_priority=(list)
  config_set('stp_global', 'vlan_priority',
             state: 'no', range: @vr, val: '') if list.empty?
  set_range_based_params(list, 'vlan_priority')
end

#vlan_root_priorityObject

Getter: Builds an array of vlan root priority commands currently on the device. cli: vlan 1-42 root priority 40960

vlan 83-92,1000-2300 root priority 53248

array: [[‘1-42’, ‘40960’], [‘83-92,1000-2300’, ‘53248’]]



630
631
632
# File 'lib/cisco_node_utils/stp_global.rb', line 630

def vlan_root_priority
  config_get('stp_global', 'vlan_root_priority')
end

#vlan_root_priority=(list) ⇒ Object



634
635
636
637
638
# File 'lib/cisco_node_utils/stp_global.rb', line 634

def vlan_root_priority=(list)
  config_set('stp_global', 'vlan_root_priority',
             state: 'no', range: @vr, val: '') if list.empty?
  set_range_based_params(list, 'vlan_root_priority')
end