Class: Cisco::BfdGlobal

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

Overview

node_utils class for bfd_global

Instance Attribute 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(instantiate = true) ⇒ BfdGlobal

Returns a new instance of BfdGlobal


27
28
29
30
31
# File 'lib/cisco_node_utils/bfd_global.rb', line 27

def initialize(instantiate=true)
  set_args_keys_default

  Feature.bfd_enable if instantiate
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


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

def name
  @name
end

Instance Method Details

#default_echo_interfaceObject


84
85
86
# File 'lib/cisco_node_utils/bfd_global.rb', line 84

def default_echo_interface
  config_get_default('bfd_global', 'echo_interface')
end

#default_echo_rx_intervalObject


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

def default_echo_rx_interval
  config_get_default('bfd_global', 'echo_rx_interval')
end

#default_fabricpath_intervalObject


226
227
228
# File 'lib/cisco_node_utils/bfd_global.rb', line 226

def default_fabricpath_interval
  config_get_default('bfd_global', 'fabricpath_interval')
end

#default_fabricpath_slow_timerObject


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

def default_fabricpath_slow_timer
  config_get_default('bfd_global', 'fabricpath_slow_timer')
end

#default_fabricpath_vlanObject


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

def default_fabricpath_vlan
  config_get_default('bfd_global', 'fabricpath_vlan')
end

#default_intervalObject


214
215
216
# File 'lib/cisco_node_utils/bfd_global.rb', line 214

def default_interval
  config_get_default('bfd_global', 'interval')
end

#default_ipv4_echo_rx_intervalObject


112
113
114
# File 'lib/cisco_node_utils/bfd_global.rb', line 112

def default_ipv4_echo_rx_interval
  config_get_default('bfd_global', 'ipv4_echo_rx_interval')
end

#default_ipv4_intervalObject


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

def default_ipv4_interval
  config_get_default('bfd_global', 'ipv4_interval')
end

#default_ipv4_slow_timerObject


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

def default_ipv4_slow_timer
  config_get_default('bfd_global', 'ipv4_slow_timer')
end

#default_ipv6_echo_rx_intervalObject


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

def default_ipv6_echo_rx_interval
  config_get_default('bfd_global', 'ipv6_echo_rx_interval')
end

#default_ipv6_intervalObject


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

def default_ipv6_interval
  config_get_default('bfd_global', 'ipv6_interval')
end

#default_ipv6_slow_timerObject


168
169
170
# File 'lib/cisco_node_utils/bfd_global.rb', line 168

def default_ipv6_slow_timer
  config_get_default('bfd_global', 'ipv6_slow_timer')
end

#default_slow_timerObject


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

def default_slow_timer
  config_get_default('bfd_global', 'slow_timer')
end

#default_startup_timerObject


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

def default_startup_timer
  config_get_default('bfd_global', 'startup_timer')
end

#destroyObject

Reset everything back to default


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cisco_node_utils/bfd_global.rb', line 34

def destroy
  return unless Feature.bfd_enabled?
  [:interval,
   :ipv4_interval,
   :ipv6_interval,
   :fabricpath_interval,
   :echo_interface,
   :echo_rx_interval,
   :ipv4_echo_rx_interval,
   :ipv6_echo_rx_interval,
   :fabricpath_vlan,
   :slow_timer,
   :ipv4_slow_timer,
   :ipv6_slow_timer,
   :fabricpath_slow_timer,
   :startup_timer,
  ].each do |prop|
    send("#{prop}=", send("default_#{prop}")) if
      send prop
  end
  set_args_keys_default
end

#echo_interfaceObject

PROPERTIES #


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

def echo_interface
  config_get('bfd_global', 'echo_interface', @get_args)
end

#echo_interface=(val) ⇒ Object


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

def echo_interface=(val)
  set_args_keys(intf:  val ? val : echo_interface,
                state: val ? '' : 'no')
  config_set('bfd_global', 'echo_interface', @set_args) if
    @set_args[:intf]
end

#echo_rx_intervalObject


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

def echo_rx_interval
  config_get('bfd_global', 'echo_rx_interval', @get_args)
end

#echo_rx_interval=(val) ⇒ Object


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

def echo_rx_interval=(val)
  set_args_keys(rxi:   val,
                state: val == default_echo_rx_interval ? 'no' : '')
  config_set('bfd_global', 'echo_rx_interval', @set_args)
end

#fabricpath_intervalObject

