Class: Cisco::TacacsGlobal
Overview
TacacsGlobal - node utility class for
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 TacacsGlobal.
31
32
33
34
35
36
37
38
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 31
def initialize(name)
fail TypeError unless name.is_a?(String)
fail ArgumentError,
"This provider only accepts an id of 'default'" \
unless name.eql?('default')
Feature.tacacs_enable unless Feature.tacacs_enabled?
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
29
30
31
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 29
def name
@name
end
|
Class Method Details
.default_key ⇒ Object
Get default encryption password
88
89
90
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 88
def self.default_key
config_get_default('tacacs_global', 'key')
end
|
.tacacs_global ⇒ Object
40
41
42
43
44
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 40
def self.tacacs_global
hash = {}
hash['default'] = TacacsGlobal.new('default')
hash
end
|
Instance Method Details
#==(other) ⇒ Object
46
47
48
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 46
def ==(other)
name == other.name
end
|
#default_timeout ⇒ Object
54
55
56
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 54
def default_timeout
config_get_default('tacacs_global', 'timeout')
end
|
#encryption_key_set(key_format, key) ⇒ Object
92
93
94
95
96
97
98
99
100
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 92
def encryption_key_set(key_format, key)
if key_format == TACACS_GLOBAL_ENC_UNKNOWN
config_set('tacacs_server', 'encryption', state: 'no',
option: key_format, key: key)
else
config_set('tacacs_server', 'encryption', state: '', option: key_format,
key: key)
end
end
|
#key ⇒ Object
82
83
84
85
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 82
def key
match = config_get('tacacs_global', 'key')
match.empty? ? TacacsGlobal.default_key : match[1]
end
|
77
78
79
80
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 77
def key_format
match = config_get('tacacs_global', 'key_format')
match.nil? ? TACACS_GLOBAL_ENC_UNKNOWN : match[0].to_i
end
|
#timeout ⇒ Object
50
51
52
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 50
def timeout
config_get('tacacs_global', 'timeout')
end
|
#timeout=(val) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/cisco_node_utils/tacacs_global.rb', line 58
def timeout=(val)
unless val.nil?
fail ArgumentError, 'timeout must be an Integer' \
unless val.is_a?(Integer)
end
if val.nil?
config_set('tacacs_global',
'timeout',
state: 'no',
timeout: timeout)
else
config_set('tacacs_global',
'timeout',
state: '',
timeout: val)
end
end
|