rbeapi 0.5.1 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/CHANGELOG.md +211 -76
  2. data/Gemfile +14 -3
  3. data/README.md +74 -38
  4. data/Rakefile +38 -17
  5. data/gems/inifile/inifile.spec.tmpl +31 -4
  6. data/gems/net_http_unix/net_http_unix.spec.tmpl +34 -8
  7. data/gems/netaddr/netaddr.spec.tmpl +31 -5
  8. data/guide/getting-started.rst +95 -64
  9. data/guide/installation.rst +27 -6
  10. data/guide/release-notes.rst +5 -1
  11. data/guide/testing.rst +5 -2
  12. data/guide/upgrading.rst +2 -0
  13. data/lib/rbeapi/api/dns.rb +8 -2
  14. data/lib/rbeapi/api/interfaces.rb +107 -21
  15. data/lib/rbeapi/api/ipinterfaces.rb +48 -0
  16. data/lib/rbeapi/api/prefixlists.rb +53 -23
  17. data/lib/rbeapi/api/routemaps.rb +11 -0
  18. data/lib/rbeapi/api/stp.rb +6 -3
  19. data/lib/rbeapi/api/switchports.rb +5 -11
  20. data/lib/rbeapi/api/system.rb +1 -1
  21. data/lib/rbeapi/api/users.rb +2 -0
  22. data/lib/rbeapi/api/varp.rb +6 -0
  23. data/lib/rbeapi/api/vlans.rb +44 -0
  24. data/lib/rbeapi/api/vrrp.rb +13 -0
  25. data/lib/rbeapi/client.rb +19 -4
  26. data/lib/rbeapi/switchconfig.rb +330 -0
  27. data/lib/rbeapi/version.rb +1 -1
  28. data/rbeapi.gemspec +2 -0
  29. data/rbeapi.spec.tmpl +30 -3
  30. data/spec/fixtures/.gitignore +1 -0
  31. data/spec/support/matchers/switch_config_sections.rb +80 -0
  32. data/spec/system/rbeapi/api/interfaces_base_spec.rb +32 -3
  33. data/spec/system/rbeapi/api/interfaces_ethernet_spec.rb +56 -8
  34. data/spec/system/rbeapi/api/interfaces_portchannel_spec.rb +33 -1
  35. data/spec/system/rbeapi/api/interfaces_vxlan_spec.rb +27 -0
  36. data/spec/system/rbeapi/api/ipinterfaces_spec.rb +34 -1
  37. data/spec/system/rbeapi/api/prefixlists_spec.rb +198 -0
  38. data/spec/system/rbeapi/api/stp_instances_spec.rb +49 -5
  39. data/spec/system/rbeapi/api/switchports_spec.rb +15 -9
  40. data/spec/system/rbeapi/api/vlans_spec.rb +46 -0
  41. data/spec/unit/rbeapi/api/interfaces/base_spec.rb +1 -1
  42. data/spec/unit/rbeapi/api/interfaces/ethernet_spec.rb +1 -1
  43. data/spec/unit/rbeapi/api/interfaces/portchannel_spec.rb +9 -2
  44. data/spec/unit/rbeapi/api/interfaces/vxlan_spec.rb +1 -1
  45. data/spec/unit/rbeapi/api/prefixlists/default_spec.rb +202 -0
  46. data/spec/unit/rbeapi/api/prefixlists/fixture_prefixlists.text +11 -0
  47. data/spec/unit/rbeapi/api/routemaps/default_spec.rb +5 -0
  48. data/spec/unit/rbeapi/api/switchports/default_spec.rb +4 -4
  49. data/spec/unit/rbeapi/api/system/default_spec.rb +5 -0
  50. data/spec/unit/rbeapi/api/system/fixture_system.text +1 -0
  51. data/spec/unit/rbeapi/api/vlans/default_spec.rb +30 -0
  52. data/spec/unit/rbeapi/api/vrrp/default_spec.rb +10 -0
  53. data/spec/unit/rbeapi/client_spec.rb +42 -0
  54. data/spec/unit/rbeapi/switchconfig2_spec.rb +119 -0
  55. data/spec/unit/rbeapi/switchconfig3_spec.rb +125 -0
  56. data/spec/unit/rbeapi/switchconfig_spec.rb +335 -0
  57. metadata +21 -7
@@ -33,5 +33,5 @@
33
33
  # #
34
34
  # Rbeapi toplevel namespace.
35
35
  module Rbeapi
36
- VERSION = '0.5.1'
36
+ VERSION = '1.0'
37
37
  end
data/rbeapi.gemspec CHANGED
@@ -31,4 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rspec', '~> 3.0.0'
32
32
  spec.add_development_dependency 'rspec-mocks', '~> 3.0.0'
33
33
  spec.add_development_dependency 'simplecov'
34
+
35
+ spec.required_ruby_version = '>= 1.9.3'
34
36
  end
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-document --local"
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-document --local"
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-document --local"
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', minimum_links: '0',
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, source_interface: '', multicast_group: '',
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
- speed: 'auto', forced: false, sflow: true, flowcontrol_send: 'off',
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', default: false,
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', minimum_links: '0',
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