rbeapi 1.1 → 1.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +33 -24
- data/README.md +49 -47
- data/Rakefile +2 -0
- data/lib/rbeapi/api/iphosts.rb +157 -0
- data/lib/rbeapi/api/ntp.rb +235 -10
- data/lib/rbeapi/api/snmp.rb +1 -1
- data/lib/rbeapi/api/system.rb +35 -0
- data/lib/rbeapi/version.rb +1 -1
- data/spec/fixtures/dut.conf +6 -3
- data/spec/support/fixtures.rb +1 -1
- data/spec/system/rbeapi/api/iphost_spec.rb +142 -0
- data/spec/system/rbeapi/api/managementdefaults_spec.rb +1 -0
- data/spec/system/rbeapi/api/ntp_spec.rb +161 -11
- data/spec/system/rbeapi/api/staticroutes_spec.rb +2 -1
- data/spec/system/rbeapi/api/system_spec.rb +22 -2
- data/spec/system/rbeapi/api/users_spec.rb +1 -1
- data/spec/system/rbeapi/api/varp_spec.rb +12 -9
- data/spec/system/rbeapi/client_spec.rb +5 -5
- data/spec/unit/rbeapi/api/iphost/default_spec.rb +125 -0
- data/spec/unit/rbeapi/api/iphost/fixture_iphosts.text +3 -0
- data/spec/unit/rbeapi/api/system/default_spec.rb +13 -4
- data/spec/unit/rbeapi/api/system/fixture_system.text +1 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f57dffb48069339da41ad9ccbacb58f0ba721c
|
4
|
+
data.tar.gz: 01a8466b66a59fba98f05b90951e3dbec95cb403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 376ea7873d47cc61f196aaae4efcfa68127b0146f64b8a265f680d6ab2e2ee7dffaa3f09df21b6d2a8e4a963bd78b7fc606fed96ca87dcb4912a8b2beee43dfa
|
7
|
+
data.tar.gz: b848cbd0cd4c76935fa9e9e542f25eb94738a16ddad6862ceb9aea5b97030e653484b53ce55bec9a88ffac6ff045d61c098ca9779747caff957539b9f6ca908f
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
AllCops:
|
2
2
|
Exclude:
|
3
3
|
- '**/*.gemspec'
|
4
|
+
- '**/*.spec'
|
4
5
|
|
5
6
|
Metrics/CyclomaticComplexity:
|
6
7
|
Max: 20
|
@@ -22,3 +23,16 @@ Metrics/ClassLength:
|
|
22
23
|
|
23
24
|
Metrics/BlockLength:
|
24
25
|
Enabled: False
|
26
|
+
|
27
|
+
# Puppet style
|
28
|
+
Style/SignalException:
|
29
|
+
Enabled: False
|
30
|
+
|
31
|
+
Layout/IndentHeredoc:
|
32
|
+
Enabled: False
|
33
|
+
|
34
|
+
Style/SymbolArray:
|
35
|
+
Enabled: False
|
36
|
+
|
37
|
+
Style/PercentLiteralDelimiters:
|
38
|
+
Enabled: False
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [1.
|
4
|
-
[Full Changelog](https://github.com/arista-eosplus/rbeapi/compare/v1.
|
3
|
+
## [1.2](https://github.com/arista-eosplus/rbeapi/tree/1.2) (2017-06-02)
|
4
|
+
[Full Changelog](https://github.com/arista-eosplus/rbeapi/compare/v1.1...1.2)
|
5
5
|
|
6
6
|
**Implemented enhancements:**
|
7
7
|
|
8
|
+
- add support for timezone, please review [\#167](https://github.com/arista-eosplus/rbeapi/pull/167) ([mmailand](https://github.com/mmailand))
|
9
|
+
- add the ip host function for static dns entries. [\#164](https://github.com/arista-eosplus/rbeapi/pull/164) ([mmailand](https://github.com/mmailand))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- \(NETDEV-29\) Enhance netdev NTP api [\#169](https://github.com/arista-eosplus/rbeapi/pull/169) ([shermdog](https://github.com/shermdog))
|
14
|
+
|
15
|
+
## [v1.1](https://github.com/arista-eosplus/rbeapi/tree/v1.1) (2016-12-06)
|
16
|
+
[Full Changelog](https://github.com/arista-eosplus/rbeapi/compare/v1.0...v1.1)
|
17
|
+
|
18
|
+
**Implemented enhancements:**
|
19
|
+
|
20
|
+
- Style updates for Rubocop 0.45 [\#163](https://github.com/arista-eosplus/rbeapi/pull/163) ([jerearista](https://github.com/jerearista))
|
8
21
|
- add subinterface functionality [\#161](https://github.com/arista-eosplus/rbeapi/pull/161) ([mmailand](https://github.com/mmailand))
|
9
22
|
- add support to set aliases [\#160](https://github.com/arista-eosplus/rbeapi/pull/160) ([mmailand](https://github.com/mmailand))
|
10
23
|
- added support for setting the crypto in managementdefaults [\#159](https://github.com/arista-eosplus/rbeapi/pull/159) ([mmailand](https://github.com/mmailand))
|
@@ -14,12 +27,8 @@
|
|
14
27
|
**Fixed bugs:**
|
15
28
|
|
16
29
|
- Fix multiline alias support [\#165](https://github.com/arista-eosplus/rbeapi/pull/165) ([jerearista](https://github.com/jerearista))
|
17
|
-
- extend and fix ospf features [\#156](https://github.com/arista-eosplus/rbeapi/pull/156) ([rknaus](https://github.com/rknaus))
|
18
|
-
|
19
|
-
**Merged pull requests:**
|
20
|
-
|
21
|
-
- Style updates for Rubocop 0.45 [\#163](https://github.com/arista-eosplus/rbeapi/pull/163) ([jerearista](https://github.com/jerearista))
|
22
30
|
- fix for rspec failure on current develop [\#162](https://github.com/arista-eosplus/rbeapi/pull/162) ([mmailand](https://github.com/mmailand))
|
31
|
+
- extend and fix ospf features [\#156](https://github.com/arista-eosplus/rbeapi/pull/156) ([rknaus](https://github.com/rknaus))
|
23
32
|
|
24
33
|
## [v1.0](https://github.com/arista-eosplus/rbeapi/tree/v1.0) (2016-09-26)
|
25
34
|
[Full Changelog](https://github.com/arista-eosplus/rbeapi/compare/v0.5.1...v1.0)
|
@@ -61,7 +70,7 @@
|
|
61
70
|
- Fix rpm uninstall issue \#118 [\#134](https://github.com/arista-eosplus/rbeapi/pull/134) ([jerearista](https://github.com/jerearista))
|
62
71
|
- Switchconfig rpms for chef [\#130](https://github.com/arista-eosplus/rbeapi/pull/130) ([jerearista](https://github.com/jerearista))
|
63
72
|
- Switchconfig zap empty lines [\#128](https://github.com/arista-eosplus/rbeapi/pull/128) ([jerearista](https://github.com/jerearista))
|
64
|
-
- Validate array param options [\#126](https://github.com/arista-eosplus/rbeapi/pull/126) ([
|
73
|
+
- Validate array param options [\#126](https://github.com/arista-eosplus/rbeapi/pull/126) ([HuntBurdick](https://github.com/HuntBurdick))
|
65
74
|
- Wip load interval v2 [\#122](https://github.com/arista-eosplus/rbeapi/pull/122) ([n1cn0c](https://github.com/n1cn0c))
|
66
75
|
- Created vlans set\_trunk\_groups method. [\#119](https://github.com/arista-eosplus/rbeapi/pull/119) ([devrobo](https://github.com/devrobo))
|
67
76
|
|
@@ -89,9 +98,9 @@
|
|
89
98
|
- Release 0.5.1 [\#115](https://github.com/arista-eosplus/rbeapi/pull/115) ([jerearista](https://github.com/jerearista))
|
90
99
|
- Only first trunk group was being returned. [\#114](https://github.com/arista-eosplus/rbeapi/pull/114) ([devrobo](https://github.com/devrobo))
|
91
100
|
- Add support for DEFAULT section to eapi config file. [\#111](https://github.com/arista-eosplus/rbeapi/pull/111) ([devrobo](https://github.com/devrobo))
|
92
|
-
- Remove getter for timeouts and use attr\_reader instead. [\#107](https://github.com/arista-eosplus/rbeapi/pull/107) ([
|
101
|
+
- Remove getter for timeouts and use attr\_reader instead. [\#107](https://github.com/arista-eosplus/rbeapi/pull/107) ([HuntBurdick](https://github.com/HuntBurdick))
|
93
102
|
- Added doc for trunk groups to get. [\#106](https://github.com/arista-eosplus/rbeapi/pull/106) ([devrobo](https://github.com/devrobo))
|
94
|
-
- Tightening up documentation. [\#105](https://github.com/arista-eosplus/rbeapi/pull/105) ([
|
103
|
+
- Tightening up documentation. [\#105](https://github.com/arista-eosplus/rbeapi/pull/105) ([HuntBurdick](https://github.com/HuntBurdick))
|
95
104
|
- Added support for setting system banners. [\#104](https://github.com/arista-eosplus/rbeapi/pull/104) ([devrobo](https://github.com/devrobo))
|
96
105
|
|
97
106
|
## [v0.5.0](https://github.com/arista-eosplus/rbeapi/tree/v0.5.0) (2016-01-12)
|
@@ -105,15 +114,15 @@
|
|
105
114
|
- switchport api should support trunk groups [\#38](https://github.com/arista-eosplus/rbeapi/issues/38)
|
106
115
|
- Need units tests for framework [\#30](https://github.com/arista-eosplus/rbeapi/issues/30)
|
107
116
|
- Need unit test to verify read and open timeout in eapi conf file override default [\#29](https://github.com/arista-eosplus/rbeapi/issues/29)
|
108
|
-
- Unit tests for switchports [\#94](https://github.com/arista-eosplus/rbeapi/pull/94) ([
|
109
|
-
- Ensure all parse methods are private. [\#93](https://github.com/arista-eosplus/rbeapi/pull/93) ([
|
110
|
-
- test timeout values [\#92](https://github.com/arista-eosplus/rbeapi/pull/92) ([
|
117
|
+
- Unit tests for switchports [\#94](https://github.com/arista-eosplus/rbeapi/pull/94) ([HuntBurdick](https://github.com/HuntBurdick))
|
118
|
+
- Ensure all parse methods are private. [\#93](https://github.com/arista-eosplus/rbeapi/pull/93) ([HuntBurdick](https://github.com/HuntBurdick))
|
119
|
+
- test timeout values [\#92](https://github.com/arista-eosplus/rbeapi/pull/92) ([HuntBurdick](https://github.com/HuntBurdick))
|
111
120
|
- Relax check on getall entries [\#91](https://github.com/arista-eosplus/rbeapi/pull/91) ([devrobo](https://github.com/devrobo))
|
112
|
-
- Update framework tests [\#90](https://github.com/arista-eosplus/rbeapi/pull/90) ([
|
121
|
+
- Update framework tests [\#90](https://github.com/arista-eosplus/rbeapi/pull/90) ([HuntBurdick](https://github.com/HuntBurdick))
|
113
122
|
- Add lacp\_mode option when setting port-channel members. [\#89](https://github.com/arista-eosplus/rbeapi/pull/89) ([devrobo](https://github.com/devrobo))
|
114
123
|
- Added support for trunk groups. [\#88](https://github.com/arista-eosplus/rbeapi/pull/88) ([devrobo](https://github.com/devrobo))
|
115
|
-
- Add basic framework tests. [\#85](https://github.com/arista-eosplus/rbeapi/pull/85) ([
|
116
|
-
- Address code coverage gaps [\#84](https://github.com/arista-eosplus/rbeapi/pull/84) ([
|
124
|
+
- Add basic framework tests. [\#85](https://github.com/arista-eosplus/rbeapi/pull/85) ([HuntBurdick](https://github.com/HuntBurdick))
|
125
|
+
- Address code coverage gaps [\#84](https://github.com/arista-eosplus/rbeapi/pull/84) ([HuntBurdick](https://github.com/HuntBurdick))
|
117
126
|
|
118
127
|
**Fixed bugs:**
|
119
128
|
|
@@ -124,11 +133,11 @@
|
|
124
133
|
- Add terminal to configure command to work around AAA issue found in p… [\#99](https://github.com/arista-eosplus/rbeapi/pull/99) ([devrobo](https://github.com/devrobo))
|
125
134
|
- Set enable password for a connection. [\#96](https://github.com/arista-eosplus/rbeapi/pull/96) ([devrobo](https://github.com/devrobo))
|
126
135
|
- Catch errors and syslog them when parsing eapi conf file. [\#95](https://github.com/arista-eosplus/rbeapi/pull/95) ([devrobo](https://github.com/devrobo))
|
127
|
-
- Ensure that nil is returned when you try to get nonexistent username. [\#83](https://github.com/arista-eosplus/rbeapi/pull/83) ([
|
136
|
+
- Ensure that nil is returned when you try to get nonexistent username. [\#83](https://github.com/arista-eosplus/rbeapi/pull/83) ([HuntBurdick](https://github.com/HuntBurdick))
|
128
137
|
|
129
138
|
**Merged pull requests:**
|
130
139
|
|
131
|
-
- Update documentation [\#97](https://github.com/arista-eosplus/rbeapi/pull/97) ([
|
140
|
+
- Update documentation [\#97](https://github.com/arista-eosplus/rbeapi/pull/97) ([HuntBurdick](https://github.com/HuntBurdick))
|
132
141
|
|
133
142
|
## [v0.4.0](https://github.com/arista-eosplus/rbeapi/tree/v0.4.0) (2015-11-21)
|
134
143
|
[Full Changelog](https://github.com/arista-eosplus/rbeapi/compare/v0.3.0...v0.4.0)
|
@@ -155,14 +164,14 @@
|
|
155
164
|
|
156
165
|
- Merge develop to master for Release 0.4.0 [\#81](https://github.com/arista-eosplus/rbeapi/pull/81) ([jerearista](https://github.com/jerearista))
|
157
166
|
- Release 0.4.0 [\#80](https://github.com/arista-eosplus/rbeapi/pull/80) ([jerearista](https://github.com/jerearista))
|
158
|
-
- Update rubocop version and rectify related test failures. [\#76](https://github.com/arista-eosplus/rbeapi/pull/76) ([
|
159
|
-
- Add method to enable ip routing to the system API [\#75](https://github.com/arista-eosplus/rbeapi/pull/75) ([
|
167
|
+
- Update rubocop version and rectify related test failures. [\#76](https://github.com/arista-eosplus/rbeapi/pull/76) ([HuntBurdick](https://github.com/HuntBurdick))
|
168
|
+
- Add method to enable ip routing to the system API [\#75](https://github.com/arista-eosplus/rbeapi/pull/75) ([HuntBurdick](https://github.com/HuntBurdick))
|
160
169
|
- Added vrrp api module and unit tests. [\#64](https://github.com/arista-eosplus/rbeapi/pull/64) ([devrobo](https://github.com/devrobo))
|
161
|
-
- Adding feature routemap [\#63](https://github.com/arista-eosplus/rbeapi/pull/63) ([
|
162
|
-
- varp and varp interfaces update. [\#60](https://github.com/arista-eosplus/rbeapi/pull/60) ([
|
170
|
+
- Adding feature routemap [\#63](https://github.com/arista-eosplus/rbeapi/pull/63) ([HuntBurdick](https://github.com/HuntBurdick))
|
171
|
+
- varp and varp interfaces update. [\#60](https://github.com/arista-eosplus/rbeapi/pull/60) ([HuntBurdick](https://github.com/HuntBurdick))
|
163
172
|
- Fixed comment for value param for set\_lacp\_timeout method. [\#57](https://github.com/arista-eosplus/rbeapi/pull/57) ([devrobo](https://github.com/devrobo))
|
164
|
-
- Feature user updates [\#56](https://github.com/arista-eosplus/rbeapi/pull/56) ([
|
165
|
-
- Update max\_paths to maximum\_paths and max\_ecmp\_paths to maximum\_ecmp\_… [\#55](https://github.com/arista-eosplus/rbeapi/pull/55) ([
|
173
|
+
- Feature user updates [\#56](https://github.com/arista-eosplus/rbeapi/pull/56) ([HuntBurdick](https://github.com/HuntBurdick))
|
174
|
+
- Update max\_paths to maximum\_paths and max\_ecmp\_paths to maximum\_ecmp\_… [\#55](https://github.com/arista-eosplus/rbeapi/pull/55) ([HuntBurdick](https://github.com/HuntBurdick))
|
166
175
|
- Fixed issues on the new bgp create call. [\#54](https://github.com/arista-eosplus/rbeapi/pull/54) ([devrobo](https://github.com/devrobo))
|
167
176
|
- Added support for getting users information. [\#53](https://github.com/arista-eosplus/rbeapi/pull/53) ([devrobo](https://github.com/devrobo))
|
168
177
|
- add dry-run mode [\#42](https://github.com/arista-eosplus/rbeapi/pull/42) ([kakkotetsu](https://github.com/kakkotetsu))
|
data/README.md
CHANGED
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
#### Table of Contents
|
4
4
|
|
5
|
-
1. [Overview]
|
6
|
-
* [Requirements]
|
7
|
-
2. [Getting Started]
|
8
|
-
* [Example eapi.conf File]
|
9
|
-
* [Using rbeapi]
|
10
|
-
3. [Installation]
|
11
|
-
4. [Upgrading]
|
12
|
-
5. [Contributing]
|
13
|
-
6. [Testing]
|
14
|
-
7. [License]
|
5
|
+
1. [Overview](#overview)
|
6
|
+
* [Requirements](#requirements)
|
7
|
+
2. [Getting Started](#getting-started)
|
8
|
+
* [Example eapi.conf File](#example-eapiconf-file)
|
9
|
+
* [Using rbeapi](#using-rbeapi)
|
10
|
+
3. [Installation](#installation)
|
11
|
+
4. [Upgrading](#upgrading)
|
12
|
+
5. [Contributing](#contributing)
|
13
|
+
6. [Testing](#testing)
|
14
|
+
7. [License](#license)
|
15
15
|
|
16
16
|
## Build status
|
17
17
|
|
18
|
+
Rubygems.org: [](https://badge.fury.io/rb/rbeapi)
|
19
|
+
|
18
20
|
Style/package build: [](https://revproxy.arista.com/eosplus/ci/job/rbeapi_start)
|
19
21
|
|
20
22
|
Unit/System spec/coverage: [](https://revproxy.arista.com/eosplus/ci/job/rbeapi_spec)
|
@@ -243,37 +245,37 @@ omnibus installation package in /opt/chef/bin/. For Chef, use the
|
|
243
245
|
$ bundle install --path .bundle/gems/
|
244
246
|
$ bundle exec rake all_rpms
|
245
247
|
...
|
246
|
-
RPMs are available in rpms/noarch/
|
247
|
-
Copy the RPMs to an EOS device then run the 'swix create' command.
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
248
|
+
RPMs are available in rpms/noarch/
|
249
|
+
Copy the RPMs to an EOS device then run the 'swix create' command.
|
250
|
+
Examples:
|
251
|
+
Puppet Open Source:
|
252
|
+
cd /mnt/flash; \
|
253
|
+
swix create rbeapi-1.2-1.swix \
|
254
|
+
rubygem-rbeapi-1.2-1.eos4.noarch.rpm \
|
255
|
+
rubygem-inifile-3.0.0-3.eos4.noarch.rpm \
|
256
|
+
rubygem-netaddr-1.5.0-2.eos4.noarch.rpm \
|
257
|
+
rubygem-net_http_unix-0.2.1-3.eos4.noarch.rpm
|
258
|
+
Puppet-enterprise agent (3.x):
|
259
|
+
cd/mnt/flash; \
|
260
|
+
swix create rbeapi-puppet3-1.2-1.swix \
|
261
|
+
rubygem-rbeapi-puppet3-1.2-1.eos4.noarch.rpm \
|
262
|
+
rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \
|
263
|
+
rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm
|
264
|
+
Puppet-All-in-one agent (2015.x/4.x):
|
265
|
+
cd/mnt/flash; \
|
266
|
+
swix create rbeapi-puppet-aio-1.2-1.swix \
|
267
|
+
rubygem-rbeapi-puppet-aio-1.2-1.eos4.noarch.rpm \
|
268
|
+
rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \
|
269
|
+
rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm \
|
270
|
+
rubygem-net_http_unix-puppet-aio-0.2.1-3.eos4.noarch.rpm
|
271
|
+
|
272
|
+
Chef client:
|
273
|
+
cd /mnt/flash; \
|
274
|
+
swix create rbeapi-chef-1.2-1.swix \
|
275
|
+
rubygem-rbeapi-chef-1.2-1.eos4.noarch.rpm \
|
276
|
+
rubygem-inifile-chef-3.0.0-5.eos4.noarch.rpm \
|
277
|
+
rubygem-netaddr-chef-1.5.1-4.eos4.noarch.rpm \
|
278
|
+
rubygem-net_http_unix-chef-0.2.2-5.eos4.noarch.rpm
|
277
279
|
```
|
278
280
|
|
279
281
|
On EOS:
|
@@ -281,13 +283,13 @@ Copy the RPMs to an EOS device then run the 'swix create' command.
|
|
281
283
|
Arista# copy <URI-to-RPMs> flash:
|
282
284
|
Arista# bash
|
283
285
|
-bash-4.1# cd /mnt/flash/
|
284
|
-
-bash-4.1# swix create rbeapi-puppet3-1.
|
285
|
-
rubygem-rbeapi-puppet3-1.
|
286
|
+
-bash-4.1# swix create rbeapi-puppet3-1.2-1.swix \
|
287
|
+
rubygem-rbeapi-puppet3-1.2-1.eos4.noarch.rpm \
|
286
288
|
rubygem-inifile-puppet3-3.0.0-1.eos4.noarch.rpm \
|
287
289
|
rubygem-netaddr-puppet3-1.5.0-1.eos4.noarch.rpm
|
288
290
|
-bash-4.1# exit
|
289
|
-
Arista# copy flash:rbeapi-puppet3-1.
|
290
|
-
Arista# extension rbeapi-puppet3-1.
|
291
|
+
Arista# copy flash:rbeapi-puppet3-1.2-1.swix extension:
|
292
|
+
Arista# extension rbeapi-puppet3-1.2-1.swix
|
291
293
|
Arista# copy installed-extensions boot-extensions
|
292
294
|
```
|
293
295
|
|
@@ -295,8 +297,8 @@ Copy the RPMs to an EOS device then run the 'swix create' command.
|
|
295
297
|
|
296
298
|
On EOS:
|
297
299
|
```
|
298
|
-
Arista# no extension pe-rbeapi-
|
299
|
-
Arista# extension rbeapi-puppet3-1.
|
300
|
+
Arista# no extension pe-rbeapi-1.1.0-1.swix
|
301
|
+
Arista# extension rbeapi-puppet3-1.2-1.swix
|
300
302
|
Arista# copy installed-extensions boot-extensions
|
301
303
|
```
|
302
304
|
|
data/Rakefile
CHANGED
@@ -7,10 +7,12 @@ task :build do
|
|
7
7
|
system 'gem build rbeapi.gemspec'
|
8
8
|
end
|
9
9
|
|
10
|
+
# rubocop:disable Style/FormatStringToken
|
10
11
|
RPM_OPTS = '--define "_topdir %(pwd)/rpmbuild" --define "_builddir ' \
|
11
12
|
'%{_topdir}" --define "_rpmdir %(pwd)/rpms" --define "_srcrpmdir ' \
|
12
13
|
'%{_rpmdir}" --define "_sourcedir %(pwd)" --define "_specdir %(pwd)" '\
|
13
14
|
'-bb'.freeze
|
15
|
+
# rubocop:enable Style/FormatStringToken
|
14
16
|
desc 'Generate regular and puppet-enterprise rbeapi RPMs for EOS'
|
15
17
|
task rpm: :build do
|
16
18
|
system "sed -e 's/^Version:.*/Version: #{Rbeapi::VERSION}/g' " \
|
@@ -0,0 +1,157 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2017, 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 'rbeapi/api'
|
33
|
+
|
34
|
+
##
|
35
|
+
# Rbeapi toplevel namespace.
|
36
|
+
module Rbeapi
|
37
|
+
##
|
38
|
+
# Api is module namespace for working with the EOS command API.
|
39
|
+
module Api
|
40
|
+
##
|
41
|
+
# The Iphosts class manages hosts entries on an EOS node.
|
42
|
+
class Iphosts < Entity
|
43
|
+
##
|
44
|
+
# get returns the current ip host configuration hash extracted from the
|
45
|
+
# nodes running configuration.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# {
|
49
|
+
# hosts: array<strings>
|
50
|
+
# }
|
51
|
+
#
|
52
|
+
# @return [Hash<Symbol, Object>] Returns the ip host resource as a hash
|
53
|
+
# object from the nodes current configuration.
|
54
|
+
def get(name)
|
55
|
+
iphost = config.scan(/^ip host #{name} ((?:\d+\.\d+\.\d+\.\d+[ ]?)*)/)
|
56
|
+
return nil unless iphost && iphost[0]
|
57
|
+
parse_host_entry(name, iphost[0])
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# getall returns a collection of ip host resource hashes from the nodes
|
62
|
+
# running configuration. The ip host resource collection hash is keyed
|
63
|
+
# by the unique host name.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# [
|
67
|
+
# <host>: {
|
68
|
+
# ipaddress: <string>
|
69
|
+
# },
|
70
|
+
# <host>: {
|
71
|
+
# ipaddress: <string>
|
72
|
+
# },
|
73
|
+
# ...
|
74
|
+
# ]
|
75
|
+
#
|
76
|
+
# @return [Hash<Symbol, Object>] Returns a hash that represents the
|
77
|
+
# entire ip host collection from the nodes running configuration. If
|
78
|
+
# there are no ip hosts configured, this method will return an empty
|
79
|
+
# hash.
|
80
|
+
def getall
|
81
|
+
entries = config.scan(/^ip host ([^\s]+) (\d+\.\d+\.\d+\.\d+)/)
|
82
|
+
response = {}
|
83
|
+
entries.each do |host|
|
84
|
+
response[host[0]] = get host[0]
|
85
|
+
end
|
86
|
+
response
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# parse_host_entry maps the tokens found to the hash entries.
|
91
|
+
#
|
92
|
+
# @api private
|
93
|
+
#
|
94
|
+
# @param host [Array] An array of values returned from the regular
|
95
|
+
# expression scan of the hosts configuration.
|
96
|
+
#
|
97
|
+
# @return [Hash<Symbol, Object>] Returns the resource hash attribute.
|
98
|
+
def parse_host_entry(host, ipaddress)
|
99
|
+
hsh = {}
|
100
|
+
hsh[:name] = host
|
101
|
+
hsh[:ipaddress] = ipaddress[0].split
|
102
|
+
hsh
|
103
|
+
end
|
104
|
+
private :parse_host_entry
|
105
|
+
|
106
|
+
##
|
107
|
+
# create will create a ip host entry in the nodes current
|
108
|
+
# configuration with the specified address.
|
109
|
+
#
|
110
|
+
# @since eos_version 4.13.7M
|
111
|
+
#
|
112
|
+
# ===Commands
|
113
|
+
# ip host <name> <address>
|
114
|
+
#
|
115
|
+
# @param name [String] The name of the host.
|
116
|
+
#
|
117
|
+
# @param opts [hash] Optional keyword arguments.
|
118
|
+
#
|
119
|
+
# @option opts ipaddress [String] Configures the host ip address
|
120
|
+
#
|
121
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
122
|
+
def create(name, opts = {})
|
123
|
+
ipaddress = opts.fetch(:ipaddress, NIL)
|
124
|
+
# rubocop:disable Style/GuardClause, Style/ClassCheck
|
125
|
+
if ipaddress.kind_of?(Array)
|
126
|
+
if ipaddress.all? { |x| x =~ /(\w+\.\d+\.\d+\.\d+)/ }
|
127
|
+
ips = opts[:ipaddress].join(' ')
|
128
|
+
cmd = "ip host #{name} #{ips}"
|
129
|
+
configure(cmd)
|
130
|
+
else
|
131
|
+
fail ArgumentError, 'option ipaddress must be a valid IP'
|
132
|
+
end
|
133
|
+
else
|
134
|
+
fail ArgumentError, 'no argument given'
|
135
|
+
end
|
136
|
+
# rubocop:enable Style/GuardClause, Style/ClassCheck
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# delete will delete an existing ip host entry from the nodes current
|
141
|
+
# running configuration. If the delete method is called and the host
|
142
|
+
# entry does not exist, this method will succeed.
|
143
|
+
#
|
144
|
+
# @since eos_version 4.13.7M
|
145
|
+
#
|
146
|
+
# ===Commands
|
147
|
+
# no ip host <name>
|
148
|
+
#
|
149
|
+
# @param name [String] The host name entry to delete from the node.
|
150
|
+
#
|
151
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
152
|
+
def delete(name)
|
153
|
+
configure("no ip host #{name}")
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|