Class: Cisco::FabricpathGlobal
- Inherits:
-
NodeUtil
show all
- Defined in:
- lib/cisco_node_utils/fabricpath_global.rb
Overview
node_utils class for fabricpath_global
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(name, instantiate = true) ⇒ FabricpathGlobal
Returns a new instance of FabricpathGlobal.
27
28
29
30
31
32
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 27
def initialize(name, instantiate=true)
fail ArgumentError unless name.to_s == 'default'
@name = name.downcase
create if instantiate
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
25
26
27
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 25
def name
@name
end
|
Class Method Details
.fabricpath_feature ⇒ Object
42
43
44
45
46
47
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 42
def self.fabricpath_feature
fabricpath = config_get('fabricpath', 'feature')
fail 'fabricpath_feature not found' if fabricpath.nil?
return :disabled if fabricpath.nil?
fabricpath.to_sym
end
|
.fabricpath_feature_set(fabricpath_set) ⇒ Object
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/fabricpath_global.rb', line 49
def self.fabricpath_feature_set(fabricpath_set)
curr = FabricpathGlobal.fabricpath_feature
return if curr == fabricpath_set
case fabricpath_set
when :enabled
config_set('fabricpath', 'feature_install',
state: '') if curr == :uninstalled
config_set('fabricpath', 'feature', state: '')
when :disabled
config_set('fabricpath', 'feature', state: 'no') if curr == :enabled
return
when :installed
config_set('fabricpath', 'feature_install',
state: '') if curr == :uninstalled
when :uninstalled
config_set('fabricpath', 'feature', state: 'no') if curr == :enabled
config_set('fabricpath', 'feature_install', state: 'no')
end
end
|
.globals ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 34
def self.globals
hash = {}
is_fabricpath_feature = config_get('fabricpath', 'feature')
return hash if (:enabled != is_fabricpath_feature.to_sym)
hash['default'] = FabricpathGlobal.new('default', false)
hash
end
|
Instance Method Details
#aggregate_multicast_routes ⇒ Object
105
106
107
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 105
def aggregate_multicast_routes
config_get('fabricpath', 'aggregate_multicast_routes')
end
|
#aggregate_multicast_routes=(val) ⇒ Object
109
110
111
112
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 109
def aggregate_multicast_routes=(val)
state = val ? '' : 'no'
config_set('fabricpath', 'aggregate_multicast_routes', state: state)
end
|
#allocate_delay ⇒ Object
118
119
120
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 118
def allocate_delay
config_get('fabricpath', 'allocate_delay')
end
|
#allocate_delay=(val) ⇒ Object
122
123
124
125
126
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 122
def allocate_delay=(val)
state = val ? '' : 'no'
delay = val ? val : ''
config_set('fabricpath', 'allocate_delay', state: state, delay: delay)
end
|
#auto_switch_id ⇒ Object
132
133
134
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 132
def auto_switch_id
config_get('fabricpath', 'auto_switch_id')
end
|
#default_aggregate_multicast_routes ⇒ Object
114
115
116
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 114
def default_aggregate_multicast_routes
config_get_default('fabricpath', 'aggregate_multicast_routes')
end
|
#default_allocate_delay ⇒ Object
128
129
130
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 128
def default_allocate_delay
config_get_default('fabricpath', 'allocate_delay')
end
|
#default_graceful_merge ⇒ Object
148
149
150
151
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 148
def default_graceful_merge
graceful_merge = config_get_default('fabricpath', 'graceful_merge')
graceful_merge.to_sym
end
|
#default_linkup_delay ⇒ Object
163
164
165
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 163
def default_linkup_delay
config_get_default('fabricpath', 'linkup_delay')
end
|
#default_linkup_delay_always ⇒ Object
180
181
182
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 180
def default_linkup_delay_always
config_get_default('fabricpath', 'linkup_delay_always')
end
|
#default_linkup_delay_enable ⇒ Object
199
200
201
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 199
def default_linkup_delay_enable
config_get_default('fabricpath', 'linkup_delay_enable')
end
|
#default_loadbalance_algorithm ⇒ Object
216
217
218
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 216
def default_loadbalance_algorithm
config_get_default('fabricpath', 'loadbalance_algorithm')
end
|
#default_loadbalance_multicast_has_vlan ⇒ Object
244
245
246
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 244
def default_loadbalance_multicast_has_vlan
config_get_default('fabricpath', 'loadbalance_multicast_has_vlan')
end
|
#default_loadbalance_multicast_rotate ⇒ Object
240
241
242
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 240
def default_loadbalance_multicast_rotate
config_get_default('fabricpath', 'loadbalance_multicast_rotate')
end
|
#default_loadbalance_unicast_has_vlan ⇒ Object
311
312
313
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 311
def default_loadbalance_unicast_has_vlan
config_get_default('fabricpath', 'loadbalance_unicast_has_vlan')
end
|
#default_loadbalance_unicast_layer ⇒ Object
303
304
305
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 303
def default_loadbalance_unicast_layer
config_get_default('fabricpath', 'loadbalance_unicast_layer')
end
|
#default_loadbalance_unicast_rotate ⇒ Object
307
308
309
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 307
def default_loadbalance_unicast_rotate
config_get_default('fabricpath', 'loadbalance_unicast_rotate')
end
|
#default_mode ⇒ Object
331
332
333
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 331
def default_mode
config_get_default('fabricpath', 'mode')
end
|
#default_transition_delay ⇒ Object
356
357
358
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 356
def default_transition_delay
config_get_default('fabricpath', 'transition_delay')
end
|
#default_ttl_multicast ⇒ Object
370
371
372
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 370
def default_ttl_multicast
config_get_default('fabricpath', 'ttl_multicast')
end
|
#default_ttl_unicast ⇒ Object
384
385
386
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 384
def default_ttl_unicast
config_get_default('fabricpath', 'ttl_unicast')
end
|
#graceful_merge ⇒ Object
136
137
138
139
140
141
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 136
def graceful_merge
graceful_merge_conf = config_get('fabricpath', 'graceful_merge')
return :enable if graceful_merge_conf.nil?
graceful_merge_conf ? :disable : :enable
end
|
#graceful_merge=(val) ⇒ Object
143
144
145
146
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 143
def graceful_merge=(val)
state = val == :enable ? 'no' : ''
config_set('fabricpath', 'graceful_merge', state: state)
end
|
#linkup_delay ⇒ Object
153
154
155
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 153
def linkup_delay
config_get('fabricpath', 'linkup_delay')
end
|
#linkup_delay=(val) ⇒ Object
157
158
159
160
161
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 157
def linkup_delay=(val)
state = val ? '' : 'no'
delay = val ? val : ''
config_set('fabricpath', 'linkup_delay', state: state, delay: delay)
end
|
#linkup_delay_always ⇒ Object
167
168
169
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 167
def linkup_delay_always
config_get('fabricpath', 'linkup_delay_always')
end
|
#linkup_delay_always=(val) ⇒ Object
171
172
173
174
175
176
177
178
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 171
def linkup_delay_always=(val)
if val == '' || val == true
state = ''
else
state = 'no'
end
config_set('fabricpath', 'linkup_delay_always', state: state)
end
|
#linkup_delay_enable ⇒ Object
184
185
186
187
188
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 184
def linkup_delay_enable
delay = config_get('fabricpath', 'linkup_delay_enable')
return false if delay.nil?
delay
end
|
#linkup_delay_enable=(val) ⇒ Object
190
191
192
193
194
195
196
197
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 190
def linkup_delay_enable=(val)
if val == '' || val == true
state = ''
else
state = 'no'
end
config_set('fabricpath', 'linkup_delay_enable', state: state)
end
|
#loadbalance_algorithm ⇒ Object
203
204
205
206
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 203
def loadbalance_algorithm
algo = config_get('fabricpath', 'loadbalance_algorithm')
algo.downcase
end
|
#loadbalance_algorithm=(val) ⇒ Object
208
209
210
211
212
213
214
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 208
def loadbalance_algorithm=(val)
val = my_munge('loadbalance_algorithm', val)
state = val ? '' : 'no'
algo = val ? val : ''
config_set('fabricpath', 'loadbalance_algorithm', state: state,
algo: algo)
end
|
#loadbalance_multicast=(rotate, has_vlan) ⇒ Object
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 229
def loadbalance_multicast=(rotate, has_vlan)
if rotate == '' && (has_vlan == '' || has_vlan == false)
config_set('fabricpath', 'loadbalance_multicast_reset')
else
rotate = my_munge('loadbalance_multicast_rotate', rotate)
has_vlan = (has_vlan == true) ? 'include-vlan' : ''
config_set('fabricpath', 'loadbalance_multicast_set',
rotate_amt: rotate, inc_vlan: has_vlan)
end
end
|
#loadbalance_multicast_has_vlan ⇒ Object
224
225
226
227
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 224
def loadbalance_multicast_has_vlan
val = config_get('fabricpath', 'loadbalance_multicast_has_vlan')
val.nil? ? false : val
end
|
#loadbalance_multicast_rotate ⇒ Object
220
221
222
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 220
def loadbalance_multicast_rotate
config_get('fabricpath', 'loadbalance_multicast_rotate')
end
|
#loadbalance_unicast=(layer, rotate, has_vlan) ⇒ Object
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 286
def loadbalance_unicast=(layer, rotate, has_vlan)
support = config_get('fabricpath', 'loadbalance_unicast_support')
if support == 'combined'
if layer == '' && rotate == '' && (has_vlan == '' || has_vlan == false)
config_set('fabricpath', 'loadbalance_unicast_reset')
else
rotate = my_munge('loadbalance_unicast_rotate', rotate)
has_vlan = (has_vlan == true) ? 'include-vlan' : ''
config_set('fabricpath', 'loadbalance_unicast_set',
pref: layer, rotate_amt: rotate, inc_vlan: has_vlan)
end
else
self.split_loadbalance_unicast_layer = layer
self.split_loadbalance_unicast_has_vlan = has_vlan
end
end
|
#loadbalance_unicast_has_vlan ⇒ Object
265
266
267
268
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 265
def loadbalance_unicast_has_vlan
val = config_get('fabricpath', 'loadbalance_unicast_has_vlan')
val.nil? ? false : val
end
|
#loadbalance_unicast_layer ⇒ Object
248
249
250
251
252
253
254
255
256
257
258
259
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 248
def loadbalance_unicast_layer
unicast = config_get('fabricpath', 'loadbalance_unicast_layer')
return default_loadbalance_unicast_layer if unicast.nil?
case unicast
when /L4/
'layer4'
when /L3/
'layer3'
when /Mixed/
'mixed'
end
end
|
#loadbalance_unicast_rotate ⇒ Object
261
262
263
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 261
def loadbalance_unicast_rotate
config_get('fabricpath', 'loadbalance_unicast_rotate')
end
|
#mode ⇒ Object
315
316
317
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 315
def mode
config_get('fabricpath', 'mode')
end
|
#mode=(val) ⇒ Object
319
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 319
def mode=(val)
if val == '' || val == 'normal'
state = 'no'
else
state = ''
vdc = config_get('limit_resource', 'vdc')
config_set('limit_resource', 'fabricpath_transit', vdc) unless vdc.nil?
end
config_set('fabricpath', 'mode', state: state)
end
|
#my_munge(property, set_val) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 80
def my_munge(property, set_val)
val = config_get_default('fabricpath', property)
case property
when /loadbalance_algorithm/
if (val == 'source-destination') &&
(set_val == 'symmetric' || set_val == 'xor')
val
else
set_val
end
when /loadbalance_.*_rotate/
if val == false || set_val == ''
''
else
"rotate-amount 0x#{set_val.to_s(16)}"
end
else
set_val
end
end
|
#split_loadbalance_unicast_has_vlan=(val) ⇒ Object
277
278
279
280
281
282
283
284
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 277
def split_loadbalance_unicast_has_vlan=(val)
if val == '' || val == false
state = 'no'
else
state = ''
end
config_set('fabricpath', 'loadbalance_unicast_has_vlan', state: state)
end
|
#split_loadbalance_unicast_layer=(val) ⇒ Object
270
271
272
273
274
275
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 270
def split_loadbalance_unicast_layer=(val)
state = val ? '' : 'no'
pref = val ? val : ''
config_set('fabricpath', 'loadbalance_unicast_layer', state: state,
pref: pref)
end
|
#switch_id ⇒ Object
335
336
337
338
339
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 335
def switch_id
switch_id_conf = config_get('fabricpath', 'switch_id')
return auto_switch_id if switch_id_conf.nil?
switch_id_conf
end
|
#switch_id=(val) ⇒ Object
341
342
343
344
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 341
def switch_id=(val)
config_set('fabricpath', 'switch_id', swid: val.to_s)
end
|
#transition_delay ⇒ Object
346
347
348
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 346
def transition_delay
config_get('fabricpath', 'transition_delay')
end
|
#transition_delay=(val) ⇒ Object
350
351
352
353
354
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 350
def transition_delay=(val)
state = val ? '' : 'no'
delay = val ? val : ''
config_set('fabricpath', 'transition_delay', state: state, delay: delay)
end
|
#ttl_multicast ⇒ Object
360
361
362
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 360
def ttl_multicast
config_get('fabricpath', 'ttl_multicast')
end
|
#ttl_multicast=(val) ⇒ Object
364
365
366
367
368
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 364
def ttl_multicast=(val)
state = val ? '' : 'no'
ttl = val ? val : ''
config_set('fabricpath', 'ttl_multicast', state: state, ttl: ttl)
end
|
#ttl_unicast ⇒ Object
374
375
376
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 374
def ttl_unicast
config_get('fabricpath', 'ttl_unicast')
end
|
#ttl_unicast=(val) ⇒ Object
378
379
380
381
382
|
# File 'lib/cisco_node_utils/fabricpath_global.rb', line 378
def ttl_unicast=(val)
state = val ? '' : 'no'
ttl = val ? val : ''
config_set('fabricpath', 'ttl_unicast', state: state, ttl: ttl)
end
|