rbeapi 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -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 Staticroutes class provides a configuration instance for working
|
@@ -43,7 +43,7 @@ module Rbeapi
|
|
43
43
|
#
|
44
44
|
class Staticroutes < 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
|
# {
|
@@ -59,9 +59,9 @@ module Rbeapi
|
|
59
59
|
# ]
|
60
60
|
# }
|
61
61
|
#
|
62
|
-
# @
|
62
|
+
# @return [Array<Hash, Hash>] The method will return all of the
|
63
63
|
# configured static routes on the node as a Ruby array object
|
64
|
-
# containing a list of hashes with each hash describing a route.
|
64
|
+
# containing a list of hashes with each hash describing a route. If
|
65
65
|
# there are no static routes configured, this method will return
|
66
66
|
# an empty array.
|
67
67
|
def getall
|
@@ -88,22 +88,28 @@ module Rbeapi
|
|
88
88
|
##
|
89
89
|
# Creates a static route in EOS. May add or overwrite an existing route.
|
90
90
|
#
|
91
|
-
#
|
91
|
+
# ===Commands
|
92
92
|
# ip route <destination> <nexthop> [router_ip] [distance] [tag <tag>]
|
93
93
|
# [name <name>]
|
94
94
|
#
|
95
|
-
# @param [String]
|
95
|
+
# @param destination [String] The destination and prefix matching the
|
96
96
|
# route(s). Ex '192.168.0.2/24'.
|
97
|
-
#
|
97
|
+
#
|
98
|
+
# @param nexthop [String] The nexthop for this entry, which may an IP
|
98
99
|
# address or interface name.
|
99
|
-
# @param [Hash] :opts Additional options for the route entry.
|
100
|
-
# @option :opts [String] :router_ip If nexthop is an egress interface,
|
101
|
-
# router_ip specifies the router to which traffic will be forwarded
|
102
|
-
# @option :opts [String] :distance The administrative distance (metric)
|
103
|
-
# @option :opts [String] :tag The route tag
|
104
|
-
# @option :opts [String] :name A route name
|
105
100
|
#
|
106
|
-
# @
|
101
|
+
# @param opts [Hash] Additional options for the route entry.
|
102
|
+
#
|
103
|
+
# @option opts router_ip [String] If nexthop is an egress interface,
|
104
|
+
# router_ip specifies the router to which traffic will be forwarded.
|
105
|
+
#
|
106
|
+
# @option opts distance [String] The administrative distance (metric).
|
107
|
+
#
|
108
|
+
# @option opts tag [String] The route tag.
|
109
|
+
#
|
110
|
+
# @option opts name [String] A route name.
|
111
|
+
#
|
112
|
+
# @return [Boolean] Returns True on success, otherwise False.
|
107
113
|
def create(destination, nexthop, opts = {})
|
108
114
|
cmd = "ip route #{destination} #{nexthop}"
|
109
115
|
cmd << " #{opts[:router_ip]}" if opts[:router_ip]
|
@@ -114,18 +120,19 @@ module Rbeapi
|
|
114
120
|
end
|
115
121
|
|
116
122
|
##
|
117
|
-
# Removes a given route from EOS.
|
123
|
+
# Removes a given route from EOS. May remove multiple routes if nexthop
|
118
124
|
# is not specified.
|
119
125
|
#
|
120
|
-
#
|
126
|
+
# ===Commands
|
121
127
|
# no ip route <destination> [nexthop]
|
122
128
|
#
|
123
|
-
# @param [String]
|
129
|
+
# @param destination [String] The destination and prefix matching the
|
124
130
|
# route(s). Ex '192.168.0.2/24'.
|
125
|
-
#
|
131
|
+
#
|
132
|
+
# @param nexthop [String] The nexthop for this entry, which may an IP
|
126
133
|
# address or interface name.
|
127
134
|
#
|
128
|
-
# @return [Boolean]
|
135
|
+
# @return [Boolean] Returns True on success, otherwise False.
|
129
136
|
def delete(destination, nexthop = nil)
|
130
137
|
cmd = "no ip route #{destination}"
|
131
138
|
cmd << " #{nexthop}" if nexthop
|
data/lib/rbeapi/api/stp.rb
CHANGED
@@ -31,14 +31,14 @@
|
|
31
31
|
#
|
32
32
|
|
33
33
|
##
|
34
|
-
# Rbeapi toplevel namespace
|
34
|
+
# Rbeapi toplevel namespace.
|
35
35
|
module Rbeapi
|
36
36
|
##
|
37
|
-
# Api is module namespace for working with the EOS command API
|
37
|
+
# Api is module namespace for working with the EOS command API.
|
38
38
|
module Api
|
39
39
|
##
|
40
40
|
# The Stp class provides a base class instance for working with
|
41
|
-
# the EOS spanning-tree configuration
|
41
|
+
# the EOS spanning-tree configuration.
|
42
42
|
#
|
43
43
|
class Stp < Entity
|
44
44
|
##
|
@@ -62,7 +62,7 @@ module Rbeapi
|
|
62
62
|
# }
|
63
63
|
# }
|
64
64
|
#
|
65
|
-
# @return [Hash] returns a Hash of attributes derived from eAPI
|
65
|
+
# @return [Hash] returns a Hash of attributes derived from eAPI.
|
66
66
|
def get
|
67
67
|
response = {}
|
68
68
|
response.merge!(parse_mode)
|
@@ -73,13 +73,13 @@ module Rbeapi
|
|
73
73
|
|
74
74
|
##
|
75
75
|
# parse_mode scans the nodes running configuration and extracts the
|
76
|
-
# value of the spanning-tree mode.
|
77
|
-
# expected to be always be available in the running config.
|
78
|
-
# value is intended to be merged into the stp resource hash
|
76
|
+
# value of the spanning-tree mode. The spanning tree mode is
|
77
|
+
# expected to be always be available in the running config. The return
|
78
|
+
# value is intended to be merged into the stp resource hash.
|
79
79
|
#
|
80
80
|
# @api private
|
81
81
|
#
|
82
|
-
# @return [Hash<Symbol, Object>]
|
82
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
83
83
|
def parse_mode
|
84
84
|
mdata = /(?<=spanning-tree\smode\s)(\w+)$/.match(config)
|
85
85
|
{ mode: mdata[1] }
|
@@ -89,7 +89,7 @@ module Rbeapi
|
|
89
89
|
# instances returns a memoized instance of StpInstances for configuring
|
90
90
|
# individual stp instances.
|
91
91
|
#
|
92
|
-
# @return [StpInstances] an instance of StpInstances class
|
92
|
+
# @return [StpInstances] an instance of StpInstances class.
|
93
93
|
def instances
|
94
94
|
return @instances if @instances
|
95
95
|
@instances = StpInstances.new(node)
|
@@ -98,9 +98,9 @@ module Rbeapi
|
|
98
98
|
|
99
99
|
##
|
100
100
|
# interfaces returns a memoized instance of StpInterfaces for
|
101
|
-
# configuring individual stp interfaces
|
101
|
+
# configuring individual stp interfaces.
|
102
102
|
#
|
103
|
-
# @return [StpInterfaces] an instance of StpInterfaces class
|
103
|
+
# @return [StpInterfaces] an instance of StpInterfaces class.
|
104
104
|
def interfaces
|
105
105
|
return @interfaces if @interfaces
|
106
106
|
@interfaces = StpInterfaces.new(node)
|
@@ -113,27 +113,27 @@ module Rbeapi
|
|
113
113
|
# mode is configured with the no keyword argument. If the default option
|
114
114
|
# is specified then the mode is configured with the default keyword
|
115
115
|
# argument. The default keyword argument takes precedence over the enable
|
116
|
-
# option if both are provided
|
116
|
+
# option if both are provided.
|
117
117
|
#
|
118
|
-
# @eos_version 4.13.7M
|
118
|
+
# @since eos_version 4.13.7M
|
119
119
|
#
|
120
|
-
#
|
120
|
+
# ===Commands
|
121
121
|
# spanning-tree mode <value>
|
122
122
|
# no spanning-tree mode
|
123
123
|
# default spanning-tree mode
|
124
124
|
#
|
125
|
-
# @param [Hash]
|
125
|
+
# @param opts [Hash] Optional keyword arguments.
|
126
126
|
#
|
127
|
-
# @option
|
128
|
-
# in the nodes current running configuration
|
127
|
+
# @option opts value [String] The value to configure the stp mode to
|
128
|
+
# in the nodes current running configuration.
|
129
129
|
#
|
130
|
-
# @option
|
130
|
+
# @option opts enable [Boolean] If false then the command is
|
131
131
|
# negated. Default is true.
|
132
132
|
#
|
133
|
-
# @option
|
134
|
-
# the default keyword
|
133
|
+
# @option opts default [Boolean] Configure the stp mode value using
|
134
|
+
# the default keyword.
|
135
135
|
#
|
136
|
-
# @return [Boolean] returns true if the command completed successfully
|
136
|
+
# @return [Boolean] returns true if the command completed successfully.
|
137
137
|
#
|
138
138
|
def set_mode(opts = {})
|
139
139
|
cmd = command_builder('spanning-tree mode', opts)
|
@@ -157,11 +157,11 @@ module Rbeapi
|
|
157
157
|
# priority: <string>
|
158
158
|
# }
|
159
159
|
#
|
160
|
-
# @param [String]
|
160
|
+
# @param inst [String] The named stp instance to return.
|
161
161
|
#
|
162
|
-
# @return [nil, Hash<Symbol, Object]
|
163
|
-
# a resource hash.
|
164
|
-
# will return a nil object
|
162
|
+
# @return [nil, Hash<Symbol, Object] Returns the stp instance config as
|
163
|
+
# a resource hash. If the instances is not configured this method
|
164
|
+
# will return a nil object.
|
165
165
|
def get(inst)
|
166
166
|
return nil unless parse_instances.include?(inst.to_s)
|
167
167
|
response = {}
|
@@ -171,8 +171,8 @@ module Rbeapi
|
|
171
171
|
|
172
172
|
##
|
173
173
|
# getall returns all configured stp instances parsed from the nodes
|
174
|
-
# running configuration.
|
175
|
-
# identifier value
|
174
|
+
# running configuration. The return hash is keyed by the instance
|
175
|
+
# identifier value.
|
176
176
|
#
|
177
177
|
# @example
|
178
178
|
# {
|
@@ -185,8 +185,8 @@ module Rbeapi
|
|
185
185
|
# ...
|
186
186
|
# }
|
187
187
|
#
|
188
|
-
# @return [Hash<Symbol, Object>]
|
189
|
-
# found in the nodes running configuration
|
188
|
+
# @return [Hash<Symbol, Object>] Returns all configured stp instances
|
189
|
+
# found in the nodes running configuration.
|
190
190
|
def getall
|
191
191
|
parse_instances.each_with_object({}) do |inst, hsh|
|
192
192
|
values = get(inst)
|
@@ -196,12 +196,12 @@ module Rbeapi
|
|
196
196
|
|
197
197
|
##
|
198
198
|
# parse_instances will scan the nodes current configuration and extract
|
199
|
-
# the list of configured mst instances.
|
200
|
-
# then this method will return an empty array
|
199
|
+
# the list of configured mst instances. If no instances are configured
|
200
|
+
# then this method will return an empty array.
|
201
201
|
#
|
202
202
|
# @api private
|
203
203
|
#
|
204
|
-
# @return [Array<String>]
|
204
|
+
# @return [Array<String>] Returns an Array of configured stp instances.
|
205
205
|
def parse_instances
|
206
206
|
config = get_block('spanning-tree mst configuration')
|
207
207
|
config.scan(/(?<=^\s{3}instance\s)\d+/)
|
@@ -210,14 +210,14 @@ module Rbeapi
|
|
210
210
|
|
211
211
|
##
|
212
212
|
# parse_priority will scan the nodes current configuration and extract
|
213
|
-
# the stp priority value for the given stp instance.
|
213
|
+
# the stp priority value for the given stp instance. If the stp
|
214
214
|
# instance priority is not configured, the priority value will be set
|
215
|
-
# using DEFAULT_STP_PRIORITY.
|
216
|
-
# into the resource hash
|
215
|
+
# using DEFAULT_STP_PRIORITY. The returned hash is intended to be merged
|
216
|
+
# into the resource hash.
|
217
217
|
#
|
218
218
|
# @api private
|
219
219
|
#
|
220
|
-
# @return [Hash<Symbol, Object>]
|
220
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
221
221
|
def parse_priority(inst)
|
222
222
|
priority_re = /(?<=^spanning-tree\smst\s#{inst}\spriority\s)(.+$)/x
|
223
223
|
mdata = priority_re.match(config)
|
@@ -226,27 +226,31 @@ module Rbeapi
|
|
226
226
|
private :parse_priority
|
227
227
|
|
228
228
|
##
|
229
|
-
# Deletes a configured MST instance
|
229
|
+
# Deletes a configured MST instance.
|
230
230
|
#
|
231
|
-
# @param [String]
|
231
|
+
# @param inst [String] The MST instance to delete.
|
232
232
|
#
|
233
|
-
# @return [Boolean] True if the commands succeed otherwise False
|
233
|
+
# @return [Boolean] True if the commands succeed otherwise False.
|
234
234
|
def delete(inst)
|
235
235
|
configure ['spanning-tree mst configuration', "no instance #{inst}",
|
236
236
|
'exit']
|
237
237
|
end
|
238
238
|
|
239
239
|
##
|
240
|
-
# Configures the spanning-tree MST priority
|
240
|
+
# Configures the spanning-tree MST priority.
|
241
241
|
#
|
242
|
-
# @param [String]
|
243
|
-
#
|
244
|
-
# @
|
245
|
-
#
|
242
|
+
# @param inst [String] The MST instance to configure.
|
243
|
+
#
|
244
|
+
# @param opts [Hash] The configuration parameters for the priority.
|
245
|
+
#
|
246
|
+
# @option opts value [string] The value to set the priority to.
|
247
|
+
#
|
248
|
+
# @option opts enable [Boolean] If false then the command is
|
246
249
|
# negated. Default is true.
|
247
|
-
# @option opts [Boolean] :default The value should be set to default
|
248
250
|
#
|
249
|
-
# @
|
251
|
+
# @option opts default [Boolean] The value should be set to default.
|
252
|
+
#
|
253
|
+
# @return [Boolean] True if the commands succeed otherwise False.
|
250
254
|
def set_priority(inst, opts = {})
|
251
255
|
value = opts[:value]
|
252
256
|
enable = opts.fetch(:enable, true)
|
@@ -268,13 +272,13 @@ module Rbeapi
|
|
268
272
|
|
269
273
|
##
|
270
274
|
# The StpInterfaces class provides a class instance for working with
|
271
|
-
# spanning-tree interfaces in EOS
|
275
|
+
# spanning-tree interfaces in EOS.
|
272
276
|
#
|
273
277
|
class StpInterfaces < Entity
|
274
278
|
##
|
275
279
|
# get returns the configured stp interfaces from the nodes running
|
276
|
-
# configuration as a resource hash.
|
277
|
-
# configured as a switchport then this method will return nil
|
280
|
+
# configuration as a resource hash. If the specified interface is not
|
281
|
+
# configured as a switchport then this method will return nil.
|
278
282
|
#
|
279
283
|
# @example
|
280
284
|
# {
|
@@ -283,11 +287,11 @@ module Rbeapi
|
|
283
287
|
# bpduguard: <boolean>
|
284
288
|
# }
|
285
289
|
#
|
286
|
-
# @param [String]
|
287
|
-
# the nodes configuration
|
290
|
+
# @param name [String] The interface name to return a resource for from
|
291
|
+
# the nodes configuration.
|
288
292
|
#
|
289
|
-
# @return [nil, Hash<Symbol, Object>]
|
290
|
-
# resource hash
|
293
|
+
# @return [nil, Hash<Symbol, Object>] Returns the stp interface as a
|
294
|
+
# resource hash.
|
291
295
|
def get(name)
|
292
296
|
config = get_block("interface #{name}")
|
293
297
|
return nil unless config
|
@@ -301,8 +305,8 @@ module Rbeapi
|
|
301
305
|
|
302
306
|
##
|
303
307
|
# getall returns all of the configured stp interfaces parsed from the
|
304
|
-
# nodes current running configuration.
|
305
|
-
# interface name
|
308
|
+
# nodes current running configuration. The returned hash is keyed by the
|
309
|
+
# interface name.
|
306
310
|
#
|
307
311
|
# @example
|
308
312
|
# {
|
@@ -319,8 +323,8 @@ module Rbeapi
|
|
319
323
|
# ...
|
320
324
|
# }
|
321
325
|
#
|
322
|
-
# @return [Hash<Symbol, Object>]
|
323
|
-
# resource hash from the nodes running configuration
|
326
|
+
# @return [Hash<Symbol, Object>] Returns the stp interfaces config as a
|
327
|
+
# resource hash from the nodes running configuration.
|
324
328
|
def getall
|
325
329
|
interfaces = config.scan(/(?<=^interface\s)[Et|Po].+/)
|
326
330
|
resp = interfaces.each_with_object({}) do |name, hsh|
|
@@ -332,12 +336,12 @@ module Rbeapi
|
|
332
336
|
|
333
337
|
##
|
334
338
|
# parse_portfast scans the supplied interface configuration block and
|
335
|
-
# parses the value stp portfast.
|
336
|
-
# (true) or disabled (false)
|
339
|
+
# parses the value stp portfast. The value of portfast is either enabled
|
340
|
+
# (true) or disabled (false).
|
337
341
|
#
|
338
342
|
# @api private
|
339
343
|
#
|
340
|
-
# @return [Hash<Symbol, Object>]
|
344
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
341
345
|
def parse_portfast(config)
|
342
346
|
val = /no spanning-tree portfast/ =~ config
|
343
347
|
{ portfast: val.nil? }
|
@@ -346,12 +350,12 @@ module Rbeapi
|
|
346
350
|
|
347
351
|
##
|
348
352
|
# parse_portfast_type scans the supplied interface configuration block
|
349
|
-
# and parses the value stp portfast type.
|
353
|
+
# and parses the value stp portfast type. The value of portfast type
|
350
354
|
# is either not set which implies normal (default), edge, or network.
|
351
355
|
#
|
352
356
|
# @api private
|
353
357
|
#
|
354
|
-
# @return [Hash<Symbol, Object>]
|
358
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
355
359
|
def parse_portfast_type(config)
|
356
360
|
if /spanning-tree portfast network/ =~ config
|
357
361
|
value = 'network'
|
@@ -366,12 +370,12 @@ module Rbeapi
|
|
366
370
|
|
367
371
|
##
|
368
372
|
# parse_bpduguard scans the supplied interface configuration block and
|
369
|
-
# parses the value of stp bpduguard.
|
370
|
-
# disabled (false) or enabled (true)
|
373
|
+
# parses the value of stp bpduguard. The value of bpduguard is either
|
374
|
+
# disabled (false) or enabled (true).
|
371
375
|
#
|
372
376
|
# @api private
|
373
377
|
#
|
374
|
-
# @return [Hash<Symbol, Object>]
|
378
|
+
# @return [Hash<Symbol, Object>] Resource hash attribute.
|
375
379
|
def parse_bpduguard(config)
|
376
380
|
val = /spanning-tree bpduguard enable/ =~ config
|
377
381
|
{ bpduguard: !val.nil? }
|
@@ -379,16 +383,20 @@ module Rbeapi
|
|
379
383
|
private :parse_bpduguard
|
380
384
|
|
381
385
|
##
|
382
|
-
# Configures the interface portfast value
|
386
|
+
# Configures the interface portfast value.
|
383
387
|
#
|
384
|
-
# @param [String]
|
385
|
-
#
|
386
|
-
# @
|
387
|
-
#
|
388
|
+
# @param name [String] The name of the interface to configure.
|
389
|
+
#
|
390
|
+
# @param opts [Hash] The configuration parameters for portfast.
|
391
|
+
#
|
392
|
+
# @option opts value [Boolean] The value to set portfast.
|
393
|
+
#
|
394
|
+
# @option opts enable [Boolean] If false then the command is
|
388
395
|
# negated. Default is true.
|
389
|
-
# @option opts [Boolean] :default The value should be set to default
|
390
396
|
#
|
391
|
-
# @
|
397
|
+
# @option opts default [Boolean] The value should be set to default.
|
398
|
+
#
|
399
|
+
# @return [Boolean] True if the commands succeed otherwise False.
|
392
400
|
def set_portfast(name, opts = {})
|
393
401
|
cmd = command_builder('spanning-tree portfast', opts)
|
394
402
|
configure_interface(name, cmd)
|
@@ -397,15 +405,19 @@ module Rbeapi
|
|
397
405
|
##
|
398
406
|
# Configures the interface portfast type value
|
399
407
|
#
|
400
|
-
# @param [String]
|
401
|
-
#
|
402
|
-
# @
|
408
|
+
# @param name [String] The name of the interface to configure.
|
409
|
+
#
|
410
|
+
# @param opts [Hash] The configuration parameters for portfast type.
|
411
|
+
#
|
412
|
+
# @option opts value [String] The value to set portfast type to.
|
403
413
|
# The value must be set for calls to this method.
|
404
|
-
#
|
414
|
+
#
|
415
|
+
# @option opts enable [Boolean] If false then the command is
|
405
416
|
# negated. Default is true.
|
406
|
-
# @option opts [Boolean] :default The value should be set to default
|
407
417
|
#
|
408
|
-
# @
|
418
|
+
# @option opts default [Boolean] The value should be set to default.
|
419
|
+
#
|
420
|
+
# @return [Boolean] True if the commands succeed otherwise False.
|
409
421
|
def set_portfast_type(name, opts = {})
|
410
422
|
value = opts[:value]
|
411
423
|
fail ArgumentError, 'value must be set' unless value
|
@@ -428,14 +440,18 @@ module Rbeapi
|
|
428
440
|
##
|
429
441
|
# Configures the interface bpdu guard value
|
430
442
|
#
|
431
|
-
# @param [String]
|
432
|
-
#
|
433
|
-
# @
|
434
|
-
#
|
443
|
+
# @param name [String] The name of the interface to configure.
|
444
|
+
#
|
445
|
+
# @param opts [Hash] The configuration parameters for bpduguard.
|
446
|
+
#
|
447
|
+
# @option opts value [Boolean] The value to set bpduguard.
|
448
|
+
#
|
449
|
+
# @option opts enable [Boolean] If false then the bpduguard is
|
435
450
|
# disabled. If true then the bpduguard is enabled. Default is true.
|
436
|
-
# @option opts [Boolean] :default The value should be set to default
|
437
451
|
#
|
438
|
-
# @
|
452
|
+
# @option opts default [Boolean] The value should be set to default.
|
453
|
+
#
|
454
|
+
# @return [Boolean] True if the commands succeed otherwise False.
|
439
455
|
def set_bpduguard(name, opts = {})
|
440
456
|
enable = opts.fetch(:enable, true)
|
441
457
|
default = opts[:default] || false
|