puppet_x_eos_eapi 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +24 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.md +87 -0
  6. data/Rakefile +1 -0
  7. data/lib/puppet_x/eos/autoload.rb +57 -0
  8. data/lib/puppet_x/eos/eapi.rb +259 -0
  9. data/lib/puppet_x/eos/module_base.rb +37 -0
  10. data/lib/puppet_x/eos/modules/daemon.rb +109 -0
  11. data/lib/puppet_x/eos/modules/extension.rb +167 -0
  12. data/lib/puppet_x/eos/modules/interface.rb +180 -0
  13. data/lib/puppet_x/eos/modules/ipinterface.rb +133 -0
  14. data/lib/puppet_x/eos/modules/mlag.rb +268 -0
  15. data/lib/puppet_x/eos/modules/ntp.rb +129 -0
  16. data/lib/puppet_x/eos/modules/ospf.rb +129 -0
  17. data/lib/puppet_x/eos/modules/portchannel.rb +277 -0
  18. data/lib/puppet_x/eos/modules/radius.rb +367 -0
  19. data/lib/puppet_x/eos/modules/snmp.rb +177 -0
  20. data/lib/puppet_x/eos/modules/switchport.rb +255 -0
  21. data/lib/puppet_x/eos/modules/system.rb +138 -0
  22. data/lib/puppet_x/eos/modules/tacacs.rb +302 -0
  23. data/lib/puppet_x/eos/modules/vlan.rb +179 -0
  24. data/lib/puppet_x/eos/modules/vxlan.rb +132 -0
  25. data/lib/puppet_x/eos/provider.rb +71 -0
  26. data/lib/puppet_x/eos/version.rb +41 -0
  27. data/lib/puppet_x/net_dev/eos_api.rb +1011 -0
  28. data/lib/puppet_x/net_dev/eos_api/common_methods.rb +27 -0
  29. data/lib/puppet_x/net_dev/eos_api/snmp_methods.rb +647 -0
  30. data/lib/puppet_x/net_dev/eos_api/version.rb +8 -0
  31. data/lib/puppet_x_eos_eapi.rb +4 -0
  32. data/puppet_x_eos_eapi.gemspec +31 -0
  33. data/spec/fixtures/fixture_all_portchannel_modes.json +8 -0
  34. data/spec/fixtures/fixture_all_portchannels_detailed.json +15 -0
  35. data/spec/fixtures/fixture_create_vlan_error.json +17 -0
  36. data/spec/fixtures/fixture_create_vlan_success.json +12 -0
  37. data/spec/fixtures/fixture_eapi_conf.yaml +4 -0
  38. data/spec/fixtures/fixture_enable_configure_vlan_3111_name_foo.json +14 -0
  39. data/spec/fixtures/fixture_enable_configure_vlan_foo_name_bar.json +19 -0
  40. data/spec/fixtures/fixture_get_snmp_communities_non_existent_acl.yaml +2 -0
  41. data/spec/fixtures/fixture_get_snmp_location_westeros.json +5 -0
  42. data/spec/fixtures/fixture_portchannel_min_links_1.json +8 -0
  43. data/spec/fixtures/fixture_portchannel_min_links_2.json +8 -0
  44. data/spec/fixtures/fixture_running_config.yaml +1 -0
  45. data/spec/fixtures/fixture_running_configuration_radius_configured.yaml +30 -0
  46. data/spec/fixtures/fixture_running_configuration_radius_default.yaml +29 -0
  47. data/spec/fixtures/fixture_running_configuration_radius_server_groups.yaml +38 -0
  48. data/spec/fixtures/fixture_running_configuration_radius_servers.yaml +34 -0
  49. data/spec/fixtures/fixture_running_configuration_tacacs_configured.yaml +38 -0
  50. data/spec/fixtures/fixture_running_configuration_tacacs_default.yaml +38 -0
  51. data/spec/fixtures/fixture_running_configuration_tacacs_groups.yaml +1 -0
  52. data/spec/fixtures/fixture_running_configuration_tacacs_groups_3.yaml +43 -0
  53. data/spec/fixtures/fixture_running_configuration_tacacs_servers.yaml +41 -0
  54. data/spec/fixtures/fixture_s4_show_etherchannel_detailed.json +9 -0
  55. data/spec/fixtures/fixture_show_flowcontrol_et1.json +5 -0
  56. data/spec/fixtures/fixture_show_interfaces.json +297 -0
  57. data/spec/fixtures/fixture_show_interfaces_switchport_format_text.json +9 -0
  58. data/spec/fixtures/fixture_show_port_channel_summary_2_lags.json +9 -0
  59. data/spec/fixtures/fixture_show_port_channel_summary_static.json +9 -0
  60. data/spec/fixtures/fixture_show_snmp_community.yaml +2 -0
  61. data/spec/fixtures/fixture_show_snmp_contact_empty.json +5 -0
  62. data/spec/fixtures/fixture_show_snmp_contact_name.json +5 -0
  63. data/spec/fixtures/fixture_show_snmp_disabled.json +5 -0
  64. data/spec/fixtures/fixture_show_snmp_enabled.json +5 -0
  65. data/spec/fixtures/fixture_show_snmp_host.yaml +2 -0
  66. data/spec/fixtures/fixture_show_snmp_host_duplicates.yaml +2 -0
  67. data/spec/fixtures/fixture_show_snmp_host_more_duplicates.yaml +2 -0
  68. data/spec/fixtures/fixture_show_snmp_location_empty.json +5 -0
  69. data/spec/fixtures/fixture_show_snmp_trap.yaml +2 -0
  70. data/spec/fixtures/fixture_show_snmp_user.yaml +2 -0
  71. data/spec/fixtures/fixture_show_snmp_user_raw_text.yaml +1 -0
  72. data/spec/fixtures/fixture_show_vlan.json +37 -0
  73. data/spec/fixtures/fixture_show_vlan_3110.json +18 -0
  74. data/spec/fixtures/fixture_show_vlan_4000.json +18 -0
  75. data/spec/fixtures/fixture_snmp_host_opts.yaml +11 -0
  76. data/spec/spec_helper.rb +21 -0
  77. data/spec/support/fixtures.rb +104 -0
  78. data/spec/unit/puppet_x/eos/eapi_spec.rb +182 -0
  79. data/spec/unit/puppet_x/eos/module_base_spec.rb +26 -0
  80. data/spec/unit/puppet_x/eos/modules/daemon_spec.rb +110 -0
  81. data/spec/unit/puppet_x/eos/modules/extension_spec.rb +197 -0
  82. data/spec/unit/puppet_x/eos/modules/fixtures/daemon_getall.json +3 -0
  83. data/spec/unit/puppet_x/eos/modules/fixtures/extension_getall.json +28 -0
  84. data/spec/unit/puppet_x/eos/modules/fixtures/hostname.json +6 -0
  85. data/spec/unit/puppet_x/eos/modules/fixtures/interface_getall.json +509 -0
  86. data/spec/unit/puppet_x/eos/modules/fixtures/ipinterface_getall.json +56 -0
  87. data/spec/unit/puppet_x/eos/modules/fixtures/mlag_get.json +21 -0
  88. data/spec/unit/puppet_x/eos/modules/fixtures/mlag_get_interfaces.json +18 -0
  89. data/spec/unit/puppet_x/eos/modules/fixtures/ntp_get.json +5 -0
  90. data/spec/unit/puppet_x/eos/modules/fixtures/ospf_instance_getall.json +58 -0
  91. data/spec/unit/puppet_x/eos/modules/fixtures/portchannel_get.json +54 -0
  92. data/spec/unit/puppet_x/eos/modules/fixtures/portchannel_getlacpmode.json +5 -0
  93. data/spec/unit/puppet_x/eos/modules/fixtures/portchannel_getmembers.json +5 -0
  94. data/spec/unit/puppet_x/eos/modules/fixtures/portchannel_po1.json +7 -0
  95. data/spec/unit/puppet_x/eos/modules/fixtures/snmp_get.json +14 -0
  96. data/spec/unit/puppet_x/eos/modules/fixtures/switchport_get.json +5 -0
  97. data/spec/unit/puppet_x/eos/modules/fixtures/switchport_get_et1.json +7 -0
  98. data/spec/unit/puppet_x/eos/modules/fixtures/switchport_getall_interfaces.json +230 -0
  99. data/spec/unit/puppet_x/eos/modules/fixtures/system_domain_list.json +5 -0
  100. data/spec/unit/puppet_x/eos/modules/fixtures/system_domain_name.json +5 -0
  101. data/spec/unit/puppet_x/eos/modules/fixtures/system_hostname.json +6 -0
  102. data/spec/unit/puppet_x/eos/modules/fixtures/system_name_servers.json +5 -0
  103. data/spec/unit/puppet_x/eos/modules/fixtures/vlan_getall.json +123 -0
  104. data/spec/unit/puppet_x/eos/modules/fixtures/vxlan_get.json +24 -0
  105. data/spec/unit/puppet_x/eos/modules/interface_spec.rb +281 -0
  106. data/spec/unit/puppet_x/eos/modules/ipinterface_spec.rb +143 -0
  107. data/spec/unit/puppet_x/eos/modules/mlag_spec.rb +349 -0
  108. data/spec/unit/puppet_x/eos/modules/ntp_spec.rb +136 -0
  109. data/spec/unit/puppet_x/eos/modules/ospf_spec.rb +143 -0
  110. data/spec/unit/puppet_x/eos/modules/portchannel_spec.rb +357 -0
  111. data/spec/unit/puppet_x/eos/modules/radius_spec.rb +509 -0
  112. data/spec/unit/puppet_x/eos/modules/snmp_spec.rb +202 -0
  113. data/spec/unit/puppet_x/eos/modules/switchport_get_et1.json +7 -0
  114. data/spec/unit/puppet_x/eos/modules/switchport_spec.rb +307 -0
  115. data/spec/unit/puppet_x/eos/modules/system_spec.rb +170 -0
  116. data/spec/unit/puppet_x/eos/modules/tacacs_spec.rb +448 -0
  117. data/spec/unit/puppet_x/eos/modules/vlan_spec.rb +244 -0
  118. data/spec/unit/puppet_x/eos/modules/vxlan_spec.rb +189 -0
  119. data/spec/unit/puppet_x/eos/provider_spec.rb +35 -0
  120. data/spec/unit/puppet_x/net_dev/eos_api/common_methods_spec.rb +34 -0
  121. data/spec/unit/puppet_x/net_dev/eos_api/snmp_methods_spec.rb +842 -0
  122. data/spec/unit/puppet_x/net_dev/eos_api_spec.rb +1000 -0
  123. metadata +369 -0
