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



230
231
232
# File 'lib/cisco_node_utils/bfd_global.rb', line 230

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

#default_fabricpath_slow_timerObject



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

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

#default_fabricpath_vlanObject



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

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

#default_intervalObject



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

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



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

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

#default_ipv4_slow_timerObject



156
157
158
# File 'lib/cisco_node_utils/bfd_global.rb', line 156

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



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

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

#default_ipv6_slow_timerObject



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

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



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

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



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

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



298
299
300
301
302
303
# File 'lib/cisco_node_utils/bfd_global.rb', line 298

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



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

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

#fabricpath_slow_timer=(val) ⇒ Object



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

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



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

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

#fabricpath_vlan=(val) ⇒ Object



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

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



236
237
238
# File 'lib/cisco_node_utils/bfd_global.rb', line 236

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



264
265
266
267
268
269
270
# File 'lib/cisco_node_utils/bfd_global.rb', line 264

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



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

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



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

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
153
154
# File 'lib/cisco_node_utils/bfd_global.rb', line 148

def ipv4_slow_timer=(val)
  # Only set the value if it's not already configured and default
  return if val == default_ipv4_slow_timer && val == ipv4_slow_timer
  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



250
251
252
# File 'lib/cisco_node_utils/bfd_global.rb', line 250

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



287
288
289
290
291
292
# File 'lib/cisco_node_utils/bfd_global.rb', line 287

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



160
161
162
# File 'lib/cisco_node_utils/bfd_global.rb', line 160

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

#ipv6_slow_timer=(val) ⇒ Object



164
165
166
167
168
169
170
# File 'lib/cisco_node_utils/bfd_global.rb', line 164

def ipv6_slow_timer=(val)
  # Only set the value if it's not already configured and default
  return if val == default_ipv6_slow_timer && val == ipv6_slow_timer
  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



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

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

#startup_timer=(val) ⇒ Object



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

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