Class: Cisco::DhcpRelayGlobal
- Inherits:
-
NodeUtil
show all
- Defined in:
- lib/cisco_node_utils/dhcp_relay_global.rb
Overview
node_utils class for dhcp_relay_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(instantiate = true) ⇒ DhcpRelayGlobal
Returns a new instance of DhcpRelayGlobal.
24
25
26
27
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 24
def initialize(instantiate=true)
Feature.dhcp_enable if instantiate
set_args_keys_default
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
22
23
24
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 22
def name
@name
end
|
Instance Method Details
84
85
86
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 84
def default_ipv4_information_option
config_get_default('dhcp_relay_global', 'ipv4_information_option')
end
|
99
100
101
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 99
def default_ipv4_information_option_trust
config_get_default('dhcp_relay_global', 'ipv4_information_option_trust')
end
|
113
114
115
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 113
def default_ipv4_information_option_vpn
config_get_default('dhcp_relay_global', 'ipv4_information_option_vpn')
end
|
127
128
129
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 127
def default_ipv4_information_trust_all
config_get_default('dhcp_relay_global', 'ipv4_information_trust_all')
end
|
#default_ipv4_relay ⇒ Object
141
142
143
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 141
def default_ipv4_relay
config_get_default('dhcp_relay_global', 'ipv4_relay')
end
|
#default_ipv4_smart_relay ⇒ Object
155
156
157
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 155
def default_ipv4_smart_relay
config_get_default('dhcp_relay_global', 'ipv4_smart_relay')
end
|
#default_ipv4_src_addr_hsrp ⇒ Object
169
170
171
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 169
def default_ipv4_src_addr_hsrp
config_get_default('dhcp_relay_global', 'ipv4_src_addr_hsrp')
end
|
#default_ipv4_src_intf ⇒ Object
186
187
188
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 186
def default_ipv4_src_intf
config_get_default('dhcp_relay_global', 'ipv4_src_intf')
end
|
#default_ipv4_sub_option_circuit_id_custom ⇒ Object
201
202
203
204
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 201
def default_ipv4_sub_option_circuit_id_custom
config_get_default('dhcp_relay_global',
'ipv4_sub_option_circuit_id_custom')
end
|
#default_ipv4_sub_option_circuit_id_string ⇒ Object
223
224
225
226
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 223
def default_ipv4_sub_option_circuit_id_string
config_get_default('dhcp_relay_global',
'ipv4_sub_option_circuit_id_string')
end
|
#default_ipv4_sub_option_cisco ⇒ Object
238
239
240
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 238
def default_ipv4_sub_option_cisco
config_get_default('dhcp_relay_global', 'ipv4_sub_option_cisco')
end
|
#default_ipv6_option_cisco ⇒ Object
252
253
254
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 252
def default_ipv6_option_cisco
config_get_default('dhcp_relay_global', 'ipv6_option_cisco')
end
|
#default_ipv6_option_vpn ⇒ Object
266
267
268
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 266
def default_ipv6_option_vpn
config_get_default('dhcp_relay_global', 'ipv6_option_vpn')
end
|
#default_ipv6_relay ⇒ Object
280
281
282
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 280
def default_ipv6_relay
config_get_default('dhcp_relay_global', 'ipv6_relay')
end
|
#default_ipv6_src_intf ⇒ Object
298
299
300
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 298
def default_ipv6_src_intf
config_get_default('dhcp_relay_global', 'ipv6_src_intf')
end
|
#destroy ⇒ Object
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/dhcp_relay_global.rb', line 47
def destroy
return unless Feature.dhcp_enabled?
[:ipv4_information_option,
:ipv4_information_option_trust,
:ipv4_information_option_vpn,
:ipv4_information_trust_all,
:ipv4_relay,
:ipv4_smart_relay,
:ipv4_src_addr_hsrp,
:ipv4_src_intf,
:ipv4_sub_option_circuit_id_custom,
:ipv4_sub_option_circuit_id_string,
:ipv4_sub_option_cisco,
:ipv6_option_cisco,
:ipv6_option_vpn,
:ipv6_relay,
:ipv6_src_intf,
].each do |prop|
send("#{prop}=", send("default_#{prop}")) if send prop
end
set_args_keys_default
end
|
74
75
76
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 74
def ipv4_information_option
config_get('dhcp_relay_global', 'ipv4_information_option')
end
|
78
79
80
81
82
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 78
def ipv4_information_option=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_information_option', @set_args)
end
|
88
89
90
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 88
def ipv4_information_option_trust
config_get('dhcp_relay_global', 'ipv4_information_option_trust')
end
|
92
93
94
95
96
97
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 92
def ipv4_information_option_trust=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_information_option_trust',
@set_args)
end
|
103
104
105
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 103
def ipv4_information_option_vpn
config_get('dhcp_relay_global', 'ipv4_information_option_vpn')
end
|
107
108
109
110
111
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 107
def ipv4_information_option_vpn=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_information_option_vpn', @set_args)
end
|
117
118
119
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 117
def ipv4_information_trust_all
config_get('dhcp_relay_global', 'ipv4_information_trust_all')
end
|
121
122
123
124
125
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 121
def ipv4_information_trust_all=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_information_trust_all', @set_args)
end
|
#ipv4_relay ⇒ Object
131
132
133
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 131
def ipv4_relay
config_get('dhcp_relay_global', 'ipv4_relay')
end
|
#ipv4_relay=(val) ⇒ Object
135
136
137
138
139
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 135
def ipv4_relay=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_relay', @set_args)
end
|
#ipv4_smart_relay ⇒ Object
145
146
147
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 145
def ipv4_smart_relay
config_get('dhcp_relay_global', 'ipv4_smart_relay')
end
|
#ipv4_smart_relay=(val) ⇒ Object
149
150
151
152
153
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 149
def ipv4_smart_relay=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_smart_relay', @set_args)
end
|
#ipv4_src_addr_hsrp ⇒ Object
159
160
161
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 159
def ipv4_src_addr_hsrp
config_get('dhcp_relay_global', 'ipv4_src_addr_hsrp')
end
|
#ipv4_src_addr_hsrp=(val) ⇒ Object
163
164
165
166
167
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 163
def ipv4_src_addr_hsrp=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_src_addr_hsrp', @set_args)
end
|
#ipv4_src_intf ⇒ Object
173
174
175
176
177
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 173
def ipv4_src_intf
intf = config_get('dhcp_relay_global', 'ipv4_src_intf')
intf = intf.downcase.delete(' ') if intf
intf
end
|
#ipv4_src_intf=(val) ⇒ Object
179
180
181
182
183
184
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 179
def ipv4_src_intf=(val)
state = val == default_ipv4_src_intf ? 'no' : ''
intf = val == default_ipv4_src_intf ? '' : val
set_args_keys(state: state, intf: intf)
config_set('dhcp_relay_global', 'ipv4_src_intf', @set_args)
end
|
#ipv4_sub_option_circuit_id_custom ⇒ Object
190
191
192
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 190
def ipv4_sub_option_circuit_id_custom
config_get('dhcp_relay_global', 'ipv4_sub_option_circuit_id_custom')
end
|
#ipv4_sub_option_circuit_id_custom=(val) ⇒ Object
194
195
196
197
198
199
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 194
def ipv4_sub_option_circuit_id_custom=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_sub_option_circuit_id_custom',
@set_args)
end
|
#ipv4_sub_option_circuit_id_string ⇒ Object
206
207
208
209
210
211
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 206
def ipv4_sub_option_circuit_id_string
str = config_get('dhcp_relay_global', 'ipv4_sub_option_circuit_id_string')
str.strip! if str.kind_of?(String)
str
end
|
#ipv4_sub_option_circuit_id_string=(val) ⇒ Object
213
214
215
216
217
218
219
220
221
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 213
def ipv4_sub_option_circuit_id_string=(val)
state = val == default_ipv4_sub_option_circuit_id_string ? 'no' : ''
format = val == default_ipv4_sub_option_circuit_id_string ? '' : 'format'
word = val == default_ipv4_sub_option_circuit_id_string ? '' : val
word = Utils.add_quotes(word) unless word.empty?
set_args_keys(state: state, format: format, word: word)
config_set('dhcp_relay_global', 'ipv4_sub_option_circuit_id_string',
@set_args)
end
|
#ipv4_sub_option_cisco ⇒ Object
228
229
230
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 228
def ipv4_sub_option_cisco
config_get('dhcp_relay_global', 'ipv4_sub_option_cisco')
end
|
#ipv4_sub_option_cisco=(val) ⇒ Object
232
233
234
235
236
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 232
def ipv4_sub_option_cisco=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv4_sub_option_cisco', @set_args)
end
|
#ipv6_option_cisco ⇒ Object
242
243
244
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 242
def ipv6_option_cisco
config_get('dhcp_relay_global', 'ipv6_option_cisco')
end
|
#ipv6_option_cisco=(val) ⇒ Object
246
247
248
249
250
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 246
def ipv6_option_cisco=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv6_option_cisco', @set_args)
end
|
#ipv6_option_vpn ⇒ Object
256
257
258
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 256
def ipv6_option_vpn
config_get('dhcp_relay_global', 'ipv6_option_vpn')
end
|
#ipv6_option_vpn=(val) ⇒ Object
260
261
262
263
264
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 260
def ipv6_option_vpn=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv6_option_vpn', @set_args)
end
|
#ipv6_relay ⇒ Object
270
271
272
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 270
def ipv6_relay
config_get('dhcp_relay_global', 'ipv6_relay')
end
|
#ipv6_relay=(val) ⇒ Object
274
275
276
277
278
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 274
def ipv6_relay=(val)
state = val ? '' : 'no'
set_args_keys(state: state)
config_set('dhcp_relay_global', 'ipv6_relay', @set_args)
end
|
#ipv6_src_intf ⇒ Object
284
285
286
287
288
289
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 284
def ipv6_src_intf
intf = config_get('dhcp_relay_global', 'ipv6_src_intf')
intf = intf.downcase.delete(' ') if intf
intf
end
|
#ipv6_src_intf=(val) ⇒ Object
291
292
293
294
295
296
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 291
def ipv6_src_intf=(val)
state = val == default_ipv6_src_intf ? 'no' : ''
intf = val == default_ipv6_src_intf ? '' : val
set_args_keys(state: state, intf: intf)
config_set('dhcp_relay_global', 'ipv6_src_intf', @set_args)
end
|
#set_args_keys(hash = {}) ⇒ Object
rubocop:disable Style/AccessorMethodName
42
43
44
45
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 42
def set_args_keys(hash={})
set_args_keys_default
@set_args = @get_args.merge!(hash) unless hash.empty?
end
|
#set_args_keys_default ⇒ Object
Helper method to delete @set_args hash keys
36
37
38
39
|
# File 'lib/cisco_node_utils/dhcp_relay_global.rb', line 36
def set_args_keys_default
@set_args = {}
@get_args = @set_args
end
|