rbeapi 0.3.0 → 0.4.0
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 +16 -0
- data/Gemfile +3 -1
- data/Guardfile +2 -2
- data/README.md +35 -24
- data/Rakefile +48 -18
- data/gems/inifile/inifile.spec.tmpl +50 -14
- data/gems/net_http_unix/net_http_unix.spec.tmpl +48 -15
- data/gems/netaddr/netaddr.spec.tmpl +47 -14
- data/lib/rbeapi/api/bgp.rb +100 -4
- data/lib/rbeapi/api/interfaces.rb +4 -5
- data/lib/rbeapi/api/radius.rb +1 -1
- data/lib/rbeapi/api/routemaps.rb +405 -37
- data/lib/rbeapi/api/system.rb +21 -0
- data/lib/rbeapi/api/users.rb +361 -0
- data/lib/rbeapi/api/varp.rb +50 -22
- data/lib/rbeapi/api/vrrp.rb +1072 -0
- data/lib/rbeapi/client.rb +12 -4
- data/lib/rbeapi/eapilib.rb +1 -1
- data/lib/rbeapi/version.rb +1 -1
- data/rbeapi.spec.tmpl +57 -25
- data/spec/system/rbeapi/api/dns_spec.rb +2 -2
- data/spec/system/rbeapi/api/routemaps_spec.rb +344 -0
- data/spec/system/rbeapi/api/switchports_spec.rb +1 -1
- data/spec/system/rbeapi/api/system_spec.rb +44 -4
- data/spec/system/{api_varp_interfaces_spec.rb → rbeapi/api/varp_interfaces_spec.rb} +25 -16
- data/spec/system/rbeapi/api/varp_spec.rb +76 -0
- data/spec/unit/rbeapi/api/bgp/bgp_neighbors_spec.rb +2 -0
- data/spec/unit/rbeapi/api/bgp/bgp_spec.rb +54 -1
- data/spec/unit/rbeapi/api/interfaces/portchannel_spec.rb +1 -1
- data/spec/unit/rbeapi/api/routemaps/default_spec.rb +370 -0
- data/spec/unit/rbeapi/api/routemaps/fixture_routemaps.text +27 -0
- data/spec/unit/rbeapi/api/system/default_spec.rb +102 -0
- data/spec/unit/rbeapi/api/system/fixture_system.text +2 -0
- data/spec/unit/rbeapi/api/users/default_spec.rb +280 -0
- data/spec/unit/rbeapi/api/users/fixture_users.text +4 -0
- data/spec/unit/rbeapi/api/vrrp/default_spec.rb +582 -0
- data/spec/unit/rbeapi/api/vrrp/fixture_vrrp.text +186 -0
- metadata +28 -8
- data/spec/system/api_varp_spec.rb +0 -41
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
Ruby Client for eAPI
|
2
2
|
====================
|
3
3
|
|
4
|
+
## v0.4.0, November, 2015
|
5
|
+
|
6
|
+
- New users API
|
7
|
+
- New routemap API
|
8
|
+
- New vrrp API
|
9
|
+
- BGP API: Add support for maximum_paths and maximum_ecmp_paths
|
10
|
+
- System API: add support for managing the global EOS ‘ip routing’ setting
|
11
|
+
- Updated RPM/SWIX packaging to handle Puppet All-In-One (AIO) agent paths
|
12
|
+
New package names are: rbeapi, rbeapi-puppet3 (formerly pe-puppet),
|
13
|
+
and rbeapi-puppet-aio
|
14
|
+
- Fixed port-channel get_members() issue with EOS 4.15 and above.
|
15
|
+
- Fixed issue with the eapi.conf wildcard connection
|
16
|
+
- Fixed issue that would cause a traceback when searching for eapi.conf if
|
17
|
+
$HOME was not set
|
18
|
+
|
19
|
+
|
4
20
|
## v0.3.0, August, 2015
|
5
21
|
|
6
22
|
- API Change: Eliminated overloading the value option in command_builder. When
|
data/Gemfile
CHANGED
@@ -6,6 +6,7 @@ gem 'net_http_unix'
|
|
6
6
|
gem 'netaddr'
|
7
7
|
|
8
8
|
group :development do
|
9
|
+
gem 'rubocop', '>=0.35.1'
|
9
10
|
gem 'guard'
|
10
11
|
gem 'guard-rspec'
|
11
12
|
gem 'guard-rubocop'
|
@@ -13,6 +14,7 @@ group :development do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
group :development, :test do
|
17
|
+
gem 'listen', '<=3.0.3'
|
16
18
|
gem 'rake', '~> 10.1.0'
|
17
19
|
gem 'rspec', '~> 3.0.0'
|
18
20
|
gem 'rspec-mocks', '~> 3.0.0'
|
@@ -22,7 +24,7 @@ group :development, :test do
|
|
22
24
|
gem 'pry', require: false
|
23
25
|
gem 'pry-doc', require: false
|
24
26
|
gem 'pry-stack_explorer', require: false
|
25
|
-
gem 'rbeapi', '0.
|
27
|
+
gem 'rbeapi', '0.4.0', path: '.'
|
26
28
|
gem 'ci_reporter_rspec', require: false
|
27
29
|
gem 'simplecov-json', require: false
|
28
30
|
gem 'simplecov-rcov', require: false
|
data/Guardfile
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
guard :rspec, cmd: 'bundle exec rspec' do
|
7
7
|
watch(%r{^spec\/.+_spec\.rb$})
|
8
|
-
watch(%r{^lib\/(.+)\.rb$})
|
9
|
-
watch('spec/spec_helper.rb')
|
8
|
+
watch(%r{^lib\/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
9
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
10
10
|
end
|
11
11
|
|
12
12
|
guard :rubocop do
|
data/README.md
CHANGED
@@ -214,8 +214,10 @@ and uploaded to [RubyGems](https://rubygems.org/).
|
|
214
214
|
by the build. NOTE:
|
215
215
|
[PuppetLabs](https://puppetlabs.com/misc/pe-files) provides a puppet agent SWIX which includes Ruby 1.9.3 in
|
216
216
|
/opt/puppet/bin/ which is different from where you might otherwise install
|
217
|
-
Ruby. If you have installed the puppet-enterprise SWIX, then you should
|
218
|
-
build and use the ``
|
217
|
+
Ruby. If you have installed the puppet-enterprise 3.x SWIX, then you should
|
218
|
+
build and use the ``rbeapi-puppet3`` swix, below. If you have installed
|
219
|
+
the puppet-enterprise 2015.x SWIX, then you should build and use the
|
220
|
+
``rbeapi-puppet-aio`` swix, below. Otherwise, if you have installed at least
|
219
221
|
Ruby 1.9.3 in the standard system location, then the ``rbeapi`` SWIX may be
|
220
222
|
used.
|
221
223
|
|
@@ -223,20 +225,29 @@ and uploaded to [RubyGems](https://rubygems.org/).
|
|
223
225
|
$ bundle install --path .bundle/gems/
|
224
226
|
$ bundle exec rake all_rpms
|
225
227
|
...
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
228
|
+
RPMs are available in rpms/noarch/
|
229
|
+
Copy the RPMs to an EOS device then run the 'swix create' command.
|
230
|
+
Examples:
|
231
|
+
Puppet Open Source:
|
232
|
+
cd /mnt/flash; \
|
233
|
+
swix create rbeapi-0.4.0-1.swix \
|
234
|
+
rubygem-rbeapi-0.4.0-1.eos4.noarch.rpm \
|
235
|
+
rubygem-inifile-3.0.0-3.eos4.noarch.rpm \
|
236
|
+
rubygem-netaddr-1.5.0-2.eos4.noarch.rpm \
|
237
|
+
rubygem-net_http_unix-0.2.1-3.eos4.noarch.rpm
|
238
|
+
Puppet-enterprise agent (3.x):
|
239
|
+
cd/mnt/flash; \
|
240
|
+
swix create rbeapi-puppet3-0.4.0-1.swix \
|
241
|
+
rubygem-rbeapi-puppet3-0.4.0-1.eos4.noarch.rpm \
|
242
|
+
rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \
|
243
|
+
rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm
|
244
|
+
Puppet-All-in-one agent (2015.x/4.x):
|
245
|
+
cd/mnt/flash; \
|
246
|
+
swix create rbeapi-puppet-aio-0.4.0-1.swix \
|
247
|
+
rubygem-rbeapi-puppet-aio-0.4.0-1.eos4.noarch.rpm \
|
248
|
+
rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \
|
249
|
+
rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm \
|
250
|
+
rubygem-net_http_unix-puppet-aio-0.2.1-3.eos4.noarch.rpm
|
240
251
|
```
|
241
252
|
|
242
253
|
On EOS:
|
@@ -244,13 +255,13 @@ and uploaded to [RubyGems](https://rubygems.org/).
|
|
244
255
|
Arista# copy <URI-to-RPMs> flash:
|
245
256
|
Arista# bash
|
246
257
|
-bash-4.1# cd /mnt/flash/
|
247
|
-
-bash-4.1# swix create
|
248
|
-
|
249
|
-
|
250
|
-
|
258
|
+
-bash-4.1# swix create rbeapi-puppet3-0.4.0-1.swix \
|
259
|
+
rubygem-rbeapi-puppet3-0.4.0-1.eos4.noarch.rpm \
|
260
|
+
rubygem-inifile-puppet3-3.0.0-1.eos4.noarch.rpm \
|
261
|
+
rubygem-netaddr-puppet3-1.5.0-1.eos4.noarch.rpm
|
251
262
|
-bash-4.1# exit
|
252
|
-
Arista# copy flash:
|
253
|
-
Arista# extension
|
263
|
+
Arista# copy flash:rbeapi-puppet3-0.4.0-1.swix extension:
|
264
|
+
Arista# extension rbeapi-puppet3-0.4.0-1.swix
|
254
265
|
Arista# copy installed-extensions boot-extensions
|
255
266
|
```
|
256
267
|
|
@@ -258,8 +269,8 @@ and uploaded to [RubyGems](https://rubygems.org/).
|
|
258
269
|
|
259
270
|
On EOS:
|
260
271
|
```
|
261
|
-
Arista# no extension pe-rbeapi-0.
|
262
|
-
Arista# extension
|
272
|
+
Arista# no extension pe-rbeapi-0.3.0-1.swix
|
273
|
+
Arista# extension rbeapi-puppet3-0.4.0-1.swix
|
263
274
|
Arista# copy installed-extensions boot-extensions
|
264
275
|
```
|
265
276
|
|
data/Rakefile
CHANGED
@@ -15,7 +15,6 @@ task rpm: :build do
|
|
15
15
|
system "sed -e 's/^Version:.*/Version: #{Rbeapi::VERSION}/g' " \
|
16
16
|
'rbeapi.spec.tmpl > rbeapi.spec'
|
17
17
|
system "rpmbuild #{RPM_OPTS} rbeapi.spec"
|
18
|
-
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' rbeapi.spec"
|
19
18
|
RPMS = `find rpms/noarch -name "*rbeapi*rpm"`
|
20
19
|
puts "\n################################################\n#"
|
21
20
|
puts "Created the following in rpms/noarch/\n#{RPMS}"
|
@@ -33,8 +32,6 @@ task :inifile do
|
|
33
32
|
system "sed -e 's/^Version:.*/Version: #{INIFILE_VERSION}/g' " \
|
34
33
|
'gems/inifile/inifile.spec.tmpl > gems/inifile/inifile.spec'
|
35
34
|
system "rpmbuild #{RPM_OPTS} gems/inifile/inifile.spec"
|
36
|
-
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
|
37
|
-
'gems/inifile/inifile.spec'
|
38
35
|
RPMS = `find rpms/noarch -name "*inifile*rpm"`
|
39
36
|
puts "\n################################################\n#"
|
40
37
|
puts "Created the following in rpms/noarch/\n#{RPMS}"
|
@@ -70,8 +67,6 @@ task :netaddr do
|
|
70
67
|
system "sed -e 's/^Version:.*/Version: #{NETADDR_VERSION}/g' " \
|
71
68
|
'gems/netaddr/netaddr.spec.tmpl > gems/netaddr/netaddr.spec'
|
72
69
|
system "rpmbuild #{RPM_OPTS} gems/netaddr/netaddr.spec"
|
73
|
-
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
|
74
|
-
'gems/netaddr/netaddr.spec'
|
75
70
|
RPMS = `find rpms/noarch -name "*netaddr*rpm"`
|
76
71
|
puts "\n################################################\n#"
|
77
72
|
puts "Created the following in rpms/noarch/\n#{RPMS}"
|
@@ -87,19 +82,54 @@ task all_rpms: :build do
|
|
87
82
|
puts 'RPMs are available in rpms/noarch/'
|
88
83
|
puts "Copy the RPMs to an EOS device then run the 'swix create' command."
|
89
84
|
puts ' Examples: '
|
90
|
-
puts '
|
91
|
-
puts '
|
92
|
-
puts "
|
93
|
-
puts "
|
94
|
-
puts '
|
95
|
-
puts '
|
96
|
-
puts '
|
97
|
-
puts '
|
98
|
-
puts '
|
99
|
-
puts "
|
100
|
-
puts "
|
101
|
-
puts '
|
102
|
-
puts '
|
85
|
+
puts ' Puppet Open Source: '
|
86
|
+
puts ' cd /mnt/flash; \\'
|
87
|
+
puts " swix create rbeapi-#{Rbeapi::VERSION}-1.swix \\"
|
88
|
+
puts " rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
|
89
|
+
puts ' rubygem-inifile-3.0.0-3.eos4.noarch.rpm \\'
|
90
|
+
puts ' rubygem-netaddr-1.5.0-2.eos4.noarch.rpm \\'
|
91
|
+
puts ' rubygem-net_http_unix-0.2.1-3.eos4.noarch.rpm'
|
92
|
+
puts ' Puppet-enterprise agent (3.x): '
|
93
|
+
puts ' cd/mnt/flash; \\'
|
94
|
+
puts " swix create rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix \\"
|
95
|
+
puts " rubygem-rbeapi-puppet3-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
|
96
|
+
puts ' rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \\'
|
97
|
+
puts ' rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm'
|
98
|
+
puts ' Puppet-All-in-one agent (2015.x/4.x): '
|
99
|
+
puts ' cd/mnt/flash; \\'
|
100
|
+
puts " swix create rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix \\"
|
101
|
+
puts " rubygem-rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
|
102
|
+
puts ' rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \\'
|
103
|
+
puts ' rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm \\'
|
104
|
+
puts ' rubygem-net_http_unix-puppet-aio-0.2.1-3.eos4.noarch.rpm'
|
105
|
+
end
|
106
|
+
|
107
|
+
desc 'Generate SWIX files from RPMs'
|
108
|
+
task swix: :all_rpms do
|
109
|
+
SWIX = 'PYTHONPATH=${PYTHONPATH}:/nfs/misc/tools/swix \
|
110
|
+
/nfs/misc/tools/swix/swix'
|
111
|
+
system "cd rpms/noarch;
|
112
|
+
rm -f rbeapi-#{Rbeapi::VERSION}-1.swix;
|
113
|
+
#{SWIX} create rbeapi-#{Rbeapi::VERSION}-1.swix \
|
114
|
+
rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
|
115
|
+
rubygem-inifile-3.0.0-3.eos4.noarch.rpm \
|
116
|
+
rubygem-netaddr-1.5.0-2.eos4.noarch.rpm"
|
117
|
+
system "cd rpms/noarch;
|
118
|
+
rm -f rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix;
|
119
|
+
#{SWIX} create rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix \
|
120
|
+
rubygem-rbeapi-puppet3-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
|
121
|
+
rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \
|
122
|
+
rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm"
|
123
|
+
system "cd rpms/noarch;
|
124
|
+
rm -f rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix;
|
125
|
+
#{SWIX} create rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix \
|
126
|
+
rubygem-rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
|
127
|
+
rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \
|
128
|
+
rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm"
|
129
|
+
SWIXS = `find rpms/noarch -name "rbeapi*swix" -ls`
|
130
|
+
puts "\n################################################\n#"
|
131
|
+
puts "The following artifacts are in rpms/noarch/\n#{SWIXS}"
|
132
|
+
puts "#\n################################################\n\n"
|
103
133
|
end
|
104
134
|
|
105
135
|
task release: :build do
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Name: %{?enterprise:pe-}rubygem-%{gem_name}
|
5
5
|
Version: 3.0.0
|
6
|
-
Release:
|
6
|
+
Release: 3.eos4
|
7
7
|
Summary: INI file reader and writer
|
8
8
|
|
9
9
|
Group: Development/Languages
|
@@ -11,19 +11,8 @@ License: Unknown
|
|
11
11
|
URL: http://rubygems.org/gems/inifile
|
12
12
|
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
13
13
|
|
14
|
-
%if 0%{?enterprise:1} == 1
|
15
|
-
# Use these settings for Puppet Enterprise
|
16
|
-
%global gem /opt/puppet/bin/gem
|
17
|
-
Requires: pe-ruby
|
18
|
-
Requires: pe-rubygems
|
19
|
-
Provides: pe-rubygem(%{gem_name}) = %{version}
|
20
|
-
Provides: pe-rubygem-%{gem_name} = %{version}
|
21
|
-
%else
|
22
|
-
# Use these settings for all other installs
|
23
|
-
%global gem gem
|
24
14
|
Requires: ruby(abi) = %{rubyabi}
|
25
15
|
Provides: ruby(%{gem_name}) = %{version}-%{release}
|
26
|
-
%endif
|
27
16
|
|
28
17
|
BuildArch: noarch
|
29
18
|
|
@@ -60,6 +49,25 @@ are also possible
|
|
60
49
|
var1 = baz
|
61
50
|
var2 = shoodle.
|
62
51
|
|
52
|
+
%package puppet3
|
53
|
+
Summary: Inifile rubygem packaged for Puppet 3.x on Arista EOS
|
54
|
+
Group: Development/Languages
|
55
|
+
Requires: pe-ruby
|
56
|
+
Requires: pe-rubygems
|
57
|
+
Provides: pe-rubygem(%{gem_name}) = %{version}
|
58
|
+
Provides: pe-rubygem-%{gem_name} = %{version}
|
59
|
+
%description puppet3
|
60
|
+
The inifile rubygem packaged for Puppet 3.x on Arista EOS.
|
61
|
+
|
62
|
+
%package puppet-aio
|
63
|
+
Summary: Inifile rubygem packaged for Puppet 2015 (4.x) on Arista EOS
|
64
|
+
Group: Development/Languages
|
65
|
+
# Use these settings for all other installs
|
66
|
+
Requires: puppet >= 4.0.0
|
67
|
+
Provides: rubygem-%{gem_name} = %{version}
|
68
|
+
%description puppet-aio
|
69
|
+
The inifile rubygem packaged for Puppet 2015 (4.x) on Arista EOS.
|
70
|
+
|
63
71
|
%prep
|
64
72
|
%setup -q -D -T -n .
|
65
73
|
|
@@ -70,13 +78,41 @@ install %{SOURCE0} %{buildroot}/
|
|
70
78
|
%files
|
71
79
|
/%{gem_name}-%{version}.gem
|
72
80
|
|
81
|
+
%files puppet3
|
82
|
+
/%{gem_name}-%{version}.gem
|
83
|
+
|
84
|
+
%files puppet-aio
|
85
|
+
/%{gem_name}-%{version}.gem
|
86
|
+
|
73
87
|
%post
|
74
|
-
|
88
|
+
GEM_OPTS="--no-document --local"
|
89
|
+
gem install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
75
90
|
|
76
91
|
%preun
|
77
|
-
|
92
|
+
gem uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
93
|
+
|
94
|
+
%post puppet3
|
95
|
+
GEM=/opt/puppet/bin/gem
|
96
|
+
GEM_OPTS="--no-document --local"
|
97
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
98
|
+
|
99
|
+
%preun puppet3
|
100
|
+
GEM=/opt/puppet/bin/gem
|
101
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
102
|
+
|
103
|
+
%post puppet-aio
|
104
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
105
|
+
GEM_OPTS="--no-document --local"
|
106
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
107
|
+
|
108
|
+
%preun puppet-aio
|
109
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
110
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
78
111
|
|
79
112
|
%changelog
|
113
|
+
* Fri Oct 30 2015 Jere Julian - 3.0.0-3
|
114
|
+
- Detect the location of the puppet-agent's gem install
|
115
|
+
|
80
116
|
* Thu May 21 2015 Jere Julian - 3.0.0-2
|
81
117
|
- Ubuntu requires we manually create the buildroot
|
82
118
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Name: %{?enterprise:pe-}rubygem-%{gem_name}
|
5
5
|
Version: 0.2.1
|
6
|
-
Release:
|
6
|
+
Release: 3.eos4
|
7
7
|
Summary: Wrapper around Net::HTTP with AF_UNIX support
|
8
8
|
|
9
9
|
Group: Development/Languages
|
@@ -11,25 +11,30 @@ License: Apache 2.0
|
|
11
11
|
URL: http://github.com/puppetlabs/net_http_unix
|
12
12
|
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
13
13
|
|
14
|
-
%if 0%{?enterprise:1} == 1
|
15
|
-
# Use these settings for Puppet Enterprise
|
16
|
-
%global gem /opt/puppet/bin/gem
|
17
|
-
Requires: pe-ruby
|
18
|
-
Requires: pe-rubygems
|
19
|
-
Provides: pe-rubygem(%{gem_name}) = %{version}
|
20
|
-
Provides: pe-rubygem-%{gem_name} = %{version}
|
21
|
-
%else
|
22
|
-
# Use these settings for all other installs
|
23
|
-
%global gem gem
|
24
14
|
Requires: ruby(abi) = %{rubyabi}
|
25
15
|
Provides: ruby(%{gem_name}) = %{version}-%{release}
|
26
|
-
%endif
|
27
16
|
|
28
17
|
BuildArch: noarch
|
29
18
|
|
30
19
|
%description
|
31
20
|
Wrapper around Net::HTTP with AF_UNIX support.
|
32
21
|
|
22
|
+
%package puppet3
|
23
|
+
Group: Development/Languages
|
24
|
+
Summary: Net_http_unix rubygem packaged for Puppet Enterprise 3.x agents
|
25
|
+
Requires: pe-ruby
|
26
|
+
Requires: pe-rubygems
|
27
|
+
Provides: pe-rubygem(%{gem_name}) = %{version}
|
28
|
+
Provides: pe-rubygem-%{gem_name} = %{version}
|
29
|
+
%description puppet3
|
30
|
+
|
31
|
+
%package puppet-aio
|
32
|
+
Group: Development/Languages
|
33
|
+
Summary: Net_http_unix rubygem packaged for Puppet All-In-One (4.x) agents
|
34
|
+
Requires: puppet >= 4.0.0
|
35
|
+
Provides: rubygem-%{gem_name} = %{version}
|
36
|
+
%description puppet-aio
|
37
|
+
|
33
38
|
%prep
|
34
39
|
%setup -q -D -T -n .
|
35
40
|
|
@@ -40,14 +45,42 @@ install %{SOURCE0} %{buildroot}/
|
|
40
45
|
%files
|
41
46
|
/%{gem_name}-%{version}.gem
|
42
47
|
|
48
|
+
%files puppet3
|
49
|
+
/%{gem_name}-%{version}.gem
|
50
|
+
|
51
|
+
%files puppet-aio
|
52
|
+
/%{gem_name}-%{version}.gem
|
53
|
+
|
43
54
|
%post
|
44
|
-
|
55
|
+
GEM_OPTS="--no-document --local"
|
56
|
+
gem install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
45
57
|
|
46
58
|
%preun
|
47
|
-
|
59
|
+
gem uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
60
|
+
|
61
|
+
%post puppet3
|
62
|
+
GEM=/opt/puppet/bin/gem
|
63
|
+
GEM_OPTS="--no-document --local"
|
64
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
65
|
+
|
66
|
+
%preun puppet3
|
67
|
+
GEM=/opt/puppet/bin/gem
|
68
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
69
|
+
|
70
|
+
%post puppet-aio
|
71
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
72
|
+
GEM_OPTS="--no-document --local"
|
73
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
74
|
+
|
75
|
+
%preun puppet-aio
|
76
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
77
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1pckage puppet3
|
48
78
|
|
49
79
|
%changelog
|
50
|
-
*
|
80
|
+
* Fri Oct 30 2015 Jere Julian - 0.2.1-3
|
81
|
+
- Detect the location of the puppet-agent's gem install
|
82
|
+
|
83
|
+
* Thu May 21 2015 Jere Julian - 0.2.1-2
|
51
84
|
- Ubuntu requires we manually create the buildroot
|
52
85
|
|
53
86
|
* Tue Mar 17 2015 Jere Julian - 0.2.1-1
|
@@ -3,31 +3,36 @@
|
|
3
3
|
|
4
4
|
Name: %{?enterprise:pe-}rubygem-%{gem_name}
|
5
5
|
Version: 1.5.0
|
6
|
-
Release:
|
6
|
+
Release: 2.eos4
|
7
7
|
Summary: A package for manipulating network addresses
|
8
8
|
Group: Development/Languages
|
9
9
|
License: Unknown
|
10
10
|
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
11
11
|
|
12
|
-
%if 0%{?enterprise:1} == 1
|
13
|
-
# Use these settings for Puppet Enterprise
|
14
|
-
%global gem /opt/puppet/bin/gem
|
15
|
-
Requires: pe-ruby
|
16
|
-
Requires: pe-rubygems
|
17
|
-
Provides: pe-rubygem(%{gem_name}) = %{version}
|
18
|
-
Provides: pe-rubygem-%{gem_name} = %{version}
|
19
|
-
%else
|
20
|
-
# Use these settings for all other installs
|
21
|
-
%global gem gem
|
22
12
|
Requires: ruby(abi) = %{rubyabi}
|
23
13
|
Provides: ruby(%{gem_name}) = %{version}-%{release}
|
24
|
-
%endif
|
25
14
|
|
26
15
|
BuildArch: noarch
|
27
16
|
|
17
|
+
|
28
18
|
%description
|
29
19
|
A package for manipulating network addresses.
|
30
20
|
|
21
|
+
%package puppet3
|
22
|
+
Summary: NetAddr rubygem packaged for Puppet Enterprise 3.x agents
|
23
|
+
Group: Development/Languages
|
24
|
+
Requires: pe-ruby
|
25
|
+
Requires: pe-rubygems
|
26
|
+
Provides: pe-rubygem(%{gem_name}) = %{version}
|
27
|
+
Provides: pe-rubygem-%{gem_name} = %{version}
|
28
|
+
%description puppet3
|
29
|
+
|
30
|
+
%package puppet-aio
|
31
|
+
Summary: NetAddr rubygem packaged for Puppet All-In-One (4.x) agents
|
32
|
+
Group: Development/Languages
|
33
|
+
Requires: puppet >= 4.0.0
|
34
|
+
Provides: rubygem-%{gem_name} = %{version}
|
35
|
+
%description puppet-aio
|
31
36
|
|
32
37
|
%prep
|
33
38
|
%setup -q -D -T -n .
|
@@ -39,12 +44,40 @@ install %{SOURCE0} %{buildroot}/
|
|
39
44
|
%files
|
40
45
|
/%{gem_name}-%{version}.gem
|
41
46
|
|
47
|
+
%files puppet3
|
48
|
+
/%{gem_name}-%{version}.gem
|
49
|
+
|
50
|
+
%files puppet-aio
|
51
|
+
/%{gem_name}-%{version}.gem
|
52
|
+
|
42
53
|
%post
|
43
|
-
|
54
|
+
GEM_OPTS="--no-document --local"
|
55
|
+
gem install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
44
56
|
|
45
57
|
%preun
|
46
|
-
|
58
|
+
gem uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
59
|
+
|
60
|
+
%post puppet3
|
61
|
+
GEM=/opt/puppet/bin/gem
|
62
|
+
GEM_OPTS="--no-document --local"
|
63
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
64
|
+
|
65
|
+
%preun puppet3
|
66
|
+
GEM=/opt/puppet/bin/gem
|
67
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
68
|
+
|
69
|
+
%post puppet-aio
|
70
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
71
|
+
GEM_OPTS="--no-document --local"
|
72
|
+
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1
|
73
|
+
|
74
|
+
%preun puppet-aio
|
75
|
+
GEM=/opt/puppetlabs/puppet/bin/gem
|
76
|
+
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
|
47
77
|
|
48
78
|
%changelog
|
79
|
+
* Fri Oct 30 2015 Jere Julian - 1.5.0-2
|
80
|
+
- Detect the location of the puppet-agent's gem install
|
81
|
+
|
49
82
|
* Tue Jul 07 2015 Jere Julian <jere@arista.com> - 1.5.0-1
|
50
83
|
- Initial package
|
data/lib/rbeapi/api/bgp.rb
CHANGED
@@ -55,11 +55,12 @@ module Rbeapi
|
|
55
55
|
# Hash.
|
56
56
|
def get
|
57
57
|
config = get_block('^router bgp .*')
|
58
|
-
return
|
58
|
+
return nil unless config
|
59
59
|
|
60
60
|
response = Bgp.parse_bgp_as(config)
|
61
61
|
response.merge!(parse_router_id(config))
|
62
62
|
response.merge!(parse_shutdown(config))
|
63
|
+
response.merge!(parse_maximum_paths(config))
|
63
64
|
response.merge!(parse_networks(config))
|
64
65
|
response[:neighbors] = @neighbors.getall
|
65
66
|
response
|
@@ -110,6 +111,21 @@ module Rbeapi
|
|
110
111
|
end
|
111
112
|
private :parse_shutdown
|
112
113
|
|
114
|
+
##
|
115
|
+
# parse_maximum_paths scans the BGP routing configuration for the
|
116
|
+
# maximum paths and maximum ecmp paths.
|
117
|
+
#
|
118
|
+
# @api private
|
119
|
+
#
|
120
|
+
# @param [String] :config The switch config.
|
121
|
+
#
|
122
|
+
# @return [Hash<Symbol, Object>] resource hash attribute
|
123
|
+
def parse_maximum_paths(config)
|
124
|
+
values = config.scan(/maximum-paths\s+(\d+)\s+ecmp\s+(\d+)/).first
|
125
|
+
{ maximum_paths: values[0].to_i, maximum_ecmp_paths: values[1].to_i }
|
126
|
+
end
|
127
|
+
private :parse_maximum_paths
|
128
|
+
|
113
129
|
##
|
114
130
|
# parse_networks scans the BGP routing configuration for all
|
115
131
|
# the network entries.
|
@@ -133,6 +149,8 @@ module Rbeapi
|
|
133
149
|
|
134
150
|
##
|
135
151
|
# create will create a new instance of BGP routing on the node.
|
152
|
+
# Optional parameters can be passed in to initialize BGP specific
|
153
|
+
# settings.
|
136
154
|
#
|
137
155
|
# @commands
|
138
156
|
# router bgp <bgp_as>
|
@@ -140,10 +158,48 @@ module Rbeapi
|
|
140
158
|
# @param [String] :bgp_as The BGP autonomous system number to be
|
141
159
|
# configured for the local BGP routing instance.
|
142
160
|
#
|
161
|
+
#
|
162
|
+
# @param [hash] :opts Optional keyword arguments
|
163
|
+
#
|
164
|
+
# @option :opts [String] :router_id The BGP routing process router-id
|
165
|
+
# value. When no ID has been specified (i.e. value not set), the
|
166
|
+
# local router ID is set to the following:
|
167
|
+
# * The loopback IP address when a single loopback interface is
|
168
|
+
# configured.
|
169
|
+
# * The loopback with the highest IP address when multiple loopback
|
170
|
+
# interfaces are configured.
|
171
|
+
# * The highest IP address on a physical interface when no loopback
|
172
|
+
# interfaces are configure
|
173
|
+
#
|
174
|
+
# @option :opts [Integer] :maximum_paths Maximum number of equal cost
|
175
|
+
# paths.
|
176
|
+
#
|
177
|
+
# @option :opts [Integer] :maximum_ecmp_paths Maximum number of installed
|
178
|
+
# ECMP routes. The maximum_paths option must be set if
|
179
|
+
# maximum_ecmp_paths is set.
|
180
|
+
#
|
181
|
+
# @option :opts [Boolean] :enable If true then the BGP router is enabled.
|
182
|
+
# If false then the BGP router is disabled.
|
183
|
+
#
|
143
184
|
# @return [Boolean] returns true if the command completed successfully
|
144
|
-
def create(bgp_as)
|
145
|
-
|
146
|
-
|
185
|
+
def create(bgp_as, opts = {})
|
186
|
+
if opts[:maximum_ecmp_paths] && !opts[:maximum_paths]
|
187
|
+
message = 'maximum_paths must be set if maximum_ecmp_paths is set'
|
188
|
+
fail ArgumentError, message
|
189
|
+
end
|
190
|
+
cmds = ["router bgp #{bgp_as}"]
|
191
|
+
if opts.key?(:enable)
|
192
|
+
cmds << (opts[:enable] == true ? 'no shutdown' : 'shutdown')
|
193
|
+
end
|
194
|
+
cmds << "router-id #{opts[:router_id]}" if opts.key?(:router_id)
|
195
|
+
if opts.key?(:maximum_paths)
|
196
|
+
cmd = "maximum-paths #{opts[:maximum_paths]}"
|
197
|
+
if opts.key?(:maximum_ecmp_paths)
|
198
|
+
cmd << " ecmp #{opts[:maximum_ecmp_paths]}"
|
199
|
+
end
|
200
|
+
cmds << cmd
|
201
|
+
end
|
202
|
+
configure(cmds)
|
147
203
|
end
|
148
204
|
|
149
205
|
##
|
@@ -250,6 +306,46 @@ module Rbeapi
|
|
250
306
|
configure_bgp(command_builder('shutdown', opts))
|
251
307
|
end
|
252
308
|
|
309
|
+
##
|
310
|
+
# set_maximum_paths sets the maximum number of equal cost paths and
|
311
|
+
# the maximum number of installed ECMP routes.
|
312
|
+
#
|
313
|
+
# @commands
|
314
|
+
# router bgp <bgp_as>
|
315
|
+
# {no | default}
|
316
|
+
# maximum-paths <maximum_paths> [ecmp <maximum_ecmp_paths>]
|
317
|
+
#
|
318
|
+
# @param [Integer] :maximum_paths Maximum number of equal cost paths.
|
319
|
+
#
|
320
|
+
# @param [Integer] :maximum_ecmp_paths Maximum number of installed ECMP
|
321
|
+
# routes.
|
322
|
+
#
|
323
|
+
# @param [hash] :opts Optional keyword arguments
|
324
|
+
#
|
325
|
+
# @option :opts [Boolean] :enable If false then the command is
|
326
|
+
# negated. Default is true.
|
327
|
+
#
|
328
|
+
# @option :opts [Boolean] :default Configure the maximum paths using
|
329
|
+
# the default keyword
|
330
|
+
#
|
331
|
+
# @return [Boolean] returns true if the command complete successfully
|
332
|
+
def set_maximum_paths(maximum_paths, maximum_ecmp_paths, opts = {})
|
333
|
+
enable = opts.fetch(:enable, true)
|
334
|
+
default = opts[:default] || false
|
335
|
+
|
336
|
+
case default
|
337
|
+
when true
|
338
|
+
cmd = 'default maximum-paths'
|
339
|
+
when false
|
340
|
+
if enable
|
341
|
+
cmd = "maximum-paths #{maximum_paths} ecmp #{maximum_ecmp_paths}"
|
342
|
+
else
|
343
|
+
cmd = 'no maximum-paths'
|
344
|
+
end
|
345
|
+
end
|
346
|
+
configure_bgp(cmd)
|
347
|
+
end
|
348
|
+
|
253
349
|
##
|
254
350
|
# add_network creates a new instance of a BGP network on the node.
|
255
351
|
#
|