@@ -0,0 +1,5 @@
1
+ [
2
+ {
3
+ "output": "ip domain-list arista.com\nip domain-list arista.net\n"
4
+ }
5
+ ]
@@ -0,0 +1,5 @@
1
+ [
2
+ {
3
+ "output": "arista.com\n"
4
+ }
5
+ ]
@@ -0,0 +1,6 @@
1
+ [
2
+ {
3
+ "fqdn": "localhost.arista.com",
4
+ "hostname": "localhost"
5
+ }
6
+ ]
@@ -0,0 +1,5 @@
1
+ [
2
+ {
3
+ "output": "1.2.3.4\n5.6.7.8\n"
4
+ }
5
+ ]
@@ -0,0 +1,123 @@
1
+ [
2
+ {
3
+ "sourceDetail": "",
4
+ "vlans": {
5
+ "100": {
6
+ "status": "active",
7
+ "name": "TEST_VLAN_100",
8
+ "interfaces": {
9
+ "Ethernet2": {
10
+ "privatePromoted": false
11
+ },
12
+ "Ethernet1": {
13
+ "privatePromoted": false
14
+ }
15
+ },
16
+ "dynamic": false
17
+ },
18
+ "101": {
19
+ "status": "active",
20
+ "name": "TEST_VLAN_101",
21
+ "interfaces": {
22
+ "Ethernet2": {
23
+ "privatePromoted": false
24
+ },
25
+ "Ethernet1": {
26
+ "privatePromoted": false
27
+ }
28
+ },
29
+ "dynamic": false
30
+ },
31
+ "102": {
32
+ "status": "active",
33
+ "name": "TEST_VLAN_102",
34
+ "interfaces": {
35
+ "Ethernet2": {
36
+ "privatePromoted": false
37
+ },
38
+ "Ethernet1": {
39
+ "privatePromoted": false
40
+ }
41
+ },
42
+ "dynamic": false
43
+ },
44
+ "103": {
45
+ "status": "active",
46
+ "name": "TEST_VLAN_103",
47
+ "interfaces": {
48
+ "Ethernet2": {
49
+ "privatePromoted": false
50
+ },
51
+ "Ethernet1": {
52
+ "privatePromoted": false
53
+ }
54
+ },
55
+ "dynamic": false
56
+ },
57
+ "104": {
58
+ "status": "active",
59
+ "name": "TEST_VLAN_104",
60
+ "interfaces": {
61
+ "Ethernet2": {
62
+ "privatePromoted": false
63
+ },
64
+ "Ethernet1": {
65
+ "privatePromoted": false
66
+ }
67
+ },
68
+ "dynamic": false
69
+ },
70
+ "105": {
71
+ "status": "active",
72
+ "name": "TEST_VLAN_105",
73
+ "interfaces": {
74
+ "Ethernet2": {
75
+ "privatePromoted": false
76
+ },
77
+ "Ethernet1": {
78
+ "privatePromoted": false
79
+ }
80
+ },
81
+ "dynamic": false
82
+ },
83
+ "4094": {
84
+ "status": "active",
85
+ "name": "MLAG_Control_Plane",
86
+ "interfaces": {
87
+ "Cpu": {
88
+ "privatePromoted": false
89
+ }
90
+ },
91
+ "dynamic": false
92
+ }
93
+ }
94
+ },
95
+ {
96
+ "trunkGroups": {
97
+ "100": {
98
+ "names": []
99
+ },
100
+ "101": {
101
+ "names": []
102
+ },
103
+ "102": {
104
+ "names": []
105
+ },
106
+ "103": {
107
+ "names": []
108
+ },
109
+ "104": {
110
+ "names": []
111
+ },
112
+ "105": {
113
+ "names": []
114
+ },
115
+ "4094": {
116
+ "names": [
117
+ "mlag1",
118
+ "mlag2"
119
+ ]
120
+ }
121
+ }
122
+ }
123
+ ]
@@ -0,0 +1,24 @@
1
+ [
2
+ {
3
+ "interfaces": {
4
+ "Vxlan1": {
5
+ "vniInDottedNotation": false,
6
+ "name": "Vxlan1",
7
+ "interfaceStatus": "notconnect",
8
+ "description": "",
9
+ "vlanToVtepList": {},
10
+ "mtu": 0,
11
+ "hardware": "vxlan",
12
+ "replicationMode": "unknown",
13
+ "bandwidth": 0,
14
+ "floodMcastGrp": "239.10.10.10",
15
+ "vlanToVniMap": {},
16
+ "srcIpIntf": "Loopback0",
17
+ "srcIpAddr": "0.0.0.0",
18
+ "interfaceAddress": [],
19
+ "lineProtocolStatus": "down",
20
+ "forwardingModel": "bridged"
21
+ }
22
+ }
23
+ }
24
+ ]
@@ -0,0 +1,281 @@
1
+ #
2
+ # Copyright (c) 2014, 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
+ require 'spec_helper'
33
+ require 'puppet_x/eos/modules/interface'
34
+
35
+ describe PuppetX::Eos::Interface do
36
+ let(:eapi) { double }
37
+ let(:instance) { PuppetX::Eos::Interface.new eapi }
38
+
39
+ context 'when initializing a new Interface instance' do
40
+ subject { instance }
41
+ it { is_expected.to be_a_kind_of PuppetX::Eos::Interface }
42
+ end
43
+
44
+ context 'with Eapi#enable' do
45
+ before :each do
46
+ allow(eapi).to receive(:enable)
47
+ .with(commands)
48
+ .and_return(api_response)
49
+ end
50
+
51
+ context '#getall' do
52
+ subject { instance.getall }
53
+
54
+ describe 'retrieve all interfaces' do
55
+ let(:commands) { ['show interfaces', 'show interfaces flowcontrol'] }
56
+
57
+ let :api_response do
58
+ dir = File.dirname(__FILE__)
59
+ file = File.join(dir, 'fixtures/interface_getall.json')
60
+ JSON.load(File.read(file))
61
+ end
62
+
63
+ it { is_expected.to be_a_kind_of Array }
64
+
65
+ it 'should contain one entry' do
66
+ expect(subject.size).to eq 1
67
+ end
68
+
69
+ it 'should have an entry for interfaces' do
70
+ expect(subject[0]).to have_key 'interfaces'
71
+ end
72
+
73
+ it 'should have an entry for interfaceFlowControls' do
74
+ expect(subject[0]).to have_key 'interfaceFlowControls'
75
+ end
76
+
77
+ it 'has interfaces with a 1:1 mapping to interfaceFlowControls' do
78
+ subject[0]['interfaces'].keys do |intf|
79
+ expect(subject[0]['interfaceFlowControls']).to have_key intf
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ context 'with Eapi#config' do
87
+ before :each do
88
+ allow(eapi).to receive(:config)
89
+ .with(commands)
90
+ .and_return(response)
91
+ end
92
+
93
+ context '#default' do
94
+ subject { instance.default(name) }
95
+
96
+ %w(Ethernet1 Ethernet1/1).each do |intf|
97
+ describe 'default interface #{intf}' do
98
+ let(:name) { intf }
99
+ let(:commands) { "default interface #{name}" }
100
+ let(:response) { [{}] }
101
+
102
+ it { is_expected.to be_truthy }
103
+ end
104
+ end
105
+ end
106
+
107
+ context '#create' do
108
+ subject { instance.create(name) }
109
+
110
+ %w(Ethernet1 Ethernet1/1).each do |intf|
111
+ context 'when the interface is physical' do
112
+ let(:name) { intf }
113
+ let(:commands) { "interface #{name}" }
114
+ let(:response) { nil }
115
+
116
+ describe 'the interface already exists' do
117
+ it { is_expected.to be_falsey }
118
+ end
119
+ end
120
+ end
121
+
122
+ %w(Vlan124, Port-Channel10).each do |intf|
123
+ context 'when the interface is logical' do
124
+ let(:name) { intf }
125
+ let(:commands) { "interface #{name}" }
126
+ let(:response) { [{}] }
127
+
128
+ describe 'the interface does not exist' do
129
+ it { is_expected.to be_truthy }
130
+ end
131
+ end
132
+ end
133
+ end
134
+
135
+ context '#delete' do
136
+ subject { instance.delete(name) }
137
+
138
+ %w(Ethernet1 Ethernet1/1 Management1).each do |intf|
139
+ describe "try to delete physical interface #{intf}" do
140
+ let(:name) { intf }
141
+ let(:commands) { "no interface #{name}" }
142
+ let(:response) { nil }
143
+
144
+ it { is_expected.to be_falsey }
145
+ end
146
+ end
147
+
148
+ %w(Vlan124 Port-Channel10).each do |intf|
149
+ describe "delete logical interface #{intf}" do
150
+ let(:name) { intf }
151
+ let(:commands) { "no interface #{name}" }
152
+ let(:response) { [{}] }
153
+ it { is_expected.to be_truthy }
154
+ end
155
+ end
156
+ end
157
+
158
+ context '#set_description' do
159
+ subject { instance.set_description(name, opts) }
160
+
161
+ let(:opts) { { value: value, default: default } }
162
+ let(:default) { false }
163
+ let(:value) { nil }
164
+
165
+ %w(Ethernet1 Ethernet1/1).each do |intf|
166
+ describe "configure interface description for #{intf}" do
167
+ let(:name) { intf }
168
+ let(:value) { 'this is a test' }
169
+ let(:commands) { ["interface #{name}", "description #{value}"] }
170
+ let(:response) { [{}, {}] }
171
+ it { is_expected.to be_truthy }
172
+ end
173
+
174
+ describe "configure default interface description #{intf}" do
175
+ let(:name) { intf }
176
+ let(:default) { true }
177
+ let(:commands) { ["interface #{name}", 'default description'] }
178
+ let(:response) { [{}, {}] }
179
+ it { is_expected.to be_truthy }
180
+ end
181
+
182
+ describe "configure no interface description for #{intf}" do
183
+ let(:name) { intf }
184
+ let(:commands) { ["interface #{name}", 'no description'] }
185
+ let(:response) { [{}, {}] }
186
+ it { is_expected.to be_truthy }
187
+ end
188
+ end
189
+ end
190
+
191
+ context '#set_shutdown' do
192
+ subject { instance.set_shutdown(name, opts) }
193
+
194
+ let(:opts) { { value: value, default: default } }
195
+ let(:default) { false }
196
+ let(:value) { nil }
197
+
198
+ %w(Ethernet1 Ethernet1/1).each do |intf|
199
+ describe "configure shutdown=false for #{intf}" do
200
+ let(:name) { intf }
201
+ let(:value) { false }
202
+ let(:commands) { ["interface #{name}", 'no shutdown'] }
203
+ let(:response) { [{}, {}] }
204
+ it { is_expected.to be_truthy }
205
+ end
206
+
207
+ describe "configure shutdown=true for #{intf}" do
208
+ let(:name) { intf }
209
+ let(:value) { true }
210
+ let(:commands) { ["interface #{name}", 'shutdown'] }
211
+ let(:response) { [{}, {}] }
212
+ it { is_expected.to be_truthy }
213
+ end
214
+
215
+ describe 'configure default interface shutdown' do
216
+ let(:name) { intf }
217
+ let(:default) { true }
218
+ let(:commands) { ["interface #{name}", 'default shutdown'] }
219
+ let(:response) { [{}, {}] }
220
+ it { is_expected.to be_truthy }
221
+ end
222
+
223
+ describe "negate interface shutdown for #{intf}" do
224
+ let(:name) { intf }
225
+ let(:commands) { ["interface #{name}", 'no shutdown'] }
226
+ let(:response) { [{}, {}] }
227
+ it { is_expected.to be_truthy }
228
+ end
229
+ end
230
+ end
231
+
232
+ context '#set_flowcontrol' do
233
+ subject { instance.set_flowcontrol(name, direction, opts) }
234
+
235
+ let(:opts) { { value: value, default: default } }
236
+ let(:default) { false }
237
+ let(:value) { nil }
238
+
239
+ %w(Ethernet1 Ethernet1/1).each do |intf|
240
+ %w(send receive).each do |direction|
241
+ %w(on off desired).each do |state|
242
+ describe 'configure flowcontrol on interface' do
243
+ let(:name) { intf }
244
+ let(:direction) { direction }
245
+ let(:value) { state }
246
+ let(:commands) do
247
+ ["interface #{name}", "flowcontrol #{direction} #{state}"]
248
+ end
249
+ let(:response) { [{}, {}] }
250
+
251
+ it { is_expected.to be_truthy }
252
+ end
253
+ end
254
+
255
+ describe 'configuring flowcontrol default' do
256
+ let(:name) { intf }
257
+ let(:direction) { direction }
258
+ let(:default) { true }
259
+ let(:commands) do
260
+ ["interface #{name}", "default flowcontrol #{direction}"]
261
+ end
262
+ let(:response) { [{}, {}] }
263
+
264
+ it { is_expected.to be_truthy }
265
+ end
266
+
267
+ describe 'negating flowcontrol' do
268
+ let(:name) { intf }
269
+ let(:direction) { direction }
270
+ let(:commands) do
271
+ ["interface #{name}", "no flowcontrol #{direction}"]
272
+ end
273
+ let(:response) { [{}, {}] }
274
+
275
+ it { is_expected.to be_truthy }
276
+ end
277
+ end
278
+ end
279
+ end
280
+ end
281
+ end