adding MEM manager changes
Change-Id: Ibc5b03b1cf510603af914a821e49a5c3fd5e33d9
This commit is contained in:
parent
ca67ca5d43
commit
60c2743048
@ -7,8 +7,8 @@ forge "https://forgeapi.puppetlabs.com"
|
||||
## OpenStack modules
|
||||
|
||||
mod 'puppet-neutron',
|
||||
:git => 'https://github.com/ahharu/puppet-neutron',
|
||||
:ref => 'master'
|
||||
:git => 'https://github.com/openstack/puppet-neutron',
|
||||
:ref => 'stable/mitaka'
|
||||
|
||||
## External modules
|
||||
|
||||
@ -17,3 +17,5 @@ mod 'puppetlabs/apt'
|
||||
mod 'puppetlabs/java'
|
||||
mod 'puppetlabs/tomcat'
|
||||
mod 'puppetlabs/stdlib'
|
||||
mod 'puppetlabs/apache'
|
||||
mod 'puppetlabs/concat'
|
||||
|
134
manifests/mem.pp
Normal file
134
manifests/mem.pp
Normal file
@ -0,0 +1,134 @@
|
||||
# == Class: midonet::mem
|
||||
#
|
||||
# Install and configure Midokura Enterprise MidoNet (MEM)
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [mem_package]
|
||||
# Name of the MEM package
|
||||
#
|
||||
# [mem_install_path]
|
||||
# Installation path of MEM package
|
||||
#
|
||||
# [api_host]
|
||||
# Configures the MidoNet REST API's host:port combination. This can be either
|
||||
# the API host's host name and Tomcat port, or if proxied, e.g via Apache,
|
||||
# the corresponding proxy host name and port.
|
||||
# e.g. "api_host": "http://host:port"
|
||||
#
|
||||
# [api_version]
|
||||
# The default value for the api_version is set to latest version. In case you
|
||||
# are using and older MidoNet REST API, change the version accordingly.
|
||||
# Note: The MidoNet Manager supports the following API versions: 1.8 and 1.9
|
||||
# e.g. "api_version": "1.9"
|
||||
#
|
||||
# [api_token]
|
||||
# If desired, auto-login can be enabled by setting the value of api_token to
|
||||
# your Keystone token.
|
||||
# e.g. "api_token": keystone_token
|
||||
#
|
||||
# [api_namespace]
|
||||
# The default value for the api_namespace is set to midonet-api which usually
|
||||
# does not have to be changed.
|
||||
# Default value: "api_namespace": "midonet-api"
|
||||
#
|
||||
# [login_host]
|
||||
# Configures the authentication host's host:port combination. Usually your
|
||||
# authentication server, e.g. Keystone, is accessible from the same address as
|
||||
# the MidoNet REST API, so the host:port combination should be the same as for
|
||||
# the API host ("api_host"). Should the authentication server be located on a
|
||||
# different host then the MidoNet REST API, change this parameter accordingly.
|
||||
# e.g "login_host": "http://host:port"
|
||||
#
|
||||
# [trace_api_host]
|
||||
# Configures the trace requests management API host:port combination. It is
|
||||
# usually the same as the "api_host" but could be setup to run on a different
|
||||
# server. This can be either the API host's host name and Tomcat port, or if
|
||||
# proxied, e.g via Apache, the corresponding proxy host name and port.
|
||||
# e.g. "trace_api_host": "http://host:port"
|
||||
#
|
||||
# [traces_ws_url]
|
||||
# Configures the websocket endpoint host:port combination. This endpoint is
|
||||
# used by the Flow Tracing feature in Midonet Manager.
|
||||
# e.g. "trace_ws_url": "ws://host:port"
|
||||
#
|
||||
# [agent_config_api_host]
|
||||
# Configures the Agent Configuration API host:port combination. The Host is
|
||||
# usually the same as the Midonet REST API and the default port is 8459.
|
||||
# e.g. "agent_config_api_host": "http://host:port"
|
||||
#
|
||||
# [agent_config_api_namespace]
|
||||
# The default value for the 'agent_config_api_namespace' is set to 'conf'
|
||||
# which usually does not have to be changed.
|
||||
# Default value: "api_namespace": "conf"
|
||||
#
|
||||
# [poll_enabled]
|
||||
# The Auto Polling will seamlessly refresh Midonet Manager data periodically.
|
||||
# It is enabled by default and can be disabled in Midonet Manager's Settings
|
||||
# section directly through the UI. This will only disable it for the duration
|
||||
# of the current session. It can also be disabled permanently by changing the
|
||||
# 'poll_enabled' parameter to 'false'
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# Midonet (http://midonet.org)
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (c) 2016 Midokura SARL, All Rights Reserved.
|
||||
|
||||
class midonet::mem(
|
||||
# Midonet Manager installation options
|
||||
$mem_package = $::midonet::params::mem_package,
|
||||
$mem_install_path = $::midonet::params::mem_install_path,
|
||||
$mem_api_host = $::midonet::params::mem_api_host,
|
||||
$mem_login_host = $::midonet::params::mem_login_host,
|
||||
$mem_trace_api_host = $::midonet::params::mem_trace_api_host,
|
||||
$mem_traces_ws_url = $::midonet::params::mem_traces_ws_url,
|
||||
$mem_api_namespace = $::midonet::params::mem_api_namespace,
|
||||
$mem_api_version = $::midonet::params::mem_api_version,
|
||||
$mem_api_token = $::midonet::params::mem_api_token,
|
||||
$mem_agent_config_api_namespace = $::midonet::params::mem_agent_config_api_namespace,
|
||||
$mem_analytics_ws_api_url = $::midonet::params::mem_analytics_ws_api_url,
|
||||
$mem_poll_enabled = $::midonet::params::mem_poll_enabled,
|
||||
$mem_login_animation_enabled = $::midonet::params::mem_login_animation_enabled,
|
||||
$mem_config_file = $::midonet::params::mem_config_file,
|
||||
|
||||
) inherits midonet::params {
|
||||
|
||||
include midonet::repository
|
||||
|
||||
validate_string($mem_package)
|
||||
validate_string($mem_install_path)
|
||||
|
||||
validate_string($mem_api_host)
|
||||
validate_string($mem_login_host)
|
||||
validate_string($mem_trace_api_host)
|
||||
validate_string($mem_traces_ws_url)
|
||||
validate_string($mem_api_namespace)
|
||||
validate_bool($mem_api_token)
|
||||
validate_string($mem_api_version)
|
||||
validate_string($mem_config_file)
|
||||
validate_string($mem_agent_config_api_namespace)
|
||||
validate_string($mem_analytics_ws_api_url)
|
||||
validate_bool($mem_poll_enabled)
|
||||
validate_bool($mem_login_animation_enabled)
|
||||
|
||||
|
||||
package { 'midonet-manager':
|
||||
ensure => installed,
|
||||
name => $mem_package
|
||||
}
|
||||
|
||||
file { 'midonet-manager-config':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
path => "${mem_install_path}/config/client.js",
|
||||
content => template("${module_name}/client.js.erb"),
|
||||
require => Package['midonet-manager']
|
||||
}
|
||||
|
||||
include ::midonet::mem::vhost
|
||||
}
|
||||
|
62
manifests/mem/vhost.pp
Normal file
62
manifests/mem/vhost.pp
Normal file
@ -0,0 +1,62 @@
|
||||
# == Class: midonet::mem::vhost
|
||||
#
|
||||
# This class installs apache2/httpd server and configures a custom virtualhost
|
||||
# for midonet-manager.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*apache_port*]
|
||||
# The TCP port where apache2/httpd server is listening on.
|
||||
# Note: this value has been defaulted to '80'
|
||||
#
|
||||
# [*docroot*]
|
||||
# The value for the virtualhost DocumentRoot directive.
|
||||
# Note: this value has been defaulted to '/var/www/html'
|
||||
#
|
||||
# [*servername*]
|
||||
# The value for the virtualhost ServerName directive.
|
||||
# Note: this value has been defaulted to "http://$::ipaddress"
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# Midonet (http://midonet.org)
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (c) 2016 Midokura SARL, All Rights Reserved.
|
||||
|
||||
class midonet::mem::vhost (
|
||||
$mem_apache_port = $midonet::params::mem_apache_port,
|
||||
$mem_apache_docroot = $midonet::params::mem_apache_docroot,
|
||||
$mem_apache_servername = $midonet::params::mem_apache_servername,
|
||||
$proxy_pass = [
|
||||
{ 'path' => "/${midonet::params::mem_api_namespace}",
|
||||
'url' => $midonet::params::mem_api_host,
|
||||
},
|
||||
],
|
||||
$directories = [
|
||||
{ 'path' => $docroot,
|
||||
'allow' => 'from all',
|
||||
},
|
||||
],
|
||||
) inherits midonet::params {
|
||||
|
||||
validate_string($mem_apache_port)
|
||||
validate_string($mem_apache_docroot)
|
||||
validate_string($mem_apache_servername)
|
||||
validate_array($proxy_pass)
|
||||
validate_array($directories)
|
||||
|
||||
include ::apache
|
||||
include ::apache::mod::headers
|
||||
|
||||
apache::vhost { 'midonet-mem':
|
||||
port => $mem_apache_port,
|
||||
servername => $mem_apache_servername,
|
||||
docroot => $mem_apache_docroot,
|
||||
proxy_pass => $proxy_pass,
|
||||
directories => $directories,
|
||||
require => Package[$midonet::params::mem_package],
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,36 @@
|
||||
|
||||
class midonet::params {
|
||||
|
||||
$midonet_repo_baseurl = 'builds.midonet.org'
|
||||
$midonet_key_url = "https://${midonet_repo_baseurl}/midorepo.key"
|
||||
$midonet_repo_baseurl = 'builds.midonet.org'
|
||||
$midonet_key_url = "https://${midonet_repo_baseurl}/midorepo.key"
|
||||
|
||||
$midonet_faraday_package = 'tfm-rubygem-faraday'
|
||||
$midonet_faraday_url = 'http://yum.theforeman.org/nightly/el7/x86_64/tfm-rubygem-faraday-0.9.1-3.el7.noarch.rpm'
|
||||
$midonet_multipart_post_package = 'tfm-rubygem-multipart-post'
|
||||
$midonet_multipart_post_url = 'http://yum.theforeman.org/nightly/el7/x86_64/tfm-rubygem-multipart-post-1.2.0-4.el7.noarch.rpm'
|
||||
|
||||
# midonet MEM Manager
|
||||
$mem_package = 'midonet-manager'
|
||||
$mem_install_path = '/var/www/html/midonet-manager'
|
||||
|
||||
# MEM Manager config.js parameters
|
||||
$mem_agent_config_api_namespace = 'conf'
|
||||
$mem_analytics_ws_api_url = "wss://${::ipaddress}:8080/analytics"
|
||||
$mem_api_host = "http://${::ipaddress}:8181"
|
||||
$mem_api_namespace = 'midonet-api'
|
||||
$mem_api_token = false
|
||||
$mem_api_version = '5.0'
|
||||
$mem_login_host = "http://${::ipaddress}:8181"
|
||||
$mem_poll_enabled = true
|
||||
$mem_login_animation_enabled = true
|
||||
$mem_trace_api_host = "http://${::ipaddress}:8181"
|
||||
$mem_traces_ws_url = "wss://${::ipaddress}:8460"
|
||||
$mem_config_file = "${mem_install_path}/config/client.js"
|
||||
|
||||
# MEM vhost parameters for apache conf
|
||||
$mem_apache_port = '80'
|
||||
$mem_apache_servername = "http://${::ipaddress}"
|
||||
$mem_apache_docroot = '/var/www/html'
|
||||
|
||||
$midonet_faraday_package = 'tfm-rubygem-faraday'
|
||||
$midonet_faraday_url = 'http://yum.theforeman.org/nightly/el7/x86_64/tfm-rubygem-faraday-0.9.1-3.el7.noarch.rpm'
|
||||
$midonet_multipart_post_package = 'tfm-rubygem-multipart-post'
|
||||
$midonet_multipart_post_url = 'http://yum.theforeman.org/nightly/el7/x86_64/tfm-rubygem-multipart-post-1.2.0-4.el7.noarch.rpm'
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,8 @@
|
||||
{ "name":"puppetlabs-apt","version_requirement":">=1.7.0 <2.0.0" },
|
||||
{ "name":"puppetlabs-java","version_requirement":">=1.3.0" },
|
||||
{ "name":"puppetlabs-tomcat","version_requirement":">=1.2.0" },
|
||||
{ "name":"puppetlabs-stdlib","version_requirement":">= 4.2.0 < 5.0.0" }
|
||||
{ "name":"puppetlabs-stdlib","version_requirement":">= 4.2.0 < 5.0.0" },
|
||||
{ "name":"puppetlabs-apache","version_requirement":">=1.8.1" }
|
||||
],
|
||||
"tags": ["openstack", "sdn", "midonet"],
|
||||
"operatingsystem_support": [
|
||||
|
16
spec/acceptance/midonet_mem_manager_spec.rb
Normal file
16
spec/acceptance/midonet_mem_manager_spec.rb
Normal file
@ -0,0 +1,16 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'midonet class' do
|
||||
context 'with mem' do
|
||||
# Using puppet_apply as a helper
|
||||
it 'should work without any errors' do
|
||||
pp = <<-EOS
|
||||
include ::midonet::mem
|
||||
EOS
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
expect(apply_manifest(pp).exit_code).to_not eq(1)
|
||||
expect(apply_manifest(pp).exit_code).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
23
spec/classes/midonet_mem_manager_spec.rb
Normal file
23
spec/classes/midonet_mem_manager_spec.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'midonet::mem' do
|
||||
context 'with default parameters' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '14.04',
|
||||
:kernel => 'Linux',
|
||||
:ipaddress => '192.168.79.13',
|
||||
:concat_basedir => '/var/packages',
|
||||
:fqdn => 'gateway',
|
||||
:memorysize => '2048',
|
||||
:lsbdistid => 'trusty',
|
||||
:lsbdistrelease => '14.04'
|
||||
}
|
||||
end
|
||||
it { is_expected.to contain_package('midonet-manager').with(
|
||||
'ensure' => 'installed',
|
||||
) }
|
||||
end
|
||||
end
|
41
templates/client.js.erb
Normal file
41
templates/client.js.erb
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
<% if @api_host -%>
|
||||
"api_host": "<%= @mem_api_host %>",
|
||||
<% end -%>
|
||||
<% if @login_host -%>
|
||||
"login_host": "<%= @mem_login_host %>",
|
||||
<% end -%>
|
||||
<% if @trace_api_host -%>
|
||||
"trace_api_host": "<%= @mem_trace_api_host %>",
|
||||
<% end -%>
|
||||
<% if @traces_ws_url -%>
|
||||
"traces_ws_url": "<%= @mem_traces_ws_url %>",
|
||||
<% end -%>
|
||||
<% if @api_namespace -%>
|
||||
"api_namespace": "<%= @mem_api_namespace %>",
|
||||
<% elsif @api_namespace == nil -%>
|
||||
"api_namespace": "midonet-api",
|
||||
<% end -%>
|
||||
<% if @api_version -%>
|
||||
"api_version": "<%= @mem_api_version %>",
|
||||
<% end -%>
|
||||
<% if @api_token -%>
|
||||
"api_token": "<%= @mem_api_token %>",
|
||||
<% elsif @api_token == false -%>
|
||||
"api_token": false,
|
||||
<% end -%>
|
||||
<% if @agent_config_api_namespace -%>
|
||||
"agent_config_api_namespace": "<%= @mem_agent_config_api_namespace %>",
|
||||
<% elsif @agent_config_api_namespace == nil -%>
|
||||
"agent_config_api_namespace": "conf",
|
||||
<% end -%>
|
||||
<% if @analytics_ws_api_url -%>
|
||||
"analytics_ws_api_url": "<%= @mem_analytics_ws_api_url %>",
|
||||
<% end -%>
|
||||
<% if @poll_enabled -%>
|
||||
"poll_enabled": "<%= @mem_poll_enabled %>",
|
||||
<% end -%>
|
||||
<% if @login_animation_enabled -%>
|
||||
"login_animation_enabled": "<%= @mem_login_animation_enabled %>"
|
||||
<% end -%>
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user