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/dns.rb
CHANGED
@@ -32,16 +32,16 @@
|
|
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 Dns class manages DNS settings on an EOS node.
|
42
42
|
class Dns < Entity
|
43
43
|
##
|
44
|
-
# get returns the DNS resource
|
44
|
+
# get returns the DNS resource.
|
45
45
|
#
|
46
46
|
# @example
|
47
47
|
# {
|
@@ -50,7 +50,7 @@ module Rbeapi
|
|
50
50
|
# "domain_list": array<strings>
|
51
51
|
# }
|
52
52
|
#
|
53
|
-
# @return [Hash]
|
53
|
+
# @return [Hash] A Ruby hash object that provides the SNMP settings as
|
54
54
|
# key / value pairs.
|
55
55
|
def get
|
56
56
|
response = {}
|
@@ -61,11 +61,11 @@ module Rbeapi
|
|
61
61
|
end
|
62
62
|
|
63
63
|
##
|
64
|
-
# parse_domain_name parses the domain-name from config
|
64
|
+
# parse_domain_name parses the domain-name from config.
|
65
65
|
#
|
66
66
|
# @api private
|
67
67
|
#
|
68
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
68
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
69
69
|
def parse_domain_name
|
70
70
|
mdata = /ip domain-name ([\w.]+)/.match(config)
|
71
71
|
{ domain_name: mdata.nil? ? '' : mdata[1] }
|
@@ -74,11 +74,11 @@ module Rbeapi
|
|
74
74
|
|
75
75
|
##
|
76
76
|
# parse_name_servers parses the name-server values from
|
77
|
-
# config
|
77
|
+
# config.
|
78
78
|
#
|
79
79
|
# @api private
|
80
80
|
#
|
81
|
-
# @return [Hash<Symbol, Array>] resource hash attribute
|
81
|
+
# @return [Hash<Symbol, Array>] Returns the resource hash attribute.
|
82
82
|
def parse_name_servers
|
83
83
|
servers = config.scan(/(?:ip name-server vrf )(?:\w+)\s(.+)/)
|
84
84
|
values = servers.each_with_object([]) { |srv, arry| arry << srv.first }
|
@@ -87,11 +87,11 @@ module Rbeapi
|
|
87
87
|
private :parse_name_servers
|
88
88
|
|
89
89
|
##
|
90
|
-
# parse_domain_list parses the domain-list from config
|
90
|
+
# parse_domain_list parses the domain-list from config.
|
91
91
|
#
|
92
92
|
# @api private
|
93
93
|
#
|
94
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
94
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
95
95
|
def parse_domain_list
|
96
96
|
search = config.scan(/(?<=^ip\sdomain-list\s).+$/)
|
97
97
|
{ domain_list: search }
|
@@ -99,15 +99,18 @@ module Rbeapi
|
|
99
99
|
private :parse_domain_list
|
100
100
|
|
101
101
|
##
|
102
|
-
# Configure the domain-name value in the running-config
|
102
|
+
# Configure the domain-name value in the running-config.
|
103
103
|
#
|
104
|
-
# @param [Hash]
|
105
|
-
#
|
106
|
-
# @option
|
104
|
+
# @param opts [Hash] The configuration parameters.
|
105
|
+
#
|
106
|
+
# @option opts value [string] The value to set the domain-name to.
|
107
|
+
#
|
108
|
+
# @option opts enable [Boolean] If false then the command is
|
107
109
|
# negated. Default is true.
|
108
|
-
# @option opts [Boolean] :default The value should be set to default
|
109
110
|
#
|
110
|
-
# @
|
111
|
+
# @option opts default [Boolean] The value should be set to default.
|
112
|
+
#
|
113
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
111
114
|
def set_domain_name(opts = {})
|
112
115
|
cmds = command_builder('ip domain-name', opts)
|
113
116
|
configure(cmds)
|
@@ -118,26 +121,29 @@ module Rbeapi
|
|
118
121
|
# to resolve dns queries. If the enable option is false, then the
|
119
122
|
# name-server list will be configured using the no keyword. If the
|
120
123
|
# default option is specified, then the name server list will be
|
121
|
-
# configured using the default keyword.
|
122
|
-
# keyword option will take precedence
|
124
|
+
# configured using the default keyword. If both options are provided the
|
125
|
+
# keyword option will take precedence.
|
123
126
|
#
|
124
|
-
# @eos_version 4.13.7M
|
127
|
+
# @since eos_version 4.13.7M
|
125
128
|
#
|
126
|
-
#
|
129
|
+
# ===Commands
|
127
130
|
# ip name-server <value>
|
128
131
|
# no ip name-server
|
129
132
|
# default ip name-server
|
130
133
|
#
|
131
|
-
# @param [Hash] opts The configuration parameters
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
134
|
+
# @param [Hash] opts The configuration parameters.
|
135
|
+
#
|
136
|
+
# @option opts value [string] The set of name servers to configure on the
|
137
|
+
# node. The list of name servers will be replace in the nodes running
|
138
|
+
# configuration by the list provided in value.
|
139
|
+
#
|
140
|
+
# @option opts enable [Boolean] If false then the command is
|
136
141
|
# negated. Default is true.
|
137
|
-
#
|
142
|
+
#
|
143
|
+
# @option default [Boolean] Configures the ip name-servers using the
|
138
144
|
# default keyword argument. Default takes precedence over enable.
|
139
145
|
#
|
140
|
-
# @return [Boolean]
|
146
|
+
# @return [Boolean] Returns true if the commands completed successfully.
|
141
147
|
def set_name_servers(opts = {})
|
142
148
|
value = opts[:value]
|
143
149
|
enable = opts.fetch(:enable, true)
|
@@ -160,9 +166,9 @@ module Rbeapi
|
|
160
166
|
##
|
161
167
|
# add_name_server adds an ip name-server.
|
162
168
|
#
|
163
|
-
# @param [String]
|
169
|
+
# @param server [String] The name of the ip name-server to create.
|
164
170
|
#
|
165
|
-
# @return [Boolean]
|
171
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
166
172
|
def add_name_server(server)
|
167
173
|
configure "ip name-server #{server}"
|
168
174
|
end
|
@@ -170,36 +176,36 @@ module Rbeapi
|
|
170
176
|
##
|
171
177
|
# remove_name_server removes the specified ip name-server.
|
172
178
|
#
|
173
|
-
# @param [String]
|
179
|
+
# @param server [String] The name of the ip name-server to remove.
|
174
180
|
#
|
175
|
-
# @return [Boolean]
|
181
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
176
182
|
def remove_name_server(server)
|
177
183
|
configure "no ip name-server #{server}"
|
178
184
|
end
|
179
185
|
|
180
186
|
##
|
181
187
|
# set_domain_list configures the set of domain names to search when
|
182
|
-
# making dns queries for the FQDN.
|
188
|
+
# making dns queries for the FQDN. If the enable option is set to false,
|
183
189
|
# then the domain-list will be configured using the no keyword. If the
|
184
190
|
# default option is specified, then the domain list will be configured
|
185
|
-
# using the default keyword.
|
191
|
+
# using the default keyword. If both options are provided the default
|
186
192
|
# keyword option will take precedence.
|
187
193
|
#
|
188
|
-
# @eos_version 4.13.7M
|
194
|
+
# @since eos_version 4.13.7M
|
189
195
|
#
|
190
|
-
#
|
196
|
+
# ===Commands
|
191
197
|
# ip domain-list <value>
|
192
198
|
# no ip domain-list
|
193
199
|
# default ip domain-list
|
194
200
|
#
|
195
|
-
# @option [Array]
|
196
|
-
# node.
|
197
|
-
# configuration by the list provided in value
|
201
|
+
# @option value [Array] The set of domain names to configure on the
|
202
|
+
# node. The list of domain names will be replace in the nodes running
|
203
|
+
# configuration by the list provided in value.
|
198
204
|
#
|
199
|
-
# @option [Boolean]
|
200
|
-
# default keyword argument
|
205
|
+
# @option default [Boolean] Configures the ip domain-list using the
|
206
|
+
# default keyword argument.
|
201
207
|
#
|
202
|
-
# @return [Boolean]
|
208
|
+
# @return [Boolean] Returns true if the commands completed successfully.
|
203
209
|
def set_domain_list(opts = {})
|
204
210
|
value = opts[:value]
|
205
211
|
enable = opts.fetch(:enable, true)
|
@@ -227,9 +233,9 @@ module Rbeapi
|
|
227
233
|
##
|
228
234
|
# add_domain_list adds an ip domain-list.
|
229
235
|
#
|
230
|
-
# @param [String]
|
236
|
+
# @param name [String] The name of the ip domain-list to add.
|
231
237
|
#
|
232
|
-
# @return [Boolean]
|
238
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
233
239
|
def add_domain_list(name)
|
234
240
|
configure "ip domain-list #{name}"
|
235
241
|
end
|
@@ -237,9 +243,9 @@ module Rbeapi
|
|
237
243
|
##
|
238
244
|
# remove_domain_list removes a specified ip domain-list.
|
239
245
|
#
|
240
|
-
# @param [String]
|
246
|
+
# @param name [String] The name of the ip domain-list to remove.
|
241
247
|
#
|
242
|
-
# @return [Boolean]
|
248
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
243
249
|
def remove_domain_list(name)
|
244
250
|
configure "no ip domain-list #{name}"
|
245
251
|
end
|
@@ -33,10 +33,10 @@ require 'rbeapi/api'
|
|
33
33
|
require 'rbeapi/utils'
|
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 Interfaces class manages all physical and logical interfaces on an
|
@@ -48,7 +48,7 @@ module Rbeapi
|
|
48
48
|
end
|
49
49
|
|
50
50
|
##
|
51
|
-
# get returns a hash of interface configurations for the given name
|
51
|
+
# get returns a hash of interface configurations for the given name.
|
52
52
|
#
|
53
53
|
# @example
|
54
54
|
# {
|
@@ -58,18 +58,18 @@ module Rbeapi
|
|
58
58
|
# shutdown: <boolean>
|
59
59
|
# }
|
60
60
|
#
|
61
|
-
# @param [String]
|
62
|
-
# the nodes configuration
|
61
|
+
# @param name [String] The interface name to return a resource for from
|
62
|
+
# the nodes configuration.
|
63
63
|
#
|
64
64
|
# @return [nil, Hash<Symbol, Object>] Returns the interface resource as a
|
65
65
|
# Hash. If the specified name is not found in the nodes current
|
66
|
-
# configuration a nil object is returned
|
66
|
+
# configuration a nil object is returned.
|
67
67
|
def get(name)
|
68
68
|
get_instance(name).get(name)
|
69
69
|
end
|
70
70
|
|
71
71
|
##
|
72
|
-
# getall returns a hash of interface configurations
|
72
|
+
# getall returns a hash of interface configurations.
|
73
73
|
#
|
74
74
|
# @example
|
75
75
|
# {
|
@@ -91,8 +91,8 @@ module Rbeapi
|
|
91
91
|
# }
|
92
92
|
#
|
93
93
|
# @return [Hash<Symbol, Object>] Returns the interface resources as a
|
94
|
-
# Hash. If none exist in the nodes current
|
95
|
-
#
|
94
|
+
# Hash. If none exist in the nodes current configuration an empty
|
95
|
+
# hash is returned.
|
96
96
|
def getall
|
97
97
|
interfaces = config.scan(/(?<=^interface\s).+$/)
|
98
98
|
|
@@ -103,12 +103,11 @@ module Rbeapi
|
|
103
103
|
end
|
104
104
|
|
105
105
|
##
|
106
|
-
# get_instance returns an interface instance for the given name
|
106
|
+
# get_instance returns an interface instance for the given name.
|
107
107
|
#
|
108
|
-
# @param [String]
|
108
|
+
# @param name [String] The interface name to return an instance for.
|
109
109
|
#
|
110
|
-
# @return [Object] Returns the interface instance as an
|
111
|
-
# Object.
|
110
|
+
# @return [Object] Returns the interface instance as an Object.
|
112
111
|
def get_instance(name)
|
113
112
|
name = name[0, 2].upcase
|
114
113
|
case name
|
@@ -148,9 +147,9 @@ module Rbeapi
|
|
148
147
|
|
149
148
|
##
|
150
149
|
# get returns the specified interface resource hash that represents the
|
151
|
-
# node's current interface configuration.
|
150
|
+
# node's current interface configuration. The BaseInterface class
|
152
151
|
# provides all the set of attributes that are common to all interfaces
|
153
|
-
# in EOS.
|
152
|
+
# in EOS. This method will return an interface type of generic.
|
154
153
|
#
|
155
154
|
# @example
|
156
155
|
# {
|
@@ -160,12 +159,12 @@ module Rbeapi
|
|
160
159
|
# shutdown: [true, false]
|
161
160
|
# }
|
162
161
|
#
|
163
|
-
# @param [String]
|
164
|
-
# running-configuration
|
162
|
+
# @param name [String] The name of the interface to return from the
|
163
|
+
# running-configuration.
|
165
164
|
#
|
166
165
|
# @return [nil, Hash<String, Object>] Returns a hash of the interface
|
167
166
|
# properties if the interface name was found in the running
|
168
|
-
# configuration. If the interface was not found, nil is returned
|
167
|
+
# configuration. If the interface was not found, nil is returned.
|
169
168
|
def get(name)
|
170
169
|
config = get_block("^interface #{name}")
|
171
170
|
return nil unless config
|
@@ -185,7 +184,10 @@ module Rbeapi
|
|
185
184
|
#
|
186
185
|
# @api private
|
187
186
|
#
|
188
|
-
# @
|
187
|
+
# @param config [String] The configuration block retrieved from the
|
188
|
+
# nodes current running configuration.
|
189
|
+
#
|
190
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
189
191
|
def parse_description(config)
|
190
192
|
mdata = /^\s{3}description\s(.+)$/.match(config)
|
191
193
|
{ description: mdata.nil? ? DEFAULT_INTF_DESCRIPTION : mdata[1] }
|
@@ -201,7 +203,10 @@ module Rbeapi
|
|
201
203
|
#
|
202
204
|
# @api private
|
203
205
|
#
|
204
|
-
# @
|
206
|
+
# @param config [String] The configuration block retrieved from the
|
207
|
+
# nodes current running configuration.
|
208
|
+
#
|
209
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
205
210
|
def parse_shutdown(config)
|
206
211
|
value = /no shutdown/ =~ config
|
207
212
|
{ shutdown: value.nil? }
|
@@ -210,80 +215,80 @@ module Rbeapi
|
|
210
215
|
|
211
216
|
##
|
212
217
|
# create will create a new interface resource in the node's current
|
213
|
-
# configuration with the specified interface name.
|
218
|
+
# configuration with the specified interface name. If the create
|
214
219
|
# method is called and the interface already exists, this method will
|
215
|
-
# return successful
|
220
|
+
# return successful.
|
216
221
|
#
|
217
|
-
# @eos_version 4.13.7M
|
222
|
+
# @since eos_version 4.13.7M
|
218
223
|
#
|
219
|
-
# @param [String]
|
224
|
+
# @param value [String] The interface name to create on the node. The
|
220
225
|
# interface name must be the full interface identifier (ie Loopback,
|
221
|
-
# not Lo)
|
226
|
+
# not Lo).
|
222
227
|
#
|
223
|
-
# @return [Boolean]
|
228
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
224
229
|
def create(value)
|
225
230
|
configure("interface #{value}")
|
226
231
|
end
|
227
232
|
|
228
233
|
##
|
229
234
|
# delete will delete an existing interface resource in the node's
|
230
|
-
# current configuration with the specified interface name.
|
235
|
+
# current configuration with the specified interface name. If the
|
231
236
|
# delete method is called and interface does not exist, this method
|
232
|
-
# will return successful
|
237
|
+
# will return successful.
|
233
238
|
#
|
234
|
-
# @eos_version 4.13.7M
|
239
|
+
# @since eos_version 4.13.7M
|
235
240
|
#
|
236
|
-
# @param [String]
|
241
|
+
# @param value [String] The interface name to delete from the node.
|
237
242
|
# The interface name must be the full interface identifier
|
238
|
-
# (ie Loopback, no Lo)
|
243
|
+
# (ie Loopback, no Lo).
|
239
244
|
#
|
240
|
-
# @return [Boolean]
|
245
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
241
246
|
def delete(value)
|
242
247
|
configure("no interface #{value}")
|
243
248
|
end
|
244
249
|
|
245
250
|
##
|
246
|
-
# default will configure the interface using the default keyword.
|
251
|
+
# default will configure the interface using the default keyword. For
|
247
252
|
# virtual interfaces this is equivalent to deleting the interface. For
|
248
253
|
# physical interfaces, the entire interface configuration will be set
|
249
254
|
# to defaults.
|
250
255
|
#
|
251
|
-
# @eos_version 4.13.7M
|
256
|
+
# @since eos_version 4.13.7M
|
252
257
|
#
|
253
|
-
# @param [String]
|
258
|
+
# @param value [String] The interface name to default in the node. The
|
254
259
|
# interface name must be the full interface identifier (ie Loopback,
|
255
|
-
# not Lo)
|
260
|
+
# not Lo).
|
256
261
|
#
|
257
|
-
# @return [Boolean]
|
262
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
258
263
|
def default(value)
|
259
264
|
configure("default interface #{value}")
|
260
265
|
end
|
261
266
|
|
262
267
|
##
|
263
268
|
# set_description configures the description value for the specified
|
264
|
-
# interface name in the nodes running configuration.
|
269
|
+
# interface name in the nodes running configuration. If the enable
|
265
270
|
# keyword is false then the description value is negated using the no
|
266
|
-
# keyword.
|
267
|
-
# value is defaulted using the default keyword.
|
271
|
+
# keyword. If the default keyword is set to true, then the description
|
272
|
+
# value is defaulted using the default keyword. The default keyword takes
|
268
273
|
# precedence over the enable keyword if both are provided.
|
269
274
|
#
|
270
|
-
# @eos_version 4.13.7M
|
275
|
+
# @since eos_version 4.13.7M
|
271
276
|
#
|
272
|
-
# @param [String]
|
273
|
-
# to.
|
277
|
+
# @param name [String] The interface name to apply the configuration
|
278
|
+
# to. The name value must be the full interface identifier.
|
274
279
|
#
|
275
|
-
# @param [hash]
|
280
|
+
# @param opts [hash] Optional keyword arguments.
|
276
281
|
#
|
277
|
-
# @option
|
282
|
+
# @option opts value [String] The value to configure the description
|
278
283
|
# to in the node's configuration.
|
279
284
|
#
|
280
|
-
# @option
|
285
|
+
# @option opts enable [Boolean] If false then the command is
|
281
286
|
# negated. Default is true.
|
282
287
|
#
|
283
|
-
# @option
|
284
|
-
# using the default keyword
|
288
|
+
# @option opts default [Boolean] Configure the interface description
|
289
|
+
# using the default keyword.
|
285
290
|
#
|
286
|
-
# @return [Boolean]
|
291
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
287
292
|
def set_description(name, opts = {})
|
288
293
|
commands = command_builder('description', opts)
|
289
294
|
configure_interface(name, commands)
|
@@ -291,31 +296,31 @@ module Rbeapi
|
|
291
296
|
|
292
297
|
##
|
293
298
|
# set_shutdown configures the administrative state of the specified
|
294
|
-
# interface in the node.
|
295
|
-
# interface is administratively disabled.
|
296
|
-
# true, then the interface is administratively enabled.
|
299
|
+
# interface in the node. If the enable keyword is false, then the
|
300
|
+
# interface is administratively disabled. If the enable keyword is
|
301
|
+
# true, then the interface is administratively enabled. If the default
|
297
302
|
# keyword is set to true, then the interface shutdown value is configured
|
298
|
-
# using the default keyword.
|
303
|
+
# using the default keyword. The default keyword takes precedence
|
299
304
|
# over the enable keyword if both are provided.
|
300
305
|
#
|
301
|
-
# @eos_version 4.13.7M
|
306
|
+
# @since eos_version 4.13.7M
|
302
307
|
#
|
303
|
-
# @param [String]
|
304
|
-
# to.
|
308
|
+
# @param name [String] The interface name to apply the configuration
|
309
|
+
# to. The name value must be the full interface identifier.
|
305
310
|
#
|
306
|
-
# @param [hash]
|
311
|
+
# @param opts [hash] Optional keyword arguments.
|
307
312
|
#
|
308
|
-
# @option
|
313
|
+
# @option opts enable [Boolean] True if the interface should be
|
309
314
|
# administratively enabled or false if the interface should be
|
310
315
|
# administratively disabled.
|
311
316
|
#
|
312
|
-
# @option
|
313
|
-
# using the default keyword
|
317
|
+
# @option opts default [Boolean] Configure the interface shutdown
|
318
|
+
# using the default keyword.
|
314
319
|
#
|
315
|
-
# @return [Boolean]
|
320
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
316
321
|
def set_shutdown(name, opts = {})
|
317
322
|
fail 'set_shutdown has the value option set' if opts[:value]
|
318
|
-
# Shutdown semantics are opposite of enable semantics so invert enable
|
323
|
+
# Shutdown semantics are opposite of enable semantics so invert enable.
|
319
324
|
value = !opts[:enable]
|
320
325
|
opts.merge!(enable: value)
|
321
326
|
commands = command_builder('shutdown', opts)
|
@@ -349,12 +354,12 @@ module Rbeapi
|
|
349
354
|
# flowcontrol_receive: <string>
|
350
355
|
# }
|
351
356
|
#
|
352
|
-
# @param [String]
|
353
|
-
# for from the node's running configuration
|
357
|
+
# @param name [String] The interface name to return a resource hash
|
358
|
+
# for from the node's running configuration.
|
354
359
|
#
|
355
360
|
# @return [nil, Hash<Symbol, Object>] Returns the interface resource as
|
356
|
-
# a hash.
|
357
|
-
# configuration a nil object is returned
|
361
|
+
# a hash. If the specified interface name is not found in the node's
|
362
|
+
# configuration a nil object is returned.
|
358
363
|
def get(name)
|
359
364
|
config = get_block("^interface #{name}")
|
360
365
|
return nil unless config
|
@@ -372,12 +377,14 @@ module Rbeapi
|
|
372
377
|
##
|
373
378
|
# parse_speed scans the provided configuration block and parses the speed
|
374
379
|
# value. If the speed value is not found in the interface configuration
|
375
|
-
# block provided, DEFAULT_SPEED and DEFAULT_FORCED are used.
|
376
|
-
# returned hash is intended to be merged into the interface resource hash
|
380
|
+
# block provided, DEFAULT_SPEED and DEFAULT_FORCED are used. The
|
381
|
+
# returned hash is intended to be merged into the interface resource hash.
|
377
382
|
#
|
378
383
|
# @api private
|
379
384
|
#
|
380
|
-
# @
|
385
|
+
# @param config [String] The configuration block to parse.
|
386
|
+
#
|
387
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
381
388
|
def parse_speed(config)
|
382
389
|
value = config.scan(/speed (forced)?[ ]?(\w+)/).first
|
383
390
|
return { speed: DEFAULT_SPEED, forced: DEFAULT_FORCED } unless value
|
@@ -388,13 +395,15 @@ module Rbeapi
|
|
388
395
|
|
389
396
|
##
|
390
397
|
# parse_sflow scans the provided configuration block and parse the
|
391
|
-
# sflow value.
|
392
|
-
# interface or returns false if it is not enabled.
|
398
|
+
# sflow value. The sflow values true if sflow is enabled on the
|
399
|
+
# interface or returns false if it is not enabled. The hash returned
|
393
400
|
# is intended to be merged into the interface hash.
|
394
401
|
#
|
395
402
|
# @api private
|
396
403
|
#
|
397
|
-
# @
|
404
|
+
# @param config [String] The configuration block to parse.
|
405
|
+
#
|
406
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
398
407
|
def parse_sflow(config)
|
399
408
|
value = /no sflow enable/ =~ config
|
400
409
|
{ sflow: value.nil? }
|
@@ -403,14 +412,16 @@ module Rbeapi
|
|
403
412
|
|
404
413
|
##
|
405
414
|
# parse_flowcontrol_send scans the provided configuration block and
|
406
|
-
# parses the flowcontrol send value.
|
415
|
+
# parses the flowcontrol send value. If the interface flowcontrol value
|
407
416
|
# is not configured, then this method will return the value of
|
408
|
-
# DEFAULT_ETH_FLOWC_TX.
|
417
|
+
# DEFAULT_ETH_FLOWC_TX. The hash returned is intended to be merged into
|
409
418
|
# the interface resource hash.
|
410
419
|
#
|
411
420
|
# @api private
|
412
421
|
#
|
413
|
-
# @
|
422
|
+
# @param config [String] The configuration block to parse.
|
423
|
+
#
|
424
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
414
425
|
def parse_flowcontrol_send(config)
|
415
426
|
mdata = /flowcontrol send (\w+)$/.match(config)
|
416
427
|
{ flowcontrol_send: mdata.nil? ? DEFAULT_ETH_FLOWC_TX : mdata[1] }
|
@@ -419,14 +430,16 @@ module Rbeapi
|
|
419
430
|
|
420
431
|
##
|
421
432
|
# parse_flowcontrol_receive scans the provided configuration block and
|
422
|
-
# parse the flowcontrol receive value.
|
433
|
+
# parse the flowcontrol receive value. If the interface flowcontrol
|
423
434
|
# value is not configured, then this method will return the value of
|
424
|
-
# DEFAULT_ETH_FLOWC_RX.
|
435
|
+
# DEFAULT_ETH_FLOWC_RX. The hash returned is intended to be merged into
|
425
436
|
# the interface resource hash.
|
426
437
|
#
|
427
438
|
# @api private
|
428
439
|
#
|
429
|
-
# @
|
440
|
+
# @param config [String] The configuration block to parse.
|
441
|
+
#
|
442
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
430
443
|
def parse_flowcontrol_receive(config)
|
431
444
|
mdata = /flowcontrol receive (\w+)$/.match(config)
|
432
445
|
{ flowcontrol_receive: mdata.nil? ? DEFAULT_ETH_FLOWC_RX : mdata[1] }
|
@@ -437,10 +450,10 @@ module Rbeapi
|
|
437
450
|
# create overrides the create method from the BaseInterface and raises
|
438
451
|
# an exception because Ethernet interface creation is not supported.
|
439
452
|
#
|
440
|
-
# @param [String]
|
453
|
+
# @param _name [String] The name of the interface.
|
441
454
|
#
|
442
455
|
# @raise [NotImplementedError] Creation of physical Ethernet interfaces
|
443
|
-
# is not supported
|
456
|
+
# is not supported.
|
444
457
|
def create(_name)
|
445
458
|
fail NotImplementedError, 'creating Ethernet interfaces is '\
|
446
459
|
'not supported'
|
@@ -451,10 +464,10 @@ module Rbeapi
|
|
451
464
|
# raises an exception because Ethernet interface deletion is not
|
452
465
|
# supported.
|
453
466
|
#
|
454
|
-
# @param [String]
|
467
|
+
# @param _name [String] The name of the interface.
|
455
468
|
#
|
456
469
|
# @raise [NotImplementedError] Deletion of physical Ethernet interfaces
|
457
|
-
# is not supported
|
470
|
+
# is not supported.
|
458
471
|
def delete(_name)
|
459
472
|
fail NotImplementedError, 'deleting Ethernet interfaces is '\
|
460
473
|
'not supported'
|
@@ -462,32 +475,32 @@ module Rbeapi
|
|
462
475
|
|
463
476
|
##
|
464
477
|
# set_speed configures the interface speed and negotiation values on the
|
465
|
-
# specified interface.
|
466
|
-
# setting is configured using the no keyword.
|
478
|
+
# specified interface. If the enable option is false the speed
|
479
|
+
# setting is configured using the no keyword. If the default options is
|
467
480
|
# set to true, then the speed setting is configured using the default
|
468
|
-
# keyword.
|
481
|
+
# keyword. If both options are specified, the default keyword takes
|
469
482
|
# precedence.
|
470
483
|
#
|
471
|
-
# @eos_version 4.13.7M
|
484
|
+
# @since eos_version 4.13.7M
|
472
485
|
#
|
473
|
-
# @param [String]
|
474
|
-
# values to.
|
486
|
+
# @param name [String] The interface name to apply the configuration
|
487
|
+
# values to. The name must be the full interface identifier.
|
475
488
|
#
|
476
|
-
# @param [Hash]
|
489
|
+
# @param opts [Hash] Optional keyword arguments.
|
477
490
|
#
|
478
|
-
# @option [String]
|
479
|
-
# the nodes running configuration
|
491
|
+
# @option opts value [String] The value to configure the speed setting to
|
492
|
+
# in the nodes running configuration.
|
480
493
|
#
|
481
|
-
# @option
|
494
|
+
# @option opts enable [Boolean] If false then the command is
|
482
495
|
# negated. Default is true.
|
483
496
|
#
|
484
|
-
# @option [Boolean]
|
485
|
-
# enabled (true) or disabled (false)
|
497
|
+
# @option opts forced [Boolean] Specifies if auto negotiation should be
|
498
|
+
# enabled (true) or disabled (false).
|
486
499
|
#
|
487
|
-
# @option
|
488
|
-
# interface using the default keyword
|
500
|
+
# @option opts default [Boolean] Configures the sflow value on the
|
501
|
+
# interface using the default keyword.
|
489
502
|
#
|
490
|
-
# @return [Boolean]
|
503
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
491
504
|
def set_speed(name, opts = {})
|
492
505
|
value = opts[:value]
|
493
506
|
forced = opts.fetch(:forced, false)
|
@@ -509,26 +522,26 @@ module Rbeapi
|
|
509
522
|
|
510
523
|
##
|
511
524
|
# set_sflow configures the administrative state of sflow on the
|
512
|
-
# interface.
|
525
|
+
# interface. Setting the enable keyword to true enables sflow on the
|
513
526
|
# interface and setting enable to false disables sflow on the interface.
|
514
527
|
# If the default keyword is set to true, then the sflow value is
|
515
|
-
# defaulted using the default keyword.
|
528
|
+
# defaulted using the default keyword. The default keyword takes
|
516
529
|
# precedence over the enable keyword
|
517
530
|
#
|
518
|
-
# @eos_version 4.13.7M
|
531
|
+
# @since eos_version 4.13.7M
|
519
532
|
#
|
520
|
-
# @param [String]
|
521
|
-
# values to.
|
533
|
+
# @param name [String] The interface name to apply the configuration
|
534
|
+
# values to. The name must be the full interface identifier.
|
522
535
|
#
|
523
|
-
# @param [Hash]
|
536
|
+
# @param opts [Hash] Optional keyword arguments.
|
524
537
|
#
|
525
|
-
# @option
|
538
|
+
# @option opts enable [Boolean] Enables sflow if the value is true or
|
526
539
|
# disables sflow on the interface if false. Default is true.
|
527
540
|
#
|
528
|
-
# @option
|
529
|
-
# interface using the default keyword
|
541
|
+
# @option opts default [Boolean] Configures the sflow value on the
|
542
|
+
# interface using the default keyword.
|
530
543
|
#
|
531
|
-
# @return [Boolean]
|
544
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
532
545
|
def set_sflow(name, opts = {})
|
533
546
|
commands = command_builder('sflow enable', opts)
|
534
547
|
configure_interface(name, commands)
|
@@ -537,31 +550,31 @@ module Rbeapi
|
|
537
550
|
##
|
538
551
|
# set_flowcontrol configures the flowcontrol value either on or off for
|
539
552
|
# the for the specified interface in the specified direction (either send
|
540
|
-
# or receive).
|
541
|
-
# negated using the no keyword.
|
542
|
-
# then the state value is defaulted using the default keyword.
|
553
|
+
# or receive). If the enable keyword is false then the configuration is
|
554
|
+
# negated using the no keyword. If the default keyword is set to true,
|
555
|
+
# then the state value is defaulted using the default keyword. The
|
543
556
|
# default keyword takes precedence over the enable keyword
|
544
557
|
#
|
545
|
-
# @eos_version 4.13.7M
|
558
|
+
# @since eos_version 4.13.7M
|
546
559
|
#
|
547
|
-
# @param [String]
|
548
|
-
# values to.
|
560
|
+
# @param name [String] The interface name to apply the configuration
|
561
|
+
# values to. The name must be the full interface identifier.
|
549
562
|
#
|
550
|
-
# @param [String]
|
551
|
-
# configure.
|
563
|
+
# @param direction [String] Specifies the flowcontrol direction to
|
564
|
+
# configure. Valid values include send and receive.
|
552
565
|
#
|
553
|
-
# @param [Hash]
|
566
|
+
# @param opts [Hash] Optional keyword arguments.
|
554
567
|
#
|
555
|
-
# @option
|
556
|
-
# flowcontrol setting for.
|
568
|
+
# @option opts value [String] Specifies the value to configure the
|
569
|
+
# flowcontrol setting for. Valid values include on or off.
|
557
570
|
#
|
558
|
-
# @option
|
571
|
+
# @option opts enable [Boolean] If false then the command is
|
559
572
|
# negated. Default is true.
|
560
573
|
#
|
561
|
-
# @option
|
562
|
-
# the interface using the default keyword
|
574
|
+
# @option opts default [Boolean] Configures the flowcontrol value on
|
575
|
+
# the interface using the default keyword.
|
563
576
|
#
|
564
|
-
# @return [Boolean]
|
577
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
565
578
|
def set_flowcontrol(name, direction, opts = {})
|
566
579
|
commands = command_builder("flowcontrol #{direction}", opts)
|
567
580
|
configure_interface(name, commands)
|
@@ -573,50 +586,50 @@ module Rbeapi
|
|
573
586
|
#
|
574
587
|
# @see set_flowcontrol
|
575
588
|
#
|
576
|
-
# @eos_version 4.13.7M
|
589
|
+
# @since eos_version 4.13.7M
|
577
590
|
#
|
578
|
-
# @param [String]
|
579
|
-
# values to.
|
591
|
+
# @param name [String] The interface name to apply the configuration
|
592
|
+
# values to. The name must be the full interface identifier.
|
580
593
|
#
|
581
|
-
# @param [Hash]
|
594
|
+
# @param opts [Hash] Optional keyword arguments.
|
582
595
|
#
|
583
|
-
# @option
|
584
|
-
# flowcontrol setting for.
|
596
|
+
# @option opts value [String] Specifies the value to configure the
|
597
|
+
# flowcontrol setting for. Valid values include on or off.
|
585
598
|
#
|
586
|
-
# @option
|
599
|
+
# @option opts enable [Boolean] If false then the command is
|
587
600
|
# negated. Default is true.
|
588
601
|
#
|
589
|
-
# @option
|
590
|
-
# the interface using the default keyword
|
602
|
+
# @option opts default [Boolean] Configures the flowcontrol value on
|
603
|
+
# the interface using the default keyword.
|
591
604
|
#
|
592
|
-
# @return [Boolean]
|
605
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
593
606
|
def set_flowcontrol_send(name, opts = {})
|
594
607
|
set_flowcontrol(name, 'send', opts)
|
595
608
|
end
|
596
609
|
|
597
610
|
##
|
598
|
-
# set_flowcontrol_receive is a convenience function for configuring
|
599
|
-
# value of interface flowcontrol
|
611
|
+
# set_flowcontrol_receive is a convenience function for configuring the
|
612
|
+
# value of interface flowcontrol.
|
600
613
|
#
|
601
614
|
# @see set_flowcontrol
|
602
615
|
#
|
603
|
-
# @eos_version 4.13.7M
|
616
|
+
# @since eos_version 4.13.7M
|
604
617
|
#
|
605
|
-
# @param [String]
|
606
|
-
# values to.
|
618
|
+
# @param name [String] The interface name to apply the configuration
|
619
|
+
# values to. The name must be the full interface identifier.
|
607
620
|
#
|
608
|
-
# @param [Hash]
|
621
|
+
# @param opts [Hash] Optional keyword arguments.
|
609
622
|
#
|
610
|
-
# @option
|
611
|
-
# flowcontrol setting for.
|
623
|
+
# @option opts value [String] Specifies the value to configure the
|
624
|
+
# flowcontrol setting for. Valid values include on or off.
|
612
625
|
#
|
613
|
-
# @option
|
626
|
+
# @option opts enable [Boolean] If false then the command is
|
614
627
|
# negated. Default is true.
|
615
628
|
#
|
616
|
-
# @option
|
617
|
-
# the interface using the default keyword
|
629
|
+
# @option opts default [Boolean] Configures the flowcontrol value on
|
630
|
+
# the interface using the default keyword.
|
618
631
|
#
|
619
|
-
# @return [Boolean]
|
632
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
620
633
|
def set_flowcontrol_receive(name, opts = {})
|
621
634
|
set_flowcontrol(name, 'receive', opts)
|
622
635
|
end
|
@@ -632,7 +645,7 @@ module Rbeapi
|
|
632
645
|
|
633
646
|
##
|
634
647
|
# get returns the specified port-channel interface configuration from
|
635
|
-
# the nodes running configuration as a resource hash.
|
648
|
+
# the nodes running configuration as a resource hash. The resource
|
636
649
|
# hash returned extends the BaseInterface resource hash, sets the type
|
637
650
|
# value to portchannel and adds the portchannel specific attributes
|
638
651
|
#
|
@@ -650,13 +663,13 @@ module Rbeapi
|
|
650
663
|
#
|
651
664
|
# @see BaseInterface Interface get example
|
652
665
|
#
|
653
|
-
# @param [String]
|
654
|
-
# a resource hash for.
|
666
|
+
# @param name [String] The name of the portchannel interface to return
|
667
|
+
# a resource hash for. The name must be the full interface name of
|
655
668
|
# the desired interface.
|
656
669
|
#
|
657
|
-
# @return [nil, Hash<Symbol, Object>]
|
658
|
-
# a hash object.
|
659
|
-
# running configuration, a nil object is returned
|
670
|
+
# @return [nil, Hash<Symbol, Object>] Returns the interface resource as
|
671
|
+
# a hash object. If the specified interface does not exist in the
|
672
|
+
# running configuration, a nil object is returned.
|
660
673
|
def get(name)
|
661
674
|
config = get_block("^interface #{name}")
|
662
675
|
return nil unless config
|
@@ -672,17 +685,17 @@ module Rbeapi
|
|
672
685
|
|
673
686
|
##
|
674
687
|
# parse_members scans the nodes running config and returns all of the
|
675
|
-
# Ethernet members for the port-channel interface specified.
|
688
|
+
# Ethernet members for the port-channel interface specified. If the
|
676
689
|
# port-channel interface has no members configured, then this method will
|
677
|
-
# assign an empty array as the value for members.
|
678
|
-
# intended to be merged into the interface resource hash
|
690
|
+
# assign an empty array as the value for members. The hash returned is
|
691
|
+
# intended to be merged into the interface resource hash.
|
679
692
|
#
|
680
693
|
# @api private
|
681
694
|
#
|
682
|
-
# @param [String]
|
683
|
-
# the members for
|
695
|
+
# @param name [String] The name of the portchannel interface to extract
|
696
|
+
# the members for.
|
684
697
|
#
|
685
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
698
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
686
699
|
def parse_members(name)
|
687
700
|
grpid = name.scan(/(?<=Port-Channel)\d+/)[0]
|
688
701
|
command = "show port-channel #{grpid} all-ports"
|
@@ -694,17 +707,17 @@ module Rbeapi
|
|
694
707
|
|
695
708
|
##
|
696
709
|
# parse_lacp_mode scans the member interfaces and returns the configured
|
697
|
-
# lacp mode.
|
698
|
-
# in the port channel interface.
|
699
|
-
# for lacp_mode will be set using DEFAULT_LACP_MODE.
|
710
|
+
# lacp mode. The lacp mode value must be common across every member
|
711
|
+
# in the port channel interface. If no members are configured, the value
|
712
|
+
# for lacp_mode will be set using DEFAULT_LACP_MODE. The hash returned is
|
700
713
|
# intended to be merged into the interface resource hash
|
701
714
|
#
|
702
715
|
# @api private
|
703
716
|
#
|
704
|
-
# @param [String]
|
705
|
-
# the members from in order to get the configured lacp_mode
|
717
|
+
# @param name [String] The name of the portchannel interface to extract
|
718
|
+
# the members from in order to get the configured lacp_mode.
|
706
719
|
#
|
707
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
720
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
708
721
|
def parse_lacp_mode(name)
|
709
722
|
members = parse_members(name)[:members]
|
710
723
|
return { lacp_mode: DEFAULT_LACP_MODE } unless members
|
@@ -716,17 +729,17 @@ module Rbeapi
|
|
716
729
|
|
717
730
|
##
|
718
731
|
# parse_minimum_links scans the port-channel configuration and returns
|
719
|
-
# the value for port-channel minimum-links.
|
732
|
+
# the value for port-channel minimum-links. If the value is not found
|
720
733
|
# in the interface configuration, then DEFAULT_MIN_LINKS value is used.
|
721
734
|
# The hash returned is intended to be merged into the interface
|
722
|
-
# resource hash
|
735
|
+
# resource hash.
|
723
736
|
#
|
724
737
|
# @api private
|
725
738
|
#
|
726
|
-
# @param [String]
|
727
|
-
# the minimum links value from
|
739
|
+
# @param config [String] The interface configuration block to extract
|
740
|
+
# the minimum links value from.
|
728
741
|
#
|
729
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
742
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
730
743
|
def parse_minimum_links(config)
|
731
744
|
mdata = /port-channel min-links (\d+)$/.match(config)
|
732
745
|
{ minimum_links: mdata ? mdata[1] : DEFAULT_MIN_LINKS }
|
@@ -735,17 +748,17 @@ module Rbeapi
|
|
735
748
|
|
736
749
|
##
|
737
750
|
# parse_lacp_fallback scans the interface config block and returns the
|
738
|
-
# configured value of the lacp fallback attribute.
|
751
|
+
# configured value of the lacp fallback attribute. If the value is not
|
739
752
|
# configured, then the method will return the value of
|
740
|
-
# DEFAULT_LACP_FALLBACK.
|
741
|
-
# the interface resource hash
|
753
|
+
# DEFAULT_LACP_FALLBACK. The hash returned is intended to be merged into
|
754
|
+
# the interface resource hash.
|
742
755
|
#
|
743
756
|
# @api private
|
744
757
|
#
|
745
|
-
# @param [String]
|
746
|
-
# the lacp fallback value from
|
758
|
+
# @param config [String] The interface configuration block to extract
|
759
|
+
# the lacp fallback value from.
|
747
760
|
#
|
748
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
761
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
749
762
|
def parse_lacp_fallback(config)
|
750
763
|
mdata = /lacp fallback (static|individual)/.match(config)
|
751
764
|
{ lacp_fallback: mdata ? mdata[1] : DEFAULT_LACP_FALLBACK }
|
@@ -754,16 +767,16 @@ module Rbeapi
|
|
754
767
|
|
755
768
|
##
|
756
769
|
# parse_lacp_timeout scans the interface config block and returns the
|
757
|
-
# value of the lacp fallback timeout value.
|
758
|
-
# found in the interface configuration block.
|
759
|
-
# intended to be merged into the interface resource hash
|
770
|
+
# value of the lacp fallback timeout value. The value is expected to be
|
771
|
+
# found in the interface configuration block. The hash returned is
|
772
|
+
# intended to be merged into the interface resource hash.
|
760
773
|
#
|
761
774
|
# @api private
|
762
775
|
#
|
763
|
-
# @param [String]
|
764
|
-
# the lacp timeout value from
|
776
|
+
# @param config [String] The interface configuration block to extract
|
777
|
+
# the lacp timeout value from.
|
765
778
|
#
|
766
|
-
# @return [Hash<Symbol, Object>] resource hash attribute
|
779
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
767
780
|
def parse_lacp_timeout(config)
|
768
781
|
mdata = /lacp fallback timeout (\d+)$/.match(config)
|
769
782
|
{ lacp_timeout: mdata[1] }
|
@@ -772,31 +785,31 @@ module Rbeapi
|
|
772
785
|
|
773
786
|
##
|
774
787
|
# set_minimum_links configures the minimum physical links up required to
|
775
|
-
# consider the logical portchannel interface operationally up.
|
788
|
+
# consider the logical portchannel interface operationally up. If the
|
776
789
|
# enable keyword is false then the minimum-links is configured using the
|
777
|
-
# no keyword argument.
|
790
|
+
# no keyword argument. If the default keyword argument is provided and
|
778
791
|
# set to true, the minimum-links value is defaulted using the default
|
779
|
-
# keyword.
|
792
|
+
# keyword. The default keyword takes precedence over the enable keyword
|
780
793
|
# argument if both are provided.
|
781
794
|
#
|
782
|
-
# @eos_version 4.13.7M
|
795
|
+
# @since eos_version 4.13.7M
|
783
796
|
#
|
784
|
-
# @param [String]
|
797
|
+
# @param name [String] The interface name to apply the configuration
|
785
798
|
# values to. The name must be the full interface identifier.
|
786
799
|
#
|
787
|
-
# @param [Hash]
|
800
|
+
# @param opts [Hash] Optional keyword arguments.
|
788
801
|
#
|
789
|
-
# @option
|
790
|
-
# configure the minimum-links to in the configuration.
|
802
|
+
# @option opts value [String, Integer] Specifies the value to
|
803
|
+
# configure the minimum-links to in the configuration. Valid values
|
791
804
|
# are in the range of 1 to 16.
|
792
805
|
#
|
793
|
-
# @option
|
806
|
+
# @option opts enable [Boolean] If false then the command is
|
794
807
|
# negated. Default is true.
|
795
808
|
#
|
796
|
-
# @option
|
797
|
-
# the interface using the default keyword
|
809
|
+
# @option opts default [Boolean] Configures the minimum links value on
|
810
|
+
# the interface using the default keyword.
|
798
811
|
#
|
799
|
-
# @return [Boolean]
|
812
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
800
813
|
def set_minimum_links(name, opts = {})
|
801
814
|
commands = command_builder('port-channel min-links', opts)
|
802
815
|
configure_interface(name, commands)
|
@@ -804,22 +817,23 @@ module Rbeapi
|
|
804
817
|
|
805
818
|
##
|
806
819
|
# set_members configures the set of physical interfaces that comprise the
|
807
|
-
# logical port-channel interface.
|
820
|
+
# logical port-channel interface. The members value passed should be an
|
808
821
|
# array of physical interface names that comprise the port-channel
|
809
|
-
# interface.
|
810
|
-
# required to sync the provided members array
|
822
|
+
# interface. This method will add and remove individual members as
|
823
|
+
# required to sync the provided members array.
|
824
|
+
#
|
825
|
+
# @see add_member Adds member links to the port-channel interface.
|
811
826
|
#
|
812
|
-
# @see
|
813
|
-
# @see remove_member Removes member links from the port-channel interface
|
827
|
+
# @see remove_member Removes member links from the port-channel interface.
|
814
828
|
#
|
815
|
-
# @param [String]
|
816
|
-
# the members to.
|
817
|
-
# it will be created
|
829
|
+
# @param name [String] The name of the port-channel interface to apply
|
830
|
+
# the members to. If the port-channel interface does not already exist
|
831
|
+
# it will be created.
|
818
832
|
#
|
819
|
-
# @param [Array]
|
833
|
+
# @param members [Array] The array of physical interface members to add
|
820
834
|
# to the port-channel logical interface.
|
821
835
|
#
|
822
|
-
# @param [str]
|
836
|
+
# @param mode [str] The LACP mode to configure the member interfaces to.
|
823
837
|
# Valid values are 'on, 'passive', 'active'. When there are
|
824
838
|
# existing channel-group members and their lacp mode differs
|
825
839
|
# from this attribute, all of those members will be removed and
|
@@ -827,7 +841,7 @@ module Rbeapi
|
|
827
841
|
# is omitted, the existing lacp mode will be used for new
|
828
842
|
# member additions.
|
829
843
|
#
|
830
|
-
# @return [Boolean]
|
844
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
831
845
|
def set_members(name, members, mode = nil)
|
832
846
|
current_members = Set.new parse_members(name)[:members]
|
833
847
|
members = Set.new members
|
@@ -841,13 +855,13 @@ module Rbeapi
|
|
841
855
|
cmds = []
|
842
856
|
grpid = /(\d+)/.match(name)[0]
|
843
857
|
|
844
|
-
# remove members from the current port-channel interface
|
858
|
+
# remove members from the current port-channel interface.
|
845
859
|
current_members.difference(members).each do |intf|
|
846
860
|
cmds << "interface #{intf}"
|
847
861
|
cmds << "no channel-group #{grpid}"
|
848
862
|
end
|
849
863
|
|
850
|
-
# add new member interfaces to the port-channel
|
864
|
+
# add new member interfaces to the port-channel.
|
851
865
|
members.difference(current_members).each do |intf|
|
852
866
|
cmds << "interface #{intf}"
|
853
867
|
cmds << "channel-group #{grpid} mode #{lacp_mode}"
|
@@ -858,18 +872,18 @@ module Rbeapi
|
|
858
872
|
|
859
873
|
##
|
860
874
|
# add_member adds the interface specified in member to the port-channel
|
861
|
-
# interface specified by name in the nodes running-configuration.
|
875
|
+
# interface specified by name in the nodes running-configuration. If
|
862
876
|
# the port-channel interface does not already exist, it will be created.
|
863
877
|
#
|
864
|
-
# @eos_version 4.13.7M
|
878
|
+
# @since eos_version 4.13.7M
|
865
879
|
#
|
866
|
-
# @param [String]
|
880
|
+
# @param name [String] The name of the port-channel interface to apply
|
867
881
|
# the configuration to.
|
868
882
|
#
|
869
|
-
# @param [String]
|
883
|
+
# @param member [String] The name of the physical Ethernet interface to
|
870
884
|
# add to the logical port-channel interface.
|
871
885
|
#
|
872
|
-
# @return [Boolean]
|
886
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
873
887
|
def add_member(name, member)
|
874
888
|
lacp = parse_lacp_mode(name)[:lacp_mode]
|
875
889
|
grpid = /(\d+)/.match(name)[0]
|
@@ -881,15 +895,15 @@ module Rbeapi
|
|
881
895
|
# port-channel interface specified by name in the nodes
|
882
896
|
# running-configuration.
|
883
897
|
#
|
884
|
-
# @eos_version 4.13.7M
|
898
|
+
# @since eos_version 4.13.7M
|
885
899
|
#
|
886
|
-
# @param [String]
|
900
|
+
# @param name [String] The name of the port-channel interface to apply
|
887
901
|
# the configuration to.
|
888
902
|
#
|
889
|
-
# @param [String]
|
903
|
+
# @param member [String] The name of the physical Ethernet interface to
|
890
904
|
# remove from the logical port-channel interface.
|
891
905
|
#
|
892
|
-
# @return [Boolean]
|
906
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
893
907
|
def remove_member(name, member)
|
894
908
|
grpid = /(\d+)/.match(name)[0]
|
895
909
|
configure_interface(member, "no channel-group #{grpid}")
|
@@ -897,20 +911,20 @@ module Rbeapi
|
|
897
911
|
|
898
912
|
##
|
899
913
|
# set_lacp_mode configures the lacp mode on the port-channel interface
|
900
|
-
# by configuring the lacp mode value for each member interface.
|
914
|
+
# by configuring the lacp mode value for each member interface. This
|
901
915
|
# method will find all member interfaces for a port-channel and
|
902
916
|
# reconfigure them using the mode argument.
|
903
917
|
#
|
904
|
-
# @eos_version 4.13.7M
|
918
|
+
# @since eos_version 4.13.7M
|
905
919
|
#
|
906
|
-
# @param [String]
|
907
|
-
# values to.
|
920
|
+
# @param name [String] The interface name to apply the configuration
|
921
|
+
# values to. The name must be the full interface identifier.
|
908
922
|
#
|
909
|
-
# @param [String]
|
910
|
-
# interfaces for the port-channel.
|
911
|
-
# passive or on
|
923
|
+
# @param mode [String] The lacp mode to configure on the member
|
924
|
+
# interfaces for the port-channel. Valid values include active,
|
925
|
+
# passive or on.
|
912
926
|
#
|
913
|
-
# @return [Boolean]
|
927
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
914
928
|
def set_lacp_mode(name, mode)
|
915
929
|
return false unless %w(on passive active).include?(mode)
|
916
930
|
grpid = /(\d+)/.match(name)[0]
|
@@ -930,29 +944,29 @@ module Rbeapi
|
|
930
944
|
##
|
931
945
|
# set_lacp_fallback configures the lacp fallback mode for the
|
932
946
|
# port-channel interface. If the enable keyword is false, lacp fallback
|
933
|
-
# is configured using the no keyword argument.
|
947
|
+
# is configured using the no keyword argument. If the default option is
|
934
948
|
# specified and set to true, the lacp fallback value is configured using
|
935
|
-
# the default keyword.
|
949
|
+
# the default keyword. The default keyword takes precedence over the
|
936
950
|
# enable keyword if both options are provided.
|
937
951
|
#
|
938
|
-
# @eos_version 4.13.7M
|
952
|
+
# @since eos_version 4.13.7M
|
939
953
|
#
|
940
|
-
# @param [String]
|
941
|
-
# values to.
|
954
|
+
# @param name [String] The interface name to apply the configuration
|
955
|
+
# values to. The name must be the full interface identifier.
|
942
956
|
#
|
943
|
-
# @param [Hash]
|
957
|
+
# @param opts [Hash] Optional keyword arguments.
|
944
958
|
#
|
945
|
-
# @option
|
946
|
-
# the port-channel lacp fallback.
|
947
|
-
# static
|
959
|
+
# @option opts value [String] Specifies the value to configure for
|
960
|
+
# the port-channel lacp fallback. Valid values are individual and
|
961
|
+
# static.
|
948
962
|
#
|
949
|
-
# @option
|
963
|
+
# @option opts enable [Boolean] If false then the command is
|
950
964
|
# negated. Default is true.
|
951
965
|
#
|
952
|
-
# @option
|
953
|
-
# the interface using the default keyword
|
966
|
+
# @option opts default [Boolean] Configures the lacp fallback value on
|
967
|
+
# the interface using the default keyword.
|
954
968
|
#
|
955
|
-
# @return [Boolean]
|
969
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
956
970
|
def set_lacp_fallback(name, opts = {})
|
957
971
|
commands = command_builder('port-channel lacp fallback', opts)
|
958
972
|
configure_interface(name, commands)
|
@@ -960,29 +974,29 @@ module Rbeapi
|
|
960
974
|
|
961
975
|
##
|
962
976
|
# set_lacp_timeout configures the lacp fallback timeout for the
|
963
|
-
# port-channel interface.
|
964
|
-
# timeout is configured using the no keyword argument.
|
977
|
+
# port-channel interface. If the enable keyword is false, lacp fallback
|
978
|
+
# timeout is configured using the no keyword argument. If the default
|
965
979
|
# option is specified and set to true, the lacp fallback timeout value is
|
966
|
-
# configured using the default keyword.
|
980
|
+
# configured using the default keyword. The default keyword takes
|
967
981
|
# precedence over the enable keyword if both options are provided.
|
968
982
|
#
|
969
|
-
# @eos_version 4.13.7M
|
983
|
+
# @since eos_version 4.13.7M
|
970
984
|
#
|
971
|
-
# @param [String]
|
972
|
-
# values to.
|
985
|
+
# @param name [String] The interface name to apply the configuration
|
986
|
+
# values to. The name must be the full interface identifier.
|
973
987
|
#
|
974
|
-
# @param [Hash]
|
988
|
+
# @param opts [Hash] Optional keyword arguments.
|
975
989
|
#
|
976
|
-
# @option
|
990
|
+
# @option opts value [String] Specifies the value to configure for
|
977
991
|
# the port-channel lacp fallback timeout.
|
978
992
|
#
|
979
|
-
# @option
|
993
|
+
# @option opts enable [Boolean] If false then the command is
|
980
994
|
# negated. Default is true.
|
981
995
|
#
|
982
|
-
# @option
|
983
|
-
# value on the interface using the default keyword
|
996
|
+
# @option opts default [Boolean] Configures the lacp fallback timeout
|
997
|
+
# value on the interface using the default keyword.
|
984
998
|
#
|
985
|
-
# @return [Boolean]
|
999
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
986
1000
|
def set_lacp_timeout(name, opts = {})
|
987
1001
|
commands = command_builder('port-channel lacp fallback timeout', opts)
|
988
1002
|
configure_interface(name, commands)
|
@@ -999,7 +1013,7 @@ module Rbeapi
|
|
999
1013
|
# Returns the Vxlan interface configuration as a Ruby hash of key/value
|
1000
1014
|
# pairs from the nodes running configuration. This method extends the
|
1001
1015
|
# BaseInterface get method and adds the Vxlan specific attributes to
|
1002
|
-
# the hash
|
1016
|
+
# the hash.
|
1003
1017
|
#
|
1004
1018
|
# @example
|
1005
1019
|
# {
|
@@ -1014,12 +1028,12 @@ module Rbeapi
|
|
1014
1028
|
# vlans: <hash>
|
1015
1029
|
# }
|
1016
1030
|
#
|
1017
|
-
# @param [String]
|
1018
|
-
# configuration.
|
1031
|
+
# @param name [String] The interface name to return from the nodes
|
1032
|
+
# configuration. This optional parameter defaults to Vxlan1.
|
1019
1033
|
#
|
1020
1034
|
# @return [nil, Hash<String, String>] Returns the interface configuration
|
1021
|
-
# as a Ruby hash object.
|
1022
|
-
# then this method will return nil
|
1035
|
+
# as a Ruby hash object. If the provided interface name is not found
|
1036
|
+
# then this method will return nil.
|
1023
1037
|
def get(name = 'Vxlan1')
|
1024
1038
|
config = get_block("interface #{name}")
|
1025
1039
|
return nil unless config
|
@@ -1036,14 +1050,14 @@ module Rbeapi
|
|
1036
1050
|
|
1037
1051
|
##
|
1038
1052
|
# parse_source_interface scans the interface config block and returns the
|
1039
|
-
# value of the vxlan source-interface.
|
1040
|
-
# configured then the value of DEFAULT_SRC_INTF is used.
|
1053
|
+
# value of the vxlan source-interface. If the source-interface is not
|
1054
|
+
# configured then the value of DEFAULT_SRC_INTF is used. The hash
|
1041
1055
|
# returned is intended to be merged into the interface resource hash
|
1042
1056
|
#
|
1043
1057
|
# @api private
|
1044
1058
|
#
|
1045
|
-
# @param [String]
|
1046
|
-
# the vxlan source-interface value from
|
1059
|
+
# @param config [String] The interface configuration block to extract
|
1060
|
+
# the vxlan source-interface value from.
|
1047
1061
|
#
|
1048
1062
|
# @return [Hash<Symbol, Object>]
|
1049
1063
|
def parse_source_interface(config)
|
@@ -1054,14 +1068,14 @@ module Rbeapi
|
|
1054
1068
|
|
1055
1069
|
##
|
1056
1070
|
# parse_multicast_group scans the interface config block and returns the
|
1057
|
-
# value of the vxlan multicast-group.
|
1058
|
-
# configured then the value of DEFAULT_MCAST_GRP is used.
|
1059
|
-
# returned is intended to be merged into the interface resource hash
|
1071
|
+
# value of the vxlan multicast-group. If the multicast-group is not
|
1072
|
+
# configured then the value of DEFAULT_MCAST_GRP is used. The hash
|
1073
|
+
# returned is intended to be merged into the interface resource hash.
|
1060
1074
|
#
|
1061
1075
|
# @api private
|
1062
1076
|
#
|
1063
|
-
# @param [String]
|
1064
|
-
# the vxlan multicast-group value from
|
1077
|
+
# @param config [String] The interface configuration block to extract
|
1078
|
+
# the vxlan multicast-group value from.
|
1065
1079
|
#
|
1066
1080
|
# @return [Hash<Symbol, Object>]
|
1067
1081
|
def parse_multicast_group(config)
|
@@ -1072,14 +1086,14 @@ module Rbeapi
|
|
1072
1086
|
|
1073
1087
|
##
|
1074
1088
|
# parse_udp_port scans the interface config block and returns the value
|
1075
|
-
# of the vxlan udp-port setting.
|
1076
|
-
# always be present in the configuration.
|
1077
|
-
# to be merged into the interface resource Hash
|
1089
|
+
# of the vxlan udp-port setting. The vxlan udp-port value is expected to
|
1090
|
+
# always be present in the configuration. The returned value is intended
|
1091
|
+
# to be merged into the interface resource Hash.
|
1078
1092
|
#
|
1079
1093
|
# @api private
|
1080
1094
|
#
|
1081
|
-
# @param [String]
|
1082
|
-
# vxlan udp-port value from
|
1095
|
+
# @param config [String] The interface configuration block to parse the
|
1096
|
+
# vxlan udp-port value from.
|
1083
1097
|
#
|
1084
1098
|
# @return [Hash<Symbol, Object>]
|
1085
1099
|
def parse_udp_port(config)
|
@@ -1090,15 +1104,15 @@ module Rbeapi
|
|
1090
1104
|
|
1091
1105
|
##
|
1092
1106
|
# parse_flood_list scans the interface config block and returns the list
|
1093
|
-
# of configured VTEPs that comprise the flood list.
|
1107
|
+
# of configured VTEPs that comprise the flood list. If there are no
|
1094
1108
|
# flood list values configured, the value will return DEFAULT_FLOOD_LIST.
|
1095
1109
|
# The returned value is intended to be merged into the interface resource
|
1096
1110
|
# Hash.
|
1097
1111
|
#
|
1098
1112
|
# @api private
|
1099
1113
|
#
|
1100
|
-
# @param [String]
|
1101
|
-
# vxlan flood list values from
|
1114
|
+
# @param config [String] The interface configuration block to parse the
|
1115
|
+
# vxlan flood list values from.
|
1102
1116
|
#
|
1103
1117
|
# @return [Hash<Symbol, Object>]
|
1104
1118
|
def parse_flood_list(config)
|
@@ -1110,13 +1124,13 @@ module Rbeapi
|
|
1110
1124
|
|
1111
1125
|
##
|
1112
1126
|
# parse_vlans scans the interface config block and returns the set of
|
1113
|
-
# configured vlan to vni mappings.
|
1114
|
-
# value will return an empty Hash
|
1127
|
+
# configured vlan to vni mappings. If there are no vlans configured, the
|
1128
|
+
# value will return an empty Hash.
|
1115
1129
|
#
|
1116
1130
|
# @api private
|
1117
1131
|
#
|
1118
|
-
# @param [String]
|
1119
|
-
# vxlan flood list values from
|
1132
|
+
# @param config [String] The interface configuration block to parse the
|
1133
|
+
# vxlan flood list values from.
|
1120
1134
|
#
|
1121
1135
|
# @return [Hash<Symbol, Object>]
|
1122
1136
|
def parse_vlans(config)
|
@@ -1129,26 +1143,26 @@ module Rbeapi
|
|
1129
1143
|
private :parse_vlans
|
1130
1144
|
|
1131
1145
|
##
|
1132
|
-
# Configures the vxlan source-interface to the specified value.
|
1146
|
+
# Configures the vxlan source-interface to the specified value. This
|
1133
1147
|
# parameter should be the interface identifier of the interface to act
|
1134
|
-
# as the source for all Vxlan traffic
|
1148
|
+
# as the source for all Vxlan traffic.
|
1135
1149
|
#
|
1136
|
-
# @param [String]
|
1137
|
-
# configuration values to
|
1150
|
+
# @param name [String] The name of the interface to apply the
|
1151
|
+
# configuration values to.
|
1138
1152
|
#
|
1139
|
-
# @param [Hash]
|
1153
|
+
# @param opts [Hash] Optional keyword arguments.
|
1140
1154
|
#
|
1141
|
-
# @option
|
1142
|
-
# the specified value
|
1155
|
+
# @option opts value [String] Configures the vxlan source-interface to
|
1156
|
+
# the specified value.
|
1143
1157
|
#
|
1144
|
-
# @option
|
1158
|
+
# @option opts enable [Boolean] If false then the command is
|
1145
1159
|
# negated. Default is true.
|
1146
1160
|
#
|
1147
|
-
# @option
|
1148
|
-
# multicast-group command is configured as default.
|
1149
|
-
# option has a higher precedence than :enable
|
1161
|
+
# @option opts default [Boolean] Specifies whether or not the
|
1162
|
+
# multicast-group command is configured as default. The value of this
|
1163
|
+
# option has a higher precedence than :enable.
|
1150
1164
|
#
|
1151
|
-
# @return [Boolean] Returns true if the commands complete successfully
|
1165
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
1152
1166
|
def set_source_interface(name = 'Vxlan1', opts = {})
|
1153
1167
|
commands = command_builder('vxlan source-interface', opts)
|
1154
1168
|
configure_interface(name, commands)
|
@@ -1156,24 +1170,24 @@ module Rbeapi
|
|
1156
1170
|
|
1157
1171
|
##
|
1158
1172
|
# Configures the vxlan multicast-group flood address to the specified
|
1159
|
-
# value.
|
1173
|
+
# value. The value should be a valid multicast address.
|
1160
1174
|
#
|
1161
|
-
# @param [String]
|
1162
|
-
# configuration values to
|
1175
|
+
# @param name [String] The name of the interface to apply the
|
1176
|
+
# configuration values to.
|
1163
1177
|
#
|
1164
|
-
# @param [Hash]
|
1178
|
+
# @param opts [Hash] Optional keyword arguments.
|
1165
1179
|
#
|
1166
|
-
# @option
|
1180
|
+
# @option opts value [String] Configures the multicast-group flood
|
1167
1181
|
# address to the specified value.
|
1168
1182
|
#
|
1169
|
-
# @option
|
1183
|
+
# @option opts enable [Boolean] If false then the command is
|
1170
1184
|
# negated. Default is true.
|
1171
1185
|
#
|
1172
|
-
# @option
|
1173
|
-
# multicast-group command is configured as default.
|
1174
|
-
# option has a higher precedence than :value
|
1186
|
+
# @option opts default [Boolean] Specifies whether or not the
|
1187
|
+
# multicast-group command is configured as default. The value of this
|
1188
|
+
# option has a higher precedence than :value.
|
1175
1189
|
#
|
1176
|
-
# @return [Boolean] Returns true if the commands complete successfully
|
1190
|
+
# @return [Boolean] Returns true if the commands complete successfully.
|
1177
1191
|
def set_multicast_group(name = 'Vxlan1', opts = {})
|
1178
1192
|
commands = command_builder('vxlan multicast-group', opts)
|
1179
1193
|
configure_interface(name, commands)
|
@@ -1181,28 +1195,28 @@ module Rbeapi
|
|
1181
1195
|
|
1182
1196
|
##
|
1183
1197
|
# set_udp_port configures the Vxlan udp-port value in EOS for the
|
1184
|
-
# specified interface name.
|
1185
|
-
# no keyword is used to configure the value.
|
1186
|
-
# provided and set to true, then the default keyword is used.
|
1198
|
+
# specified interface name. If the enable keyword is false then the
|
1199
|
+
# no keyword is used to configure the value. If the default option is
|
1200
|
+
# provided and set to true, then the default keyword is used. If both
|
1187
1201
|
# options are provided, the default keyword will take precedence.
|
1188
1202
|
#
|
1189
|
-
# @eos_version 4.13.7M
|
1203
|
+
# @since eos_version 4.13.7M
|
1190
1204
|
#
|
1191
|
-
# @param [String]
|
1205
|
+
# @param name [String] The name of the vxlan interface to configure.
|
1192
1206
|
#
|
1193
|
-
# @param [Hash]
|
1207
|
+
# @param opts [Hash] Optional keyword arguments.
|
1194
1208
|
#
|
1195
|
-
# @option
|
1196
|
-
# udp-port setting to.
|
1197
|
-
# 65535
|
1209
|
+
# @option opts value [String] Specifies the value to configure the
|
1210
|
+
# udp-port setting to. Valid values are in the range of 1024 to
|
1211
|
+
# 65535.
|
1198
1212
|
#
|
1199
|
-
# @option
|
1213
|
+
# @option opts enable [Boolean] If false then the command is
|
1200
1214
|
# negated. Default is true.
|
1201
1215
|
#
|
1202
|
-
# @option
|
1203
|
-
# the interface using the default keyword
|
1216
|
+
# @option opts default [Boolean] Configures the udp-port value on
|
1217
|
+
# the interface using the default keyword.
|
1204
1218
|
#
|
1205
|
-
# @return [Boolean]
|
1219
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
1206
1220
|
def set_udp_port(name, opts = {})
|
1207
1221
|
commands = command_builder('vxlan udp-port', opts)
|
1208
1222
|
configure_interface(name, commands)
|
@@ -1210,47 +1224,49 @@ module Rbeapi
|
|
1210
1224
|
|
1211
1225
|
##
|
1212
1226
|
# add_vtep adds a new VTEP endpoint to the global flood list for the
|
1213
|
-
# specified interface.
|
1227
|
+
# specified interface. If the VTEP endpoint is already configured, this
|
1214
1228
|
# method will still return successfully.
|
1215
1229
|
#
|
1216
|
-
# @eos_version 4.13.7M
|
1230
|
+
# @since eos_version 4.13.7M
|
1231
|
+
#
|
1232
|
+
# @param name [String] The name of the interface to configure.
|
1217
1233
|
#
|
1218
|
-
# @param [String]
|
1219
|
-
# @param [String] :vtep The IP address of the remote VTEP endpoint
|
1234
|
+
# @param vtep [String] The IP address of the remote VTEP endpoint.
|
1220
1235
|
#
|
1221
|
-
# @return [Boolean] Returns true if the commands completed successfully
|
1236
|
+
# @return [Boolean] Returns true if the commands completed successfully.
|
1222
1237
|
def add_vtep(name, vtep)
|
1223
1238
|
configure_interface(name, "vxlan flood vtep add #{vtep}")
|
1224
1239
|
end
|
1225
1240
|
|
1226
1241
|
##
|
1227
1242
|
# remove_vtep deletes a VTEP endpoint from the global flood list for the
|
1228
|
-
# specified interface.
|
1243
|
+
# specified interface. If the VTEP endpoint specified is not configured,
|
1229
1244
|
# this method will still return successfully.
|
1230
1245
|
#
|
1231
|
-
# @eos_version 4.13.7M
|
1246
|
+
# @since eos_version 4.13.7M
|
1247
|
+
#
|
1248
|
+
# @param name [String] The name of the interface to configure.
|
1232
1249
|
#
|
1233
|
-
# @param [String]
|
1234
|
-
# @param [String] :vtep The IP address of the remote VTEP endpoint
|
1250
|
+
# @param vtep [String] The IP address of the remote VTEP endpoint.
|
1235
1251
|
#
|
1236
|
-
# @return [Boolean] Returns true if the commands completed successfully
|
1252
|
+
# @return [Boolean] Returns true if the commands completed successfully.
|
1237
1253
|
def remove_vtep(name, vtep)
|
1238
1254
|
configure_interface(name, "vxlan flood vtep remove #{vtep}")
|
1239
1255
|
end
|
1240
1256
|
|
1241
1257
|
##
|
1242
1258
|
# update_vlan creates a new vlan to vni mapping for the specified
|
1243
|
-
# interface in the nodes current configuration
|
1259
|
+
# interface in the nodes current configuration.
|
1244
1260
|
#
|
1245
|
-
# @eos_verson 4.13.7M
|
1261
|
+
# @since eos_verson 4.13.7M
|
1246
1262
|
#
|
1247
|
-
# @param [String]
|
1263
|
+
# @param name [String] The name of the interface to configure.
|
1248
1264
|
#
|
1249
|
-
# @param [Fixnum]
|
1265
|
+
# @param vlan [Fixnum] The VLAN ID to configure.
|
1250
1266
|
#
|
1251
|
-
# @param [Fixnum]
|
1267
|
+
# @param vni [Fixnum] The VNI value to map the VLAN into.
|
1252
1268
|
#
|
1253
|
-
# @return [Boolean]
|
1269
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
1254
1270
|
def update_vlan(name, vlan, vni)
|
1255
1271
|
configure_interface(name, "vxlan vlan #{vlan} vni #{vni}")
|
1256
1272
|
end
|
@@ -1259,15 +1275,15 @@ module Rbeapi
|
|
1259
1275
|
# remove_vlan deletes a previously configured VLAN to VNI mapping on the
|
1260
1276
|
# specified interface.
|
1261
1277
|
#
|
1262
|
-
# @eos_version 4.13.7M
|
1278
|
+
# @since eos_version 4.13.7M
|
1263
1279
|
#
|
1264
|
-
# @param [String]
|
1280
|
+
# @param name [String] the name of the interface to configure.
|
1265
1281
|
#
|
1266
|
-
# @param [Fixnum]
|
1282
|
+
# @param vlan [Fixnum] The VLAN ID to remove from the configuration. If
|
1267
1283
|
# the VLAN ID does not exist, this method will still return
|
1268
|
-
# successfully
|
1284
|
+
# successfully.
|
1269
1285
|
#
|
1270
|
-
# @return [Boolean]
|
1286
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
1271
1287
|
def remove_vlan(name, vlan)
|
1272
1288
|
configure_interface(name, "no vxlan vlan #{vlan} vni")
|
1273
1289
|
end
|