diff options
Diffstat (limited to 'framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests')
5 files changed, 242 insertions, 0 deletions
diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp new file mode 100644 index 00000000..457d732f --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp @@ -0,0 +1,55 @@ +class onos::config{ +$onos_home = $onos::onos_home +$karaf_dist = $onos::karaf_dist +$onos_boot_features = $onos::onos_boot_features +$onos_extra_features = $onos::onos_extra_features +$roles = $onos::roles +$public_vip = hiera('public_vip') +$management_vip = hiera('management_vip') +$manager_ip = $onos::manager_ip +$onos_names = $onos::onos_names + +$onos_pkg_name = $onos::onos_pkg_name +$jdk8_pkg_name = $onos::jdk8_pkg_name + +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + timeout => 180, + logoutput => "true", +} + +file{ '/opt/onos_config.sh': + source => "puppet:///modules/onos/onos_config.sh", +} -> +exec{ 'install onos config': + command => "sh /opt/onos_config.sh; + rm -rf /opt/onos_config.sh;", +}-> +exec{ "clean used files": + command => "rm -rf /opt/$onos_pkg_name; + rm -rf /opt/$jdk8_pkg_name + rm -rf /root/.m2/*.tar" +}-> +exec{ 'onos boot features': + command => "sed -i '/^featuresBoot=/c\featuresBoot=$onos_boot_features' $onos_home/$karaf_dist/etc/org.apache.karaf.features.cfg", + path => "/usr/bin:/usr/sbin:/bin:/sbin", +} +case $::operatingsystem { + ubuntu:{ + file{'/etc/init/onos.conf': + ensure => file, + content => template('onos/debian/onos.conf.erb') +}} + centos:{ + file{'/etc/init.d/onos': + ensure => file, + content => template('onos/centos/onos.erb'), + mode => 0777 +}}} + + +#if !member($roles, 'compute') { +# include onos::ha::haproxy +#} + +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp new file mode 100644 index 00000000..c35752d9 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp @@ -0,0 +1,64 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# 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 onos::ha::haproxy { + + + Haproxy::Service { use_include => true } + Haproxy::Balancermember { use_include => true } + + $public_vip = hiera('public_vip') + $management_vip = hiera('management_vip') + $nodes_hash = hiera('nodes') + $primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller') + $onos_controllers = filter_nodes($nodes_hash,'role','onos') + + # defaults for any haproxy_service within this class + Openstack::Ha::Haproxy_service { + internal_virtual_ip => $management_vip, + ipaddresses => filter_hash($onos_controllers, 'internal_address'), + public_virtual_ip => $public_vip, + server_names => filter_hash($onos_controllers, 'name'), + public => true, + internal => true, + } + + openstack::ha::haproxy_service { 'onos': + order => '221', + listen_port => '8181', + haproxy_config_options => { + 'option' => ['httpchk /onos/ui', 'httplog'], + 'timeout client' => '2h', + 'timeout server' => '2h', + 'balance' => 'source', + 'mode' => 'http' + }, + balancermember_options => 'check inter 2000 fall 5', + } + + exec { 'haproxy reload onos': + command => 'export OCF_ROOT="/usr/lib/ocf"; (ip netns list | grep haproxy) && ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy reload', + path => '/usr/bin:/usr/sbin:/bin:/sbin', + logoutput => true, + provider => 'shell', + tries => 10, + try_sleep => 10, + returns => [0, ''], + } + + Haproxy::Listen <||> -> Exec['haproxy reload onos'] + Haproxy::Balancermember <||> -> Exec['haproxy reload onos'] +} + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp new file mode 100644 index 00000000..839ae095 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp @@ -0,0 +1,19 @@ +class onos{ +$nodes = hiera('nodes') +$primary_controller = filter_nodes($nodes,'role','primary-controller') +$roles = node_roles($nodes, hiera('uid')) + +$onos_settings = hiera('onos') +$public_eth = $onos_settings['public_eth'] +$onos_hash = filter_nodes($nodes,'role','onos') +$manager_ip = filter_hash($onos_hash, 'internal_address') +$onos_names = filter_hash($onos_hash, 'name') + +$onos_home = '/opt/onos' +$onos_pkg_url = 'http://downloads.onosproject.org/release/onos-1.3.0.tar.gz' +$karaf_dist = 'apache-karaf-3.0.3' +$onos_pkg_name = 'onos-1.3.0.tar.gz' +$jdk8_pkg_name = 'jdk-8u51-linux-x64.tar.gz' +$onos_boot_features = 'config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui,onos-openflow-base,onos-openflow' +$onos_extra_features = 'ovsdb,vtn' +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp new file mode 100644 index 00000000..7ccb7699 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp @@ -0,0 +1,56 @@ + +class onos::install{ +$onos_home = $onos::onos_home +$onos_pkg_url = $onos::onos_pkg_url +$karaf_dist = $onos::karaf_dist +$onos_pkg_name = $onos::onos_pkg_name +$jdk8_pkg_name = $onos::jdk8_pkg_name + + +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + logoutput => "true", + timeout => 180, +} +group { 'onos': + ensure => present, + before => [File['/opt/onos/'], User['onos']], + } + + +user { 'onos': + ensure => present, + home => '/opt/onos/', + membership => 'minimum', + groups => 'onos', + before => File['/opt/onos/'], + } + + +file { '/opt/onos/': + ensure => 'directory', + recurse => true, + owner => 'onos', + group => 'onos', +}-> + + +file{ "/opt/$onos_pkg_name": + source => "puppet:///modules/onos/$onos_pkg_name", +} -> +file{ "/opt/$jdk8_pkg_name": + source => "puppet:///modules/onos/$jdk8_pkg_name", +} -> + +file{ '/root/.m2/': + ensure => 'directory', + recurse => true, +} -> +file{ '/root/.m2/repository.tar': + source => "puppet:///modules/onos/repository.tar", +} -> +exec{ "unzip packages": + command => "tar -zvxf /opt/$onos_pkg_name -C $onos_home --strip-components 1 --no-overwrite-dir -k; + tar xf /root/.m2/repository.tar -C /root/.m2/", +} +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp new file mode 100644 index 00000000..45399232 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp @@ -0,0 +1,48 @@ + +class onos::service{ + +$public_eth = $onos::public_eth +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + timeout => 320, + logoutput => 'true', +} + +firewall {'221 onos': + port => [6633, 6640, 6653, 8181, 8101,9876], + proto => 'tcp', + action => 'accept', +}-> +service{ 'onos': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, +}-> + +exec{ 'sleep 100 to stablize onos': + command => 'sleep 100;' +}-> + +exec{ 'restart onos': + command => 'service onos restart', +}-> + +exec{ 'sleep 100 again to stablize onos': + command => 'sleep 100;' +}-> +exec{ 'restart onos again': + command => 'service onos restart', +}-> + +exec{ 'sleep 60 to stablize onos': + command => 'sleep 60;' +}-> + +exec{ 'add onos auto start': + command => 'echo "onos">>/opt/service', +}-> +exec{ 'set public port': + command => "/opt/onos/bin/onos \"externalportname-set -n $public_eth\"" +} +} |