rbeapi 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +17 -12
- data/guide/.gitignore +2 -0
- data/guide/api.rst +5894 -0
- data/guide/conf.py +5 -5
- data/guide/contributing.rst +6 -0
- data/guide/getting-started.rst +134 -0
- data/guide/index.rst +3 -5
- data/guide/installation.rst +56 -1
- data/guide/license.rst +13 -2
- data/guide/overview.rst +2 -5
- data/guide/testing.rst +5 -1
- data/guide/upgrading.rst +10 -0
- data/lib/rbeapi/api.rb +37 -36
- data/lib/rbeapi/api/aaa.rb +90 -90
- data/lib/rbeapi/api/acl.rb +70 -53
- data/lib/rbeapi/api/bgp.rb +186 -163
- data/lib/rbeapi/api/dns.rb +51 -45
- data/lib/rbeapi/api/interfaces.rb +344 -328
- data/lib/rbeapi/api/ipinterfaces.rb +92 -92
- data/lib/rbeapi/api/logging.rb +32 -32
- data/lib/rbeapi/api/mlag.rb +97 -97
- data/lib/rbeapi/api/ntp.rb +39 -39
- data/lib/rbeapi/api/ospf.rb +58 -58
- data/lib/rbeapi/api/prefixlists.rb +22 -22
- data/lib/rbeapi/api/radius.rb +77 -49
- data/lib/rbeapi/api/routemaps.rb +110 -64
- data/lib/rbeapi/api/snmp.rb +104 -100
- data/lib/rbeapi/api/staticroutes.rb +27 -20
- data/lib/rbeapi/api/stp.rb +100 -84
- data/lib/rbeapi/api/switchports.rb +98 -77
- data/lib/rbeapi/api/system.rb +93 -25
- data/lib/rbeapi/api/tacacs.rb +54 -35
- data/lib/rbeapi/api/users.rb +68 -68
- data/lib/rbeapi/api/varp.rb +56 -47
- data/lib/rbeapi/api/vlans.rb +86 -86
- data/lib/rbeapi/api/vrrp.rb +210 -173
- data/lib/rbeapi/client.rb +142 -108
- data/lib/rbeapi/eapilib.rb +73 -62
- data/lib/rbeapi/utils.rb +8 -8
- data/lib/rbeapi/version.rb +2 -2
- data/spec/fixtures/test.conf +3 -3
- data/spec/system/rbeapi/api/system_spec.rb +46 -2
- data/spec/system/rbeapi/api/vlans_spec.rb +5 -2
- data/spec/system/rbeapi/client_spec.rb +4 -4
- data/spec/unit/rbeapi/api/system/default_spec.rb +40 -4
- data/spec/unit/rbeapi/api/system/fixture_system.text +14 -0
- data/spec/unit/rbeapi/api/vlans/default_spec.rb +1 -1
- data/spec/unit/rbeapi/api/vlans/fixture_vlans.text +2 -0
- data/spec/unit/rbeapi/client_spec.rb +1 -0
- metadata +9 -9
- data/guide/cookbook.rst +0 -4
- data/guide/developing.rst +0 -4
- data/guide/faq.rst +0 -4
- data/guide/quickstart.rst +0 -4
- data/guide/troubleshooting.rst +0 -1
data/lib/rbeapi/api/ospf.rb
CHANGED
@@ -32,17 +32,17 @@
|
|
32
32
|
require 'rbeapi/api'
|
33
33
|
|
34
34
|
##
|
35
|
-
# Rbeapi toplevel namespace
|
35
|
+
# Rbeapi toplevel namespace.
|
36
36
|
module Rbeapi
|
37
37
|
##
|
38
|
-
# Api is module namespace for working with the EOS command API
|
38
|
+
# Api is module namespace for working with the EOS command API.
|
39
39
|
module Api
|
40
40
|
##
|
41
41
|
# The Ospf class is a global class that provides an instance for working
|
42
|
-
# with the node's OSPF configuration
|
42
|
+
# with the node's OSPF configuration.
|
43
43
|
class Ospf < Entity
|
44
44
|
##
|
45
|
-
# Returns the global OSPF configuration from the node
|
45
|
+
# Returns the global OSPF configuration from the node.
|
46
46
|
#
|
47
47
|
# rubocop:disable Metrics/MethodLength
|
48
48
|
#
|
@@ -55,9 +55,9 @@ module Rbeapi
|
|
55
55
|
# redistribute: {}
|
56
56
|
# }
|
57
57
|
#
|
58
|
-
# @param [String]
|
58
|
+
# @param inst [String] The ospf instance name.
|
59
59
|
#
|
60
|
-
# @return [Hash]
|
60
|
+
# @return [Hash] A Ruby hash object that provides the OSPF settings as
|
61
61
|
# key / value pairs.
|
62
62
|
def get(inst)
|
63
63
|
config = get_block("router ospf #{inst}")
|
@@ -88,19 +88,19 @@ module Rbeapi
|
|
88
88
|
end
|
89
89
|
|
90
90
|
##
|
91
|
-
# Returns the OSPF configuration from the node as a Ruby hash
|
91
|
+
# Returns the OSPF configuration from the node as a Ruby hash.
|
92
92
|
#
|
93
93
|
# @example
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
94
|
+
# {
|
95
|
+
# <pid>: {
|
96
|
+
# router_id: <string>,
|
97
|
+
# areas: {},
|
98
|
+
# redistribute: {}
|
99
|
+
# },
|
100
|
+
# interfaces: {}
|
101
|
+
# }
|
102
102
|
#
|
103
|
-
# @return [Hash]
|
103
|
+
# @return [Hash] A Ruby hash object that provides the OSPF settings as
|
104
104
|
# key / value pairs.
|
105
105
|
def getall
|
106
106
|
instances = config.scan(/(?<=^router\sospf\s)\d+$/)
|
@@ -118,38 +118,38 @@ module Rbeapi
|
|
118
118
|
end
|
119
119
|
|
120
120
|
##
|
121
|
-
# create will create a router ospf with the specified pid
|
121
|
+
# create will create a router ospf with the specified pid.
|
122
122
|
#
|
123
|
-
# @param [String]
|
123
|
+
# @param pid [String] The router ospf to create.
|
124
124
|
#
|
125
|
-
# @return [Boolean]
|
125
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
126
126
|
def create(pid)
|
127
127
|
configure "router ospf #{pid}"
|
128
128
|
end
|
129
129
|
|
130
130
|
##
|
131
|
-
# delete will remove the specified router ospf
|
131
|
+
# delete will remove the specified router ospf.
|
132
132
|
#
|
133
|
-
# @param [String]
|
133
|
+
# @param pid [String] The router ospf to remove.
|
134
134
|
#
|
135
|
-
# @return [Boolean]
|
135
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
136
136
|
def delete(pid)
|
137
137
|
configure "no router ospf #{pid}"
|
138
138
|
end
|
139
139
|
|
140
140
|
##
|
141
|
-
# set_router_id sets router ospf router-id with pid and options
|
141
|
+
# set_router_id sets router ospf router-id with pid and options.
|
142
142
|
#
|
143
|
-
# @param [String]
|
143
|
+
# @param pid [String] The router ospf name.
|
144
144
|
#
|
145
|
-
# @param [hash]
|
145
|
+
# @param opts [hash] Optional keyword arguments.
|
146
146
|
#
|
147
|
-
# @option
|
147
|
+
# @option opts enable [Boolean] If false then the command is
|
148
148
|
# negated. Default is true.
|
149
149
|
#
|
150
|
-
# @option
|
150
|
+
# @option opts default [Boolean] Configure the router-id to default.
|
151
151
|
#
|
152
|
-
# @return [Boolean]
|
152
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
153
153
|
def set_router_id(pid, opts = {})
|
154
154
|
cmd = command_builder('router-id', opts)
|
155
155
|
cmds = ["router ospf #{pid}", cmd]
|
@@ -159,13 +159,13 @@ module Rbeapi
|
|
159
159
|
##
|
160
160
|
# add_network adds network settings for router ospf and network area.
|
161
161
|
#
|
162
|
-
# @param [String]
|
162
|
+
# @param pid [String] The pid for router ospf.
|
163
163
|
#
|
164
|
-
# @param [String]
|
164
|
+
# @param net [String] The network name.
|
165
165
|
#
|
166
|
-
# @param [String]
|
166
|
+
# @param area [String] The network area name.
|
167
167
|
#
|
168
|
-
# @return [Boolean]
|
168
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
169
169
|
def add_network(pid, net, area)
|
170
170
|
configure ["router ospf #{pid}", "network #{net} area #{area}"]
|
171
171
|
end
|
@@ -174,34 +174,34 @@ module Rbeapi
|
|
174
174
|
# remove_network removes network settings for router ospf and network
|
175
175
|
# area.
|
176
176
|
#
|
177
|
-
# @param [String]
|
177
|
+
# @param pid [String] The pid for router ospf.
|
178
178
|
#
|
179
|
-
# @param [String]
|
179
|
+
# @param net [String] The network name.
|
180
180
|
#
|
181
|
-
# @param [String]
|
181
|
+
# @param area [String] The network area name.
|
182
182
|
#
|
183
|
-
# @return [Boolean]
|
183
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
184
184
|
def remove_network(pid, net, area)
|
185
185
|
configure ["router ospf #{pid}", "no network #{net} area #{area}"]
|
186
186
|
end
|
187
187
|
|
188
188
|
##
|
189
|
-
# set_redistribute sets router ospf router-id with pid and options
|
189
|
+
# set_redistribute sets router ospf router-id with pid and options.
|
190
190
|
#
|
191
|
-
# @param [String]
|
191
|
+
# @param pid [String] The router ospf name.
|
192
192
|
#
|
193
|
-
# @param [String]
|
193
|
+
# @param proto [String] The redistribute value.
|
194
194
|
#
|
195
|
-
# @param [hash]
|
195
|
+
# @param opts [hash] Optional keyword arguments.
|
196
196
|
#
|
197
|
-
# @option
|
197
|
+
# @option opts routemap [String] The route-map value.
|
198
198
|
#
|
199
|
-
# @option
|
199
|
+
# @option opts enable [Boolean] If false then the command is
|
200
200
|
# negated. Default is true.
|
201
201
|
#
|
202
|
-
# @option
|
202
|
+
# @option opts default [Boolean] Configure the router-id to default.
|
203
203
|
#
|
204
|
-
# @return [Boolean]
|
204
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
205
205
|
def set_redistribute(pid, proto, opts = {})
|
206
206
|
routemap = opts[:routemap]
|
207
207
|
cmds = ["router ospf #{pid}", "redistribute #{proto}"]
|
@@ -212,21 +212,21 @@ module Rbeapi
|
|
212
212
|
|
213
213
|
##
|
214
214
|
# The OspfInterfaces class is a global class that provides an instance
|
215
|
-
# for working with the node's OSPF interface configuration
|
215
|
+
# for working with the node's OSPF interface configuration.
|
216
216
|
class OspfInterfaces < Entity
|
217
217
|
##
|
218
|
-
# Returns a single MLAG interface configuration
|
218
|
+
# Returns a single MLAG interface configuration.
|
219
219
|
#
|
220
220
|
# Example
|
221
221
|
# {
|
222
222
|
# network_type: <string>
|
223
223
|
# }
|
224
224
|
#
|
225
|
-
# @param [String]
|
226
|
-
# values for.
|
225
|
+
# @param name [String] The interface name to return the configuration
|
226
|
+
# values for. This must be the full interface identifier.
|
227
227
|
#
|
228
228
|
# @return [nil, Hash<String, String>] A Ruby hash that represents the
|
229
|
-
# MLAG interface configuration.
|
229
|
+
# MLAG interface configuration. A nil object is returned if the
|
230
230
|
# specified interface is not configured
|
231
231
|
def get(name)
|
232
232
|
config = get_block("interface #{name}")
|
@@ -241,7 +241,7 @@ module Rbeapi
|
|
241
241
|
|
242
242
|
##
|
243
243
|
# Returns the collection of MLAG interfaces as a hash index by the
|
244
|
-
# interface name
|
244
|
+
# interface name.
|
245
245
|
#
|
246
246
|
# Example
|
247
247
|
# {
|
@@ -255,7 +255,7 @@ module Rbeapi
|
|
255
255
|
# }
|
256
256
|
#
|
257
257
|
# @return [nil, Hash<String, String>] A Ruby hash that represents the
|
258
|
-
# MLAG interface configuration.
|
258
|
+
# MLAG interface configuration. A nil object is returned if no
|
259
259
|
# interfaces are configured.
|
260
260
|
def getall
|
261
261
|
interfaces = config.scan(/(?<=interface\s)[Et|Po|Lo|Vl].+/)
|
@@ -266,21 +266,21 @@ module Rbeapi
|
|
266
266
|
end
|
267
267
|
|
268
268
|
##
|
269
|
-
# set_network_type sets network type with options
|
269
|
+
# set_network_type sets network type with options.
|
270
270
|
#
|
271
|
-
# @param [String]
|
271
|
+
# @param name [String] The name of the interface.
|
272
272
|
#
|
273
|
-
# @param [hash]
|
273
|
+
# @param opts [hash] Optional keyword arguments.
|
274
274
|
#
|
275
|
-
# @option
|
275
|
+
# @option opts value [String] The point-to-point value.
|
276
276
|
#
|
277
|
-
# @option
|
277
|
+
# @option opts enable [Boolean] If false then the command is
|
278
278
|
# negated. Default is true.
|
279
279
|
#
|
280
|
-
# @option
|
280
|
+
# @option opts default [Boolean] Configure the ip ospf network
|
281
281
|
# to default.
|
282
282
|
#
|
283
|
-
# @return [Boolean]
|
283
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
284
284
|
def set_network_type(name, opts = {})
|
285
285
|
value = opts[:value]
|
286
286
|
return false unless [nil, 'point-to-point'].include?(value)
|
@@ -32,10 +32,10 @@
|
|
32
32
|
require 'rbeapi/api'
|
33
33
|
|
34
34
|
##
|
35
|
-
# Rbeapi toplevel namespace
|
35
|
+
# Rbeapi toplevel namespace.
|
36
36
|
module Rbeapi
|
37
37
|
##
|
38
|
-
# Api is module namespace for working with the EOS command API
|
38
|
+
# Api is module namespace for working with the EOS command API.
|
39
39
|
module Api
|
40
40
|
##
|
41
41
|
# The Prefixlists class provides a configuration instance for working
|
@@ -43,7 +43,7 @@ module Rbeapi
|
|
43
43
|
#
|
44
44
|
class Prefixlists < Entity
|
45
45
|
##
|
46
|
-
# Returns the static routes configured on the node
|
46
|
+
# Returns the static routes configured on the node.
|
47
47
|
#
|
48
48
|
# @example
|
49
49
|
# {
|
@@ -53,12 +53,12 @@ module Rbeapi
|
|
53
53
|
# }
|
54
54
|
# }
|
55
55
|
#
|
56
|
-
# @param [String]
|
56
|
+
# @param name [String] The name of the prefix-list to return.
|
57
57
|
#
|
58
|
-
# @
|
59
|
-
# configured static routes on the node as a Ruby hash object.
|
58
|
+
# @return [Hash<String, String> The method will return all of the
|
59
|
+
# configured static routes on the node as a Ruby hash object. If
|
60
60
|
# there are no static routes configured, this method will return
|
61
|
-
# an empty hash
|
61
|
+
# an empty hash.
|
62
62
|
def get(name)
|
63
63
|
config = get_block("ip prefix-list #{name}")
|
64
64
|
return nil unless config
|
@@ -71,7 +71,7 @@ module Rbeapi
|
|
71
71
|
end
|
72
72
|
|
73
73
|
##
|
74
|
-
# Returns the static routes configured on the node
|
74
|
+
# Returns the static routes configured on the node.
|
75
75
|
#
|
76
76
|
# @example
|
77
77
|
# {
|
@@ -81,10 +81,10 @@ module Rbeapi
|
|
81
81
|
# }
|
82
82
|
# }
|
83
83
|
#
|
84
|
-
# @
|
85
|
-
# configured static routes on the node as a Ruby hash object.
|
84
|
+
# @return [Hash<String, String> The method will return all of the
|
85
|
+
# configured static routes on the node as a Ruby hash object. If
|
86
86
|
# there are no static routes configured, this method will return
|
87
|
-
# an empty hash
|
87
|
+
# an empty hash.
|
88
88
|
def getall
|
89
89
|
lists = config.scan(/(?<=^ip\sprefix-list\s).+/)
|
90
90
|
lists.each_with_object({}) do |name, hsh|
|
@@ -96,9 +96,9 @@ module Rbeapi
|
|
96
96
|
##
|
97
97
|
# create will create a new ip prefix-list with designated name.
|
98
98
|
#
|
99
|
-
# @param [String]
|
99
|
+
# @param name [String] The name of the ip prefix-list.
|
100
100
|
#
|
101
|
-
# @return [Boolean]
|
101
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
102
102
|
def create(name)
|
103
103
|
configure "ip prefix-list #{name}"
|
104
104
|
end
|
@@ -107,15 +107,15 @@ module Rbeapi
|
|
107
107
|
# add_rule will create an ip prefix-list with the designated name,
|
108
108
|
# seqno, action and prefix.
|
109
109
|
#
|
110
|
-
# @param [String]
|
110
|
+
# @param name [String] The name of the ip prefix-list.
|
111
111
|
#
|
112
|
-
# @param [String]
|
112
|
+
# @param seq [String] The seq value.
|
113
113
|
#
|
114
|
-
# @param [String]
|
114
|
+
# @param action [String] The action value.
|
115
115
|
#
|
116
|
-
# @param [String]
|
116
|
+
# @param prefix [String] The prefix value.
|
117
117
|
#
|
118
|
-
# @return [Boolean]
|
118
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
119
119
|
def add_rule(name, action, prefix, seq = nil)
|
120
120
|
cmd = "ip prefix-list #{name}"
|
121
121
|
cmd << " seq #{seq}" if seq
|
@@ -124,13 +124,13 @@ module Rbeapi
|
|
124
124
|
end
|
125
125
|
|
126
126
|
##
|
127
|
-
# delete will remove the designated prefix-list
|
127
|
+
# delete will remove the designated prefix-list.
|
128
128
|
#
|
129
|
-
# @param [String]
|
129
|
+
# @param name [String] The name of the ip prefix-list.
|
130
130
|
#
|
131
|
-
# @param [String]
|
131
|
+
# @param seq [String] The seq value.
|
132
132
|
#
|
133
|
-
# @return [Boolean]
|
133
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
134
134
|
def delete(name, seq = nil)
|
135
135
|
cmd = "no ip prefix-list #{name}"
|
136
136
|
cmd << " seq #{seq}" if seq
|
data/lib/rbeapi/api/radius.rb
CHANGED
@@ -32,10 +32,10 @@
|
|
32
32
|
require 'rbeapi/api'
|
33
33
|
|
34
34
|
##
|
35
|
-
# Rbeapi toplevel namespace
|
35
|
+
# Rbeapi toplevel namespace.
|
36
36
|
module Rbeapi
|
37
37
|
##
|
38
|
-
# Api is module namespace for working with the EOS command API
|
38
|
+
# Api is module namespace for working with the EOS command API.
|
39
39
|
module Api
|
40
40
|
##
|
41
41
|
# Radius provides instance methods to retrieve and set radius configuration
|
@@ -70,7 +70,7 @@ module Rbeapi
|
|
70
70
|
# servers: <array>
|
71
71
|
# }
|
72
72
|
#
|
73
|
-
# @return [Array<Hash>] Single element Array of resource hashes
|
73
|
+
# @return [Array<Hash>] Single element Array of resource hashes.
|
74
74
|
def get
|
75
75
|
global = {}
|
76
76
|
global.merge!(parse_global_timeout)
|
@@ -82,12 +82,12 @@ module Rbeapi
|
|
82
82
|
|
83
83
|
##
|
84
84
|
# parse_time scans the nodes current configuration and parse the
|
85
|
-
# radius-server timeout value.
|
86
|
-
# be present in the config
|
85
|
+
# radius-server timeout value. The timeout value is expected to always
|
86
|
+
# be present in the config.
|
87
87
|
#
|
88
88
|
# @api private
|
89
89
|
#
|
90
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
90
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
91
91
|
def parse_global_timeout
|
92
92
|
value = config.scan(/radius-server timeout (\d+)/).first
|
93
93
|
{ timeout: value.first.to_i }
|
@@ -96,12 +96,12 @@ module Rbeapi
|
|
96
96
|
|
97
97
|
##
|
98
98
|
# parse_retransmit scans the cnodes current configuration and parses the
|
99
|
-
# radius-server retransmit value.
|
100
|
-
# always be present in the config
|
99
|
+
# radius-server retransmit value. The retransmit value is expected to
|
100
|
+
# always be present in the config.
|
101
101
|
#
|
102
102
|
# @api private
|
103
103
|
#
|
104
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
104
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
105
105
|
def parse_global_retransmit
|
106
106
|
value = config.scan(/radius-server retransmit (\d+)/).first
|
107
107
|
{ retransmit: value.first.to_i }
|
@@ -110,13 +110,13 @@ module Rbeapi
|
|
110
110
|
|
111
111
|
##
|
112
112
|
# parse_key scans the current nodes running configuration and parse the
|
113
|
-
# global radius-server key and format value.
|
113
|
+
# global radius-server key and format value. If the key is not
|
114
114
|
# configured this method will return DEFAULT_KEY and DEFAULT_KEY_FORMAT
|
115
115
|
# for the resource hash values.
|
116
116
|
#
|
117
117
|
# @api private
|
118
118
|
#
|
119
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
119
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
120
120
|
def parse_global_key
|
121
121
|
rsrc_hsh = {}
|
122
122
|
(key_format, key) = config.scan(/radius-server key (\d+) (\w+)/).first
|
@@ -127,9 +127,9 @@ module Rbeapi
|
|
127
127
|
private :parse_global_key
|
128
128
|
|
129
129
|
##
|
130
|
-
# parse_servers returns an Array of radius server resource hashes.
|
130
|
+
# parse_servers returns an Array of radius server resource hashes. Each
|
131
131
|
# hash describes the current state of the radius server and is intended
|
132
|
-
# to be merged into the radius resource hash
|
132
|
+
# to be merged into the radius resource hash.
|
133
133
|
#
|
134
134
|
# The resource hash returned contains the following information:
|
135
135
|
# * hostname: hostname or ip address
|
@@ -145,7 +145,7 @@ module Rbeapi
|
|
145
145
|
#
|
146
146
|
# @api private
|
147
147
|
#
|
148
|
-
# @return [Array<Hash<Symbol,Object>>] Array of resource hashes
|
148
|
+
# @return [Array<Hash<Symbol,Object>>] Array of resource hashes.
|
149
149
|
def parse_servers
|
150
150
|
tuples = config.scan(SERVER_REGEXP)
|
151
151
|
tuples.map do |(host, vrf, authp, acctp, tout, tries, keyfm, key)|
|
@@ -164,33 +164,33 @@ module Rbeapi
|
|
164
164
|
private :parse_servers
|
165
165
|
|
166
166
|
##
|
167
|
-
# set_global_key configures the global radius-server key.
|
167
|
+
# set_global_key configures the global radius-server key. If the enable
|
168
168
|
# option is false, radius-server key is configured using the no
|
169
169
|
# keyword. If the default option is specified, radius-server key is
|
170
170
|
# configured using the default keyword. If both options are specified,
|
171
171
|
# the default keyword option takes precedence.
|
172
172
|
#
|
173
|
-
# @eos_version 4.13.7M
|
173
|
+
# @since eos_version 4.13.7M
|
174
174
|
#
|
175
|
-
#
|
175
|
+
# ===Commands
|
176
176
|
# radius-server key <format> <value>
|
177
177
|
# no radius-server key
|
178
178
|
# default radius-server key
|
179
179
|
#
|
180
|
-
# @option [String]
|
181
|
-
# in the nodes running configuration
|
180
|
+
# @option value [String] The value to configure the radius-server key to
|
181
|
+
# in the nodes running configuration.
|
182
182
|
#
|
183
|
-
# @option [Fixnum]
|
184
|
-
# nodes running configuration.
|
185
|
-
# (encrypted).
|
183
|
+
# @option key_format [Fixnum] The format of the key to be passed to the
|
184
|
+
# nodes running configuration. Valid values are 0 (clear text) or 7
|
185
|
+
# (encrypted). The default value is 0 if format is not provided.
|
186
186
|
#
|
187
|
-
# @option
|
187
|
+
# @option opts enable [Boolean] If false then the command is
|
188
188
|
# negated. Default is true.
|
189
189
|
#
|
190
|
-
# @option [Boolean]
|
191
|
-
# default keyword argument
|
190
|
+
# @option default [Boolean] Configures the radius-server key using the
|
191
|
+
# default keyword argument.
|
192
192
|
#
|
193
|
-
# @return [Boolean]
|
193
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
194
194
|
def set_global_key(opts = {})
|
195
195
|
value = opts[:value]
|
196
196
|
enable = opts.fetch(:enable, true)
|
@@ -211,30 +211,30 @@ module Rbeapi
|
|
211
211
|
end
|
212
212
|
|
213
213
|
##
|
214
|
-
# set_global_timeout configures the radius-server timeout value.
|
214
|
+
# set_global_timeout configures the radius-server timeout value. If the
|
215
215
|
# enable option is false, then radius-server timeout is configured
|
216
|
-
# using the no keyword.
|
217
|
-
# timeout is configured using the default keyword.
|
216
|
+
# using the no keyword. If the default option is specified, radius-server
|
217
|
+
# timeout is configured using the default keyword. If both options are
|
218
218
|
# specified then the default keyword takes precedence.
|
219
219
|
#
|
220
|
-
# @eos_version 4.13.7M
|
220
|
+
# @since eos_version 4.13.7M
|
221
221
|
#
|
222
|
-
#
|
222
|
+
# ===Commands
|
223
223
|
# radius-server timeout <value>
|
224
224
|
# no radius-server timeout
|
225
225
|
# default radius-server timeout
|
226
226
|
#
|
227
|
-
# @option [String, Fixnum]
|
228
|
-
# radius-server timeout value to.
|
229
|
-
# 1 to 1000
|
227
|
+
# @option value [String, Fixnum] The value to set the global
|
228
|
+
# radius-server timeout value to. This value should be in the range of
|
229
|
+
# 1 to 1000.
|
230
230
|
#
|
231
|
-
# @option
|
231
|
+
# @option opts enable [Boolean] If false then the command is
|
232
232
|
# negated. Default is true.
|
233
233
|
#
|
234
|
-
# @option [Boolean]
|
234
|
+
# @option default [Boolean] Configures the radius-server timeout value
|
235
235
|
# using the default keyword.
|
236
236
|
#
|
237
|
-
# @return [Boolean]
|
237
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
238
238
|
def set_global_timeout(opts = {})
|
239
239
|
cmd = command_builder('radius-server timeout', opts)
|
240
240
|
configure cmd
|
@@ -246,26 +246,26 @@ module Rbeapi
|
|
246
246
|
# value is configured using the no keyword. If the default option is
|
247
247
|
# specified, the radius-server retransmit value is configured using the
|
248
248
|
# default keyword. If both options are specified then the default keyword
|
249
|
-
# takes precedence
|
249
|
+
# takes precedence.
|
250
250
|
#
|
251
|
-
# @eos_version 4.13.7M
|
251
|
+
# @since eos_version 4.13.7M
|
252
252
|
#
|
253
|
-
#
|
253
|
+
# ===Commands
|
254
254
|
# radius-server retransmit <value>
|
255
255
|
# no radius-server retransmit
|
256
256
|
# default radius-server retransmit
|
257
257
|
#
|
258
|
-
# @option [String, Fixnum]
|
259
|
-
# radius-server retransmit value to.
|
258
|
+
# @option value [String, Fixnum] The value to set the global
|
259
|
+
# radius-server retransmit value to. This value should be in the range
|
260
260
|
# of 1 to 100
|
261
261
|
#
|
262
|
-
# @option
|
262
|
+
# @option opts enable [Boolean] If false then the command is
|
263
263
|
# negated. Default is true.
|
264
264
|
#
|
265
|
-
# @option [Boolean]
|
266
|
-
# value using the default keyword
|
265
|
+
# @option default [Boolean] Configures the radius-server retransmit
|
266
|
+
# value using the default keyword.
|
267
267
|
#
|
268
|
-
# @return [Boolean]
|
268
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
269
269
|
def set_global_retransmit(opts = {})
|
270
270
|
cmd = command_builder('radius-server retransmit', opts)
|
271
271
|
configure cmd
|
@@ -275,11 +275,29 @@ module Rbeapi
|
|
275
275
|
# update_server configures a radius server resource on the target device.
|
276
276
|
# This API method maps to the `radius server host` command, e.g.
|
277
277
|
# `radius-server host 10.11.12.13 auth-port 1024 acct-port 2048 timeout
|
278
|
-
# 30 retransmit 5 key 7 011204070A5955
|
278
|
+
# 30 retransmit 5 key 7 011204070A5955`.
|
279
279
|
#
|
280
280
|
# @api public
|
281
281
|
#
|
282
|
-
# @
|
282
|
+
# @param opts [Hash] The configuration options.
|
283
|
+
#
|
284
|
+
# @option opts key_format [Integer] The key format value.
|
285
|
+
#
|
286
|
+
# @option opts hostname [String] The host value.
|
287
|
+
#
|
288
|
+
# @option opts vrf [String] The vrf value.
|
289
|
+
#
|
290
|
+
# @option opts auth_port [String] The auth-port value.
|
291
|
+
#
|
292
|
+
# @option opts acct_port [String] The acct-port value.
|
293
|
+
#
|
294
|
+
# @option opts timeout [String] The timeout value.
|
295
|
+
#
|
296
|
+
# @option opts retransmit [String] The retransmit value.
|
297
|
+
#
|
298
|
+
# @option opts key [String] The key value.
|
299
|
+
#
|
300
|
+
# @return [Boolean] Returns true if there are no errors.
|
283
301
|
def update_server(opts = {})
|
284
302
|
# beware: order of cli keyword options counts
|
285
303
|
key_format = opts[:key_format] || 7
|
@@ -299,7 +317,17 @@ module Rbeapi
|
|
299
317
|
#
|
300
318
|
# @api public
|
301
319
|
#
|
302
|
-
# @
|
320
|
+
# @param opts [Hash] The configuration options.
|
321
|
+
#
|
322
|
+
# @option opts hostname [String] The host value.
|
323
|
+
#
|
324
|
+
# @option opts vrf [String] The vrf value.
|
325
|
+
#
|
326
|
+
# @option opts auth_port [String] The auth-port value.
|
327
|
+
#
|
328
|
+
# @option opts acct_port [String] The acct-port value.
|
329
|
+
#
|
330
|
+
# @return [Boolean] Returns true if there are no errors.
|
303
331
|
def remove_server(opts = {})
|
304
332
|
cmd = "no radius-server host #{opts[:hostname]}"
|
305
333
|
cmd << " vrf #{opts[:vrf]}" if opts[:vrf]
|