fabricpath_interval is an array of fabricpath_interval, fabricpath_min_rx and fabricpath_multiplier CLI: bfd fabricpath interval 100 min_rx 100 multiplier 25


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

def fabricpath_interval
  config_get('bfd_global', 'fabricpath_interval', @get_args)
end

#fabricpath_interval=(arr) ⇒ Object

fabricpath_interval is an array of fabricpath_interval, fabricpath_min_rx and fabricpath_multiplier ex: ['100', '100', '25'] CLI: bfd fabricpath interval 100 min_rx 100 multiplier 25


294
295
296
297
298
299
# File 'lib/cisco_node_utils/bfd_global.rb', line 294

def fabricpath_interval=(arr)
  interval, min_rx, multiplier = arr
  set_args_keys(interval: interval, min_rx: min_rx, multiplier: multiplier,
                state: arr == default_fabricpath_interval ? 'no' : '')
  config_set('bfd_global', 'fabricpath_interval', @set_args)
end

#fabricpath_slow_timerObject


172
173
174
# File 'lib/cisco_node_utils/bfd_global.rb', line 172

def fabricpath_slow_timer
  config_get('bfd_global', 'fabricpath_slow_timer', @get_args)
end

#fabricpath_slow_timer=(val) ⇒ Object


176
177
178
179
180
# File 'lib/cisco_node_utils/bfd_global.rb', line 176

def fabricpath_slow_timer=(val)
  set_args_keys(timer: val,
                state: val == default_fabricpath_slow_timer ? 'no' : '')
  config_set('bfd_global', 'fabricpath_slow_timer', @set_args)
end

#fabricpath_vlanObject


200
201
202
# File 'lib/cisco_node_utils/bfd_global.rb', line 200

def fabricpath_vlan
  config_get('bfd_global', 'fabricpath_vlan', @get_args)
end

#fabricpath_vlan=(val) ⇒ Object


204
205
206
207
208
# File 'lib/cisco_node_utils/bfd_global.rb', line 204

def fabricpath_vlan=(val)
  set_args_keys(vlan:  val,
                state: val == default_fabricpath_vlan ? 'no' : '')
  config_set('bfd_global', 'fabricpath_vlan', @set_args)
end

#intervalObject

interval is an array of interval, min_rx and multiplier CLI: bfd interval 100 min_rx 100 multiplier 25


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

def interval
  config_get('bfd_global', 'interval', @get_args)
end

#interval=(arr) ⇒ Object

interval is an array of interval, min_rx and multiplier ex: ['100', '100', '25'] CLI: bfd interval 100 min_rx 100 multiplier 25


260
261
262
263
264
265
266
# File 'lib/cisco_node_utils/bfd_global.rb', line 260

def interval=(arr)
  return if arr == interval
  interval, min_rx, multiplier = arr
  set_args_keys(interval: interval, min_rx: min_rx, multiplier: multiplier,
                state: arr == default_interval ? 'no' : '')
  config_set('bfd_global', 'interval', @set_args)
end

#ipv4_echo_rx_intervalObject


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

def ipv4_echo_rx_interval
  config_get('bfd_global', 'ipv4_echo_rx_interval', @get_args)
end

#ipv4_echo_rx_interval=(val) ⇒ Object


106
107
108
109
110
# File 'lib/cisco_node_utils/bfd_global.rb', line 106

def ipv4_echo_rx_interval=(val)
  set_args_keys(rxi:   val,
                state: val == default_ipv4_echo_rx_interval ? 'no' : '')
  config_set('bfd_global', 'ipv4_echo_rx_interval', @set_args)
end

#ipv4_intervalObject

ipv4_interval is an array of ipv4_interval, ipv4_min_rx and ipv4_multiplier CLI: bfd ipv4 interval 100 min_rx 100 multiplier 25


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

def ipv4_interval
  config_get('bfd_global', 'ipv4_interval', @get_args)
end

#ipv4_interval=(arr) ⇒ Object

ipv4_interval is an array of ipv4_interval, ipv4_min_rx and ipv4_multiplier ex: ['100', '100', '25'] CLI: bfd ipv4 interval 100 min_rx 100 multiplier 25


272
273
274
275
276
277
# File 'lib/cisco_node_utils/bfd_global.rb', line 272

def ipv4_interval=(arr)
  interval, min_rx, multiplier = arr
  set_args_keys(interval: interval, min_rx: min_rx, multiplier: multiplier,
                state: arr == default_ipv4_interval ? 'no' : '')
  config_set('bfd_global', 'ipv4_interval', @set_args)
