Move arrakis here

Most of the arrakis code moved here, using puppet-cassandra and
puppet-zookeeper as dependencies

Change-Id: I6bdfb80457c500e2c6ea98aeaa9e7c074757c6c7
This commit is contained in:
Jaume Devesa 2015-06-08 16:50:31 +02:00
parent 77ec05e9cf
commit 8c353be83b
38 changed files with 1694 additions and 115 deletions

54
.gitignore vendored Normal file
View File

@ -0,0 +1,54 @@
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
**/pkg/
/spec/reports/
/test/tmp/
/test/version_tmp/
/tmp/
## Specific to RubyMotion:
.dat*
.repl_history
build/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalisation:
/.bundle/
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
Puppetfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# DS_Store
*/.DS_Store
# Configuration files for cloud9.io
*/.c9/
# Kitchen files
.kitchen/
# Librarian files
.librarian/
.tmp/
# Vim files
**.swp
# Ignore vagrant-generated files
.vagrant

33
.kitchen.yml Normal file
View File

@ -0,0 +1,33 @@
---
driver:
name: docker
use_sudo: false
disable_upstart: false
provisioner:
name: puppet_apply
manifests_path: test
modules_path: modules
hiera_data_path: data
hiera_config_path: data/hiera.yaml
manifest: init.pp
platforms:
- name: ubuntu-14.04
driver_config:
image: midonet/ubuntu:14.04
privileged: true
run_command: /sbin/init
ssh_timeout: 10
ssh_retries: 5
- name: centos-7
driver_config:
image: midonet/centos:centos7
privileged: true
volume: /sys/fs/cgroup:/sys/fs/cgroup:ro
run_command: /usr/sbin/init
ssh_timeout: 10
ssh_retries: 5
suites:
- name: default

12
Gemfile Normal file
View File

@ -0,0 +1,12 @@
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
gem 'test-kitchen', :git => 'git://github.com/jdevesa/test-kitchen', :branch => 'remove_ssh_retry_options'
gem 'kitchen-puppet'
gem 'librarian-puppet', '>= 2.0.1'
gem 'kitchen-docker', :git => 'git://github.com/jdevesa/kitchen-docker.git', :branch => 'wait_for_ssh'
gem 'kitchen-vagrant'

15
Puppetfile Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env ruby
#^syntax detection
forge "https://forgeapi.puppetlabs.com"
metadata
mod 'midonet-zookeeper',
:git => 'http://github.com/midonet/puppet-zookeeper',
:ref => 'master'
mod 'midonet-cassandra',
:git => 'http://github.com/midonet/puppet-cassandra',
:ref => 'master'

115
README.md
View File

