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/aaa.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 Aaa class manages Authorization, Authentication and Accounting (AAA)
|
42
42
|
# on an EOS node.
|
43
43
|
class Aaa < Entity
|
44
44
|
##
|
45
|
-
# get returns a hash of all Aaa resources
|
45
|
+
# get returns a hash of all Aaa resources.
|
46
46
|
#
|
47
47
|
# @example
|
48
48
|
# {
|
@@ -105,12 +105,12 @@ module Rbeapi
|
|
105
105
|
# servers: <array>
|
106
106
|
# }
|
107
107
|
#
|
108
|
-
# @param [String]
|
109
|
-
# current running configuration.
|
108
|
+
# @param name [String] The server group name to return from the nodes
|
109
|
+
# current running configuration. If the name is not configured a nil
|
110
110
|
# object is returned.
|
111
111
|
#
|
112
|
-
# @return [nil, Hash<Symbol, Object>]
|
113
|
-
# specified name.
|
112
|
+
# @return [nil, Hash<Symbol, Object>] Returns the resource hash for the
|
113
|
+
# specified name. If the name does not exist, a nil object is returned.
|
114
114
|
def get(name)
|
115
115
|
block = get_block("aaa group server ([^\s]+) #{name}")
|
116
116
|
return nil unless block
|
@@ -121,22 +121,22 @@ module Rbeapi
|
|
121
121
|
end
|
122
122
|
|
123
123
|
##
|
124
|
-
# getall returns a aaa server groups hash
|
124
|
+
# getall returns a aaa server groups hash.
|
125
125
|
#
|
126
126
|
# @example
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
127
|
+
# {
|
128
|
+
# <name>: {
|
129
|
+
# type: <string>,
|
130
|
+
# servers: <array>
|
131
|
+
# },
|
132
|
+
# <name>: {
|
133
|
+
# type: <string>,
|
134
|
+
# servers: <array>
|
135
|
+
# }
|
135
136
|
# }
|
136
|
-
# }
|
137
137
|
#
|
138
|
-
# @return [Hash<Symbol, Object>]
|
139
|
-
# configured aaa groups.
|
138
|
+
# @return [Hash<Symbol, Object>] Returns the resource hashes for
|
139
|
+
# configured aaa groups. If none exist, a nil object is returned.
|
140
140
|
def getall
|
141
141
|
cfg = config.scan(/aaa group server (?:radius|tacacs\+) (.+)$/)
|
142
142
|
cfg.each_with_object({}) do |name, hsh|
|
@@ -147,15 +147,15 @@ module Rbeapi
|
|
147
147
|
|
148
148
|
##
|
149
149
|
# parse_type scans the specified configuration block and returns the
|
150
|
-
# server group type as either 'tacacs' or 'radius'.
|
150
|
+
# server group type as either 'tacacs' or 'radius'. The type value is
|
151
151
|
# expected to always be present in the config.
|
152
152
|
#
|
153
153
|
# @api private
|
154
154
|
#
|
155
|
-
# @param [String]
|
156
|
-
# group name to parse
|
155
|
+
# @param config [String] The aaa server group block configuration for the
|
156
|
+
# group name to parse.
|
157
157
|
#
|
158
|
-
# @return [Hash<Symbol, Object>]
|
158
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
159
159
|
def parse_type(config)
|
160
160
|
value = config.scan(/aaa group server ([^\s]+)/).first
|
161
161
|
{ type: value.first }
|
@@ -164,7 +164,7 @@ module Rbeapi
|
|
164
164
|
|
165
165
|
##
|
166
166
|
# parse_servers scans the specified configuraiton block and returns the
|
167
|
-
# list of servers configured for the group.
|
167
|
+
# list of servers configured for the group. If there are no servers
|
168
168
|
# configured for the group the servers value will return an empty array.
|
169
169
|
#
|
170
170
|
# @api private
|
@@ -172,13 +172,13 @@ module Rbeapi
|
|
172
172
|
# @see parse_radius_server
|
173
173
|
# @see parse_tacacs_server
|
174
174
|
#
|
175
|
-
# @param [String]
|
176
|
-
# group name to parse
|
175
|
+
# @param config [String] The aaa server group block configuration for the
|
176
|
+
# group name to parse.
|
177
177
|
#
|
178
|
-
# @param [String]
|
178
|
+
# @param type [String] The aaa server block type. Valid values are
|
179
179
|
# either radius or tacacs+.
|
180
180
|
#
|
181
|
-
# @return [Hash<Symbol, Object>]
|
181
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute
|
182
182
|
def parse_servers(config, type)
|
183
183
|
case type
|
184
184
|
when 'radius' then parse_radius_server(config)
|
@@ -189,13 +189,13 @@ module Rbeapi
|
|
189
189
|
|
190
190
|
##
|
191
191
|
# parse_radius_server scans the provide configuration block and returns
|
192
|
-
# the list of servers configured.
|
193
|
-
# be a radius configuration block.
|
192
|
+
# the list of servers configured. The configuration block is expected to
|
193
|
+
# be a radius configuration block. If there are no servers configured
|
194
194
|
# for the group the servers value will return an empty array.
|
195
195
|
#
|
196
196
|
# @api private
|
197
197
|
#
|
198
|
-
# @param [String]
|
198
|
+
# @param config [String] The aaa server group block configuration for the
|
199
199
|
# group name to parse
|
200
200
|
#
|
201
201
|
# @return [Hash<Symbol, Object>] resource hash attribute
|
@@ -213,16 +213,16 @@ module Rbeapi
|
|
213
213
|
|
214
214
|
##
|
215
215
|
# parse_tacacs_server scans the provided configuration block and returns
|
216
|
-
# the list of configured servers.
|
217
|
-
# be a tacacs configuration block.
|
216
|
+
# the list of configured servers. The configuration block is expected to
|
217
|
+
# be a tacacs configuration block. If there are no servers configured
|
218
218
|
# for the group the servers value will return an empty array.
|
219
219
|
#
|
220
220
|
# @api private
|
221
221
|
#
|
222
|
-
# @param [String]
|
223
|
-
# group name to parse
|
222
|
+
# @param config [String] The aaa server group block configuration for the
|
223
|
+
# group name to parse.
|
224
224
|
#
|
225
|
-
# @return [Hash<Symbol, Object>]
|
225
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
226
226
|
def parse_tacacs_server(config)
|
227
227
|
values = config.scan(TACACS_GROUP_SERVER).map do |(name, vrf, port)|
|
228
228
|
{
|
@@ -237,17 +237,17 @@ module Rbeapi
|
|
237
237
|
|
238
238
|
##
|
239
239
|
# find_type is a utility method to find the type of aaa server group for
|
240
|
-
# the specified name.
|
240
|
+
# the specified name. This method will scan the current running
|
241
241
|
# configuration on the node and return the server group type as either
|
242
|
-
# 'radius' or 'tacacs+'.
|
242
|
+
# 'radius' or 'tacacs+'. If the server group is not configured, then nil
|
243
243
|
# will be returned.
|
244
244
|
#
|
245
245
|
# @api private
|
246
246
|
#
|
247
|
-
# @param [String]
|
248
|
-
# and return the type value for
|
247
|
+
# @param name [String] The aaa server group name to find in the config
|
248
|
+
# and return the type value for.
|
249
249
|
#
|
250
|
-
# @return [nil, String]
|
250
|
+
# @return [nil, String] Returns either the type name as 'radius' or
|
251
251
|
# 'tacacs+' or nil if the server group is not configured.
|
252
252
|
def find_type(name)
|
253
253
|
mdata = /aaa group server ([^\s]+) #{name}/.match(config)
|
@@ -258,19 +258,19 @@ module Rbeapi
|
|
258
258
|
##
|
259
259
|
# create adds a new aaa group server to the nodes current configuration.
|
260
260
|
# If the specified name and type are already created then this method
|
261
|
-
# will return successfully.
|
261
|
+
# will return successfully. If the name is configured but the type is
|
262
262
|
# different, this method will not return successfully (returns false).
|
263
263
|
#
|
264
|
-
# @eos_version 4.13.7M
|
264
|
+
# @since eos_version 4.13.7M
|
265
265
|
#
|
266
|
-
#
|
266
|
+
# ===Commands
|
267
267
|
# aaa group server <type> <name>
|
268
268
|
#
|
269
|
-
# @param [String]
|
269
|
+
# @param name [String] The name of the aaa group server to create in the
|
270
270
|
# nodes running configuration
|
271
271
|
#
|
272
|
-
# @param [String]
|
273
|
-
# nodes running configuration.
|
272
|
+
# @param type [String] The type of aaa group server to create in the
|
273
|
+
# nodes running configuration. Valid values include 'radius' or
|
274
274
|
# 'tacacs+'
|
275
275
|
#
|
276
276
|
# @return [Boolean] returns true if the commands complete successfully
|
@@ -280,19 +280,19 @@ module Rbeapi
|
|
280
280
|
|
281
281
|
##
|
282
282
|
# delete removes a current aaa server group from the nodes current
|
283
|
-
# configuration.
|
284
|
-
# group type based on the name.
|
283
|
+
# configuration. This method will automatically determine the server
|
284
|
+
# group type based on the name. If the name is not configured in the
|
285
285
|
# nodes current configuration, this method will return successfully.
|
286
286
|
#
|
287
|
-
# @eos_version 4.13.7M
|
287
|
+
# @since eos_version 4.13.7M
|
288
288
|
#
|
289
|
-
#
|
289
|
+
# ===Commands
|
290
290
|
# no aaa group server [radius | tacacs+] <name>
|
291
291
|
#
|
292
|
-
# @param [String]
|
293
|
-
# nodes running configuration
|
292
|
+
# @param name [String] The name of the aaa group server to create in the
|
293
|
+
# nodes running configuration.
|
294
294
|
#
|
295
|
-
# @return [Boolean]
|
295
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
296
296
|
def delete(name)
|
297
297
|
type = find_type(name)
|
298
298
|
return true unless type
|
@@ -301,22 +301,20 @@ module Rbeapi
|
|
301
301
|
|
302
302
|
##
|
303
303
|
# set_servers configures the set of servers for a specified aaa server
|
304
|
-
# group.
|
305
|
-
# servers and then adds the new servers back.
|
304
|
+
# group. This is an atomic operation that first removes all current
|
305
|
+
# servers and then adds the new servers back. If any of the servers
|
306
306
|
# failes to be removed or added, this method will return unsuccessfully.
|
307
307
|
#
|
308
308
|
# @see remove_server
|
309
309
|
# @see add_server
|
310
310
|
#
|
311
|
-
# @param [String]
|
311
|
+
# @param name [String] The name of the aaa group server to add the new
|
312
312
|
# server configuration to.
|
313
313
|
#
|
314
|
-
# @param [String]
|
314
|
+
# @param servers [String] The IP address or host name of the server to
|
315
315
|
# add to the configuration
|
316
316
|
#
|
317
|
-
# @
|
318
|
-
#
|
319
|
-
# @return [Boolean] returns true if the commands complete successfully
|
317
|
+
# @return [Boolean] Returns true if the commands complete successfully
|
320
318
|
def set_servers(name, servers)
|
321
319
|
current = get(name)
|
322
320
|
current[:servers].each do |srv|
|
@@ -330,22 +328,22 @@ module Rbeapi
|
|
330
328
|
end
|
331
329
|
|
332
330
|
##
|
333
|
-
# add_server adds a new server to the specified aaa server group.
|
331
|
+
# add_server adds a new server to the specified aaa server group. If
|
334
332
|
# the server is already configured in the list of servers, this method
|
335
333
|
# will still return successfully.
|
336
334
|
#
|
337
335
|
# @see add_radius_server
|
338
336
|
# @see add_tacacs_server
|
339
337
|
#
|
340
|
-
# @param [String]
|
338
|
+
# @param name [String] The name of the aaa group server to add the new
|
341
339
|
# server configuration to.
|
342
340
|
#
|
343
|
-
# @param [String]
|
344
|
-
# add to the configuration
|
341
|
+
# @param server [String] The IP address or host name of the server to
|
342
|
+
# add to the configuration.
|
345
343
|
#
|
346
|
-
# @param [Hash]
|
344
|
+
# @param opts [Hash] Optional configuration parameters.
|
347
345
|
#
|
348
|
-
# @return [Boolean]
|
346
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
349
347
|
def add_server(name, server, opts = {})
|
350
348
|
type = find_type(name)
|
351
349
|
return false unless type
|
@@ -359,24 +357,24 @@ module Rbeapi
|
|
359
357
|
##
|
360
358
|
# add_radius_server adds a new radius server to the nodes current
|
361
359
|
# configuration. If the server already exists in the specified group
|
362
|
-
# name this method will still return successfully
|
360
|
+
# name this method will still return successfully.
|
363
361
|
#
|
364
|
-
# @eos_version 4.13.7M
|
362
|
+
# @since eos_version 4.13.7M
|
365
363
|
#
|
366
|
-
#
|
364
|
+
# commmands
|
367
365
|
# aaa group server radius <name>
|
368
366
|
# server <server> [acct-port <acct_port>] [auth-port <auth_port>]
|
369
367
|
# [vrf <vrf>]
|
370
368
|
#
|
371
|
-
# @param [String]
|
369
|
+
# @param name [String] The name of the aaa group server to add the new
|
372
370
|
# server configuration to.
|
373
371
|
#
|
374
|
-
# @param [String]
|
375
|
-
# add to the configuration
|
372
|
+
# @param server [String] The IP address or host name of the server to
|
373
|
+
# add to the configuration.
|
376
374
|
#
|
377
|
-
# @param [Hash]
|
375
|
+
# @param opts [Hash] Optional configuration parameters.
|
378
376
|
#
|
379
|
-
# @return [Boolean]
|
377
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
380
378
|
def add_radius_server(name, server, opts = {})
|
381
379
|
# order of command options matter here!
|
382
380
|
server = "server #{server} "
|
@@ -388,25 +386,25 @@ module Rbeapi
|
|
388
386
|
|
389
387
|
##
|
390
388
|
# add_tacacs_server adds a new tacacs server to the nodes current
|
391
|
-
# configuration.
|
392
|
-
# name this method will still return successfully
|
389
|
+
# configuration. If the server already exists in the specified group
|
390
|
+
# name this method will still return successfully.
|
393
391
|
#
|
394
|
-
# @eos_version 4.13.7M
|
392
|
+
# @since eos_version 4.13.7M
|
395
393
|
#
|
396
|
-
#
|
394
|
+
# commmands
|
397
395
|
# aaa group server tacacs+ <name>
|
398
396
|
# server <server> [acct-port <acct_port>] [auth-port <auth_port>]
|
399
397
|
# [vrf <vrf>]
|
400
398
|
#
|
401
|
-
# @param [String]
|
399
|
+
# @param name [String] The name of the aaa group server to add the new
|
402
400
|
# server configuration to.
|
403
401
|
#
|
404
|
-
# @param [String]
|
405
|
-
# add to the configuration
|
402
|
+
# @param server [String] The IP address or host name of the server to
|
403
|
+
# add to the configuration.
|
406
404
|
#
|
407
|
-
# @param [Hash]
|
405
|
+
# @param opts [Hash] Optional configuration parameters.
|
408
406
|
#
|
409
|
-
# @return [Boolean]
|
407
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
410
408
|
def add_tacacs_server(name, server, opts = {})
|
411
409
|
# order of command options matter here!
|
412
410
|
server = "server #{server} "
|
@@ -417,20 +415,22 @@ module Rbeapi
|
|
417
415
|
|
418
416
|
##
|
419
417
|
# remove_server deletes an existing server from the specified aaa server
|
420
|
-
# group.
|
418
|
+
# group. If the specified server is not configured in the specified
|
421
419
|
# server group, this method will still return true.
|
422
420
|
#
|
423
|
-
#
|
421
|
+
# eos_version 4.13.7M
|
424
422
|
#
|
425
|
-
#
|
423
|
+
# ===Commands
|
426
424
|
# aaa group server [radius | tacacs+] <name>
|
427
425
|
# no server <server>
|
428
426
|
#
|
429
|
-
# @param [String]
|
427
|
+
# @param name [String] The name of the aaa group server to remove.
|
430
428
|
#
|
431
|
-
# @param [String]
|
429
|
+
# @param server [String] The IP address or host name of the server.
|
432
430
|
#
|
433
|
-
# @
|
431
|
+
# @param opts [Hash] Optional configuration parameters.
|
432
|
+
#
|
433
|
+
# @return [Boolean] returns true if the commands complete successfully.
|
434
434
|
def remove_server(name, server, opts = {})
|
435
435
|
type = find_type(name)
|
436
436
|
return false unless type
|
data/lib/rbeapi/api/acl.rb
CHANGED
@@ -33,10 +33,10 @@ require 'netaddr'
|
|
33
33
|
require 'rbeapi/api'
|
34
34
|
|
35
35
|
##
|
36
|
-
# Rbeapi toplevel namespace
|
36
|
+
# Rbeapi toplevel namespace.
|
37
37
|
module Rbeapi
|
38
38
|
##
|
39
|
-
# Api is module namespace for working with the EOS command API
|
39
|
+
# Api is module namespace for working with the EOS command API.
|
40
40
|
module Api
|
41
41
|
##
|
42
42
|
# The Acl class manages the set of standard ACLs.
|
@@ -75,7 +75,7 @@ module Rbeapi
|
|
75
75
|
# ...
|
76
76
|
# }
|
77
77
|
#
|
78
|
-
# @param [String]
|
78
|
+
# @param name [String] The ACL name.
|
79
79
|
#
|
80
80
|
# @return [nil, Hash<Symbol, Object>] Returns the ACL resource as a
|
81
81
|
# Hash. Returns nil if name does not exist.
|
@@ -144,11 +144,11 @@ module Rbeapi
|
|
144
144
|
|
145
145
|
##
|
146
146
|
# mask_to_prefixlen converts a subnet mask from dotted decimal to
|
147
|
-
# bit length
|
147
|
+
# bit length.
|
148
148
|
#
|
149
|
-
# @param [String]
|
149
|
+
# @param mask [String] The dotted decimal subnet mask to convert.
|
150
150
|
#
|
151
|
-
# @return [String] The subnet mask as a valid prefix length
|
151
|
+
# @return [String] The subnet mask as a valid prefix length.
|
152
152
|
def mask_to_prefixlen(mask)
|
153
153
|
mask = '255.255.255.255' unless mask
|
154
154
|
NetAddr::CIDR.create('0.0.0.0/' + mask).netmask_ext
|
@@ -160,9 +160,9 @@ module Rbeapi
|
|
160
160
|
#
|
161
161
|
# @api private
|
162
162
|
#
|
163
|
-
# @param [String]
|
163
|
+
# @param config [String] The switch config.
|
164
164
|
#
|
165
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
165
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
166
166
|
|
167
167
|
def parse_entries(config)
|
168
168
|
entries = {}
|
@@ -187,38 +187,38 @@ module Rbeapi
|
|
187
187
|
|
188
188
|
##
|
189
189
|
# create will create a new ACL resource in the nodes current
|
190
|
-
# configuration with the specified name.
|
190
|
+
# configuration with the specified name. If the create method
|
191
191
|
# is called and the ACL already exists, this method will still
|
192
192
|
# return true. The ACL will not have any entries. Use add_entry
|
193
193
|
# to add entries to the ACL.
|
194
194
|
#
|
195
|
-
# @eos_version 4.13.7M
|
195
|
+
# @since eos_version 4.13.7M
|
196
196
|
#
|
197
|
-
#
|
197
|
+
# ===Commands
|
198
198
|
# ip access-list standard <name>
|
199
199
|
#
|
200
|
-
# @param [String]
|
200
|
+
# @param name [String] The ACL name to create on the node. Must
|
201
201
|
# begin with an alphabetic character. Cannot contain spaces or
|
202
202
|
# quotation marks.
|
203
203
|
#
|
204
|
-
# @return [Boolean]
|
204
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
205
205
|
def create(name)
|
206
206
|
configure("ip access-list standard #{name}")
|
207
207
|
end
|
208
208
|
|
209
209
|
##
|
210
210
|
# delete will delete an existing ACL resource from the nodes current
|
211
|
-
# running configuration.
|
211
|
+
# running configuration. If the delete method is called and the ACL
|
212
212
|
# does not exist, this method will succeed.
|
213
213
|
#
|
214
|
-
# @eos_version 4.13.7M
|
214
|
+
# @since eos_version 4.13.7M
|
215
215
|
#
|
216
|
-
#
|
216
|
+
# ===Commands
|
217
217
|
# no ip access-list standard <name>
|
218
218
|
#
|
219
|
-
# @param [String]
|
219
|
+
# @param name [String] The ACL name to delete on the node.
|
220
220
|
#
|
221
|
-
# @return [Boolean]
|
221
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
222
222
|
def delete(name)
|
223
223
|
configure("no ip access-list standard #{name}")
|
224
224
|
end
|
@@ -228,15 +228,15 @@ module Rbeapi
|
|
228
228
|
# command has the same effect as deleting the ACL from the nodes
|
229
229
|
# running configuration.
|
230
230
|
#
|
231
|
-
# @eos_version 4.13.7M
|
231
|
+
# @since eos_version 4.13.7M
|
232
232
|
#
|
233
|
-
#
|
233
|
+
# ===Commands
|
234
234
|
# default no ip access-list standard <name>
|
235
235
|
#
|
236
|
-
# @param [String]
|
236
|
+
# @param name [String] The ACL name to set to the default value
|
237
237
|
# on the node.
|
238
238
|
#
|
239
|
-
# @return [Boolean]
|
239
|
+
# @return [Boolean] Returns true if the command complete successfully
|
240
240
|
def default(name)
|
241
241
|
configure("default ip access-list standard #{name}")
|
242
242
|
end
|
@@ -246,17 +246,22 @@ module Rbeapi
|
|
246
246
|
#
|
247
247
|
# @api private
|
248
248
|
#
|
249
|
-
# @param [Hash]
|
250
|
-
#
|
249
|
+
# @param entry [Hash] the options for the entry.
|
250
|
+
#
|
251
|
+
# @option entry seqno [String] The sequence number of the entry in
|
251
252
|
# the ACL to add. Default is nil, will be assigned.
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
256
|
-
# @option
|
253
|
+
#
|
254
|
+
# @option entry action [String] The action triggered by the ACL. Valid
|
255
|
+
# values are 'permit', 'deny', or 'remark'.
|
256
|
+
#
|
257
|
+
# @option entry addr [String] The IP address to permit or deny.
|
258
|
+
#
|
259
|
+
# @option entry prefixlen [String] The prefixlen for the IP address.
|
260
|
+
#
|
261
|
+
# @option entry log [Boolean] Triggers an informational log message
|
257
262
|
# to the console about the matching packet.
|
258
263
|
#
|
259
|
-
# @return [String]
|
264
|
+
# @return [String] Returns commands to create an entry.
|
260
265
|
def build_entry(entry)
|
261
266
|
cmds = "#{entry[:seqno]} " if entry[:seqno]
|
262
267
|
cmds << "#{entry[:action]} #{entry[:srcaddr]}/#{entry[:srcprefixlen]}"
|
@@ -269,20 +274,26 @@ module Rbeapi
|
|
269
274
|
# update_entry will update an entry, identified by the seqno
|
270
275
|
# in the ACL specified by name, with the passed in parameters.
|
271
276
|
#
|
272
|
-
# @eos_version 4.13.7M
|
277
|
+
# @since eos_version 4.13.7M
|
273
278
|
#
|
274
|
-
# @param [String]
|
275
|
-
#
|
276
|
-
# @
|
279
|
+
# @param name [String] The ACL name to update on the node.
|
280
|
+
#
|
281
|
+
# @param entry [Hash] the options for the entry.
|
282
|
+
#
|
283
|
+
# @option entry seqno [String] The sequence number of the entry in
|
277
284
|
# the ACL to update.
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
# @option
|
285
|
+
#
|
286
|
+
# @option entry action [String] The action triggered by the ACL. Valid
|
287
|
+
# values are 'permit', 'deny', or 'remark'.
|
288
|
+
#
|
289
|
+
# @option entry addr [String] The IP address to permit or deny.
|
290
|
+
#
|
291
|
+
# @option entry prefixlen [String] The prefixlen for the IP address.
|
292
|
+
#
|
293
|
+
# @option entry log [Boolean] Triggers an informational log message
|
283
294
|
# to the console about the matching packet.
|
284
295
|
#
|
285
|
-
# @return [Boolean]
|
296
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
286
297
|
def update_entry(name, entry)
|
287
298
|
cmds = ["ip access-list standard #{name}"]
|
288
299
|
cmds << "no #{entry[:seqno]}"
|
@@ -295,18 +306,23 @@ module Rbeapi
|
|
295
306
|
# add_entry will add an entry to the specified ACL with the
|
296
307
|
# passed in parameters.
|
297
308
|
#
|
298
|
-
# @eos_version 4.13.7M
|
309
|
+
# @since eos_version 4.13.7M
|
310
|
+
#
|
311
|
+
# @param name [String] The ACL name to add an entry to on the node.
|
312
|
+
#
|
313
|
+
# @param entry [Hash] the options for the entry.
|
299
314
|
#
|
300
|
-
# @
|
301
|
-
#
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
# @option
|
306
|
-
#
|
315
|
+
# @option entry action [String] The action triggered by the ACL. Valid
|
316
|
+
# values are 'permit', 'deny', or 'remark'.
|
317
|
+
#
|
318
|
+
# @option entry addr [String] The IP address to permit or deny.
|
319
|
+
#
|
320
|
+
# @option entry prefixlen [String] The prefixlen for the IP address.
|
321
|
+
#
|
322
|
+
# @option entry log [Boolean] Triggers an informational log message
|
307
323
|
# to the console about the matching packet.
|
308
324
|
#
|
309
|
-
# @return [Boolean]
|
325
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
310
326
|
def add_entry(name, entry)
|
311
327
|
cmds = ["ip access-list standard #{name}"]
|
312
328
|
cmds << build_entry(entry)
|
@@ -318,13 +334,14 @@ module Rbeapi
|
|
318
334
|
# remove_entry will remove the entry specified by the seqno for
|
319
335
|
# the ACL specified by name.
|
320
336
|
#
|
321
|
-
# @eos_version 4.13.7M
|
337
|
+
# @since eos_version 4.13.7M
|
338
|
+
#
|
339
|
+
# @param name [String] The ACL name to update on the node.
|
322
340
|
#
|
323
|
-
# @param [String]
|
324
|
-
# @param [String] :seqno The sequence number of the entry in
|
341
|
+
# @param seqno [String] The sequence number of the entry in
|
325
342
|
# the ACL to remove.
|
326
343
|
#
|
327
|
-
# @return [Boolean]
|
344
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
328
345
|
def remove_entry(name, seqno)
|
329
346
|
cmds = ["ip access-list standard #{name}", "no #{seqno}", 'exit']
|
330
347
|
configure(cmds)
|