merging changes to master branch from mitaka brnach

Change-Id: I64df20298a6fef141e90a0c2dd0cd2f1debb3d15
Signed-off-by: sathishkumar_murugesan <sathishcold@gmail.com>
This commit is contained in:
sathishkumar_murugesan
2017-02-20 16:19:09 +05:30
parent 9070b3220b
commit 52764e13b0
38 changed files with 882 additions and 434 deletions

View File

@@ -8,10 +8,11 @@ This plugin will install [ Open Network Operating System (ONOS) controller](http
##Notification##
* Fuel opentack version should be after 7.0.
* Fuel opentack version should be 9.0.
* Only supports the environment with network type: Neutron.
* Live migration is supported.
* L2 and L3 traffic are supported.
* Sfc is suppprted.
##Installation Guide##
@@ -22,7 +23,7 @@ This plugin will install [ Open Network Operating System (ONOS) controller](http
1. Log in Fuel Master and clone GIT repository of fuel-plugin-onos from openstack:
git clone -b Kilo git://git.openstack.org/openstack/fuel-plugin-onos
git clone -b Mitaka git://git.openstack.org/openstack/fuel-plugin-onos
2. Preparing an environment for plugin development by three easy steps:
@@ -31,6 +32,7 @@ This plugin will install [ Open Network Operating System (ONOS) controller](http
For Ubuntu 14.04 LTS, run:
sudo apt-get install createrepo rpm dpkg-dev
For Centos 6.5, run:
yum install createrepo rpm rpm-build dpkg-devel
@@ -60,7 +62,7 @@ This plugin will install [ Open Network Operating System (ONOS) controller](http
id | name | version | package_version
---|--------|---------|----------------
1 | onos | 0.7.0 | 3.0.0
1 | onos | 0.9.0 | 4.0.0
7. Check if the plugin is enabled on the settings table.
@@ -78,11 +80,11 @@ All described actions below are described from a Fuel GUI provisioning perspecti
1. Create a new environment.
2. Select 'onos plugin' on Settings tab.
2. Select 'onos plugin' on Settings tab. If you want to try sfc functions, select SFC features as well.
onos plugin
3. Select three nodes with role 'controller', three with role 'compute' and one with 'onos'.
3. Select a node with role 'onos'
4. Click 'Deploy changes' to enable nodes with ONOSFW.
@@ -93,7 +95,7 @@ All described actions below are described from a Fuel GUI provisioning perspecti
In order to run ONOS, the following are required:
- Java 8 JDK (Oracle Java recommended; OpenJDK is not as thoroughly tested)
- ONOS tarball( Newest version 1.3 recommended.)
- ONOS tarball( Newest version 1.6 recommended.)
Notice: In case of version problems, the onos rpm uses jdk and onos packages that have been tested.
@@ -102,7 +104,8 @@ Notice: In case of version problems, the onos rpm uses jdk and onos packages tha
1. Web UI is recommended for ONOS controller with tuitive information of topo, devices and etc.
For that purpose, IP address of horizon should be ready, which can be found in fuel master after successful deployment. The web will run into the log page after inputing the path, username and password are both 'karaf'. Now enjot ONOS!
Web UI: http://horizon_ip:8181/onos/ui/index.html
Web UI: http://horizon_ip:8181/onos/ui
2. CLI is capable of more diverse functionality by running /opt/onos/bin/onos. More about CLI can be found in [The ONOS CLI](
https://wiki.onosproject.org/display/ONOS/The+ONOS+CLI).
@@ -114,6 +117,5 @@ https://wiki.openstack.org/wiki/Fuel/Plugins).
##Contributors##
1. Wu Wenbin <wuwenbin2@huawei.com>
2. Zhang Haoyu <zhanghaoyu7@huawei.com>
Wu Wenbin <wuwenbin2@huawei.com>

18
components.yaml Normal file
View File

@@ -0,0 +1,18 @@
- name: 'network:neutron:onos:tun'
label: 'onos based on neutron tunneling segmentation'
description: 'Use Neutron with networking-onos driver'
bind: !!pairs
- "cluster:net_provider": "neutron"
- "cluster:net_segment_type": "tun"
compatible:
- name: 'hypervisor:kvm'
- name: 'hypervisor:qemu'
- name: 'network:neutron:onos:vlan'
label: 'onos based on neutron vlan segmentation'
description: 'Use Neutron with networking-onos driver'
bind: !!pairs
- "cluster:net_provider": "neutron"
- "cluster:net_segment_type": "vlan"
compatible:
- name: 'hypervisor:kvm'
- name: 'hypervisor:qemu'

View File

@@ -1,21 +0,0 @@
include onos
Exec{
path => "/usr/bin:/usr/sbin:/bin:/sbin",
timeout => 180,
logoutput => "true",
}
$neutron_settings = hiera_hash('quantum_settings')
$nets = $neutron_settings['predefined_networks']
$gateway_ip = $nets['net04_ext']['L3']['gateway']
$public_eth = $onos::public_eth
file{ "/opt/netconfig.sh":
ensure => file,
content => template('onos/netconfig.sh.erb'),
}->
exec{ 'set gatewaymac':
command => "sh /opt/netconfig.sh;
rm -rf /opt/netconfig.sh;",
}

View File

@@ -0,0 +1,95 @@
notice(' ONOS MODULAR: neutron-config.pp')
include onos
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
$onos_settings = hiera('onos')
service {'Stop neutron service':
name => "neutron-server",
ensure => stopped,
}->
neutron_plugin_ml2 {
'ml2/mechanism_drivers': value => 'onos_ml2';
'ml2/tenant_network_types': value => 'vxlan';
'ml2_type_vxlan/vni_ranges': value => '100:50000';
'onos/password': value => 'admin';
'onos/username': value => 'admin';
'onos/url_path': value => "http://${onos::manager_ip}:8181/onos/vtn";
}->
package { 'Install git':
ensure => installed,
name => "git",
}->
file { "/opt/networking-onos.tar":
source => "puppet:///modules/onos/networking-onos.tar",
}->
exec { 'Unpack onos driver':
command => "tar xf /opt/networking-onos.tar -C /opt",
}->
exec { 'Install onos driver':
command => "sh /opt/networking-onos/install_driver.sh;
rm -rf /opt/networking*;"
}
if $onos_settings['enable_sfc'] {
neutron_config { 'DEFAULT/service_plugins':
value => 'networking_sfc.services.sfc.plugin.SfcPlugin, networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin, onos_router,neutron.services.metering.metering_plugin.MeteringPlugin';
}
file{ "/opt/networking-sfc.tar":
source => "puppet:///modules/onos/networking-sfc.tar",
}->
exec{ 'Unpack onos sfc driver':
command => "tar xf /opt/networking-sfc.tar -C /opt",
}->
exec{ 'Install onos sfc driver':
command => "sh /opt/networking-sfc/install_driver.sh;
rm -rf /opt/networking*;"
}
}
else {
neutron_config { 'DEFAULT/service_plugins':
value => 'onos_router,neutron.services.metering.metering_plugin.MeteringPlugin';
}
}
if roles_include(['primary-controller']) {
exec { 'Disable neutron l3 agent':
command => "crm resource stop neutron-l3-agent",
require => Service['Stop neutron service'],
}->
exec { 'Drop_neutron_db':
command => "sudo mysql -e 'drop database if exists neutron;'",
}->
exec { 'Create_neutron_db':
command => "sudo mysql -e 'create database neutron character set utf8;'",
}->
exec { 'Grant_neutron_db':
command => "sudo mysql -e \"grant all on neutron.* to 'neutron'@'%';\"",
}->
exec { 'Neutron_db_sync':
command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head',
}
if $onos_settings['enable_sfc'] {
exec { 'Neutron_db_sync for sfc':
command => 'neutron-db-manage --subproject networking-sfc upgrade head',
require => [Exec['Neutron_db_sync'], Exec['Install onos sfc driver']],
}
}
}

View File

@@ -0,0 +1,25 @@
notice(' ONOS MODULAR: neutron-start.pp')
include onos
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
service {'Start neutron service':
name => "neutron-server",
ensure => running
}
if roles_include(['primary-controller']) {
exec{ 'Sleep 20 to stablize neutron':
command => 'sleep 20;',
require => Service ['Start neutron service']
}->
class {'onos::network::create_network':
}->
class {'onos::network::create_router':}
}

View File

@@ -1,102 +0,0 @@
include onos
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
$neutron_config = hiera_hash('quantum_settings')
$nets = $neutron_config['predefined_networks']
$net04_ext =
{"shared"=>false,
"L2"=>
{"network_type"=>"vxlan",
"router_ext"=>true,
"segment_id"=>"10000"},
"L3"=> $nets['net04_ext']['L3'],
"tenant"=>"admin"}
$net04 =
{"shared"=>false,
"L2"=>
{"network_type"=>"vxlan",
"router_ext"=>false,
"segment_id"=>"500"},
"L3"=> $nets['net04']['L3'],
"tenant"=>"admin"}
$roles = $onos::roles
$network_type = 'vxlan'
if member($roles, 'primary-controller') {
cs_resource { 'p_neutron-l3-agent':
ensure => absent,
require => Exec ['stop neutron'],
}->
exec{ 'delete Neutron db':
command => "mysql -e 'drop database if exists neutron;';
mysql -e 'create database neutron character set utf8;';
mysql -e \"grant all on neutron.* to 'neutron'@'%';\";
neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head;",
before => Service ['start neutron service'],
}
}
exec{ 'stop neutron':
command => "service neutron-server stop",
}
package { 'install git':
ensure => installed,
name => "git",
}->
file{ "/opt/networking-onos.tar":
source => "puppet:///modules/onos/networking-onos.tar",
}->
file{ '/opt/onos_driver.sh':
source => "puppet:///modules/onos/onos_driver.sh",
} ->
exec{ 'install onos driver':
command => "sh /opt/onos_driver.sh;"
}->
neutron_config { 'DEFAULT/service_plugins':
value => 'onos_router,neutron.services.metering.metering_plugin.MeteringPlugin';
}->
neutron_plugin_ml2 {
'ml2/mechanism_drivers': value => 'onos_ml2';
'ml2/tenant_network_types': value => 'vxlan';
'ml2_type_vxlan/vni_ranges': value => '100:50000';
'onos/password': value => 'admin';
'onos/username': value => 'admin';
'onos/url_path': value => "http://${onos::manager_ip}:8181/onos/vtn";
}->
service {'start neutron service':
name => "neutron-server",
ensure => running
}
if member($roles, 'primary-controller') {
Service<| title == 'start neutron service' |> ->
Openstack::Network::Create_network <||>
Service<| title == 'start neutron service' |> ->
Openstack::Network::Create_router <||>
openstack::network::create_network{'net04':
netdata => $net04,
segmentation_type => $network_type,
} ->
openstack::network::create_network{'net04_ext':
netdata => $net04_ext,
segmentation_type => $network_type,
} ->
openstack::network::create_router{'router04':
internal_network => 'net04',
external_network => 'net04_ext',
tenant_name => 'admin',
}
}

View File

@@ -0,0 +1,26 @@
notice(' ONOS MODULAR: onos-dashboard.pp')
$cluster_id = hiera('deployment_id')
$master_ip = hiera('master_ip')
$network_metadata = hiera_hash('network_metadata', {})
$os_public_vip = $network_metadata['vips']['public']['ipaddr']
$onos = hiera('onos')
$port = '8181'
$user = 'karaf'
$password = 'karaf'
$dashboard_name = 'Onos Dashboard'
$dashboard_desc = "Onos dashboard interface. Default credentials are ${user}/${password}"
$dashboard_link = "http://${os_public_vip}:${port}/onos/ui"
$json_hash = { title => $dashboard_name,
description => $dashboard_desc,
url => $dashboard_link, }
$json_message = inline_template('<%= require "json"; JSON.dump(@json_hash) %>')
exec { 'create_dashboard_link':
command => "/usr/bin/curl -H 'Content-Type: application/json' -X POST \
-d '${json_message}' \
http://${master_ip}:8000/api/clusters/${cluster_id}/plugin_links",
}

View File

@@ -1 +1,3 @@
notice(' ONOS MODULAR: onos-ha.pp')
class {'onos::ha::haproxy':}

View File

@@ -1,2 +1,4 @@
notice(' ONOS MODULAR: onos-install.pp')
include onos
class{ 'onos::install':}

View File

@@ -1,6 +1,8 @@
notice(' ONOS MODULAR: onos-service.pp')
include onos
class {'onos::config':} ~>
class {'onos::config':} ->
class {'onos::service':}

View File

@@ -0,0 +1,17 @@
notice(' ONOS MODULAR: onos-uploadvm.pp')
file { "/root/firewall_block_image.img":
source => "puppet:///modules/onos/firewall_block_image.img",
}->
file { '/root/upload_vm.sh':
source => "puppet:///modules/onos/upload_vm.sh",
}
exec {'source openrc':
command => "/bin/bash '/root/upload_vm.sh'",
path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
logoutput => true,
}

View File

@@ -0,0 +1,72 @@
notice(' ONOS MODULAR: ovs-compute.pp')
include onos
Exec {
path => "/usr/bin:/usr/sbin:/bin:/sbin",
timeout => 180,
logoutput => "true",
}
$neutron_ovs_agent='neutron-openvswitch-agent'
$ovs_service='openvswitch-switch'
$network_scheme=hiera(network_scheme)
$transformations=$network_scheme[transformations]
$add_port=filter_nodes($transformations,'bridge','br-ex')
$public_eth_hash=filter_hash($add_port,'name')
$public_eth=$public_eth_hash[0]
$network_metadata=hiera(network_metadata)
$vrouter=$network_metadata['vips']['vrouter']['ipaddr']
service {$neutron_ovs_agent:
ensure => stopped,
enable => false,
}->
firewall {'222 vxlan':
dport => [4789, 4790],
proto => 'udp',
action => 'accept',
}->
exec {'Delete manager':
command => "ovs-vsctl del-manager",
}->
exec {'Delete br-prv':
command => "ovs-vsctl del-br br-prv",
onlyif => "ovs-vsctl br-exists br-prv",
}->
exec {'Delete br-tun':
command => "ovs-vsctl del-br br-tun",
onlyif => "ovs-vsctl br-exists br-tun",
}->
exec {'Delete br-int':
command => "ovs-vsctl del-br br-int",
onlyif => "ovs-vsctl br-exists br-int",
}->
exec {'Delete br-floating':
command => "ovs-vsctl del-br br-floating",
onlyif => "ovs-vsctl br-exists br-floating",
}->
file { "/opt/portconfig.sh":
ensure => file,
content => template('onos/portconfig.sh.erb'),
}->
exec { 'Set port':
command => "sh /opt/portconfig.sh;
rm -rf /opt/portconfig.sh;",
}->
exec {'Set ONOS as the manager':
command => "ovs-vsctl set-manager tcp:${onos::manager_ip}:6640",
}

View File

@@ -0,0 +1,73 @@
notice(' ONOS MODULAR: ovs-controller.pp')
include onos
Exec {
path => "/usr/bin:/usr/sbin:/bin:/sbin",
timeout => 180,
logoutput => "true",
}
$neutron_ovs_agent='neutron-openvswitch-agent'
$ovs_service='openvswitch-switch'
if roles_include(['primary-controller']) {
exec {'Disable neutron openvswitch agent':
command => "crm resource stop neutron-openvswitch-agent",
before => Exec['Delete manager'],
}
}
else {
service {$neutron_ovs_agent:
ensure => stopped,
before => Exec['Delete manager'],
}
}
firewall {'222 vxlan':
dport => [4789, 4790],
proto => 'udp',
action => 'accept',
}->
exec {'Delete manager':
command => "ovs-vsctl del-manager",
}->
exec {'Delete br-prv':
command => "ovs-vsctl del-br br-prv",
onlyif => "ovs-vsctl br-exists br-prv",
}->
exec {'Delete br-tun':
command => "ovs-vsctl del-br br-tun",
onlyif => "ovs-vsctl br-exists br-tun",
}->
exec {'Delete br-int':
command => "ovs-vsctl del-br br-int",
onlyif => "ovs-vsctl br-exists br-int",
}->
exec {'Delete br-floating':
command => "ovs-vsctl del-br br-floating",
onlyif => "ovs-vsctl br-exists br-floating",
}->
exec {'Set ONOS as the manager':
command => "ovs-vsctl set-manager tcp:${onos::manager_ip}:6640",
}->
exec {"Sleep 5 for ovsconnect":
command => "sleep 5",
}->
exec {"Delete public port from ovs of controllers":
command => "ovs-vsctl del-port br-int onos_port2",
onlyif => "ovs-vsctl br-exists br-int",
}

View File

@@ -0,0 +1,12 @@
notice(' ONOS MODULAR: ovs-update.pp')
package { 'openvswitch-datapath-dkms':
ensure => '2.5.90-1',
}->
package { 'openvswitch-common':
ensure => '2.5.90-1',
}->
package { 'openvswitch-switch':
ensure => '2.5.90-1',
}

View File

@@ -1,77 +0,0 @@
include onos
Exec{path => "/usr/bin:/usr/sbin:/bin:/sbin",}
case $::operatingsystem{
centos:{
$neutron_ovs_agent='neutron-openvswitch-agent'
$ovs_service='openvswitch'
$cmd_remove_agent='chkconfig --del neutron-openvswitch-agent'
}
ubuntu:{
$neutron_ovs_agent='neutron-plugin-openvswitch-agent'
$ovs_service='openvswitch-switch'
$cmd_remove_agent='update-rc.d neutron-plugin-openvswitch-agent remove'
}
}
$roles = $onos::roles
if member($roles, 'primary-controller') {
cs_resource { "p_${neutron_ovs_agent}":
ensure => absent,
before => Service["shut down and disable Neutron's agent services"],
}}
else{
exec{'remove neutron-openvswitch-agent auto start':
command => "touch /opt/service;
$cmd_remove_agent;
sed -i /neutron-openvswitch-agent/d /opt/service",
before => Service["shut down and disable Neutron's agent services"],
}
}
firewall{'222 vxlan':
port => [4789],
proto => 'udp',
action => 'accept',
}->
service {"shut down and disable Neutron's agent services":
name => $neutron_ovs_agent,
ensure => stopped,
enable => false,
}->
exec{'Stop the OpenvSwitch service and clear existing OVSDB':
command => "service $ovs_service stop ;
rm -rf /var/log/openvswitch/* ;
rm -rf /etc/openvswitch/conf.db ;
service $ovs_service start ;"
} ->
exec{'Set ONOS as the manager':
command => "su -s /bin/sh -c 'ovs-vsctl set-manager tcp:${onos::manager_ip}:6640'",
}
$public_eth = $onos::public_eth
if member($roles, 'compute') {
exec{"net config":
command => "ifconfig $public_eth up",
}
}
else
{
exec{"sleep 20 for ovsconnect":
command => "sleep 20",
require => Exec['Set ONOS as the manager'],
}->
exec{"delete public port from ovs of controllers":
command => "ovs-vsctl del-port br-int $public_eth",
}
}

View File

@@ -32,3 +32,4 @@ EOT
chmod +x /etc/profile.d/jdk*

View File

@@ -7,4 +7,11 @@ cd /opt
tar xf networking-onos.tar
cd networking-onos
python setup.py install
rm -rf /opt/networking-onos*
cd /opt
git clone https://github.com/openstack/networking-sfc.git
cd networking-sfc
python setup.py install
rm -rf /opt/networking-sfc*

View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -ux
source /root/openrc
/usr/bin/glance image-create --name 'TestSfcVm' --visibility 'public' --container-format='bare' --disk-format='qcow2' --min-ram='64' --file '/root/firewall_block_image.img'

View File

@@ -0,0 +1,9 @@
module Puppet::Parser::Functions
newfunction(:filter_nodes, :type => :rvalue) do |args|
name = args[1]
value = args[2]
args[0].select do |it|
it[name] == value
end
end
end

View File

@@ -1,55 +1,56 @@
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_home = $onos::onos_home
$karaf_dist = $onos::karaf_dist
$roles = $onos::roles
$public_vip = hiera('public_vip')
$management_vip = hiera('management_vip')
$manager_ip = $onos::manager_ip
$onos_pkg_name = $onos::onos_pkg_name
$jdk8_pkg_name = $onos::jdk8_pkg_name
$node = hiera('node')
$ip = $node['network_roles']['management']
$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",
}
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,
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;"
}->
file { "${onos_home}/config/cluster.json":
ensure => file,
content => template('onos/cluster.json.erb')
}
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,
}
}
centos: {
file {'/etc/init.d/onos':
ensure => file,
content => template('onos/centos/onos.erb'),
mode => 0777
}}}
#if !member($roles, 'compute') {
# include onos::ha::haproxy
#}
mode => 0777
}
}
}
}

View File

@@ -1,19 +1,13 @@
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'
$nodes = hiera('nodes')
$primary_controller = filter_nodes( $nodes,'role','primary-controller')
$roles = node_roles( $nodes, hiera('uid'))
$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'
$karaf_dist = 'apache-karaf-3.0.5'
$onos_pkg_name = 'onos-1.6.0.tar.gz'
$jdk8_pkg_name = 'jdk-8u51-linux-x64.tar.gz'
}

View File

@@ -1,56 +1,57 @@
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
$onos_home = $onos::onos_home
$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/'],
}
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/",
}
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/",
}
}

View File

@@ -0,0 +1,103 @@
class onos::network::create_network {
if hiera('use_neutron', false) {
$access_hash = hiera_hash('access', {})
$keystone_admin_tenant = $access_hash['tenant']
$neutron_config = hiera_hash('neutron_config')
$floating_net = try_get_value($neutron_config, 'default_floating_net', 'net04_ext')
$private_net = try_get_value($neutron_config, 'default_private_net', 'net04')
$default_router = try_get_value($neutron_config, 'default_router', 'router04')
$segmentation_type = try_get_value($neutron_config, 'L2/segmentation_type')
$nets = $neutron_config['predefined_networks']
$network_type = 'vxlan'
$private_net_segment_id = '500'
$private_net_physnet = false
$private_net_shared = try_get_value($nets, "${private_net}/shared", false)
$private_net_router_external = false
$floating_net_type = 'vxlan'
$floating_net_physnet = false
$floating_net_segment_id = '10000'
$floating_net_router_external = try_get_value($nets, "${floating_net}/L2/router_ext")
$floating_net_floating_range = try_get_value($nets, "${floating_net}/L3/floating", '')
$floating_net_shared = try_get_value($nets, "${floating_net}/shared", false)
if !empty($floating_net_floating_range) {
$floating_cidr = try_get_value($nets, "${floating_net}/L3/subnet")
$floating_net_allocation_pool = format_allocation_pools($floating_net_floating_range, $floating_cidr)
}
$tenant_name = try_get_value($access_hash, 'tenant', 'admin')
neutron_network { $floating_net :
ensure => 'present',
provider_physical_network => $floating_net_physnet,
provider_network_type => $floating_net_type,
provider_segmentation_id => $floating_net_segment_id,
router_external => $floating_net_router_external,
tenant_name => $tenant_name,
shared => $floating_net_shared
}
neutron_subnet { "${floating_net}__subnet" :
ensure => 'present',
cidr => try_get_value($nets, "${floating_net}/L3/subnet"),
network_name => $floating_net,
tenant_name => $tenant_name,
gateway_ip => try_get_value($nets, "${floating_net}/L3/gateway"),
enable_dhcp => false,
allocation_pools => $floating_net_allocation_pool,
}
neutron_network { $private_net :
ensure => 'present',
provider_physical_network => $private_net_physnet,
provider_network_type => $network_type,
provider_segmentation_id => $private_net_segment_id,
router_external => $private_net_router_external,
tenant_name => $tenant_name,
shared => $private_net_shared
}
neutron_subnet { "${private_net}__subnet" :
ensure => 'present',
cidr => try_get_value($nets, "${private_net}/L3/subnet"),
network_name => $private_net,
tenant_name => $tenant_name,
gateway_ip => try_get_value($nets, "${private_net}/L3/gateway"),
enable_dhcp => true,
dns_nameservers => try_get_value($nets, "${private_net}/L3/nameservers"),
}
if has_key($nets, 'baremetal') {
$baremetal_physnet = try_get_value($nets, 'baremetal/L2/physnet', false)
$baremetal_segment_id = try_get_value($nets, 'baremetal/L2/segment_id')
$baremetal_router_external = try_get_value($nets, 'baremetal/L2/router_ext')
$baremetal_shared = try_get_value($nets, 'baremetal/shared', false)
neutron_network { 'baremetal' :
ensure => 'present',
provider_physical_network => 'false',
provider_network_type => 'vxlan',
provider_segmentation_id => '1000',
router_external => $baremetal_router_external,
tenant_name => $tenant_name,
shared => $baremetal_shared
}
neutron_subnet { 'baremetal__subnet' :
ensure => 'present',
cidr => try_get_value($nets, 'baremetal/L3/subnet'),
network_name => 'baremetal',
tenant_name => $tenant_name,
gateway_ip => try_get_value($nets, 'baremetal/L3/gateway'),
enable_dhcp => true,
dns_nameservers => try_get_value($nets, 'baremetal/L3/nameservers'),
allocation_pools => format_allocation_pools(try_get_value($nets, 'baremetal/L3/floating')),
}
}
}
}

View File

@@ -0,0 +1,60 @@
class onos::network::create_router {
$use_neutron = hiera('use_neutron', false)
$neutron_advanced_config = hiera_hash('neutron_advanced_configuration', { })
# In case of L3 HA enabled this task must be executed on a post-deployment stage.
# as HA routers can't be created when less then 2 L3 agents are available (Neutron limitation)
$l3_ha = pick($neutron_advanced_config['neutron_l3_ha'], false)
$dvr = pick($neutron_advanced_config['neutron_dvr'], false)
$neutron_controller_roles = hiera('neutron_controller_roles', ['controller', 'primary-controller'])
$controllers_num = size(get_nodes_hash_by_roles(hiera_hash('network_metadata'), $neutron_controller_roles))
if $use_neutron {
$access_hash = hiera_hash('access', {})
$keystone_admin_tenant = pick($access_hash['tenant'], 'admin')
$neutron_config = hiera_hash('neutron_config')
$floating_net = try_get_value($neutron_config, 'default_floating_net', 'net04_ext')
$private_net = try_get_value($neutron_config, 'default_private_net', 'net04')
$default_router = try_get_value($neutron_config, 'default_router', 'router04')
$baremetal_router = try_get_value($neutron_config, 'baremetal_router', 'baremetal')
$nets = $neutron_config['predefined_networks']
if ($l3_ha) and ($controllers_num < 2) {
warning ('Not enough controllers to create an HA router')
} else {
neutron_router { $default_router:
ensure => 'present',
gateway_network_name => $floating_net,
name => $default_router,
tenant_name => $keystone_admin_tenant,
} ->
neutron_router_interface { "${default_router}:${private_net}__subnet":
ensure => 'present',
}
if has_key($nets, 'baremetal') {
if $dvr {
neutron_router { $baremetal_router:
ensure => 'present',
gateway_network_name => $floating_net,
name => $baremetal_router,
tenant_name => $keystone_admin_tenant,
distributed => false,
} ->
neutron_router_interface { "${baremetal_router}:baremetal__subnet":
ensure => 'present',
require => Neutron_router[$baremetal_router]
}
} else {
neutron_router_interface { "${default_router}:baremetal__subnet":
ensure => 'present',
require => Neutron_router[$default_router]
}
}
}
}
}
}

View File

@@ -1,48 +1,60 @@
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\""
}
$manager_ip = $onos::manager_ip
Exec {
path => "/usr/bin:/usr/sbin:/bin:/sbin",
timeout => 320,
logoutput => 'true',
}
firewall {'221 onos':
dport => [6633, 6640, 6653, 8181, 8101, 9876],
proto => 'tcp',
action => 'accept',
}->
service { 'onos':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}->
exec { 'sleep 150 to stablize onos':
command => 'sleep 150;'
}->
exec { 'wait onos ready':
command => "curl -o /dev/null --fail --silent --head -u karaf:karaf http://$manager_ip:8181/onos/ui",
tries => 60,
try_sleep => 20,
}->
exec { 'install feature openflow':
command => "/opt/onos/bin/onos 'feature:install onos-openflow-base';
/opt/onos/bin/onos 'feature:install onos-openflow'",
tries => 3,
try_sleep => 5,
}->
exec { 'install feature ovs':
command => "/opt/onos/bin/onos 'feature:install onos-ovsdatabase';
/opt/onos/bin/onos 'feature:install onos-ovsdb-base';
/opt/onos/bin/onos 'feature:install onos-drivers-ovsdb';
/opt/onos/bin/onos 'feature:install onos-ovsdb-provider-host';",
tries => 3,
try_sleep => 2,
}->
exec { 'install feature onosfw':
command => "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw';
/opt/onos/bin/onos 'externalportname-set -n onos_port2';",
tries => 3,
try_sleep => 2,
}->
exec { 'add onos auto start':
command => 'echo "onos">>/opt/service',
}
}

View File

@@ -1,20 +1,25 @@
{"ipPrefix": "192.168.0.*",
"nodes": [
<% index = 1 -%>
<%- @manager_ip.each do |ip| -%>
<%- if index == @manager_ip.size -%>
{
"nodes": [
{
"ip": "<%= ip -%>",
"id": "<%= ip -%>",
"tcpPort": 9876
"ip": "<%= @ip %>",
"id": "<%= @ip %>",
"port": 9876
}
<%- else -%>
],
"name": "default",
"partitions": [
{
"ip": "<%= ip -%>",
"id": "<%= ip -%>",
"tcpPort": 9876
},
<%- end -%>
<%- index = index + 1 -%>
<%- end -%>
]}
"id": 0,
"members": [
"<%= @ip %>"
]
},
{
"id": 1,
"members": [
"<%= @ip %>"
]
}
]
}

View File

@@ -23,7 +23,6 @@ script
export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin;
export JAVA_HOME=/usr/lib/jvm/java-8-oracle;
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db;
export ONOS_APPS=<%= @onos_extra_features %>
[ -f /opt/onos/options ] && . /opt/onos/options
start-stop-daemon --signal INT --start --chuid $ONOS_USER \
--exec /opt/onos/bin/onos-service -- $ONOS_OPTS \

View File

@@ -1,9 +1,11 @@
#!/bin/bash
# For onos 1.4 and 1.5, after external network is created, you need use cli to give gatewaymac to onos before you allocate floating ip.
# For onos 1.6, this part can be omitted.
set -ux
set -eux
ifconfig <%= @public_eth -%> <%= @gateway_ip -%>00/24 up
route add default gw <%= @gateway_ip %>
ping -c 5 <%= @gateway_ip %>
gatewayMac=`arp -a <%= @gateway_ip -%> | awk '{print $4}'`
#gatewayMac=`arp -a <%= @gateway_ip -%> | awk '{print $4}'`
gatewayMac=$(arp -a <%= @gateway_ip -%> | grep -Eo "[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+")
/opt/onos/bin/onos "externalgateway-update -m $gatewayMac"
ifconfig <%= @public_eth -%> 0 down

View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -ux
ifconfig | grep br-ex
if [ $? -eq 1 ];then
echo "no br-ex exits"
else
echo "br-ex needs to remove"
ifconfig br-ex down
brctl delbr br-ex
fi
ifconfig <%= @public_eth -%> up
ovs-vsctl add-br br-public
ovs-vsctl add-port br-public <%= @public_eth %>
ifconfig br-public up
ip link add onos_port1 type veth peer name onos_port2
ifconfig onos_port1 up
ifconfig onos_port2 up
#externamMac=`ifconfig <%= @public_eth -%> | grep "HWaddr" | awk '{print $5}'`
externamMac=$(ifconfig <%= @public_eth -%> | \
grep -Eo "[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+")
ifconfig onos_port2 hw ether $externamMac
ovs-vsctl add-port br-public onos_port1
route | grep default
if [ $? -eq 1 ];then
echo "need to add default gw"
route add default gw <%= @vrouter -%>
else
echo "no need to add default gw"
fi

View File

@@ -1,27 +1,35 @@
# These tasks will be merged into deployment graph. Here you
# can specify new tasks for any roles, even built-in ones.
- id: onos
type: group
role: [onos]
requires: [deploy_start]
required_for: [deploy_end, primary-controller, controller]
tasks: [fuel_pkgs, hiera, globals, tools, logging, netconfig,
hosts, firewall, deploy_start, onos_install]
tasks: [hiera, setup_repositories, fuel_pkgs, globals, tools, logging, onos_install, netconfig]
parameters:
strategy:
type: parallel
- id: ovs_update
type: puppet
version: 2.0.0
groups: [primary-controller,controller,compute]
requires: [deploy_start]
required_for: [netconfig, deploy_end]
parameters:
puppet_manifest: puppet/manifests/ovs-update.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: onos_install
type: puppet
version: 2.0.0
groups: [onos]
requires: [deploy_start, hosts, firewall, globals]
required_for: [deploy_end, openstack-network]
required_for: [deploy_end, openstack-network-start]
parameters:
puppet_manifest: puppet/manifests/onos-install.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: onos_service
type: puppet
version: 2.0.0
role: [onos]
requires: [post_deployment_start]
required_for: [post_deployment_end]
@@ -31,37 +39,68 @@
timeout: 1400
- id: onos_ha
type: puppet
role: ['primary-controller','controller']
requires: [onos_service]
version: 2.0.0
role: [primary-controller,controller]
cross-depends:
- name: onos_service
requires: [post_deployment_start]
required_for: [post_deployment_end]
parameters:
puppet_manifest: puppet/manifests/onos-ha.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1400
- id: onos_config_ovs
role: ['primary-controller','controller','compute']
- id: onos_config_ovs_controller
type: puppet
version: 2.0.0
role: [primary-controller,controller]
requires: [onos_ha]
required_for: [post_deployment_end]
type: puppet
parameters:
puppet_manifest: puppet/manifests/ovs.pp
puppet_manifest: puppet/manifests/ovs-controller.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 600
- id: onos_config_ovs_compute
type: puppet
version: 2.0.0
role: [compute]
cross-depends:
- name: onos_ha
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/ovs-compute.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 600
- id: onos_config_neutron
role: ['primary-controller', 'controller']
requires: [onos_config_ovs]
required_for: [post_deployment_end]
type: puppet
version: 2.0.0
role: [primary-controller,controller]
cross-depends:
- name: onos_config_ovs_compute
requires: [onos_config_ovs_controller]
required_for: [post_deployment_end]
parameters:
puppet_manifest: puppet/manifests/neutron.pp
puppet_manifest: puppet/manifests/neutron-config.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1800
- id: onos_config_net
role: [onos]
- id: onos_start_neutron
type: puppet
version: 2.0.0
role: [primary-controller,controller]
requires: [onos_config_neutron]
required_for: [post_deployment_end]
type: puppet
parameters:
puppet_manifest: puppet/manifests/netconfig.pp
puppet_manifest: puppet/manifests/neutron-start.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1800
timeout: 600
- id: onos_dashboard_registration
type: puppet
role: [primary-controller]
required_for: [post_deployment_end]
requires: [post_deployment_start]
version: 2.0.0
parameters:
puppet_manifest: puppet/manifests/onos-dashboard.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 180

View File

@@ -2,9 +2,9 @@ attributes:
metadata:
restrictions:
- "cluster:net_provider != 'neutron'": "Neutron only"
public_eth:
description: "Please note that onos needs an independent eth for public network when interfaces of nodes are configured, or L3 traffic to internet will fail! Defualt is eth3."
type: text
label: Public Ethernet Port
weight: 20
value: eth3
- settings:public_network_assignment.assign_to_all_nodes.value == false: Assign public network to all nodes
enable_sfc:
weight: 13
type: "checkbox"
value: false
label: "SFC features"

View File

@@ -3,28 +3,31 @@ name: onos
# Human-readable name for your plugin
title: onos plugin
# Plugin version
version: '0.7.0'
version: '0.9.0'
# Description
description: 'Open Network Operating System (ONOS) is a typical SDN controller. Web-ui: http://horizon_ip:8181/onos/ui.'
description: 'Open Network Operating System (ONOS) is a typical SDN controller. Web-ui: http://horizon_ip:8181/onos/ui'
# Required fuel version
fuel_version: ['7.0']
fuel_version: ['9.0']
# Specify license of your plugin
licenses: ['Apache License Version 2.0']
# Specify author or company name
authors: ['Wu Wenbin, Huawei']
# A link to the plugin's page
homepage: 'https://github.com/openstack/fuel-plugins-onos'
homepage: 'git://git.openstack.org/openstack/fuel-plugin-onos'
# Specify a group which your plugin implements, possible options:
# network, storage, storage::cinder, storage::glance, hypervisor
groups: ['network']
# Change `false` to `true` if the plugin can be installed in the environment
# after the deployment.
is_hotpluggable: false
# The plugin is compatible with releases in the list
releases:
- os: ubuntu
version: 2015.1.0-7.0
version: mitaka-9.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
# Version of plugin package
package_version: '3.0.0'
package_version: '4.0.0'

View File

@@ -2,12 +2,31 @@
set -eux
DIR="$(dirname `readlink -f $0`)"
TARGET="${DIR}/deployment_scripts/puppet/modules/onos/files"
onos=http://205.177.226.235:9999/onosfw/onos-1.3.0.tar.gz
jdk=http://205.177.226.235:9999/onosfw/jdk-8u51-linux-x64.tar.gz
repo=http://205.177.226.235:9999/onosfw/repository.tar
base_url=http://205.177.226.237:9999/onosfw
repo_target="${DIR}/repositories/ubuntu"
onos=onos-1.6.0.tar.gz
package=package_ovs_debian.tar.gz
jdk=jdk-8u51-linux-x64.tar.gz
repo=repository.tar
img=firewall_block_image.img
cd $TARGET
if [ ! -f "onos-1.3.0.tar.gz" ]; then
wget $onos -P $TARGET
wget $jdk -P $TARGET
wget $repo -P $TARGET
if [ ! -f $onos ]; then
wget $base_url/$onos -P $TARGET
fi
if [ ! -f $jdk ]; then
wget $base_url/$jdk -P $TARGET
wget $base_url/$repo -P $TARGET
wget $base_url/$img -P $TARGET
fi
cd $repo_target
rm -rf *.deb
if [ ! -f $package ]; then
wget $base_url/$package -P $repo_target
fi
tar zxf $repo_target/$package -C $repo_target
rm -rf $repo_target/$package

Binary file not shown.

View File

@@ -1,2 +0,0 @@
Label: onos
Version: 0.7

1
tasks.yaml Normal file
View File

@@ -0,0 +1 @@
[]