@ -10,8 +10,6 @@
4. [Usage](#usage)
5. [Reference](#reference)
* [Midonet Repository Class Reference](#midonet-repository)
* [Cassandra Class Reference](#cassandra)
* [Zookeeper Class Reference](#zookeeper)
* [Midonet Agent Class Reference](#midonet-agent)
* [Midonet API Class Reference](#midonet-api)
* [Midonet CLI Class Reference](#midonet-cli)
@ -113,119 +111,6 @@ or use a YAML file using the same attributes, accessible from Hiera:
midonet_repository::openstack_release: 'juno'
#### Cassandra
MidoNet needs Cassandra cluster to keep track of living connections. This class
installs cassandra the way that MidoNet needs it.
The easiest way to run the class is:
include midonet::cassandra
And a cassandra single-machine cluster will be installed, binding the
'localhost' address.
Run a single-machine cluster but binding a hostname or another address
would be:
class {'midonet::cassandra':
seeds => ['192.168.2.2'],
seed_address => '192.168.2.2'
}
For cluster of nodes, use the same 'seeds' value, but change the
seed_address of each node:
... On node1:
class {'midonet::cassandra':
seeds => ['node_1', 'node_2', 'node_3'],
seed_address => 'node_1'
}
... On node2:
class {'midonet::cassandra':
seeds => ['node_1', 'node_2', 'node_3'],
seed_address => 'node_2'
}
... On node3:
class {'midonet::cassandra':
seeds => ['node_1', 'node_2', 'node_3'],
seed_address => 'node_3'
}
NOTE: node_X can be either hostnames or ip addresses
You can alternatively use the Hiera's yaml style:
midonet::cassandra::seeds:
- node_1
- node_2
- node_3
midonet::cassandra::seed_address: 'node_1'
#### Zookeeper
ZooKeeper cluster stores MidoNet virtual network hierarchy. Likewise
Cassandra, this class installs the version and configuration that MidoNet needs
to run.
The easiest way to run the class is:
include midonet::zookeeper
And puppet will install a local zookeeper without cluster. For a clustered
zookeeper, the way you have to define your puppet site, is:
... on Node1
class {'midonet::zookeeper':
servers => [{'id' => 1
'host' => 'node_1'},
{'id' => 2,
'host' => 'node_2'},
{'id' => 3,
'host' => 'node_3'}],
server_id => 1}
... on Node2
class {'midonet::zookeeper':
servers => [{'id' => 1
'host' => 'node_1'},
{'id' => 2,
'host' => 'node_2'},
{'id' => 3,
'host' => 'node_3'}],
server_id => 2}
... on Node3
class {'midonet::zookeeper':
servers => [{'id' => 1
'host' => 'node_1'},
{'id' => 2,
'host' => 'node_2'},
{'id' => 3,
'host' => 'node_3'}],
server_id => 3}
defining the same servers for each puppet node, but using a different
server\_id for each one. NOTE: node\_X can be hostnames or IP addresses.
you can alternatively use the Hiera's yaml style
midonet::zookeeper::servers:
- id: 1
host: 'node_1'
- id: 2
host: 'node_2'
- id: 3
host: 'node_3'
midonet::zookeeper::server_id: '1'
#### Midonet Agent
Midonet Agent is the Openvswitch datapath controller and must run in all the Hypervisor hosts.

32
Rakefile Normal file
View File

@ -0,0 +1,32 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_autoloader_layout')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
desc "Validate manifests, templates, and ruby files"
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
task :lint do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet-lint --no-80chars-check --no-autoloader_layout-check #{manifest}"
end
end
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
end

0
data/common.yaml Normal file
View File

9
data/hiera.yaml Normal file
View File

@ -0,0 +1,9 @@
---
:backends:
- yaml
- module_data
:hierarchy:
- osfamily/%{::osfamily}/%{::lsbmajdistrelease}
- osfamily/%{::osfamily}/%{::lsbdistrelease}
- osfamily/%{::osfamily}/common
- common

View File

@ -0,0 +1,3 @@
--- # Repository-based attributes
midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack-icehouse'
midonet::repository::openstack_release: 'icehouse'

View File

@ -0,0 +1,4 @@
---
# Repository-based attributes
midonet::repository::midonet_openstack_repo: "http://repo.midonet.org/openstack-juno"
midonet::repository::openstack_release: 'juno'

View File

@ -0,0 +1,29 @@
---
# Repository-based attributes
midonet::repository::midonet_repo: 'http://repo.midonet.org/midonet/v2015.03'
midonet::repository::midonet_thirdparty_repo: 'http://repo.midonet.org/misc'
midonet::repository::midonet_key: '35FEEF2BAD40EA777D0C5BA6FCE340D250F18FCF'
midonet::repository::midonet_stage: 'stable'
midonet::repository::midonet_key_url: 'http://repo.midonet.org/packages.midokura.key'
# Midonet Host Agent-based attributes
midonet::midonet_agent::zk_servers:
- ip: 'localhost'
port: 2181
midonet::midonet_agent::cassandra_seeds:
- 'localhost'
# Midonet API-based attributes
midonet::midonet_api::zk_servers:
- ip: 'localhost'
port: 2181
midonet::midonet_api::keystone_auth: false
midonet::midonet_api::vtep: false
midonet::midonet_api::tomcat_package: 'tomcat7'
midonet::midonet_api::catalina_base: '/var/lib/tomcat7'
# Neutron Plugin based attributes
midonet::neutron_plugin::midonet_api_ip: 'localhost'
midonet::neutron_plugin::username: 'fake_user'
midonet::neutron_plugin::password: 'fake_password'
midonet::neutron_plugin::project_id: 'service'

View File

@ -0,0 +1,4 @@
---
# Repository-based attributes
midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack-icehouse/RHEL'
midonet::repository::openstack_release: 'icehouse'

View File

@ -0,0 +1,4 @@
---
# Repository-based attributes
midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack-juno/RHEL'
midonet::repository::openstack_release: 'juno'

View File

@ -0,0 +1,28 @@
---
# Repository-based attributes
midonet::repository::midonet_repo: 'http://repo.midonet.org/midonet/v2015.03/RHEL'
midonet::repository::midonet_thirdparty_repo: 'http://repo.midonet.org/misc/RHEL'
midonet::repository::midonet_stage: 'stable'
midonet::repository::midonet_key_url: 'http://repo.midonet.org/packages.midokura.key'
# Midonet Host Agent-based attributes
midonet::midonet_agent::zk_servers:
- ip: 'localhost'
port: 2181
midonet::midonet_agent::cassandra_seeds:
- 'localhost'
# Midonet API-based attributes
midonet::midonet_api::zk_servers:
- ip: 'localhost'
port: 2181
midonet::midonet_api::keystone_auth: false
midonet::midonet_api::vtep: false
midonet::midonet_api::tomcat_package: 'tomcat'
midonet::midonet_api::catalina_base: '/usr/share/tomcat'
# Neutron Plugin based attributes
midonet::neutron_plugin::midonet_api_ip: 'localhost'
midonet::neutron_plugin::username: 'fake_user'
midonet::neutron_plugin::password: 'fake_password'
midonet::neutron_plugin::project_id: 'service'

View File

@ -0,0 +1,6 @@
<Context
path="/midonet-api"
docBase="/usr/share/midonet-api"
antiResourceLocking="false"
privileged="true"
/>

63
manifests/init.pp Normal file
View File

@ -0,0 +1,63 @@
# == Class: midonet
#
# Install all the midonet modules in a single machine with all
# the default parameters.
#
# == Examples
#
# The only way to call this class is using the include reserved word:
#
# include midonet
#
# To more advanced usage of the midonet puppet module, check out the
# documentation for the midonet's modules:
#
# - midonet::repository
# - midonet::cassandra
# - midonet::zookeeper
# - midonet::midonet_agent
# - midonet::midonet_api
# - midonet::midonet_cli
# - midonet::neutron_plugin
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet {
# Add zookeeper
class {'::zookeeper': }
# Add cassandra
class {'::cassandra': }
# Add midonet-agent
class { 'midonet::midonet_agent':
require => [Class['::cassandra'],
Class['::zookeeper']]
}
# Add midonet-api
class {'midonet::midonet_api':}
# Add midonet-cli
class {'midonet::midonet_cli':}
}

View File

@ -0,0 +1,75 @@
# == Class: midonet::midonet_agent
#
# Install and run midonet_agent
#
# === Parameters
#
# [*zk_servers*]
# List of hash [{ip, port}] Zookeeper instances that run in cluster.
# [*cassandra_seeds]
# List of [ip] cassandra instances that run in cluster.
#
# === Examples
#
# The easiest way to run the class is:
#
# include midonet::midonet_agent
#
# This call assumes that there is a zookeeper instance and a cassandra instance
# running in the target machine, and will configure the midonet-agent to
# connect to them.
#
# This is a quite naive deployment, just for demo purposes. A more realistic one
# would be:
#
# class {'midonet::midonet_agent':
# zk_servers => [{'ip' => 'host1',
# 'port' => '2183'},
# {'ip' => 'host2'}],
# cassandra_seeds => ['host1', 'host2', 'host3']
# }
#
# Please note that Zookeeper port is not mandatory and defaulted to 2181
#
# You can alternatively use the Hiera.yaml style:
#
# midonet::midonet_agent::zk_servers:
# - ip: 'host1'
# port: 2183
# - ip: 'host2'
# midonet::midonet_agent::cassandra_seeds:
# - 'host1'
# - 'host2'
# - 'host3'
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_agent($zk_servers, $cassandra_seeds) {
class {'midonet::midonet_agent::install':
}
class {'midonet::midonet_agent::run':
zk_servers => $zk_servers,
cs_seeds => $cassandra_seeds
}
}

View File

@ -0,0 +1,40 @@
# == Class: midonet::midonet_agent::install
# Check out the midonet::midonet-agent class for a full understanding of
# how to use the midonet_agent resource
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_agent::install {
require midonet::repository
if ! defined(Class['java']) {
class {'java':
distribution => 'jre',
require => Exec['update-midonet-repos']
}
}
package {'midolman':
ensure => present,
require => Class['java']
}
}

View File

@ -0,0 +1,40 @@
# == Class: midonet::midonet_agent::run
# Check out the midonet::midonet_agent class for a full understanding of
# how to use the midonet_agent resource
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_agent::run (
$zk_servers,
$cs_seeds) {
require midonet::midonet_agent::install
file {'/etc/midolman/midolman.conf':
ensure => present,
content => template('midonet/midonet-agent/midolman.conf.erb'),
require => Package['midolman']
} ~>
service {'midolman':
ensure => running
}
}

123
manifests/midonet_api.pp Normal file
View File

@ -0,0 +1,123 @@
# == Class: midonet::midonet_api
#
# Install and run midonet_api
#
# === Parameters
#
# [*zk_servers*]
# List of hash [{ip, port}] Zookeeper instances that run in cluster.
# [*keystone_auth*]
# Whether to authenticate the API request through a Keystone service. Default:
# false.
# [*vtep*]
# Whether to enable the vtep service endpoint. Default: false
# [*tomcat_package*]
# The name of the tomcat package to install. The module already inserts a
# value depending on the distribution used. Don't override it unless you know
# what you are doing.
# [*api_ip*]
# Exposed IP address. By default, it exposes the first internet address that
# founds in the host.
# [*api_port*]
# TCP listening port. By default, 8080
# [*keystone_host*]
# Keystone service endpoint IP. Not used if keystone_auth is false.
# [*keystone_port*]
# Keystone service endpoint port. Not used if keystone_auth is false.
# [*keystone_admin_token*]
# Keystone admin token. Not used if keystone_auth is false.
# [*keystone_tenant_name*]
# Keystone tenant name. 'admin' by default. Not used if keystone_auth is false.
#
# === Examples
#
# The easiest way to run this class is:
#
# include midonet::midonet_api
#
# This call assumes that there is a zookeeper running in the target host and the
# module will spawn a midonet_api without keystone authentication.
#
# This is a quite naive deployment, just for demo purposes. A more realistic one
# would be:
#
# class {'midonet::midonet_api':
# zk_servers => [{'ip' => 'host1',
# 'port' => '2183'},
# {'ip' => 'host2'}],
# keystone_auth => true,
# vtep => true,
# api_ip => '92.234.12.4',
# keystone_host => '92.234.12.9',
# keystone_port => 35357 (35357 is already the default)
# keystone_admin_token => 'arrakis',
# keystone_tenant_name => 'other-than-admin' ('admin' by default)
# }
#
# You can alternatively use the Hiera.yaml style:
#
# midonet::midonet_api::zk_servers:
# - ip: 'host1'
# port: 2183
# - ip: 'host2'
# midonet::midonet_api::vtep: true
# midonet::midonet_api::keystone_auth: true
# midonet::midonet_api::api_ip: '92.234.12.4'
# midonet::midonet_api::keystone_host: '92.234.12.9'
# midonet::midonet_api::keystone_port: 35357
# midonet::midonet_api::keystone_admin_token: 'arrakis'
# midonet::midonet_api::keystone_tenant_name: 'admin'
#
# Please note that Zookeeper port is not mandatory and defaulted to 2181.
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_api(
$zk_servers,
$keystone_auth,
$vtep,
$tomcat_package,
$keystone_host=$::ipaddress,
$keystone_port=35357,
$keystone_admin_token=undef,
$keystone_tenant_name='admin',
$api_ip=$::ipaddress,
$api_port='8084',
$catalina_base) {
include midonet::midonet_api::augeas
class {'midonet::midonet_api::install': }
class {'midonet::midonet_api::run':
zk_servers => $zk_servers,
keystone_auth => $keystone_auth,
tomcat_package => $tomcat_package,
vtep => $vtep,
api_ip => $api_ip,
api_port => $api_port,
keystone_host => $keystone_host,
keystone_port => $keystone_port,
keystone_admin_token => $keystone_admin_token,
keystone_tenant_name => $keystone_tenant_name,
catalina_base => $catalina_base
}
}

View File

@ -0,0 +1,31 @@
# == Class: midonet::midonet_api::augeas
#
# Make sure augeas is installed before install tomcat
class midonet::midonet_api::augeas {
require midonet::repository
case $::osfamily {
'Debian': {
package {'libaugeas-ruby':
ensure => present
}
}
'RedHat': {
package {'deltarpm':
ensure => present
} ->
package {'augeas':
ensure => present
} ->
package {'augeas-devel':
ensure => present
} ->
exec {'/usr/bin/gem install ruby-augeas': }
}
default: {
fail('Operating System not supported by this module')
}
}
}

View File

@ -0,0 +1,46 @@
# == Class: midonet::midonet_api::install
# Check out the midonet::midonet_api class for a full understanding of
# how to use the midonet_api resource
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_api::install {
require midonet::repository
require midonet::midonet_api::augeas
if ! defined(Class['java']) {
class {'java':
distribution => 'jre',
require => Exec['update-midonet-repos']
}
}
class {'tomcat':
install_from_source => false,
require => [Class['java'],
Exec['update-midonet-repos']]
} ->
package {'midonet-api':
ensure => present,
}
}

View File

@ -0,0 +1,74 @@
# == Class: midonet::midonet_api::run
# Check out the midonet::midonet_api class for a full understanding of
# how to use the midonet_api resource
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_api::run (
$zk_servers,
$keystone_auth,
$vtep,
$tomcat_package,
$api_ip,
$api_port,
$keystone_host,
$keystone_port,
$keystone_admin_token,
$keystone_tenant_name,
$catalina_base
) {
require midonet::midonet_api::install
tomcat::instance{'midonet-api':
package_name => $tomcat_package,
} ->
tomcat::config::server::connector {'midonet-api':
port => $api_port,
catalina_base => $catalina_base,
connector_ensure => 'present',
require => Tomcat::Instance['midonet-api'],
notify => Service[$tomcat_package]
}
file {"/etc/${tomcat_package}/Catalina/localhost/midonet-api.xml":
ensure => present,
source => 'puppet:///modules/midonet/midonet-api/midonet-api.xml',
owner => 'root',
group => 'root',
require => Tomcat::Instance['midonet-api'],
notify => Service[$tomcat_package]
}
file {'/usr/share/midonet-api/WEB-INF/web.xml':
ensure => present,
content => template('midonet/midonet-api/web.xml.erb'),
require => Package['midonet-api'],
notify => Service[$tomcat_package]
}
service {$tomcat_package:
ensure => running,
require => [File['/usr/share/midonet-api/WEB-INF/web.xml'],
Tomcat::Config::Server::Connector['midonet-api']]
}
}

41
manifests/midonet_cli.pp Normal file
View File

@ -0,0 +1,41 @@
# == Class: midonet::midonet_cli
#
# Install midonet_cli
#
# === Parameters
#
# No parameters
#
# === Examples
#
# Just declare the class and the package will be installed
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::midonet_cli {
require midonet::repository
package {'python-midonetclient':
ensure => present,
require => Exec['update-midonet-repos']
}
}

View File

@ -0,0 +1,94 @@
# == Class: midonet::neutron_plugin
#
# Install and configure Midonet Neutron Plugin. Please note that manifest does
# install Neutron (because it is a requirement of
# 'python-neutron-plugin-midonet' package) but it does not configure it nor run
# it. It just configure the specific midonet plugin files. It is supposed to be
# deployed along any existing puppet module that configures Neutron, such as
# puppetlabs/neutron
#
# === Parameters
#
# [*midonet_api_ip*]
# IP address of the midonet api service
# [*midonet_api_port*]
# port address of the midonet api service
# [*keystone_username*]
# Username from which midonet api will authenticate against Keystone (use
# neutron service username)
# [*keystone_password*]
# Password from which midonet api will authenticate against Keystone (use
# neutron service password)
# [*keystone_tenant*]
# Tenant from which midonet api will authenticate against Keystone (use
# neutron service tenant)
# [*sync_db*]
# Whether 'midonet-db-manage' should run to create and/or syncrhonize the database
# with MidoNet specific tables. Defaults to false
#
# === Examples
#
# An example call would be:
#
# class {'midonet::neutron_plugin':
# midonet_api_ip => '23.123.5.32',
# midonet_api_port => '8080',
# keystone_username => 'neutron',
# keystone_password => '32kjaxT0k3na',
# keystone_tenant => 'services',
# sync_db => true
# }
#
# You can alternatively use the Hiera's yaml style:
# midonet::neutron_plugin::midonet_api_ip: '23.213.5.32'
# midonet::neutron_plugin::port: '8080'
# midonet::neutron_plugin::keystone_username: 'neutron'
# midonet::neutron_plugin::keystone_password: '32.kjaxT0k3na'
# midonet::neutron_plugin::keystone_tenant: 'services'
# midonet::neutron_plugin::sync_db: true
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::neutron_plugin (
$midonet_api_ip = '127.0.0.1',
$midonet_api_port = '8080',
$keystone_username = 'neutron',
$keystone_password = undef,
$keystone_tenant = 'services',
$sync_db = false
) {
require midonet::repository
package {'python-neutron-plugin-midonet':
ensure => present,
require => Exec['update-midonet-repos']
} ->
class {'neutron::plugins::midonet':
midonet_api_ip => $midonet_api_ip,
midonet_api_port => $midonet_api_port,
keystone_username => $keystone_username,
keystone_password => $keystone_password,
keystone_tenant => $keystone_tenant,
sync_db => $sync_db
}
}

120
manifests/repository.pp Normal file
View File

@ -0,0 +1,120 @@
# == Class: midonet::repository
#
# Prepare the midonet repositories to install packages.
#
# === Parameters
#
# [*midonet_repo*]
# Midonet Repository URL location. Please note the version
# of midonet use to be part of that URL.
# Ex: 'http://repo.midonet.org/midonet/v2014.11'
# [*midonet_openstack_repo*]
# Midonet Repository URL for the Midonet Neutron Plugin. The version use to
# be part of the URL. The package avaiable in this repo (the midonet plugin)
# is released along each OpenStack release (Icehouse, Juno, Kilo...) , not
# the Midonet OSS release. This is why Midonet maintains different repos.
# Ex: 'http://repo.midonet.org/openstack'.
# [*midonet_thirdparty_repo*]
# Third party software pinned for Midonet stability URL.
# Ex: 'http://repo.midonet.org/misc'.
# [*midonet_release*]
# Stage of the package. It can be 'stable', 'testing' or 'unstable'.
# Stable by default.
# [*midoney_key_url*]
# Midonet Key URL path.
# [*midonet_key*]
# Midonet GPG key for validate packages. Only override it if you use a
# different fork of Midonet.
#
# === Examples
#
# The easiest way to run the class is:
#
# include midonet::repository
#
# And puppet will configure the system to use the latest stable version
# of MidoNet OSS.
#
# To install other releases than the last default's Midonet OSS, you can
# override the default's midonet_repository atributes by a resource-like
# declaration:
#
# class { 'midonet::repository':
# midonet_repo => 'http://repo.midonet.org/midonet/v2014.11',
# midonet_openstack_repo => 'http://repo.midonet.org/openstack',
# midonet_thirdparty_repo => 'http://repo.midonet.org/misc',
# midonet_key => '50F18FCF',
# midonet_stage => 'stable',
# midonet_key_url => 'http://repo.midonet.org/packages.midokura.key',
# openstack_release => 'juno'
# }
#
# or use a YAML file using the same attributes, accessible from Hiera:
#
# midonet::repository::midonet_repo: 'http://repo.midonet.org/midonet/v2014.11'
# midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack'
# midonet::repository::midonet_thirdparty_repo: 'http://repo.midonet.org/misc'
# midonet::repository::midonet_key: '50F18FCF'
# midonet::repository::midonet_stage: 'stable'
# midonet::repository::midonet_key_url: 'http://repo.midonet.org/packages.midokura.key'
# midonet::repository::openstack_release: 'juno'
#
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::repository (
$midonet_repo,
$midonet_openstack_repo,
$midonet_thirdparty_repo,
$midonet_stage,
$openstack_release,
$midonet_key_url,
$midonet_key=unset) {
case $::osfamily {
'Debian': {
class {'midonet::repository::ubuntu':
midonet_repo => $midonet_repo,
midonet_openstack_repo => $midonet_openstack_repo,
midonet_thirdparty_repo => $midonet_thirdparty_repo,
midonet_stage => $midonet_stage,
openstack_release => $openstack_release,
midonet_key_url => $midonet_key_url,
midonet_key => $midonet_key
}
}
'RedHat': {
class {'midonet::repository::centos':
midonet_repo => $midonet_repo,
midonet_openstack_repo => $midonet_openstack_repo,
midonet_thirdparty_repo => $midonet_thirdparty_repo,
midonet_stage => $midonet_stage,
openstack_release => $openstack_release,
midonet_key_url => $midonet_key_url
}
}
default: {
fail('Operating System not supported by this module')
}
}
}

View File

@ -0,0 +1,84 @@
# == Class: midonet::repository::centos
# NOTE: don't use this class, use midonet::repository(::init) instead
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::repository::centos (
$midonet_repo,
$midonet_openstack_repo,
$midonet_thirdparty_repo,
$midonet_stage,
$openstack_release,
$midonet_key_url)
{
# Adding repository for ubuntu
notice('Adding midonet sources for RedHat-like distribution')
if ($::operatingsystemmajrelease == 6 or
$::operatingsystemmajrelease == 7) {
if ($::operatingsystemmajrelease == 6 and
$openstack_release == 'juno') {
fail ("CentOS/Redhat 6 only supports
'openstack_release => icehouse'")
}
yumrepo { 'midonet':
baseurl => "${midonet_repo}/${::operatingsystemmajrelease}/${midonet_stage}",
descr => 'Midonet base repo',
enabled => 1,
gpgcheck => 1,
gpgkey => $midonet_key_url,
timeout => 60
}
yumrepo { 'midonet-openstack-integration':
baseurl => "${midonet_openstack_repo}/${::operatingsystemmajrelease}/${midonet_stage}",
descr => 'Midonet OS plugin repo',
enabled => 1,
gpgcheck => 1,
gpgkey => $midonet_key_url,
timeout => 60
}
package { 'epel-release':
ensure => installed
}
package { 'rdo-release':
ensure => installed,
source => "https://repos.fedorapeople.org/repos/openstack/openstack-${openstack_release}/rdo-release-${openstack_release}.rpm",
provider => 'rpm',
require => Package['epel-release']
}
exec {'update-midonet-repos':
command => '/usr/bin/yum clean all && /usr/bin/yum makecache'
}
Yumrepo<| |> -> Exec<| command == 'update-midonet-repos' |>
Package<| |> -> Exec<| command == 'update-midonet-repos' |>
}
else
{
fail("RedHat/CentOS version ${::operatingsystemmajrelease}
not supported")
}
}

View File

@ -0,0 +1,85 @@
# == Class: midonet::repository::ubuntu
# NOTE: don't use this class, use midonet::repository(::init) instead
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::repository::ubuntu (
$midonet_repo,
$midonet_stage,
$midonet_openstack_repo,
$midonet_thirdparty_repo,
$midonet_key,
$midonet_key_url,
$openstack_release)
{
# Adding repository for ubuntu
notice('Adding midonet sources for Debian-like distribution')
if $::lsbdistrelease == '14.04' or $::lsbdistrelease == '12.04' {
if $::lsbdistrelease == '12.04' and $openstack_release == 'juno' {
fail ('Ubuntu 12.04 only supports icehouse')
}
notice('Adding midonet sources for Debian-like distribution')
include apt
include apt::update
# Update the package list each time a package is defined. That takes
# time, but it ensures it will not fail for out of date repository info
# Exec['apt_update'] -> Package<| |>
apt::key {'midonetkey':
key => $midonet_key,
key_source => $midonet_key_url,
}
apt::source {'midonet':
comment => 'Midonet apt repository',
location => $midonet_repo,
release => $midonet_stage,
include_src => false,
}
apt::source {'midonet-openstack-integration':
comment => 'Midonet apt plugin repository',
location => $midonet_openstack_repo,
release => $midonet_stage,
include_src => false,
}
# Dummy exec to wrap apt_update
exec {'update-midonet-repos':
command => '/bin/true',
require => [Exec['apt_update'],
Apt::Source['midonet'],
Apt::Source['midonet-openstack-integration']]
}
Apt::Key<| |> -> Apt::Source<| |>
Apt::Source<| |> -> Exec<| command == 'update-midonet-repos' |>
}
else
{
fail("${::lsbdistid} ${::lsbdistrelease} version not supported")
}
}

29
metadata.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "midonet-midonet",
"version": "2015.3.0",
"author": "MidoNet",
"summary": "Configure and install MidoNet components",
"license": "Apache-2.0",
"source": "https://github.com/midonet/arrakis",
"project_page": "http://github.com/midonet/arrakis/tree/master/modules/midonet-midonet",
"issues_url": "https://midonet.atlassian.net/projects/MDT",
"dependencies": [
{ "name":"ripienaar-module_data","version_requirement":">=0.0.3" },
{ "name":"midonet-zookeeper","version_requirement":">=1.0.0" },
{ "name":"midonet-cassandra","version_requirement":">=1.0.0" },
{ "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" }
],
"tags": ["openstack", "sdn", "midonet"],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [ "6.5", "6.6", "7.0" ]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": ["12.04", "14.04"]
}
]
}

View File

@ -0,0 +1,168 @@
opyright 2014 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Midolman configuration file
[zookeeper]
<%- zkarr = Array.new -%>
<%- @zk_servers.each do |s| -%>
<%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
<%- end -%>
zookeeper_hosts = <%= zkarr.join(",") %>
session_timeout = 30000
midolman_root_key = /midonet/v1
session_gracetime = 30000
[cassandra]
# The minimum recommended cassandra setup is a 3-node cluster with a
# replication factor of 3. Midolman uses Quorum as consistency policy, which
# would translate to 2 in the suggested setup.
#
# Refer to the docs/cassandra-cache.md documentation for more specific details
servers = <%= @cs_seeds.join(",") %>
# DO CHANGE THIS, recommended value is 3
replication_factor = 1
cluster = midonet
[bridge]
mac_port_mapping_expire_millis = 15000
[arptable]
arp_retry_interval_seconds = 10
arp_timeout_seconds = 60
arp_stale_seconds = 1800
arp_expiration_seconds = 3600
[midolman]
disconnected_ttl_seconds = 30
control_interface = eth0
cache_type = cassandra
check_flow_expiration_interval = 10000 #millis
# top_level_actor_supervisor = resume
top_level_actor_supervisor = crash
# after requesting an update to the kernel if a flow with idle expiration set
# has less then idle_flow_tolerance_interval to live, we expire it
# idle_flow_tolerance_interval = 10000
# bgpd options
# path to directory containing bgpd binary, default is /usr/sbin
#bgpd_binary = /usr/sbin # for RHEL
#bgpd_binary = /usr/lib/quagga/ # for ubuntu
# path to directory containing bgpd.conf configuration file for bgpd
#bgpd_config = /etc/quagga # default value
# number of threads dedicated to packet processing
simulation_threads = 1
# number of datapath output channels
output_channels = 1
# threading model for datapath input channels. There is one channel per port.
# Allowed values are:
# + one_to_many: use one thread to service all ports
# + one_to_one: use one thread to service each port
input_channel_threading = one_to_many
# dashboard, experimental
enable_dashboard=false
jetty_xml=/etc/midolman/jetty/etc/jetty.xml
# location of the exterior vxlan vport uuid to vni key map (as a json object)
#uuid_vni_json_mapping_file=/etc/midolman/uuidtovni.json
[host]
# This file holds the host UUID across reboots. It is created when
# midolman is first executed in the host, by default it will be stored
# in /etc/midolman/
#properties_file = /etc/midolman/host_uuid.properties
wait_time_between_scans = 5000 # 5 * 1000 millis
[datapath]
# This option specifies the value of the udp port used for vxlan tunnelling
# to peer vteps. By default it is set to the standardized vxlan udp port value
# which is 4789.
#vxlan_vtep_udp_port = 4789
# This option specifies the value of the udp port used for vxlan tunnelling
# of overlay traffic from midolman hosts to other midolman hosts. The value
# needs to be the same across the cluster. It also needs to be different from
# the vxlan_vtep_udp_port value.
vxlan_overlay_udp_port = 6677
# Maximum number of flows a given datapath will be able to contain.
max_flow_count = 20000
# Maximum number of wildcard flows a given datapath will be able to contain.
max_wildcard_flow_count = 20000
# Midolman uses a pool of reusable buffers to send requests to the
# datapath. The options below tune the pool's size and that of its
# buffers. One pool is created for each output channel, the settings
# defined here will apply to each of those pools.
# max_size: maximum number of buffers to hold in the pool. When the
# pool is empty (all buffers are in use) and has reached
# its maximum size, temporary buffers will be allocated.
send_buffer_pool_max_size = 2048
# initial_size: initial number of buffers to allocate in the pool
send_buffer_pool_initial_size = 2048
# buf_size_kb: size of each buffer, in kb. Maximum total pool size would thus
# be: max_size * buf_size_kb. Beware that the buffer size puts a
# limit on the packet size that Midolman can send. In a network
# jumbo frames, adjust the size so that one buffer will accomodate
# a whole frame plus enough room for the flow's actions.
send_buffer_pool_buf_size_kb = 8
# How many datapath messages to process in each batch, increasing througput
# by reducing synchronization costs. Too high a value may hurt latency.
msgs_per_batch = 200
# Midolman limits the amount of packets in flight in the system at any
# given time. This prevents its internal queues from growing infinitely.
# Additionally, midolman ensures that its processing capacity is shared
# fairly among ports connected to the datapath. This, for example,
# would prevent a single VM from setting up new flows at a rate that
# would starve other VMs in the system.
#
# This behaviour is achieved by routing packets that miss the datapath
# flow table and rise to userspace through a Hierarchical Token Bucket.
# This HTB is set up in such a way such that tunnel ports will get 50%
# of the resources, and the remaining 50% is shared fairly among all
# other ports (typically, VMs).
#
# The rate at which the buckets are refilled is automatic and dynamic.
# However the size of the buckets at each stage of the HTB can be tuned
# through the settings below, increasing a bucket size will increase the
# burstiness at which traffic can be queued before new tokens become
# available.
#
# Bucket size is measured in packets.
# global_incoming_burts_capacity: size of the root bucket in the HTB.
global_incoming_burst_capacity = 128
# tunnel_incoming_burst_capacity: bucket size for tunnel ports (GRE, VxLAN)
tunnel_incoming_burst_capacity = 64
# vm_incoming_burst_capacity: bucket size for VM ports
vm_incoming_burst_capacity = 16
# vtep_incoming_burst_capacity: bucket size for VTEP (VxLAN) ports.
vtep_incoming_burst_capacity = 64
[haproxy_health_monitor]
# Health monitor is disabled by default. Please change the following value to
# true to activate it.
Health_monitor_enable = false

View File

@ -0,0 +1,24 @@
<!-- Keystone configuration -->
<context-param>
<param-name>keystone-service_protocol</param-name>
<param-value>http</param-value>
</context-param>
<context-param>
<param-name>keystone-service_host</param-name>
<param-value><%= @keystone_host %></param-value>
</context-param>
<context-param>
<param-name>keystone-service_port</param-name>
<param-value><%= @keystone_port %></param-value>
</context-param>
<context-param>
<param-name>keystone-admin_token</param-name>
<param-value><%= @keystone_admin_token %></param-value>
</context-param>
<!-- This tenant name is used to get the scoped token from Keystone, and
should be the tenant name of the user that owns the token sent in the
request -->
<context-param>
<param-name>keystone-tenant_name</param-name>
<param-value><%= @keystone_tenant_name %></param-value>
</context-param>

View File

@ -0,0 +1,14 @@
<!-- Mock auth configuration -->
<context-param>
<param-name>mock_auth-admin_token</param-name>
<param-value>999888777666</param-value>
</context-param>
<context-param>
<param-name>mock_auth-tenant_admin_token</param-name>
<param-value>999888777666</param-value>
</context-param>
<context-param>
<param-name>mock_auth-tenant_user_token</param-name>
<param-value>999888777666</param-value>
</context-param>

View File

@ -0,0 +1,110 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>MidoNet API</display-name>
<!-- REST API configuration -->
<!-- This value overrides the default base URI. This is typically set if
you are proxying the API server and the base URI that the clients use
to access the API is different from the actual server base URI. -->
<context-param>
<param-name>rest_api-base_uri</param-name>
<param-value>http://<%= @api_ip %>:<%= @api_port %>/midonet-api</param-value>
</context-param>
<!-- CORS configuration -->
<context-param>
<param-name>cors-access_control_allow_origin</param-name>
<param-value>*</param-value>
</context-param>
<context-param>
<param-name>cors-access_control_allow_headers</param-name>
<param-value>Origin, X-Auth-Token, Content-Type, Accept, Authorization</param-value>
</context-param>
<context-param>
<param-name>cors-access_control_allow_methods</param-name>
<param-value>GET, POST, PUT, DELETE, OPTIONS</param-value>
</context-param>
<context-param>
<param-name>cors-access_control_expose_headers</param-name>
<param-value>Location</param-value>
</context-param>
<!-- Auth configuration -->
<context-param>
<param-name>auth-auth_provider</param-name>
<!-- Specify the class path of the auth service -->
<%- if @keystone_auth -%>
<param-value>org.midonet.api.auth.keystone.v2_0.KeystoneService</param-value>
<%- else -%>
<param-value>org.midonet.api.auth.MockAuthService</param-value>
<%- end -%>
</context-param>
<context-param>
<param-name>auth-admin_role</param-name>
<param-value>admin</param-value>
</context-param>
<%- if @keystone_auth -%>
<%= scope.function_template(['midonet/midonet-api/keystone_config.xml.erb']) %>
<%- else -%>
<%= scope.function_template(['midonet/midonet-api/mockauth_config.xml.erb']) %>
<%- end -%>
<!-- Zookeeper configuration -->
<!-- The following parameters should match the ones in midolman.conf
except 'use_mock' -->
<context-param>
<param-name>zookeeper-use_mock</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>zookeeper-zookeeper_hosts</param-name>
<!-- comma separated list of Zookeeper nodes(host:port) -->
<%- zkarr = Array.new -%>
<%- @zk_servers.each do |s| -%>
<%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
<%- end -%>
<param-value><%= zkarr.join(",") %></param-value>
</context-param>
<context-param>
<param-name>zookeeper-session_timeout</param-name>
<param-value>30000</param-value>
</context-param>
<context-param>
<param-name>zookeeper-midolman_root_key</param-name>
<param-value>/midonet/v1</param-value>
</context-param>
<context-param>
<param-name>zookeeper-curator_enabled</param-name>
<param-value>true</param-value>
</context-param>
<!-- VXLAN gateway configuration -->
<context-param>
<param-name>midobrain-vxgw_enabled</param-name>
<param-value><%= @vtep %></param-value>
</context-param>
<!-- Servlet Listner -->
<listener>
<listener-class>
<!-- Use Jersey's Guice compatible context listener -->
org.midonet.api.servlet.JerseyGuiceServletContextListener
</listener-class>
</listener>
<!-- Servlet filter -->
<filter>
<!-- Filter to enable Guice -->
<filter-name>Guice Filter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Guice Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

View File

@ -0,0 +1,5 @@
[MIDONET]
midonet_uri = http://<%= @midonet_api_ip %>:8080/midonet-api
username = <%= @username %>
password = <%= @password %>
project_id = <%= @project_id %>

View File

@ -0,0 +1,19 @@
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=<%= @data_dir %>
# the port at which the clients will connect
clientPort=2181
# specify all zookeeper servers
# The fist port is used by followers to connect to the leader
# The second one is used for leader election
<% @servers.each do |s| %>
<%="server.#{s['id']}=#{s['host']}:#{s['peer_port'] ||= 2888}:#{s['lead_port'] || 3888}" %>
<% end %>

View File

@ -0,0 +1,2 @@
export JAVA_HOME=<%= @java_home %>
export ZOO_LOG_DIR=/var/log/zookeeper

19
test/init.pp Normal file
View File

@ -0,0 +1,19 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
# Fake the facter when it compiles. The augeas version that will be installed
# will be this one
if empty($::augeasversion) {
$augeasversion = '1.0.0'
}
class {'midonet':}

View File

@ -0,0 +1,155 @@
# Test verify methods for midonet_repository
command_exists() {
command -v "$@" > /dev/null 2>&1
}
# Code copied unashamedly from http://get.docker.io
get_distro() {
lsb_dist=''
if command_exists lsb_release; then
lsb_dist="$(lsb_release -si)"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then
lsb_dist='debian'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/redhat-release ]; then
lsb_dist='red-hat'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
fi
distro=$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')
}
get_distro
@test 'midonet repo is set' {
case $distro in
ubuntu)
run file /etc/apt/sources.list.d/midonet.list
[ "$status" -eq 0 ]
run file /etc/apt/sources.list.d/midonet-openstack-integration.list
[ "$status" -eq 0 ]
;;
centos|red-hat)
run ls /etc/yum.repos.d/midonet.repo
[ "$status" -eq 0 ]
run ls /etc/yum.repos.d/midonet-openstack-integration.repo
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'midonet packages are available' {
case $distro in
ubuntu)
run bash -c "apt-cache search mido | grep midolman"
[ "$status" -eq 0 ]
run bash -c "apt-cache search mido | grep midonet-api"
[ "$status" -eq 0 ]
run bash -c "apt-cache search mido | grep python-midonetclient"
[ "$status" -eq 0 ]
run bash -c "apt-cache search mido | grep python-neutron-plugin-midonet"
[ "$status" -eq 0 ]
run bash -c "apt-cache search dsc20"
[ "$status" -eq 0 ]
;;
centos|red-hat)
run bash -c "yum search mido | grep midolman"
[ "$status" -eq 0 ]
run bash -c "yum search mido | grep midonet-api"
[ "$status" -eq 0 ]
run bash -c "yum search mido | grep python-midonetclient"
[ "$status" -eq 0 ]
run bash -c "yum search mido | grep python-neutron-plugin-midonet"
[ "$status" -eq 0 ]
run bash -c "yum search dsc20-2.0.10-1"
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'zookeeper is running' {
case $distro in
ubuntu)
run bash -c "sudo /usr/share/zookeeper/bin/zkServer.sh status || sudo /usr/sbin/zkServer.sh status"
[ "$status" -eq 0 ]
;;
centos|red-hat)
run sudo /usr/sbin/zkServer.sh status
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'cassandra is running' {
case $distro in
ubuntu)
run sudo service cassandra status
[ "$status" -eq 0 ]
;;
centos|red-hat)
run sudo service cassandra status
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'midonet-agent is running' {
case $distro in
ubuntu)
run sudo service midolman status
[ "$status" -eq 0 ]
;;
centos|red-hat)
run sudo service midolman status
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'midonet-api is running' {
case $distro in
ubuntu)
run sudo service tomcat7 status
[ "$status" -eq 0 ]
;;
centos|red-hat)
run sudo service tomcat status
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}
@test 'midonet-cli is installed' {
case $distro in
ubuntu)
run bash -c "dpkg -l | grep python-midonetclient"
[ "$status" -eq 0 ]
;;
centos|red-hat)
run bash -c "rpm -qa | grep python-midonetclient"
[ "$status" -eq 0 ]
;;
*)
exit 1;
esac
}