rbeapi 0.5.1 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +211 -76
- data/Gemfile +14 -3
- data/README.md +74 -38
- data/Rakefile +38 -17
- data/gems/inifile/inifile.spec.tmpl +31 -4
- data/gems/net_http_unix/net_http_unix.spec.tmpl +34 -8
- data/gems/netaddr/netaddr.spec.tmpl +31 -5
- data/guide/getting-started.rst +95 -64
- data/guide/installation.rst +27 -6
- data/guide/release-notes.rst +5 -1
- data/guide/testing.rst +5 -2
- data/guide/upgrading.rst +2 -0
- data/lib/rbeapi/api/dns.rb +8 -2
- data/lib/rbeapi/api/interfaces.rb +107 -21
- data/lib/rbeapi/api/ipinterfaces.rb +48 -0
- data/lib/rbeapi/api/prefixlists.rb +53 -23
- data/lib/rbeapi/api/routemaps.rb +11 -0
- data/lib/rbeapi/api/stp.rb +6 -3
- data/lib/rbeapi/api/switchports.rb +5 -11
- data/lib/rbeapi/api/system.rb +1 -1
- data/lib/rbeapi/api/users.rb +2 -0
- data/lib/rbeapi/api/varp.rb +6 -0
- data/lib/rbeapi/api/vlans.rb +44 -0
- data/lib/rbeapi/api/vrrp.rb +13 -0
- data/lib/rbeapi/client.rb +19 -4
- data/lib/rbeapi/switchconfig.rb +330 -0
- data/lib/rbeapi/version.rb +1 -1
- data/rbeapi.gemspec +2 -0
- data/rbeapi.spec.tmpl +30 -3
- data/spec/fixtures/.gitignore +1 -0
- data/spec/support/matchers/switch_config_sections.rb +80 -0
- data/spec/system/rbeapi/api/interfaces_base_spec.rb +32 -3
- data/spec/system/rbeapi/api/interfaces_ethernet_spec.rb +56 -8
- data/spec/system/rbeapi/api/interfaces_portchannel_spec.rb +33 -1
- data/spec/system/rbeapi/api/interfaces_vxlan_spec.rb +27 -0
- data/spec/system/rbeapi/api/ipinterfaces_spec.rb +34 -1
- data/spec/system/rbeapi/api/prefixlists_spec.rb +198 -0
- data/spec/system/rbeapi/api/stp_instances_spec.rb +49 -5
- data/spec/system/rbeapi/api/switchports_spec.rb +15 -9
- data/spec/system/rbeapi/api/vlans_spec.rb +46 -0
- data/spec/unit/rbeapi/api/interfaces/base_spec.rb +1 -1
- data/spec/unit/rbeapi/api/interfaces/ethernet_spec.rb +1 -1
- data/spec/unit/rbeapi/api/interfaces/portchannel_spec.rb +9 -2
- data/spec/unit/rbeapi/api/interfaces/vxlan_spec.rb +1 -1
- data/spec/unit/rbeapi/api/prefixlists/default_spec.rb +202 -0
- data/spec/unit/rbeapi/api/prefixlists/fixture_prefixlists.text +11 -0
- data/spec/unit/rbeapi/api/routemaps/default_spec.rb +5 -0
- data/spec/unit/rbeapi/api/switchports/default_spec.rb +4 -4
- data/spec/unit/rbeapi/api/system/default_spec.rb +5 -0
- data/spec/unit/rbeapi/api/system/fixture_system.text +1 -0
- data/spec/unit/rbeapi/api/vlans/default_spec.rb +30 -0
- data/spec/unit/rbeapi/api/vrrp/default_spec.rb +10 -0
- data/spec/unit/rbeapi/client_spec.rb +42 -0
- data/spec/unit/rbeapi/switchconfig2_spec.rb +119 -0
- data/spec/unit/rbeapi/switchconfig3_spec.rb +125 -0
- data/spec/unit/rbeapi/switchconfig_spec.rb +335 -0
- metadata +21 -7
data/lib/rbeapi/version.rb
CHANGED
data/rbeapi.gemspec
CHANGED
data/rbeapi.spec.tmpl
CHANGED
@@ -31,6 +31,18 @@ The library is freely provided to the open source community for building robust
|
|
31
31
|
applications using Arista EOS eAPI. Support is provided as best effort through
|
32
32
|
Github iusses.
|
33
33
|
|
34
|
+
%package chef
|
35
|
+
Summary: Arista eAPI Ruby Library for Chef clients
|
36
|
+
Group: Development/Languages
|
37
|
+
Requires: chef
|
38
|
+
Requires: chef-rubygem(net_http_unix)
|
39
|
+
Requires: chef-rubygem(inifile)
|
40
|
+
Requires: chef-rubygem(netaddr)
|
41
|
+
Provides: chef-rubygem(%{gem_name}) = %{version}
|
42
|
+
Provides: chef-rubygem-%{gem_name} = %{version}
|
43
|
+
%description chef
|
44
|
+
The Ruby eAPI Client for Chef clients
|
45
|
+
|
34
46
|
%package puppet3
|
35
47
|
Summary: Arista eAPI Ruby Library Puppet Enterprise 3.x agents
|
36
48
|
Group: Development/Languages
|
@@ -66,6 +78,9 @@ install %{SOURCE0} %{buildroot}/
|
|
66
78
|
%files
|
67
79
|
/%{gem_name}-%{version}.gem
|
68
80
|
|
81
|
+
%files chef
|
82
|
+
/%{gem_name}-%{version}.gem
|
83
|
+
|
69
84
|
%files puppet3
|
70
85
|
/%{gem_name}-%{version}.gem
|
71
86
|
|
@@ -73,15 +88,24 @@ install %{SOURCE0} %{buildroot}/
|
|
73
88
|
/%{gem_name}-%{version}.gem
|
74
89
|
|
75
90
|
%post
|
76
|
-
GEM_OPTS="--no-
|
91
|
+
GEM_OPTS="--no-rdoc --no-ri --local"
|
77
92
|
gem install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
78
93
|
|
79
94
|
%preun
|
80
95
|
gem uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
81
96
|
|
97
|
+
%post chef
|
98
|
+
GEM=/opt/chef/embedded/bin/gem
|
99
|
+
GEM_OPTS="--no-document --local"
|
100
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
101
|
+
|
102
|
+
%preun chef
|
103
|
+
GEM=/opt/chef/embedded/bin/gem
|
104
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
105
|
+
|
82
106
|
%post puppet3
|
83
107
|
GEM=/opt/puppet/bin/gem
|
84
|
-
GEM_OPTS="--no-
|
108
|
+
GEM_OPTS="--no-rdoc --no-ri --local"
|
85
109
|
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
86
110
|
|
87
111
|
%preun puppet3
|
@@ -90,7 +114,7 @@ ${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
|
90
114
|
|
91
115
|
%post puppet-aio
|
92
116
|
GEM=/opt/puppetlabs/puppet/bin/gem
|
93
|
-
GEM_OPTS="--no-
|
117
|
+
GEM_OPTS="--no-rdoc --no-ri --local"
|
94
118
|
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
95
119
|
|
96
120
|
%preun puppet-aio
|
@@ -98,6 +122,9 @@ GEM=/opt/puppetlabs/puppet/bin/gem
|
|
98
122
|
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
99
123
|
|
100
124
|
%changelog
|
125
|
+
* Tue May 24 2016 Jere Julian - 0.6.0-1
|
126
|
+
- Add Chef sub-package
|
127
|
+
|
101
128
|
* Fri Oct 30 2015 Jere Julian - 0.4.0-1
|
102
129
|
- Detect the location of the puppet-agent's gem install
|
103
130
|
|
@@ -0,0 +1 @@
|
|
1
|
+
dut.conf
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2016, Arista Networks, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are
|
7
|
+
# met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
|
33
|
+
def get_child(section, line)
|
34
|
+
section.children.each do |child|
|
35
|
+
return child if child.line == line
|
36
|
+
end
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def section_compare(section1, section2)
|
41
|
+
# Verify lines are the same
|
42
|
+
return false unless section1.line == section2.line
|
43
|
+
|
44
|
+
# Verify cmds are the same
|
45
|
+
c1 = Set.new(section1.cmds)
|
46
|
+
c2 = Set.new(section2.cmds)
|
47
|
+
return false unless c1 == c2
|
48
|
+
|
49
|
+
# Return false if the number of children are different
|
50
|
+
return false unless section1.children.length == section2.children.length
|
51
|
+
|
52
|
+
# Using a depth first search to recursively descend through the
|
53
|
+
# children doing a comparison.
|
54
|
+
section1.children.each do |s1_child|
|
55
|
+
s2_child = get_child(section2, s1_child.line)
|
56
|
+
return false unless s2_child
|
57
|
+
return false unless section_compare(s1_child, s2_child)
|
58
|
+
end
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
RSpec::Matchers.define :section_equal do |expected|
|
63
|
+
if expected.class != Rbeapi::SwitchConfig::Section
|
64
|
+
fail 'expected is not a Rbeapi::SwitchConfig::Section class'
|
65
|
+
end
|
66
|
+
|
67
|
+
match do |actual|
|
68
|
+
if actual.class != Rbeapi::SwitchConfig::Section
|
69
|
+
fail 'actual is not a Rbeapi::SwitchConfig::Section class'
|
70
|
+
end
|
71
|
+
|
72
|
+
section_compare(actual, expected)
|
73
|
+
end
|
74
|
+
|
75
|
+
description do
|
76
|
+
'Verifies contents of section with a deep class comparison.'
|
77
|
+
end
|
78
|
+
|
79
|
+
diffable
|
80
|
+
end
|
@@ -20,7 +20,8 @@ describe Rbeapi::Api::Interfaces do
|
|
20
20
|
describe '#get' do
|
21
21
|
context 'with interface Loopback' do
|
22
22
|
let(:entity) do
|
23
|
-
{ name: 'Loopback0', type: 'generic', description: '', shutdown: false
|
23
|
+
{ name: 'Loopback0', type: 'generic', description: '', shutdown: false,
|
24
|
+
load_interval: '' }
|
24
25
|
end
|
25
26
|
|
26
27
|
before { node.config(['no interface Loopback0', 'interface Loopback0']) }
|
@@ -33,7 +34,8 @@ describe Rbeapi::Api::Interfaces do
|
|
33
34
|
context 'with interface Port-Channel' do
|
34
35
|
let(:entity) do
|
35
36
|
{ name: 'Port-Channel1', type: 'portchannel', description: '',
|
36
|
-
shutdown: false, members: [], lacp_mode: 'on',
|
37
|
+
shutdown: false, load_interval: '', members: [], lacp_mode: 'on',
|
38
|
+
minimum_links: '0',
|
37
39
|
lacp_fallback: 'disabled', lacp_timeout: '90' }
|
38
40
|
end
|
39
41
|
|
@@ -50,7 +52,8 @@ describe Rbeapi::Api::Interfaces do
|
|
50
52
|
context 'with interface Vxlan' do
|
51
53
|
let(:entity) do
|
52
54
|
{ name: 'Vxlan1', type: 'vxlan', description: '',
|
53
|
-
shutdown: false,
|
55
|
+
shutdown: false, load_interval: '', source_interface: '',
|
56
|
+
multicast_group: '',
|
54
57
|
udp_port: 4789, flood_list: [], vlans: {} }
|
55
58
|
end
|
56
59
|
|
@@ -131,4 +134,30 @@ describe Rbeapi::Api::Interfaces do
|
|
131
134
|
expect(subject.get('Loopback0')[:shutdown]).to be_falsy
|
132
135
|
end
|
133
136
|
end
|
137
|
+
|
138
|
+
describe '#set_load_interval' do
|
139
|
+
before do
|
140
|
+
node.config(['interface Loopback0', 'default load-interval'])
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'sets the load-interval value on the interface' do
|
144
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('')
|
145
|
+
expect(subject.set_load_interval('Loopback0', value: '10')).to be_truthy
|
146
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('10')
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'negates the load-interval' do
|
150
|
+
expect(subject.set_load_interval('Loopback0', value: '20')).to be_truthy
|
151
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('20')
|
152
|
+
expect(subject.set_load_interval('Loopback0', enable: false)).to be_truthy
|
153
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('')
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'defaults the load-interval' do
|
157
|
+
expect(subject.set_load_interval('Loopback0', value: '10')).to be_truthy
|
158
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('10')
|
159
|
+
expect(subject.set_load_interval('Loopback0', default: true)).to be_truthy
|
160
|
+
expect(subject.get('Loopback0')[:load_interval]).to eq('')
|
161
|
+
end
|
162
|
+
end
|
134
163
|
end
|
@@ -15,8 +15,9 @@ describe Rbeapi::Api::Interfaces do
|
|
15
15
|
describe '#get' do
|
16
16
|
let(:entity) do
|
17
17
|
{ name: 'Ethernet1', type: 'ethernet', description: '', shutdown: false,
|
18
|
-
|
19
|
-
flowcontrol_receive: 'off'
|
18
|
+
load_interval: '', speed: 'default', sflow: true,
|
19
|
+
flowcontrol_send: 'off', flowcontrol_receive: 'off',
|
20
|
+
lacp_priority: '32768' }
|
20
21
|
end
|
21
22
|
|
22
23
|
before { node.config(['default interface Ethernet1']) }
|
@@ -89,13 +90,8 @@ describe Rbeapi::Api::Interfaces do
|
|
89
90
|
describe '#set_speed' do
|
90
91
|
before { node.config(['default interface Ethernet1']) }
|
91
92
|
|
92
|
-
it 'sets default true' do
|
93
|
-
expect(subject.set_speed('Ethernet1', default: true)).to be_truthy
|
94
|
-
end
|
95
|
-
|
96
93
|
it 'sets enable true' do
|
97
|
-
expect(subject.set_speed('Ethernet1',
|
98
|
-
enable: true)).to be_falsy
|
94
|
+
expect(subject.set_speed('Ethernet1', enable: true)).to be_falsy
|
99
95
|
end
|
100
96
|
end
|
101
97
|
|
@@ -150,4 +146,56 @@ describe Rbeapi::Api::Interfaces do
|
|
150
146
|
expect(subject.get('Ethernet1')[:flowcontrol_receive]).to eq('off')
|
151
147
|
end
|
152
148
|
end
|
149
|
+
|
150
|
+
describe '#set_load_interval' do
|
151
|
+
before do
|
152
|
+
node.config(['interface Ethernet1', 'default load-interval'])
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'sets the load-interval value on the interface' do
|
156
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
157
|
+
expect(subject.set_load_interval('Ethernet1', value: '10')).to be_truthy
|
158
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('10')
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'negates the load-interval' do
|
162
|
+
expect(subject.set_load_interval('Ethernet1', value: '20')).to be_truthy
|
163
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('20')
|
164
|
+
expect(subject.set_load_interval('Ethernet1', enable: false)).to be_truthy
|
165
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'defaults the load-interval' do
|
169
|
+
expect(subject.set_load_interval('Ethernet1', value: '10')).to be_truthy
|
170
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('10')
|
171
|
+
expect(subject.set_load_interval('Ethernet1', default: true)).to be_truthy
|
172
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe '#set_lacp_priority' do
|
177
|
+
before do
|
178
|
+
node.config(['interface Ethernet1', 'default lacp port-priority'])
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'sets the lacp port-priority value on the interface' do
|
182
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('32768')
|
183
|
+
expect(subject.set_lacp_priority('Ethernet1', value: '0')).to be_truthy
|
184
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('0')
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'negates the lacp port-priority' do
|
188
|
+
expect(subject.set_lacp_priority('Ethernet1', value: '1')).to be_truthy
|
189
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('1')
|
190
|
+
expect(subject.set_lacp_priority('Ethernet1', enable: false)).to be_truthy
|
191
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('32768')
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'defaults the lacp port-priority' do
|
195
|
+
expect(subject.set_lacp_priority('Ethernet1', value: '2')).to be_truthy
|
196
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('2')
|
197
|
+
expect(subject.set_lacp_priority('Ethernet1', default: true)).to be_truthy
|
198
|
+
expect(subject.get('Ethernet1')[:lacp_priority]).to eq('32768')
|
199
|
+
end
|
200
|
+
end
|
153
201
|
end
|
@@ -14,7 +14,8 @@ describe Rbeapi::Api::Interfaces do
|
|
14
14
|
describe '#get' do
|
15
15
|
let(:entity) do
|
16
16
|
{ name: 'Port-Channel1', type: 'portchannel', description: '',
|
17
|
-
shutdown: false, members: [], lacp_mode: 'on',
|
17
|
+
shutdown: false, load_interval: '', members: [], lacp_mode: 'on',
|
18
|
+
minimum_links: '0',
|
18
19
|
lacp_timeout: '90', lacp_fallback: 'disabled' }
|
19
20
|
end
|
20
21
|
|
@@ -270,4 +271,35 @@ describe Rbeapi::Api::Interfaces do
|
|
270
271
|
expect(subject.get('Port-Channel1')[:lacp_timeout]).to eq('100')
|
271
272
|
end
|
272
273
|
end
|
274
|
+
|
275
|
+
describe '#set_load_interval' do
|
276
|
+
before do
|
277
|
+
node.config(['interface Port-Channel1', 'default load-interval'])
|
278
|
+
end
|
279
|
+
|
280
|
+
it 'sets the load-interval value on the interface' do
|
281
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('')
|
282
|
+
expect(subject.set_load_interval('Port-Channel1',
|
283
|
+
value: '10')).to be_truthy
|
284
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('10')
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'negates the load-interval' do
|
288
|
+
expect(subject.set_load_interval('Port-Channel1',
|
289
|
+
value: '20')).to be_truthy
|
290
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('20')
|
291
|
+
expect(subject.set_load_interval('Port-Channel1',
|
292
|
+
enable: false)).to be_truthy
|
293
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('')
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'defaults the load-interval' do
|
297
|
+
expect(subject.set_load_interval('Port-Channel1',
|
298
|
+
value: '10')).to be_truthy
|
299
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('10')
|
300
|
+
expect(subject.set_load_interval('Port-Channel1',
|
301
|
+
default: true)).to be_truthy
|
302
|
+
expect(subject.get('Port-Channel1')[:load_interval]).to eq('')
|
303
|
+
end
|
304
|
+
end
|
273
305
|
end
|
@@ -14,6 +14,7 @@ describe Rbeapi::Api::Interfaces do
|
|
14
14
|
describe '#get' do
|
15
15
|
let(:entity) do
|
16
16
|
{ name: 'Vxlan1', type: 'vxlan', description: '', shutdown: false,
|
17
|
+
load_interval: '',
|
17
18
|
source_interface: '', multicast_group: '', udp_port: 4789,
|
18
19
|
flood_list: [], vlans: {} }
|
19
20
|
end
|
@@ -91,6 +92,32 @@ describe Rbeapi::Api::Interfaces do
|
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
95
|
+
describe '#set_load_interval' do
|
96
|
+
before do
|
97
|
+
node.config(['interface Vxlan1', 'default load-interval'])
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'sets the load-interval value on the interface' do
|
101
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('')
|
102
|
+
expect(subject.set_load_interval('Vxlan1', value: '10')).to be_truthy
|
103
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('10')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'negates the load-interval' do
|
107
|
+
expect(subject.set_load_interval('Vxlan1', value: '20')).to be_truthy
|
108
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('20')
|
109
|
+
expect(subject.set_load_interval('Vxlan1', enable: false)).to be_truthy
|
110
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('')
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'defaults the load-interval' do
|
114
|
+
expect(subject.set_load_interval('Vxlan1', value: '10')).to be_truthy
|
115
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('10')
|
116
|
+
expect(subject.set_load_interval('Vxlan1', default: true)).to be_truthy
|
117
|
+
expect(subject.get('Vxlan1')[:load_interval]).to eq('')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
94
121
|
describe '#set_source_interface' do
|
95
122
|
before { node.config(['no interface Vxlan1', 'interface Vxlan1']) }
|
96
123
|
|
@@ -13,7 +13,8 @@ describe Rbeapi::Api::Ipinterfaces do
|
|
13
13
|
|
14
14
|
describe '#get' do
|
15
15
|
let(:entity) do
|
16
|
-
{ address: '77.99.99.99/24', mtu: '1500', helper_addresses: []
|
16
|
+
{ address: '77.99.99.99/24', mtu: '1500', helper_addresses: [],
|
17
|
+
load_interval: '' }
|
17
18
|
end
|
18
19
|
|
19
20
|
before do
|
@@ -150,5 +151,37 @@ describe Rbeapi::Api::Ipinterfaces do
|
|
150
151
|
.to be_truthy
|
151
152
|
expect(subject.get('Ethernet1')[:helper_addresses].sort).to be_empty
|
152
153
|
end
|
154
|
+
|
155
|
+
it 'raises an ArgumentError if opts value is not an array' do
|
156
|
+
expect { subject.set_helper_addresses('Ethernet1', value: '123') }
|
157
|
+
.to raise_error(ArgumentError)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '#set_load_interval' do
|
162
|
+
before do
|
163
|
+
node.config(['default interface Ethernet1', 'interface Ethernet1',
|
164
|
+
'no switchport'])
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'sets the load-interval value on the interface' do
|
168
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
169
|
+
expect(subject.set_load_interval('Ethernet1', value: '10')).to be_truthy
|
170
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('10')
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'negates the load-interval' do
|
174
|
+
expect(subject.set_load_interval('Ethernet1', value: '20')).to be_truthy
|
175
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('20')
|
176
|
+
expect(subject.set_load_interval('Ethernet1', enable: false)).to be_truthy
|
177
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'defaults the load-interval' do
|
181
|
+
expect(subject.set_load_interval('Ethernet1', value: '10')).to be_truthy
|
182
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('10')
|
183
|
+
expect(subject.set_load_interval('Ethernet1', default: true)).to be_truthy
|
184
|
+
expect(subject.get('Ethernet1')[:load_interval]).to eq('')
|
185
|
+
end
|
153
186
|
end
|
154
187
|
end
|