end

#ipv4_slow_timerObject


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

def ipv4_slow_timer
  config_get('bfd_global', 'ipv4_slow_timer', @get_args)
end

#ipv4_slow_timer=(val) ⇒ Object


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

def ipv4_slow_timer=(val)
  set_args_keys(timer: val,
                state: val == default_ipv4_slow_timer ? 'no' : '')
  config_set('bfd_global', 'ipv4_slow_timer', @set_args)
end

#ipv6_echo_rx_intervalObject


116
117
118
# File 'lib/cisco_node_utils/bfd_global.rb', line 116

def ipv6_echo_rx_interval
  config_get('bfd_global', 'ipv6_echo_rx_interval', @get_args)
end

#ipv6_echo_rx_interval=(val) ⇒ Object


120
121
122
123
124
# File 'lib/cisco_node_utils/bfd_global.rb', line 120

def ipv6_echo_rx_interval=(val)
  set_args_keys(rxi:   val,
                state: val == default_ipv6_echo_rx_interval ? 'no' : '')
  config_set('bfd_global', 'ipv6_echo_rx_interval', @set_args)
end

#ipv6_intervalObject

ipv6_interval is an array of ipv6_interval, ipv6_min_rx and ipv6_multiplier CLI: bfd ipv6 interval 100 min_rx 100 multiplier 25


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

def ipv6_interval
  config_get('bfd_global', 'ipv6_interval', @get_args)
end

#ipv6_interval=(arr) ⇒ Object

ipv6_interval is an array of ipv6_interval, ipv6_min_rx and ipv6_multiplier ex: ['100', '100', '25'] CLI: bfd ipv6 interval 100 min_rx 100 multiplier 25


283
284
285
286
287
288
# File 'lib/cisco_node_utils/bfd_global.rb', line 283

def ipv6_interval=(arr)
  interval, min_rx, multiplier = arr
  set_args_keys(interval: interval, min_rx: min_rx, multiplier: multiplier,
                state: arr == default_ipv6_interval ? 'no' : '')
  config_set('bfd_global', 'ipv6_interval', @set_args)
end

#ipv6_slow_timerObject


158
159
160
# File 'lib/cisco_node_utils/bfd_global.rb', line 158

def ipv6_slow_timer
  config_get('bfd_global', 'ipv6_slow_timer', @get_args)
end

#ipv6_slow_timer=(val) ⇒ Object


162
163
164
165
166
# File 'lib/cisco_node_utils/bfd_global.rb', line 162

def ipv6_slow_timer=(val)
  set_args_keys(timer: val,
                state: val == default_ipv6_slow_timer ? 'no' : '')
  config_set('bfd_global', 'ipv6_slow_timer', @set_args)
end

#set_args_keys(hash = {}) ⇒ Object

rubocop:disable Style/AccessorMethodName


64
65
66
67
# File 'lib/cisco_node_utils/bfd_global.rb', line 64

def set_args_keys(hash={})
  set_args_keys_default
  @set_args = @get_args.merge!(hash) unless hash.empty?
end

#set_args_keys_defaultObject

Helper method to delete @set_args hash keys


58
59
60
61
# File 'lib/cisco_node_utils/bfd_global.rb', line 58

def set_args_keys_default
  keys = { state: '' }
  @get_args = @set_args = keys
end

#slow_timerObject


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

def slow_timer
  config_get('bfd_global', 'slow_timer', @get_args)
end

#slow_timer=(val) ⇒ Object


134
135
136
137
138
# File 'lib/cisco_node_utils/bfd_global.rb', line 134

def slow_timer=(val)
  set_args_keys(timer: val,
                state: val == default_slow_timer ? 'no' : '')
  config_set('bfd_global', 'slow_timer', @set_args)
end

#startup_timerObject


186
187
188
# File 'lib/cisco_node_utils/bfd_global.rb', line 186

def startup_timer
  config_get('bfd_global', 'startup_timer', @get_args)
end

#startup_timer=(val) ⇒ Object


190
191
192
193
194
# File 'lib/cisco_node_utils/bfd_global.rb', line 190

def startup_timer=(val)
  set_args_keys(timer: val,
                state: val == default_startup_timer ? 'no' : '')
  config_set('bfd_global', 'startup_timer', @set_args)
end