aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifests/honeycomb.pp33
-rw-r--r--spec/acceptance/fdio_spec.rb4
-rw-r--r--spec/acceptance/honeycomb_spec.rb12
-rw-r--r--spec/classes/honeycomb_spec.rb23
-rw-r--r--templates/honeycomb.json.erb41
5 files changed, 49 insertions, 64 deletions
diff --git a/manifests/honeycomb.pp b/manifests/honeycomb.pp
index 619f98e..78ef7ee 100644
--- a/manifests/honeycomb.pp
+++ b/manifests/honeycomb.pp
@@ -67,17 +67,32 @@ class fdio::honeycomb (
ensure => present,
require => Package['vpp'],
}
+
# Configuration of Honeycomb
- -> file { 'honeycomb.json':
- ensure => file,
- path => '/opt/honeycomb/config/honeycomb.json',
- # Set user:group owners
- owner => 'honeycomb',
- group => 'honeycomb',
- # Use a template to populate the content
- content => template('fdio/honeycomb.json.erb'),
+ augeas { 'credential.json':
+ lens => 'Json.lns',
+ incl => '/opt/honeycomb/config/credentials.json',
+ changes => [
+ "set /files/opt/honeycomb/config/credentials.json/dict/entry[. = 'username']/string ${user}",
+ "set /files/opt/honeycomb/config/credentials.json/dict/entry[. = 'password']/string ${password}",
+ ],
+ require => Package['honeycomb'],
+ before => Service['honeycomb'],
+ }
+ augeas { 'restconf.json':
+ lens => 'Json.lns',
+ incl => '/opt/honeycomb/config/restconf.json',
+ changes => [
+ "set /files/opt/honeycomb/config/restconf.json/dict/entry[. = 'restconf-binding-address']/string ${bind_ip}",
+ "set /files/opt/honeycomb/config/restconf.json/dict/entry[. = 'restconf-https-binding-address']/string ${bind_ip}",
+ "set /files/opt/honeycomb/config/restconf.json/dict/entry[. = 'restconf-port']/number ${rest_port}",
+ "set /files/opt/honeycomb/config/restconf.json/dict/entry[. = 'restconf-websocket-port']/number ${websocket_rest_port}",
+ ],
+ require => Package['honeycomb'],
+ before => Service['honeycomb'],
}
- ~> service { 'honeycomb':
+
+ service { 'honeycomb':
ensure => running,
enable => true,
hasstatus => true,
diff --git a/spec/acceptance/fdio_spec.rb b/spec/acceptance/fdio_spec.rb
index 250de9a..293707f 100644
--- a/spec/acceptance/fdio_spec.rb
+++ b/spec/acceptance/fdio_spec.rb
@@ -7,7 +7,7 @@ describe 'fdio' do
it 'should work with no errors' do
pp= <<-EOS
class { '::fdio':
- repo_branch => 'stable.1707'
+ repo_branch => 'stable.1710'
}
EOS
@@ -35,7 +35,7 @@ describe 'fdio' do
it 'should work with no errors' do
pp= <<-EOS
class { '::fdio':
- repo_branch => 'stable.1707',
+ repo_branch => 'stable.1710',
vpp_cpu_main_core => '1',
vpp_cpu_corelist_workers => '2',
vpp_vhostuser_coalesce_frames => 32,
diff --git a/spec/acceptance/honeycomb_spec.rb b/spec/acceptance/honeycomb_spec.rb
index 36f8a2e..27358b8 100644
--- a/spec/acceptance/honeycomb_spec.rb
+++ b/spec/acceptance/honeycomb_spec.rb
@@ -17,14 +17,20 @@ describe 'fdio::honeycomb' do
it { should be_installed }
end
- describe file('/opt/honeycomb/config/honeycomb.json') do
+ describe file('/opt/honeycomb/config/credentials.json') do
it { is_expected.to exist }
- its(:content) { should match /"restconf-port":\s+8181/ }
- its(:content) { should match /"restconf-websocket-port":\s+7779/ }
its(:content) { should match /"username":\s+"admin"/}
its(:content) { should match /"password":\s+"admin"/}
end
+ describe file('/opt/honeycomb/config/restconf.json') do
+ it { is_expected.to exist }
+ its(:content) { should match /"restconf-port":\s+8181/ }
+ its(:content) { should match /"restconf-websocket-port":\s+7779/ }
+ its(:content) { should match /"restconf-https-binding-address":\s+"127.0.0.1"/ }
+ its(:content) { should match /"restconf-binding-address":\s+"127.0.0.1"/ }
+ end
+
describe service('honeycomb') do
it { should be_running }
it { should be_enabled }
diff --git a/spec/classes/honeycomb_spec.rb b/spec/classes/honeycomb_spec.rb
index 8fc2252..a1968bf 100644
--- a/spec/classes/honeycomb_spec.rb
+++ b/spec/classes/honeycomb_spec.rb
@@ -14,21 +14,26 @@ describe 'fdio::honeycomb' do
it { should contain_class('fdio::honeycomb') }
it { should contain_class('fdio::install').that_comes_before('Class[fdio::config]') }
it { should contain_package('honeycomb').that_requires('Package[vpp]') }
- it { should contain_file('honeycomb.json').that_requires('Package[honeycomb]') }
- it { should contain_file('honeycomb.json').that_notifies('Service[honeycomb]') }
+ it { should contain_augeas('credential.json').that_requires('Package[honeycomb]') }
+ it { should contain_augeas('credential.json').that_comes_before('Service[honeycomb]') }
+ it { should contain_augeas('restconf.json').that_requires('Package[honeycomb]') }
+ it { should contain_augeas('restconf.json').that_comes_before('Service[honeycomb]') }
it { should contain_service('honeycomb').that_requires('Package[honeycomb]') }
it { should contain_service('honeycomb').that_requires('Service[vpp]') }
- it { should contain_file('honeycomb.json').with(
- 'ensure' => 'file',
- 'path' => '/opt/honeycomb/config/honeycomb.json',
- 'owner' => 'honeycomb',
- 'group' => 'honeycomb',
+ it { should contain_augeas('credential.json').with(
+ 'lens' => 'Json.lns',
+ 'incl' => '/opt/honeycomb/config/credentials.json',
+ )
+ }
+ it { should contain_augeas('restconf.json').with(
+ 'lens' => 'Json.lns',
+ 'incl' => '/opt/honeycomb/config/restconf.json',
)
}
it { should contain_service('honeycomb').with(
- 'ensure' => 'running',
- 'enable' => 'true',
+ 'ensure' => 'running',
+ 'enable' => 'true',
)
}
end
diff --git a/templates/honeycomb.json.erb b/templates/honeycomb.json.erb
deleted file mode 100644
index 601dd28..0000000
--- a/templates/honeycomb.json.erb
+++ /dev/null
@@ -1,41 +0,0 @@
- {
- "persisted-context-path": "/var/lib/honeycomb/persist/context/data.json",
- "persisted-context-restoration-type": "Merge",
- "persisted-config-path": "/var/lib/honeycomb/persist/config/data.json",
- "persisted-config-restoration-type": "Merge",
-
- "notification-service-queue-depth": 1,
-
- "restconf-http-enabled": "true",
- "restconf-root-path": "/restconf",
- "restconf-binding-address": "<%= scope['fdio::honeycomb::bind_ip'] %>",
- "restconf-port": <%= scope['fdio::honeycomb::rest_port'] %>,
- "restconf-https-enabled": "true",
- "restconf-https-binding-address": "<%= scope['fdio::honeycomb::bind_ip'] %>",
- "restconf-https-port": 8443,
- "restconf-keystore": "/honeycomb-keystore",
- "restconf-keystore-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-keystore-manager-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-truststore": "/honeycomb-keystore",
- "restconf-truststore-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-websocket-port": <%= scope['fdio::honeycomb::websocket_rest_port'] %>,
- "restconf-pool-max-size": 10,
- "restconf-pool-min-size": 1,
- "restconf-acceptors-size": 1,
- "restconf-selectors-size": 1,
- "restconf-https-acceptors-size": 1,
- "restconf-https-selectors-size": 1,
-
-
- "netconf-netty-threads": 2,
- "netconf-tcp-enabled" : "true",
- "netconf-tcp-binding-address": "127.0.0.1",
- "netconf-tcp-binding-port": 7777,
- "netconf-ssh-enabled" : "true",
- "netconf-ssh-binding-address": "0.0.0.0",
- "netconf-ssh-binding-port": 2831,
- "netconf-notification-stream-name": "honeycomb",
-
- "username": "<%= scope['fdio::honeycomb::user'] %>",
- "password": "<%= scope['fdio::honeycomb::password'] %>"
-}