From fb272b15819d8c9412b3f0061b7a282ab6a025be Mon Sep 17 00:00:00 2001 From: Kanzhe Jiang Date: Sun, 29 Nov 2015 01:17:31 -0800 Subject: [PATCH] first draft p-only plugin P-only bigswitch Neutron fuel plugin. ToDo: discover the uplinks of compute, controller, and ceph nodes. Change-Id: I433d370c761b8070be2cea27ace1651926b9e37c --- README.md | 31 +-- deployment_scripts/deploy.sh | 4 - .../puppet/manifests/ceph-config.pp | 17 ++ .../puppet/manifests/compute-config.pp | 17 ++ .../puppet/manifests/controller-config.pp | 17 ++ .../puppet/modules/bcf/AUTHORS.txt | 1 + .../puppet/modules/bcf/manifests/ceph.pp | 44 +++ .../puppet/modules/bcf/manifests/compute.pp | 260 ++++++++++++++++++ .../modules/bcf/manifests/controller.pp | 259 +++++++++++++++++ .../puppet/modules/bcf/manifests/init.pp | 16 ++ .../puppet/modules/bcf/manifests/params.pp | 36 +++ .../modules/bcf/manifests/params/openstack.pp | 57 ++++ deployment_scripts/python_scripts/send_lldp | 176 ++++++++++++ deployment_tasks.yaml | 41 ++- environment_config.yaml | 8 +- metadata.yaml | 2 +- 16 files changed, 945 insertions(+), 41 deletions(-) delete mode 100755 deployment_scripts/deploy.sh create mode 100755 deployment_scripts/puppet/manifests/ceph-config.pp create mode 100755 deployment_scripts/puppet/manifests/compute-config.pp create mode 100755 deployment_scripts/puppet/manifests/controller-config.pp create mode 100644 deployment_scripts/puppet/modules/bcf/AUTHORS.txt create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/ceph.pp create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/compute.pp create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/controller.pp create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/init.pp create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/params.pp create mode 100644 deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp create mode 100644 deployment_scripts/python_scripts/send_lldp diff --git a/README.md b/README.md index 337dd54..3df50c2 100644 --- a/README.md +++ b/README.md @@ -38,35 +38,39 @@ Installation Guide BigSwitch plugin installation ---------------------------------------- -1. Clone the fuel-plugin-bigswitch repo from github: +1. Download Switch Light virtual package from Big Switch Networks for + the deployed operating system. The downloaded package must be + saved on the Fuel master node under directory, "/tmp/repositories" + +2. Clone the fuel-plugin-bigswitch repo from github: git clone https://github.com/openstack/fuel-plugin-bigswitch -2. Install the Fuel Plugin Builder: +3. Install the Fuel Plugin Builder: pip install fuel-plugin-builder -3. Build Openvswitch Fuel plugin: +4. Build Openvswitch Fuel plugin: fpb --build fuel-plugin-bigswitch/ -4. The *fuel-plugin-bigswitch-[x.x.x].rpm* plugin package will be created in the plugin folder. +5. The *fuel-plugin-bigswitch-[x.x.x].rpm* plugin package will be created in the plugin folder. -5. Move this file to the Fuel Master node with secure copy (scp): +6. Move this file to the Fuel Master node with secure copy (scp): scp fuel-plugin-bigswitch-[x.x.x].rpm root@:/tmp -6. While logged in Fuel Master install the BigSwitch plugin: +7. While logged in Fuel Master install the BigSwitch plugin: fuel plugins --install fuel-plugin-bigswitch-[x.x.x].rpm -7. Check if the plugin was installed successfully: +8. Check if the plugin was installed successfully: fuel plugins id | name | version | package_version ---|-----------------------|---------|---------------- - 1 | fuel-plugin-bigswitch | 1.0.0 | 1.0.0 + 1 | fuel-plugin-bigswitch | 1.0.0 | 3.0.0 8. Plugin is ready to use and can be enabled on the Settings tab of the Fuel web UI. @@ -87,17 +91,6 @@ Build options It is possible to modify process of building plugin by setting environment variables. Look into [pre_build_hook file](pre_build_hook) for more details. -Dependencies ------------- - -If you plan to use plugin in environment without internet access, modify build command: - - INCLUDE_DEPENDENCIES=true fpb --build fuel-plugin-bigswitch/ - -Pre build script will try download required dependencies so it become part of the compiled plugin. - -Note: List of packages for [ubuntu](bigswitch_package/ubuntu/dependencies.txt) and [centos](bigswitch_package/centos/dependencies.txt) may need to be modified if packages in centos or ubuntu repositories will change. - Testing ------- diff --git a/deployment_scripts/deploy.sh b/deployment_scripts/deploy.sh deleted file mode 100755 index 8f45d0f..0000000 --- a/deployment_scripts/deploy.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# It's a script which deploys your plugin -echo fuel-plugin-bigswitch > /tmp/fuel-plugin-bigswitch diff --git a/deployment_scripts/puppet/manifests/ceph-config.pp b/deployment_scripts/puppet/manifests/ceph-config.pp new file mode 100755 index 0000000..6980710 --- /dev/null +++ b/deployment_scripts/puppet/manifests/ceph-config.pp @@ -0,0 +1,17 @@ +# +# Copyright 2015 BigSwitch Networks +# +# 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. +# +notice('MODULAR: bigswitch compute-config') +include bcf::ceph diff --git a/deployment_scripts/puppet/manifests/compute-config.pp b/deployment_scripts/puppet/manifests/compute-config.pp new file mode 100755 index 0000000..4383306 --- /dev/null +++ b/deployment_scripts/puppet/manifests/compute-config.pp @@ -0,0 +1,17 @@ +# +# Copyright 2015 BigSwitch Networks +# +# 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. +# +notice('MODULAR: bigswitch compute-config') +include bcf::compute diff --git a/deployment_scripts/puppet/manifests/controller-config.pp b/deployment_scripts/puppet/manifests/controller-config.pp new file mode 100755 index 0000000..4e2f6aa --- /dev/null +++ b/deployment_scripts/puppet/manifests/controller-config.pp @@ -0,0 +1,17 @@ +# +# Copyright 2015 BigSwitch Networks +# +# 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. +# +notice("MODULAR: bigswitch controller-config") +include bcf::controller diff --git a/deployment_scripts/puppet/modules/bcf/AUTHORS.txt b/deployment_scripts/puppet/modules/bcf/AUTHORS.txt new file mode 100644 index 0000000..39ff3f3 --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/AUTHORS.txt @@ -0,0 +1 @@ +Kanzhe Jiang diff --git a/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp b/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp new file mode 100644 index 0000000..5b32a4b --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp @@ -0,0 +1,44 @@ +# +# Copyright 2015 BigSwitch Networks, 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 bcf::ceph { + + include bcf::params + # all of the exec statements use this path + $binpath = "/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin" + + # lldp + file { "/bin/send_lldp": + ensure => file, + mode => 0777, + } + file { "/etc/init/send_lldp.conf": + ensure => file, + content => " +description \"BCF LLDP\" +start on runlevel [2345] +stop on runlevel [!2345] +respawn +script + exec /bin/send_lldp --system-desc 5c:16:c7:00:00:04 --system-name $(uname -n) -i 10 --network_interface %(uplinks)s +end script +", + } + service { "send_lldp": + ensure => running, + enable => true, + require => [File['/bin/send_lldp'], File['/etc/init/send_lldp.conf']], + } +} diff --git a/deployment_scripts/puppet/modules/bcf/manifests/compute.pp b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp new file mode 100644 index 0000000..ab4e44a --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp @@ -0,0 +1,260 @@ +# +# Copyright 2015 BigSwitch Networks, 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 bcf::compute { + + include bcf::params + # all of the exec statements use this path + $binpath = "/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin" + + # lldp + file { "/bin/send_lldp": + ensure => file, + mode => 0777, + } + file { "/etc/init/send_lldp.conf": + ensure => file, + content => " +description \"BCF LLDP\" +start on runlevel [2345] +stop on runlevel [!2345] +respawn +script + exec /bin/send_lldp --system-desc 5c:16:c7:00:00:04 --system-name $(uname -n) -i 10 --network_interface eth2,eth3 +end script +", + } + service { "send_lldp": + ensure => running, + enable => true, + require => [File['/bin/send_lldp'], File['/etc/init/send_lldp.conf']], + } + + # edit rc.local for cron job and default gw + file { "/etc/rc.local": + ensure => file, + mode => 0777, + }-> + + # config /etc/neutron/neutron.conf + ini_setting { "neutron.conf report_interval": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'agent', + key_val_separator => '=', + setting => 'report_interval', + value => '60', + } + ini_setting { "neutron.conf agent_down_time": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'agent_down_time', + value => '150', + } + ini_setting { "neutron.conf service_plugins": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'service_plugins', + value => 'router', + } + ini_setting { "neutron.conf dhcp_agents_per_network": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'dhcp_agents_per_network', + value => '1', + } + ini_setting { "neutron.conf notification driver": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'notification_driver', + value => 'messaging', + } + + # set the correct properties in ml2_conf.ini on compute as well + # config /etc/neutron/plugins/ml2/ml2_conf.ini + ini_setting { "ml2 type dirvers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'type_drivers', + value => 'vlan', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 tenant network types": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'tenant_network_types', + value => 'vlan', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 mechanism drivers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'mechanism_drivers', + value => 'openvswitch,bsn_ml2', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy ssl cert directory": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'ssl_cert_directory', + value => '/etc/neutron/plugins/ml2', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy servers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'servers', + value => '${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy server auth": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'server_auth', + value => '${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy server ssl": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'server_ssl', + value => 'True', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy auto sync on failure": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auto_sync_on_failure', + value => 'True', + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy consistency interval": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'consistency_interval', + value => 60, + notify => Service['neutron-plugin-openvswitch-agent'], + } + ini_setting { "ml2 restproxy neutron_id": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'neutron_id', + value => '${bcf::params::openstack::bcf_instance_id}', + notify => Service['neutron-plugin-openvswitch-agent'], + } + + # change ml2 ownership + file { '/etc/neutron/plugins/ml2': + owner => neutron, + group => neutron, + recurse => true, + notify => Service['neutron-plugin-openvswitch-agent'], + } + + # make sure neutron-bsn-agent is stopped + service {'neutron-bsn-agent': + ensure => stopped, + enable => false, + } + + # ensure neutron-plugin-openvswitch-agent is running + file { "/etc/init/neutron-plugin-openvswitch-agent.conf": + ensure => file, + mode => 0644, + } + service { 'neutron-plugin-openvswitch-agent': + ensure => 'running', + enable => 'true', + provider => 'upstart', + hasrestart => 'true', + hasstatus => 'true', + subscribe => [File['/etc/init/neutron-plugin-openvswitch-agent.conf']], + } + + file { '/etc/neutron/dnsmasq-neutron.conf': + ensure => file, + content => 'dhcp-option-force=26,1400', + } + + # dhcp configuration + ini_setting { "dhcp agent interface driver": + ensure => present, + path => '/etc/neutron/dhcp_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'interface_driver', + value => 'neutron.agent.linux.interface.OVSInterfaceDriver', + } + ini_setting { "dhcp agent dhcp driver": + ensure => present, + path => '/etc/neutron/dhcp_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'dhcp_driver', + value => 'neutron.agent.linux.dhcp.Dnsmasq', + } + ini_setting { "dhcp agent enable isolated metadata": + ensure => present, + path => '/etc/neutron/dhcp_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'enable_isolated_metadata', + value => 'True', + } + ini_setting { "dhcp agent disable metadata network": + ensure => present, + path => '/etc/neutron/dhcp_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'enable_metadata_network', + value => 'False', + } + ini_setting { "dhcp agent disable dhcp_delete_namespaces": + ensure => present, + path => '/etc/neutron/dhcp_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'dhcp_delete_namespaces', + value => 'False', + } +} diff --git a/deployment_scripts/puppet/modules/bcf/manifests/controller.pp b/deployment_scripts/puppet/modules/bcf/manifests/controller.pp new file mode 100644 index 0000000..6668d60 --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/controller.pp @@ -0,0 +1,259 @@ +# +# Copyright 2015 BigSwitch Networks, 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 bcf::controller { + + include bcf::params + $binpath = "/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin" + + # load bonding module + file_line {'load bonding on boot': + path => '/etc/modules', + line => 'bonding', + match => '^bonding$', + } + + # purge bcf controller public key + exec { 'purge bcf key': + command => "rm -rf /etc/neutron/plugins/ml2/host_certs/*", + path => $binpath, + notify => Service['neutron-server'], + } + + # config /etc/neutron/neutron.conf + ini_setting { "neutron.conf report_interval": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'agent', + key_val_separator => '=', + setting => 'report_interval', + value => '60', + } + ini_setting { "neutron.conf agent_down_time": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'agent_down_time', + value => '150', + } + ini_setting { "neutron.conf service_plugins": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'service_plugins', + value => 'router', + notify => Service['neutron-server'], + } + ini_setting { "neutron.conf dhcp_agents_per_network": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'dhcp_agents_per_network', + value => '1', + notify => Service['neutron-server'], + } + ini_setting { "neutron.conf notification driver": + ensure => present, + path => '/etc/neutron/neutron.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'notification_driver', + value => 'messaging', + notify => Service['neutron-server'], + } + + # configure /etc/keystone/keystone.conf + ini_setting { "keystone.conf notification driver": + ensure => present, + path => '/etc/keystone/keystone.conf', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'notification_driver', + value => 'messaging', + notify => Service['keystone'], + } + + # config /etc/neutron/plugin.ini + ini_setting { "neutron plugin.ini firewall_driver": + ensure => present, + path => '/etc/neutron/plugin.ini', + section => 'securitygroup', + key_val_separator => '=', + setting => 'firewall_driver', + value => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', + notify => Service['neutron-server'], + } + ini_setting { "neutron plugin.ini enable_security_group": + ensure => present, + path => '/etc/neutron/plugin.ini', + section => 'securitygroup', + key_val_separator => '=', + setting => 'enable_security_group', + value => 'True', + notify => Service['neutron-server'], + } + file { '/etc/neutron/dnsmasq-neutron.conf': + ensure => file, + content => 'dhcp-option-force=26,1400', + } + + # config /etc/neutron/l3-agent.ini + ini_setting { "l3 agent disable metadata proxy": + ensure => present, + path => '/etc/neutron/l3_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'enable_metadata_proxy', + value => 'False', + } + ini_setting { "l3 agent external network bridge": + ensure => present, + path => '/etc/neutron/l3_agent.ini', + section => 'DEFAULT', + key_val_separator => '=', + setting => 'external_network_bridge', + value => '', + } + + # config /etc/neutron/plugins/ml2/ml2_conf.ini + ini_setting { "ml2 type dirvers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'type_drivers', + value => 'vlan', + notify => Service['neutron-server'], + } + ini_setting { "ml2 tenant network types": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'tenant_network_types', + value => 'vlan', + notify => Service['neutron-server'], + } + ini_setting { "ml2 mechanism drivers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'ml2', + key_val_separator => '=', + setting => 'mechanism_drivers', + value => 'openvswitch,bsn_ml2', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy ssl cert directory": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'ssl_cert_directory', + value => '/etc/neutron/plugins/ml2', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy servers": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'servers', + value => '${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy server auth": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'server_auth', + value => '${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy server ssl": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'server_ssl', + value => 'True', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy auto sync on failure": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auto_sync_on_failure', + value => 'True', + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy consistency interval": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'consistency_interval', + value => 60, + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy neutron_id": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'neutron_id', + value => '${bcf::params::openstack::bcf_instance_id}', + notify => Service['neutron-server'], + } + + # change ml2 ownership + file { '/etc/neutron/plugins/ml2': + owner => neutron, + group => neutron, + recurse => true, + notify => Service['neutron-server'], + } + + # heat-engine, neutron-server, neutron-dhcp-agent and neutron-metadata-agent + service { 'heat-engine': + ensure => running, + enable => true, + } + service { 'neutron-server': + ensure => running, + enable => true, + } + service { 'keystone': + ensure => running, + enable => true, + } + service { 'neutron-dhcp-agent': + ensure => stopped, + enable => false, + } + service { 'neutron-metadata-agent': + ensure => stopped, + enable => false, + } + service {'neutron-bsn-agent': + ensure => stopped, + enable => false, + } +} + diff --git a/deployment_scripts/puppet/modules/bcf/manifests/init.pp b/deployment_scripts/puppet/modules/bcf/manifests/init.pp new file mode 100644 index 0000000..fe361ea --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/init.pp @@ -0,0 +1,16 @@ +# +# 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 bcf {} diff --git a/deployment_scripts/puppet/modules/bcf/manifests/params.pp b/deployment_scripts/puppet/modules/bcf/manifests/params.pp new file mode 100644 index 0000000..5de5729 --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/params.pp @@ -0,0 +1,36 @@ +# +# 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 bcf::params { + + include bcf::params::openstack + + $bcf_hash = hiera('bigswitch') + $network_metadata = hiera('network_metadata') + $ssl = hiera('public_ssl') + + case $::operatingsystem { + 'Ubuntu', 'Debian': { + } + 'CentOS', 'RedHat': { + } + default: { + } + } + + #server parameters + $server_ip = $network_metadata['vips'][$vip_name]['ipaddr'] + $mgmt_vip = $network_metadata['vips']['management']['ipaddr'] +} diff --git a/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp b/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp new file mode 100644 index 0000000..b66b242 --- /dev/null +++ b/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp @@ -0,0 +1,57 @@ +# +# Copyright 2015 BigSwitch Networks +# +# 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 bcf::params::openstack { + + $virtual_cluster_name = 'OpenStackCluster' + $ceph_virtual_cluster_name = 'CephCluster' + + $keystone_vip = hiera('management_vip') + $db_vip = hiera('management_vip') + $nova_vip = hiera('management_vip') + $glance_vip = hiera('management_vip') + $cinder_vip = hiera('management_vip') + $rabbit_vip = hiera('management_vip') + $bcf_hash = hiera('bigswitch') + + + $access_hash = hiera('access') + $keystone_hash = hiera('keystone') + $nova_hash = hiera('nova') + $neutron_hash = hiera('neutron_config') + $cinder_hash = hiera('cinder') + $rabbit_hash = hiera('rabbit') + + $bcf_mode = $bcf_hash['bcf_mode'] + $bcf_controller_1 = $bcf_hash['bcf_controller_1'] + $bcf_controller_2 = $bcf_hash['bcf_controller_2'] + $bcf_username = $bcf_hash['bcf_controller_username'] + $bcf_password = $bcf_hash['bcf_controller_password'] + $bcf_instance_id = $bcf_hash['openstack_instance_id'] + $bcf_controller_mgmt = $bcf_hash['bcf_controller_os_mgmt'] + $access_tenant = 'services' + $keystone_db_password = $keystone_hash['db_password'] + $nova_db_password = $nova_hash['db_password'] + $neutron_db_password = $neutron_hash['database']['passwd'] + $cinder_db_password = $cinder_hash['db_password'] + $rabbit_password = $rabbit_hash['password'] + $rabbitmq_service_name = 'rabbitmq-server' + + if !$rabbit_hash['user'] { + $rabbit_user = 'nova' + } else { + $rabbit_user = $rabbit_hash['user'] + } +} diff --git a/deployment_scripts/python_scripts/send_lldp b/deployment_scripts/python_scripts/send_lldp new file mode 100644 index 0000000..e1fe621 --- /dev/null +++ b/deployment_scripts/python_scripts/send_lldp @@ -0,0 +1,176 @@ +#!/usr/bin/env python +# +# Sends LLDP packets out of a specified network interface, +# either once or periodically at a fixed interval. +# The process can be optionally daemonized. +# +# Previous version: +# +# GitHub Repository: bigswitch/bigswitchcontroller +# Branch: bigdb +# Path: bare-metal/hypervisor/pcap_start_lldp.py +# + +import argparse +import socket +import os +import time + +LLDP_DST_MAC = "01:80:c2:00:00:0e" +LLDP_ETHERTYPE = 0x88cc +CHASSIS_ID = "Big Cloud Fabric" +TTL = 120 + +CHASSIS_ID_LOCALLY_ASSIGNED = 7 + +PORT_ID_INTERFACE_ALIAS = 1 + +def parse_args(): + parser = argparse.ArgumentParser() + + # LLDP packet arguments + parser.add_argument("--network_interface") + parser.add_argument("--system-name") + parser.add_argument("--system-desc") + + # Other arguments + parser.add_argument("-i", "--interval", type=int, default=0) + parser.add_argument("-d", "--daemonize", action="store_true", default=False) + + return parser.parse_args() + +def validate_num_bits_of_int(int_value, num_bits, name=None): + mask = pow(2, num_bits) - 1 + if (int_value & mask) != int_value: + name = name if name else "The integer value" + raise ValueError("%s must be %d-bit long. Given: %d (%s)" + % (name, num_bits, int_value, hex(int_value))) + +def raw_bytes_of_hex_str(hex_str): + return hex_str.decode("hex") + +def raw_bytes_of_mac_str(mac_str): + return raw_bytes_of_hex_str(mac_str.replace(":", "")) + +def raw_bytes_of_int(int_value, num_bytes, name=None): + validate_num_bits_of_int(int_value, num_bytes * 8, name) + template = "%0" + "%d" % (num_bytes * 2) + "x" + return raw_bytes_of_hex_str(template % int_value) + +def get_mac_str(network_interface): + with open("/sys/class/net/%s/address" % network_interface) as f: + return f.read().strip() + +def lldp_ethertype(): + return raw_bytes_of_int(LLDP_ETHERTYPE, 2, "LLDP ethertype") + +def validate_tlv_type(type_): + validate_num_bits_of_int(type_, 7, "TLV type") + +def validate_tlv_length(length): + validate_num_bits_of_int(length, 9, "TLV length") + +def tlv_1st_2nd_bytes_of(type_, length): + validate_tlv_type(type_) + validate_tlv_length(length) + int_value = (type_ << (8 + 1)) | length + return raw_bytes_of_int(int_value, 2, "First 2 bytes of TLV") + +def tlv_of(type_, str_value): + return tlv_1st_2nd_bytes_of(type_, len(str_value)) + str_value + +def chassis_id_tlv_of(chassis_id, subtype=CHASSIS_ID_LOCALLY_ASSIGNED): + return tlv_of(1, + raw_bytes_of_int(subtype, 1, "Chassis ID subtype") + chassis_id) + +def port_id_tlv_of(port_id, subtype=PORT_ID_INTERFACE_ALIAS): + return tlv_of(2, raw_bytes_of_int(subtype, 1, "Port ID subtype") + port_id) + +def ttl_tlv_of(ttl_seconds): + return tlv_of(3, raw_bytes_of_int(ttl_seconds, 2, "TTL (seconds)")) + +def system_name_tlv_of(system_name): + return tlv_of(5, system_name) + +def system_desc_tlv_of(system_desc): + return tlv_of(6, system_desc) + +def end_tlv(): + return tlv_of(0, "") + +def lldp_frame_of(chassis_id, + network_interface, + ttl, + system_name=None, + system_desc=None): + contents = [ + # Ethernet header + raw_bytes_of_mac_str(LLDP_DST_MAC), + raw_bytes_of_mac_str(get_mac_str(network_interface)), + lldp_ethertype(), + + # Required LLDP TLVs + chassis_id_tlv_of(chassis_id), + port_id_tlv_of(network_interface), + ttl_tlv_of(ttl) + ] + + # Optional LLDP TLVs + if system_name is not None: + contents.append(system_name_tlv_of(system_name)) + if system_desc is not None: + contents.append(system_desc_tlv_of(system_desc)) + + # End TLV + contents.append(end_tlv()) + + return "".join(contents) + +def daemonize(): + # Do not use this code for daemonizing elsewhere as this is + # a very simple version that is just good enough for here. + pid = os.fork() + if pid != 0: + # Exit from the parent process + os._exit(os.EX_OK) + + os.setsid() + + pid = os.fork() + if pid != 0: + # Exit from the 2nd parent process + os._exit(os.EX_OK) + +def main(): + args = parse_args() + + if args.daemonize: + daemonize() + + senders = [] + frames = [] + intfs = args.network_interface.split(',') + for intf in intfs: + interface = intf.strip() + frame = lldp_frame_of(chassis_id=CHASSIS_ID, + network_interface=interface, + ttl=TTL, + system_name=args.system_name, + system_desc=args.system_desc) + frames.append(frame) + + # Send the frame + s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) + s.bind((interface, 0)) + senders.append(s) + + while True: + for idx, s in enumerate(senders): + s.send(frames[idx]) + if not args.interval: + break + time.sleep(args.interval) + +if __name__ == "__main__": + main() + diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 9d43d03..3105d6f 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -1,20 +1,35 @@ # These tasks will be merged into deployment graph. Here you # can specify new tasks for any roles, even built-in ones. -- id: fuel-plugin-bigswitch - type: group - role: [fuel-plugin-bigswitch] - -- id: fuel-plugin-bigswitch-deployment-puppet +- id: openstack-controller-bigswitch type: puppet - groups: [fuel-plugin-bigswitch] - required_for: [deploy_end] - requires: [deploy_start] + role: [controller] + required_for: [post_deployment_end] + requires: [post_deployment_start] parameters: - puppet_manifest: "deploy.pp" - puppet_modules: "" - timeout: 3600 - + puppet_manifest: puppet/manifests/controller-config.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +# Setup compute node +- id: compute-config + type: puppet + role: [compute] + required_for: [post_deployment_end] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/compute-config.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +#- id: fuel-plugin-bigswitch-deployment-puppet +# type: puppet +# groups: [fuel-plugin-bigswitch] +# required_for: [deploy_end] +# requires: [deploy_start] +# parameters: +# puppet_manifest: "deploy.pp" +# puppet_modules: "" +# timeout: 3600 +# #- id: fuel-plugin-bigswitch-post-deployment-sh # type: shell # role: [fuel-plugin-bigswitch] @@ -25,7 +40,7 @@ # retries: 3 # interval: 20 # timeout: 180 - +# #- id: fuel-plugin-bigswitch-pre-deployment-sh # type: shell # role: [fuel-plugin-bigswitch] diff --git a/environment_config.yaml b/environment_config.yaml index 3fbe90e..f6849a5 100644 --- a/environment_config.yaml +++ b/environment_config.yaml @@ -12,9 +12,9 @@ attributes: label: "BCF Fabric Mode" description: "Big Cloud Fabric can be deployed in either physical-only or physical+virtual Modes." values: - - data: "p-only" + - data: "P-Only" label: "P-Only" - - data: "p+v" + - data: "P+V" label: "P+V" bcf_controller_1: @@ -55,12 +55,12 @@ attributes: value: "" label: "Openstack Instance ID" description: "The Openstack instance ID that is unique within the BCF fabric" - weight: 40 + weight: 30 type: "text" bcf_controller_os_mgmt: value: "" label: "Openstack Management Tenant Name" description: "The tenant that defines Openstack management segments" - weight: 30 + weight: 40 type: "text" diff --git a/metadata.yaml b/metadata.yaml index db61647..1659218 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -27,4 +27,4 @@ releases: repository_path: repositories/ubuntu # Version of plugin package -package_version: '1.0.0' +package_version: '3.0.0'