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
data/lib/rbeapi/api/varp.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 Varp class provides an instance for working with the global
|
42
|
-
# VARP configuration of the node
|
42
|
+
# VARP configuration of the node.
|
43
43
|
class Varp < Entity
|
44
44
|
##
|
45
|
-
# Returns the global VARP configuration from the node
|
45
|
+
# Returns the global VARP configuration from the node.
|
46
46
|
#
|
47
47
|
# @example
|
48
48
|
# {
|
@@ -58,7 +58,7 @@ module Rbeapi
|
|
58
58
|
# }
|
59
59
|
# }
|
60
60
|
#
|
61
|
-
# @return [Hash]
|
61
|
+
# @return [Hash] A Ruby hash object that provides the Varp settings as
|
62
62
|
# key / value pairs.
|
63
63
|
def get
|
64
64
|
response = {}
|
@@ -68,17 +68,17 @@ module Rbeapi
|
|
68
68
|
end
|
69
69
|
|
70
70
|
##
|
71
|
-
# parse_mac_address parses mac-address values from the provided config
|
71
|
+
# parse_mac_address parses mac-address values from the provided config.
|
72
72
|
#
|
73
73
|
# @api private
|
74
74
|
#
|
75
|
-
# @param [String]
|
76
|
-
# from the node's running configuration
|
75
|
+
# @param config [String] The configuration block returned
|
76
|
+
# from the node's running configuration.
|
77
77
|
#
|
78
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
78
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
79
79
|
def parse_mac_address(config)
|
80
80
|
# ip virtual-router mac-address value will always
|
81
|
-
# be stored in aa:bb:cc:dd:ee:ff format
|
81
|
+
# be stored in aa:bb:cc:dd:ee:ff format.
|
82
82
|
regex = /mac-address ((?:[a-f0-9]{2}:){5}[a-f0-9]{2})$/
|
83
83
|
mdata = regex.match(config)
|
84
84
|
{ mac_address: mdata.nil? ? '' : mdata[1] }
|
@@ -92,15 +92,18 @@ module Rbeapi
|
|
92
92
|
end
|
93
93
|
|
94
94
|
##
|
95
|
-
# Configure the VARP virtual-router mac-address value
|
95
|
+
# Configure the VARP virtual-router mac-address value.
|
96
96
|
#
|
97
|
-
# @param [Hash]
|
98
|
-
#
|
99
|
-
# @option opts [
|
97
|
+
# @param opts [Hash] The configuration parameters.
|
98
|
+
#
|
99
|
+
# @option opts value [string] The value to set the mac-address to.
|
100
|
+
#
|
101
|
+
# @option opts enable [Boolean] If false then the command is
|
100
102
|
# negated. Default is true.
|
101
|
-
# @option opts [Boolean] :default The value should be set to default
|
102
103
|
#
|
103
|
-
# @
|
104
|
+
# @option opts default [Boolean] The value should be set to default.
|
105
|
+
#
|
106
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
104
107
|
def set_mac_address(opts = {})
|
105
108
|
cmd = command_builder('ip virtual-router mac-address', opts)
|
106
109
|
configure(cmd)
|
@@ -109,21 +112,21 @@ module Rbeapi
|
|
109
112
|
|
110
113
|
##
|
111
114
|
# The VarpInterfaces class provides an instance for working with the global
|
112
|
-
# VARP interface configuration of the node
|
115
|
+
# VARP interface configuration of the node.
|
113
116
|
class VarpInterfaces < Entity
|
114
117
|
##
|
115
|
-
# Returns a single VARP interface configuration
|
118
|
+
# Returns a single VARP interface configuration.
|
116
119
|
#
|
117
120
|
# @example
|
118
121
|
# {
|
119
122
|
# "addresses": array<string>
|
120
123
|
# }
|
121
124
|
#
|
122
|
-
# @param [String]
|
123
|
-
# values for.
|
125
|
+
# @param name [String] The interface name to return the configuration
|
126
|
+
# values for. This must be the full interface identifier.
|
124
127
|
#
|
125
128
|
# @return [nil, Hash<String, String>] A Ruby hash that represents the
|
126
|
-
# VARP interface configuration.
|
129
|
+
# VARP interface configuration. A nil object is returned if the
|
127
130
|
# specified interface is not configured
|
128
131
|
def get(name)
|
129
132
|
config = get_block("^interface #{name}")
|
@@ -134,7 +137,7 @@ module Rbeapi
|
|
134
137
|
|
135
138
|
##
|
136
139
|
# Returns the collection of MLAG interfaces as a hash index by the
|
137
|
-
# interface name
|
140
|
+
# interface name.
|
138
141
|
#
|
139
142
|
# @example
|
140
143
|
# {
|
@@ -148,7 +151,7 @@ module Rbeapi
|
|
148
151
|
# }
|
149
152
|
#
|
150
153
|
# @return [nil, Hash<String, String>] A Ruby hash that represents the
|
151
|
-
# MLAG interface configuration.
|
154
|
+
# MLAG interface configuration. A nil object is returned if no
|
152
155
|
# interfaces are configured.
|
153
156
|
def getall
|
154
157
|
interfaces = config.scan(/(?<=^interface\s)(Vl.+)$/)
|
@@ -162,14 +165,14 @@ module Rbeapi
|
|
162
165
|
|
163
166
|
##
|
164
167
|
# parse_addresses parses ip virtual-router address from the provided
|
165
|
-
# config
|
168
|
+
# config.
|
166
169
|
#
|
167
170
|
# @api private
|
168
171
|
#
|
169
|
-
# @param [String]
|
170
|
-
# from the node's running configuration
|
172
|
+
# @param config [String] The configuration block returned
|
173
|
+
# from the node's running configuration.
|
171
174
|
#
|
172
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
175
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
173
176
|
def parse_addresses(config)
|
174
177
|
addrs = config.scan(/(?<=\s{3}ip\svirtual-router\saddress\s).+$/)
|
175
178
|
{ addresses: addrs }
|
@@ -181,17 +184,21 @@ module Rbeapi
|
|
181
184
|
# to the specified VLAN interface. All existing addresses are
|
182
185
|
# removed before the ones in value are added.
|
183
186
|
#
|
184
|
-
# @param [String]
|
185
|
-
# name argument must be the full interface name.
|
186
|
-
# are restricted to VLAN interfaces
|
187
|
-
#
|
188
|
-
# @
|
187
|
+
# @param name [String] The name of the interface. The
|
188
|
+
# name argument must be the full interface name. Valid interfaces
|
189
|
+
# are restricted to VLAN interfaces.
|
190
|
+
#
|
191
|
+
# @param opts [Hash] The configuration parameters.
|
192
|
+
#
|
193
|
+
# @option opts value [Array] Array of IPv4 addresses to add to
|
189
194
|
# the virtual router.
|
190
|
-
#
|
195
|
+
#
|
196
|
+
# @option opts enable [Boolean] If false then the command is
|
191
197
|
# negated. Default is true.
|
192
|
-
# @option opts [Boolean] :default The value should be set to default
|
193
198
|
#
|
194
|
-
# @
|
199
|
+
# @option opts default [Boolean] The value should be set to default.
|
200
|
+
#
|
201
|
+
# @return [Boolean] True if the commands succeeds otherwise False.
|
195
202
|
def set_addresses(name, opts = {})
|
196
203
|
value = opts[:value]
|
197
204
|
enable = opts.fetch(:enable, true)
|
@@ -215,27 +222,29 @@ module Rbeapi
|
|
215
222
|
end
|
216
223
|
|
217
224
|
##
|
218
|
-
# The add_address method assigns one virtual IPv4 address
|
225
|
+
# The add_address method assigns one virtual IPv4 address.
|
219
226
|
#
|
220
|
-
# @param [String]
|
221
|
-
# name argument must be the full interface name.
|
222
|
-
# are restricted to VLAN interfaces
|
223
|
-
# @param [string] :address The virtual router address to add
|
227
|
+
# @param name [String] The name of the interface. The
|
228
|
+
# name argument must be the full interface name. Valid interfaces
|
229
|
+
# are restricted to VLAN interfaces.
|
224
230
|
#
|
225
|
-
# @
|
231
|
+
# @param value [string] The virtual router address to add.
|
232
|
+
#
|
233
|
+
# @return [Boolean] True if the commands succeeds otherwise False.
|
226
234
|
def add_address(name, value)
|
227
235
|
configure(["interface #{name}", "ip virtual-router address #{value}"])
|
228
236
|
end
|
229
237
|
|
230
238
|
##
|
231
|
-
# The remove_address method removes one virtual IPv4 address
|
239
|
+
# The remove_address method removes one virtual IPv4 address.
|
240
|
+
#
|
241
|
+
# @param name [String] The name of the interface. The
|
242
|
+
# name argument must be the full interface name. Valid interfaces
|
243
|
+
# are restricted to VLAN interfaces.
|
232
244
|
#
|
233
|
-
# @param [
|
234
|
-
# name argument must be the full interface name. Valid interfaces
|
235
|
-
# are restricted to VLAN interfaces
|
236
|
-
# @param [string] :address The virtual router address to remove
|
245
|
+
# @param value [string] The virtual router address to remove.
|
237
246
|
#
|
238
|
-
# @return [Boolean] True if the commands succeeds otherwise False
|
247
|
+
# @return [Boolean] True if the commands succeeds otherwise False.
|
239
248
|
def remove_address(name, value)
|
240
249
|
configure(["interface #{name}",
|
241
250
|
"no ip virtual-router address #{value}"])
|
data/lib/rbeapi/api/vlans.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 Vlan class provides a class implementation for working with the
|
42
|
-
# collection of Vlans on the node.
|
42
|
+
# collection of Vlans on the node. This class presents an abstraction
|
43
43
|
# of the nodes configured vlan id's from the running configuration.
|
44
44
|
#
|
45
|
-
# @eos_version 4.13.7M
|
45
|
+
# @since eos_version 4.13.7M
|
46
46
|
class Vlans < Entity
|
47
47
|
##
|
48
48
|
# get returns the specified vlan resource Hash that represents the
|
@@ -55,12 +55,12 @@ module Rbeapi
|
|
55
55
|
# trunk_groups: array[<string]
|
56
56
|
# }
|
57
57
|
#
|
58
|
-
# @param [String]
|
59
|
-
# nodes configuration
|
58
|
+
# @param id [String] The vlan id to return a resource for from the
|
59
|
+
# nodes configuration.
|
60
60
|
#
|
61
61
|
# @return [nil, Hash<Symbol, Object>] Returns the vlan resource as a
|
62
|
-
# Hash.
|
63
|
-
# configuration a nil object is returned
|
62
|
+
# Hash. If the specified vlan id is not found in the nodes current
|
63
|
+
# configuration a nil object is returned.
|
64
64
|
def get(id)
|
65
65
|
config = get_block("vlan #{id}")
|
66
66
|
return nil unless config
|
@@ -73,8 +73,8 @@ module Rbeapi
|
|
73
73
|
|
74
74
|
##
|
75
75
|
# getall returns the collection of vlan resources from the nodes
|
76
|
-
# running configuration as a hash.
|
77
|
-
# hash is keyed by the unique vlan id
|
76
|
+
# running configuration as a hash. The vlan resource collection
|
77
|
+
# hash is keyed by the unique vlan id.
|
78
78
|
#
|
79
79
|
# @example
|
80
80
|
# {
|
@@ -93,10 +93,10 @@ module Rbeapi
|
|
93
93
|
#
|
94
94
|
# @see get Vlan resource example
|
95
95
|
#
|
96
|
-
# @return [Hash<Symbol, Object>]
|
97
|
-
# entire vlan collection from the nodes running configuration.
|
96
|
+
# @return [Hash<Symbol, Object>] Returns a hash that represents the
|
97
|
+
# entire vlan collection from the nodes running configuration. If
|
98
98
|
# there are no vlans configured, this method will return an empty
|
99
|
-
# hash
|
99
|
+
# hash.
|
100
100
|
def getall
|
101
101
|
vlans = config.scan(/(?<=^vlan\s)\d+$/)
|
102
102
|
vlans.each_with_object({}) do |vid, hsh|
|
@@ -107,13 +107,13 @@ module Rbeapi
|
|
107
107
|
|
108
108
|
##
|
109
109
|
# parse_name scans the provided configuration block and parses the
|
110
|
-
# vlan name value.
|
111
|
-
# from the running configuration.
|
112
|
-
# be merged into the resource hash
|
110
|
+
# vlan name value. The vlan name should always return a value
|
111
|
+
# from the running configuration. The return value is intended to
|
112
|
+
# be merged into the resource hash.
|
113
113
|
#
|
114
114
|
# @api private
|
115
115
|
#
|
116
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
116
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
117
117
|
def parse_name(config)
|
118
118
|
mdata = /name ([^\s]+)$/.match(config)
|
119
119
|
{ name: mdata[1] }
|
@@ -123,12 +123,12 @@ module Rbeapi
|
|
123
123
|
##
|
124
124
|
# parse_state scans the provided configuration block and parses the
|
125
125
|
# vlan state value. The vlan state should always return a value from
|
126
|
-
# the nodes running configuration.
|
127
|
-
# merged into the resource hash
|
126
|
+
# the nodes running configuration. The return hash is intended to be
|
127
|
+
# merged into the resource hash.
|
128
128
|
#
|
129
129
|
# @api private
|
130
130
|
#
|
131
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
131
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
132
132
|
def parse_state(config)
|
133
133
|
mdata = /state (\w+)$/.match(config)
|
134
134
|
{ state: mdata[1] }
|
@@ -137,15 +137,15 @@ module Rbeapi
|
|
137
137
|
|
138
138
|
##
|
139
139
|
# parse_trunk_groups scans the provided configuration block and parses
|
140
|
-
# the trunk groups.
|
140
|
+
# the trunk groups. If no trunk groups are found in the nodes
|
141
141
|
# running configuration then an empty array is returned as the value.
|
142
142
|
# The return hash is intended to be merged into the resource hash.
|
143
143
|
#
|
144
144
|
# @api private
|
145
145
|
#
|
146
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
146
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
147
147
|
def parse_trunk_groups(config)
|
148
|
-
values = config.scan(/trunk group (.+)$/).
|
148
|
+
values = config.scan(/trunk group (.+)$/).flatten
|
149
149
|
values = [] unless values
|
150
150
|
{ trunk_groups: values }
|
151
151
|
end
|
@@ -153,92 +153,92 @@ module Rbeapi
|
|
153
153
|
|
154
154
|
##
|
155
155
|
# create will create a new vlan resource in the nodes current
|
156
|
-
# configuration with the specified vlan id.
|
156
|
+
# configuration with the specified vlan id. If the create method
|
157
157
|
# is called and the vlan id already exists, this method will still
|
158
158
|
# return true.
|
159
159
|
#
|
160
|
-
# @eos_version 4.13.7M
|
160
|
+
# @since eos_version 4.13.7M
|
161
161
|
#
|
162
|
-
#
|
162
|
+
# ===Commands
|
163
163
|
# vlan <value>
|
164
164
|
#
|
165
|
-
# @param [String, Integer]
|
166
|
-
# vlan id must be in the valid range of 1 to 4094
|
165
|
+
# @param id [String, Integer] The vlan id to create on the node. The
|
166
|
+
# vlan id must be in the valid range of 1 to 4094.
|
167
167
|
#
|
168
|
-
# @return [Boolean]
|
168
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
169
169
|
def create(id)
|
170
170
|
configure("vlan #{id}")
|
171
171
|
end
|
172
172
|
|
173
173
|
##
|
174
174
|
# delete will delete an existing vlan resource from the nodes current
|
175
|
-
# running configuration.
|
175
|
+
# running configuration. If the delete method is called and the vlan
|
176
176
|
# id does not exist, this method will succeed.
|
177
177
|
#
|
178
|
-
# @eos_version 4.13.7M
|
178
|
+
# @since eos_version 4.13.7M
|
179
179
|
#
|
180
|
-
#
|
180
|
+
# ===Commands
|
181
181
|
# no vlan <value>
|
182
182
|
#
|
183
|
-
# @param [String, Integer]
|
184
|
-
# id value should be in the valid range of 1 to 4094
|
183
|
+
# @param id [String, Integer] The vlan id to delete from the node. The
|
184
|
+
# id value should be in the valid range of 1 to 4094.
|
185
185
|
#
|
186
|
-
# @return [Boolean]
|
186
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
187
187
|
def delete(id)
|
188
188
|
configure("no vlan #{id}")
|
189
189
|
end
|
190
190
|
|
191
191
|
##
|
192
|
-
# default will configure the vlan using the default keyword.
|
192
|
+
# default will configure the vlan using the default keyword. This
|
193
193
|
# command has the same effect as deleting the vlan from the nodes
|
194
194
|
# running configuration.
|
195
195
|
#
|
196
|
-
# @eos_version 4.13.7M
|
196
|
+
# @since eos_version 4.13.7M
|
197
197
|
#
|
198
|
-
#
|
198
|
+
# ===Commands
|
199
199
|
# default vlan <value>
|
200
200
|
#
|
201
|
-
# @param [String, Integer]
|
202
|
-
# configuration.
|
203
|
-
# to 4094
|
201
|
+
# @param id [String, Integer] The vlan id to default in the nodes
|
202
|
+
# configuration. Ths vid value should be in the valid range of 1
|
203
|
+
# to 4094.
|
204
204
|
#
|
205
|
-
# @return [Boolean]
|
205
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
206
206
|
def default(id)
|
207
207
|
configure("default vlan #{id}")
|
208
208
|
end
|
209
209
|
|
210
210
|
##
|
211
211
|
# set_name configures the name value for the specified vlan id in the
|
212
|
-
# nodes running configuration.
|
212
|
+
# nodes running configuration. If enable is false in the
|
213
213
|
# opts keyword Hash then the name value is negated using the no
|
214
|
-
# keyword.
|
215
|
-
# is defaulted using the default keyword.
|
216
|
-
# precedence over the enable keyword
|
214
|
+
# keyword. If the default keyword is set to true, then the name value
|
215
|
+
# is defaulted using the default keyword. The default keyword takes
|
216
|
+
# precedence over the enable keyword.
|
217
217
|
#
|
218
|
-
# @eos_version 4.13.7M
|
218
|
+
# @since eos_version 4.13.7M
|
219
219
|
#
|
220
|
-
#
|
220
|
+
# ===Commands
|
221
221
|
# vlan <id>
|
222
222
|
# name <value>
|
223
223
|
# no name
|
224
224
|
# default name
|
225
225
|
#
|
226
|
-
# @param [String, Integer]
|
227
|
-
# to.
|
226
|
+
# @param id [String, Integer] The vlan id to apply the configuration
|
227
|
+
# to. The id value should be in the valid range of 1 to 4094.
|
228
228
|
#
|
229
|
-
# @param [Hash]
|
229
|
+
# @param opts [Hash] Optional keyword arguments.
|
230
230
|
#
|
231
|
-
# @option
|
232
|
-
# to in the node configuration.
|
231
|
+
# @option opts value [String] The value to configure the vlan name
|
232
|
+
# to in the node configuration. The name parameter accepts a-z, 0-9
|
233
233
|
# and _.
|
234
234
|
#
|
235
|
-
# @option
|
235
|
+
# @option opts enable [Boolean] If false then the command is
|
236
236
|
# negated. Default is true.
|
237
237
|
#
|
238
|
-
# @option
|
239
|
-
# the default keyword
|
238
|
+
# @option opts default [Boolean] Configure the vlan name value using
|
239
|
+
# the default keyword.
|
240
240
|
#
|
241
|
-
# @return [Boolean]
|
241
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
242
242
|
def set_name(id, opts = {})
|
243
243
|
cmd = command_builder('name', opts)
|
244
244
|
cmds = ["vlan #{id}", cmd]
|
@@ -247,39 +247,39 @@ module Rbeapi
|
|
247
247
|
|
248
248
|
##
|
249
249
|
# set_state configures the state value for the specified vlan id in
|
250
|
-
# the nodes running configuration.
|
250
|
+
# the nodes running configuration. If enable is set to false in
|
251
251
|
# the opts keyword Hash then the state value is negated using the no
|
252
252
|
# keyword. If the default keyword is set to true, then the state
|
253
|
-
# value is defaulted using the default keyword.
|
253
|
+
# value is defaulted using the default keyword. The default keyword
|
254
254
|
# takes precedence over the enable keyword
|
255
255
|
#
|
256
|
-
# @eos_version 4.13.7M
|
256
|
+
# @since eos_version 4.13.7M
|
257
257
|
#
|
258
|
-
#
|
258
|
+
# ===Commands
|
259
259
|
# vlan <id>
|
260
260
|
# state [active, suspend]
|
261
261
|
# no state
|
262
262
|
# default state
|
263
263
|
#
|
264
|
-
# @param [String, Integer]
|
265
|
-
# to.
|
264
|
+
# @param id [String, Integer] The vlan id to apply the configuration
|
265
|
+
# to. The id value should be in the valid range of 1 to 4094.
|
266
266
|
#
|
267
|
-
# @param [Hash]
|
267
|
+
# @param opts [Hash] Optional keyword arguments.
|
268
268
|
#
|
269
|
-
# @option
|
270
|
-
# to in the node's configuration.
|
271
|
-
# 'suspend'
|
269
|
+
# @option opts value [String] The value to configure the vlan state
|
270
|
+
# to in the node's configuration. Accepted values are 'active' or
|
271
|
+
# 'suspend'.
|
272
272
|
#
|
273
|
-
# @option
|
273
|
+
# @option opts enable [Boolean] If false then the command is
|
274
274
|
# negated. Default is true.
|
275
275
|
#
|
276
|
-
# @option
|
277
|
-
# the default keyword
|
276
|
+
# @option opts default [Boolean] Configure the vlan state value using
|
277
|
+
# the default keyword.
|
278
278
|
#
|
279
|
-
# @return [Boolean]
|
279
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
280
280
|
#
|
281
281
|
# @raise [ArgumentError] if the value is not in the accept list of
|
282
|
-
# values
|
282
|
+
# values.
|
283
283
|
def set_state(id, opts = {})
|
284
284
|
value = opts[:value]
|
285
285
|
unless ['active', 'suspend', nil].include?(value)
|
@@ -294,41 +294,41 @@ module Rbeapi
|
|
294
294
|
##
|
295
295
|
# add_trunk_group adds a new trunk group value to the specified vlan
|
296
296
|
# id in the nodes running configuration. The trunk group name value
|
297
|
-
# accepts a-z 0-9 and _
|
297
|
+
# accepts a-z 0-9 and _.
|
298
298
|
#
|
299
|
-
# @version 4.13.7M
|
299
|
+
# @since version 4.13.7M
|
300
300
|
#
|
301
|
-
#
|
301
|
+
# ===Commands
|
302
302
|
# vlan <id>
|
303
303
|
# trunk group <value>
|
304
304
|
#
|
305
|
-
# @param [String, Integer]
|
306
|
-
# to.
|
305
|
+
# @param id [String, Integer] The vlan id to apply the configuration
|
306
|
+
# to. the id value should be in the range of 1 to 4094
|
307
307
|
#
|
308
|
-
# @param [String]
|
308
|
+
# @param value [String] The value to add to the vlan id configuration
|
309
309
|
# on the node.
|
310
310
|
#
|
311
|
-
# @return [Boolean]
|
311
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
312
312
|
def add_trunk_group(id, value)
|
313
313
|
configure(["vlan #{id}", "trunk group #{value}"])
|
314
314
|
end
|
315
315
|
|
316
316
|
##
|
317
317
|
# remove_trunk_group removes the specified trunk group value from the
|
318
|
-
# specified vlan id in the node's configuration.
|
318
|
+
# specified vlan id in the node's configuration. If the trunk group
|
319
319
|
# name does not exist, this method will return success
|
320
320
|
#
|
321
|
-
# @eos_version 4.13.7M
|
321
|
+
# @since eos_version 4.13.7M
|
322
322
|
#
|
323
|
-
#
|
323
|
+
# ===Commands
|
324
324
|
# vlan <id>
|
325
325
|
# no trunk group <value>
|
326
326
|
#
|
327
|
-
# @param [String, Integer]
|
328
|
-
# to. the id value should be in the range of 1 to 4094
|
327
|
+
# @param id [String, Integer] The vlan id to apply the configuration
|
328
|
+
# to. the id value should be in the range of 1 to 4094.
|
329
329
|
#
|
330
|
-
# @param [String]
|
331
|
-
# group names configured for the specified vlan
|
330
|
+
# @param value [String] The value to remove from the list of trunk
|
331
|
+
# group names configured for the specified vlan.
|
332
332
|
#
|
333
333
|
def remove_trunk_group(id, value)
|
334
334
|
configure(["vlan #{id}", "no trunk group #{value}"])
|