Class: Cisco::RadiusGlobal
Overview
RadiusGlobal - node utility class for Radius Global configuration management
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
Returns a new instance of RadiusGlobal.
27
28
29
30
31
32
33
|
# File 'lib/cisco_node_utils/radius_global.rb', line 27
def initialize(name)
fail TypeError unless name.is_a?(String)
fail ArgumentError,
"This provider only accepts an id of 'default'" \
unless name.eql?('default')
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
25
26
27
|
# File 'lib/cisco_node_utils/radius_global.rb', line 25
def name
@name
end
|
Class Method Details
.radius_global ⇒ Object
35
36
37
38
39
|
# File 'lib/cisco_node_utils/radius_global.rb', line 35
def self.radius_global
hash = {}
hash['default'] = RadiusGlobal.new('default')
hash
end
|
Instance Method Details
#==(other) ⇒ Object
41
42
43
|
# File 'lib/cisco_node_utils/radius_global.rb', line 41
def ==(other)
name == other.name
end
|
#default_retransmit_count ⇒ Object
76
77
78
|
# File 'lib/cisco_node_utils/radius_global.rb', line 76
def default_retransmit_count
config_get_default('radius_global', 'retransmit').to_i
end
|
#default_timeout ⇒ Object
49
50
51
|
# File 'lib/cisco_node_utils/radius_global.rb', line 49
def default_timeout
config_get_default('radius_global', 'timeout')
end
|
#key ⇒ Object
103
104
105
|
# File 'lib/cisco_node_utils/radius_global.rb', line 103
def key
config_get('radius_global', 'key')
end
|
99
100
101
|
# File 'lib/cisco_node_utils/radius_global.rb', line 99
def key_format
config_get('radius_global', 'key_format')
end
|
#key_set(value, format) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/cisco_node_utils/radius_global.rb', line 107
def key_set(value, format)
unless value.nil?
fail ArgumentError, 'value must be a String' \
unless value.is_a?(String)
end
unless format.nil?
fail ArgumentError, 'format must be an Integer' \
unless format.is_a?(Integer)
end
if value.nil? && !key.nil?
config_set('radius_global',
'key',
state: 'no',
key: "#{key_format} #{key}")
elsif !format.nil?
config_set('radius_global',
'key',
state: '',
key: "#{format} #{value}")
else
config_set('radius_global',
'key',
state: '',
key: "#{value}")
end
end
|
#retransmit_count ⇒ Object
72
73
74
|
# File 'lib/cisco_node_utils/radius_global.rb', line 72
def retransmit_count
config_get('radius_global', 'retransmit')
end
|
#retransmit_count=(val) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/cisco_node_utils/radius_global.rb', line 80
def retransmit_count=(val)
unless val.nil?
fail ArgumentError, 'retransmit_count must be an Integer' \
unless val.is_a?(Integer)
end
if val.nil?
config_set('radius_global',
'retransmit',
state: 'no',
count: retransmit_count)
else
config_set('radius_global',
'retransmit',
state: '',
count: val)
end
end
|
#timeout ⇒ Object
45
46
47
|
# File 'lib/cisco_node_utils/radius_global.rb', line 45
def timeout
config_get('radius_global', 'timeout')
end
|
#timeout=(val) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/cisco_node_utils/radius_global.rb', line 53
def timeout=(val)
unless val.nil?
fail ArgumentError, 'timeout must be an Integer' \
unless val.is_a?(Integer)
end
if val.nil?
config_set('radius_global',
'timeout',
state: 'no',
timeout: timeout)
else
config_set('radius_global',
'timeout',
state: '',
timeout: val)
end
end
|