Sync Neutron module 6.0.0 with upstream

v6.0.0 commit c83277d21c42da040c8d8d34d2346da6ac319950

Partially implements: blueprint upgrade-openstack-puppet-modules
Change-Id: I026013b60dff06f777ac02ebe4ca8c85a1e32eff
This commit is contained in:
Sergey Kolekonov 2015-07-21 15:26:58 +03:00
parent f869286e00
commit 684213b283
33 changed files with 1106 additions and 356 deletions

View File

@ -0,0 +1,307 @@
##2015-07-08 - 6.0.0
###Summary
This is a backwards-incompatible major release for OpenStack Kilo.
####Backwards-incompatible changes
- Remove deprecated parameters
- Drop OVS & LB monolitic plugins
- Use libreswan on fedora
- Move rabbit/kombu settings to oslo_messaging_rabbit section
- FWaaS: update packaging for Debian & Ubuntu
- Don't specify a nova region by default
- Do not create tun and int bridges manually
####Features
- Puppet 4.x support
- Refactorise Keystone resources management
- Add 'state_path' and 'lock_path' to neutron class
- Add service_name parameter to neutron::server class
- DB: Added postgresql backend using openstacklib helper
- Subscribe neutron db sync to db connection setting
- Ensure DB is provisioned before db-sync
- Add support for identity_uri
- Notify the ovs-agent service if the config changes
- Add portdb and fastpath_flood to n1kv.conf
- Add fwaas package for Kilo in Red Hat platforms
- Add memcache_servers parameter to base neutron class
- Add MidoNet plugin support
- Add PLUMgrid plugin support
- Add OpenContrail plugin support
- Tag all neutron packages
- Allow to configure Nova metadata protocol
- Configure OVS mechanism agent configs in its config file
- Don't manage chmod for /etc/neutron and neutron.conf
- Introduce public_url, internal_url and admin_url
- Allow customization of dhcp_domain setting
- Add manage_service parameter to all agents
- Add ability to specify auth_region
####Bugfixes
- Fix l3 agent network_device_mtu deprecation
- Set allow_automatic_l3agent_failover in neutron.conf instead of l3_agent.ini
- Fix parsing of network gateway id for router
####Maintenance
- Acceptance tests with Beaker
- Fix spec tests for RSpec 3.x and Puppet 4.x
##2015-06-17 - 5.1.0
###Summary
This is a feature and bugfix release in the Juno series.
####Features
- Switch to TLSv1
- Support SR-IOV mechanism driver in ML2
- Implement better nova_admin_tenant_id_setter exists? method
- OVS Agent with ML2: fix symlink on RH plateforms
- Adding portdb and fastpath_flood to n1kv.conf
- Adding vxlan network type support for neutron ML2 plug-in
- Add MidoNet plugin support
####Bugfixes
- Fix l3_ha enablement
- Make cisco plugin symlink coherent
- Fix status messages checks for neutron provider
- Make neutron_plugin_ml2 before db-sync
- Change default MySQL collate to utf8_general_ci
- Fix neutron file_line dependency
- Correct "ip link set" command
- Raise puppet error, if nova-api unavailable
- Do not run neutron-ovs-cleanup for each Puppet run
- Unescape value in parse_allocation_pool
- Fix neutron_network for --router:external setting
- Allow l3_ha to be turned back off after it has been enabled
- Fix support for auth_uri setting in neutron provider
- Reduce neutron API timeout to 10 seconds
####Maintenance
- spec: pin rspec-puppet to 1.0.1
- Pin puppetlabs-concat to 1.2.1 in fixtures
- Update .gitreview file for project rename
##2014-11-21 - 5.0.0
###Summary
This is a backwards-incompatible major release for OpenStack Juno.
####Backwards-incompatible changes
- Migrated the neutron::db::mysql class to use openstacklib::db::mysql, adding
dependency on openstacklib
####Features
- Add neutron::policy to control policy.json
- Add parameter allow_automatic_l3agent_failover to neutron::agents::l3
- Add parameter metadata_memory_cache_ttl to neutron::agents::metadata
- Add l3_ext as a provider_network_type property for neutron_network type
- Add api_extensions_path parameter to neutron class
- Add database tuning parameters
- Add parameters to enable DVR and HA support in neutron::agents::l3 for Juno
- Make keystone user creation optional when creating a service
- Add the ability to override the keystone service name in
neutron::keystone::auth
- Add kombu_reconnect_delay parameter to neutron class
- Add neutron::agents::n1kv_vem to deploy N1KV VEM
- Add SSL support for nova_admin_tenant_id_setter
- Deprecated the network_device_mtu parameter in neutron::agents::l3 and moved
it to the neutron class
- Add vpnaas_agent_package parameter to neutron::services::fwaas to install
the vpnaas agent package
####Bugfixes
- Change user_group parameter in neutron::agents::lbaas to have different
defaults depending on operating system
- Change openswan package to libreswan for RHEL 7 for vpnaas
- Ensure neutron package was installed before nova_admin_tenant_id_setter is
called
- Change management of file lines in /etc/default/neutron-server only for
Ubuntu
- Fix meaning of manage_service parameter in neutron::agents::ovs
- Fix the enable_dhcp property of neutron_subnet
- Fix bug in parsing allocation pools in neutron_subnet type
- Add relationship to refresh neutron-server when nova_admin_tenant_id_setter
changes
- Fix the relationship between the HA proxy package and the
neutron-lbaas-agent package
- Fix plugin.ini error when cisco class is used
- Fix relationship between vs_pridge types and the neutron-plugin-ovs service
- Fix relationship between neutron-server package and neutron_plugin_ml2
types
- Stop puppet from trying to manage the ovs cleanup service
##2014-10-16 - 4.3.0
###Summary
This is a feature and bugfix release in the Icehouse series.
####Features
- Add parameter to specify number of RPC workers to spawn
- Add ability to manage Neutron ML2 plugin
- Add ability to hide secret neutron configs from logs and fixed password
leaking
- Add neutron plugin config file specification in neutron-server config
- Add support for Cisco ML2 Mech Driver
- Add parameter to configure dhcp_agent_notification in neutron config
- Add class for linuxbridge support
- Undeprecate enable_security_group parameter
####Bugfixes
- Fix ssl parameter requirements when using kombu and rabbit
- Fix installation of ML2 plugin on Ubuntu
- Fix quotas parameters in neutron config
- Fix neutron-server restart
##2014-07-11 - 4.2.0
###Summary
This is a feature and bugfix release in the Icehouse series.
####Features
- Add ml2/ovs support
- Add multi-region support
####Bugfixes
- Set default metadata backlog to 4096
- Fix neutron-server refresh bug
##2014-06-20 - 4.1.0
###Summary
This is a feature and bugfix release in the Icehouse series.
####Features
- Add parameter to set veth MTU
- Add RabbitMQ SSL support
- Add support for '' as a valid value for gateway_ip
####Bugfixes
- Fix potential OVS resource duplication
####Maintenance
- Pin major gems
##2014-05-01 - 4.0.0
###Summary
This is a backwards-incompatible major release for OpenStack Icehouse.
####Backwards-incompatible changes
- Update security group option for ml2 plugin
- Update packaging changes for Red Hat and Ubuntu systems
- Update parameter defaults to track upstream (Icehouse)
####Features
- Add Neutron-Nova interactions support
- Add external network bridge and interface driver for vpn agent
- Add support for puppetlabs-mysql 2.2 and greater
- Add neutron::config to handle additional custom options
- Add https support to metadata agent
- Add manage_service parameter
- Add quota parameters
- Add support to configure ovs without installing package
- Add support for optional haproxy package management
- Add support to configure plugins by name rather than class name
- Add multi-worker support
- Add isolated network support
####Bugfixes
- Fix bug for subnets with empty values
- Fix typos and misconfiguration in neutron.conf
- Fix max_retries parameter warning
- Fix database creation bugs
##2014-04-15 - 3.3.0
###Summary
This is a feature and bugfix release in the Havana series.
####Features
- Add neutron_port resource
- Add external network bridge for vpn agent
####Bugfixes
- Change dhcp_lease_duration to Havana default of 86400
- Fix VPNaaS installation for Red Hat systems
- Fix conflicting symlink
- Fix network_vlan_ranges parameter for OVS plugin
##2014-03-28 - 3.2.0
###Summary
This is a feature and bugfix release in the Havana series.
####Features
- Add write support for dns, allocation pools, and host routes to Neutron
router provider
####Bugfixes
- Fix multi-line attribute detection in base Neutron provider
- Fix bugs with neutron router gateway id parsing
##2014-03-26 - 3.1.0
###Summary
This is a feature and bugfix release in the Havana series.
####Features
- Add VXLAN support
- Add support for neutron nvp plugin
- Allow log_dir to be set to false in order to disable file logging
- Add support for https auth endpoints
- Make haproxy package management optional
####Bugfixes
- Configure security group when using ML2 plugin
- Ensure installation of ML2 plugin
- Fix server deprecated warnings
- Tune report and downtime intervals for l2 agent
- Ensure linuxbridge dependency is installed on RHEL
- Improve L3 scheduler support
- Remove strict checks for vlan_ranges
- Fix neutron-metering-agent package for Ubuntu
- Fix VPNaaS service name for Ubuntu
- Fix FWaaS race condition
- Fix ML2 package dependency for Ubuntu
- Remove erronious check for service_plugins
####Maintenance
- Fix improper test for tunnel_types param
- Improve consistency with other puppet modules for OpenStack by prefixing
database related parameters with database
##2013-12-25 - 3.0.0
###Summary
This is a backwards-incompatible major release for OpenStack Havana.
####Backwards-incompatible changes
- Rename project from quantum to neutron
- Change the default quota_driver
####Features
- Remove provider setting requirement
- Add database configuration support for Havana
- Ensure dnsmasq package resource for compatibility with modules that define
the same resource
- Add multi-worker support
- Add metering agent support
- Add vpnaas agent support
- Add ml2 plugin support
####Bugfixes
- Fix file permissions
- Fix bug to ensure that keystone endpoint is set before service starts
- Fix lbass driver name
##2013-10-07 - 2.2.0
###Summary
This is a feature and bugfix release in the Grizzly series.
####Features
- Add syslog support
- Add quantum-plugin-cisco package resource
####Maintenance
- Improve documentation

View File

@ -18,6 +18,7 @@ end
group :system_tests do
gem 'beaker-rspec', :require => 'false'
gem 'beaker-puppet_install_helper', :require => false
end
if facterversion = ENV['FACTER_GEM_VERSION']

View File

@ -1,7 +1,7 @@
neutron
===================================
5.1.0 - 2014.2 - Juno
6.0.0 - 2015.1 - Kilo
#### Table of Contents
@ -12,12 +12,11 @@ neutron
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
7. [Contributors - Those with commits](#contributors)
8. [Release Notes - Notes on the most recent updates to the module](#release-notes)
Overview
--------
The neutron module is a part of [Stackforge](https://github.com/stackforge), an effort by the Openstack infrastructure team to provide continuous integration testing and code review for Openstack and Openstack community projects not part of the core software. The module itself is used to flexibly configure and manage the network service for Openstack.
The neutron module is a part of [OpenStack](https://github.com/openstack), an effort by the Openstack infrastructure team to provide continuous integration testing and code review for Openstack and Openstack community projects as part of the core software. The module itself is used to flexibly configure and manage the network service for Openstack.
Module Description
------------------
@ -135,179 +134,4 @@ The puppet-openstack modules follow the Openstack development model. Developer d
Contributors
------------
The github [contributor graph](https://github.com/stackforge/puppet-neutron/graphs/contributors).
Release Notes
-------------
**5.1.0**
* Fix l3_ha enablement
* spec: pin rspec-puppet to 1.0.1
* Switch to TLSv1
* Support SR-IOV mechanism driver in ML2
* Implement better nova_admin_tenant_id_setter exists? method
* OVS Agent with ML2: fix symlink on RH plateforms
* Adding portdb and fastpath_flood to n1kv.conf
* Make cisco plugin symlink coherent
* Fix status messages checks for neutron provider
* Make neutron_plugin_ml2 before db-sync
* Pin puppetlabs-concat to 1.2.1 in fixtures
* change default MySQL collate to utf8_general_ci
* Fix neutron file_line dependency
* Corrects "ip link set" command
* Adding vxlan network type support for neutron ML2 plug-in
* Raise puppet error, if nova-api unavailable
* Do not run neutron-ovs-cleanup for each Puppet run
* Unescape value in parse_allocation_pool
* Fix neutron_network for --router:external setting
* Add MidoNet plugin support
* Allow l3_ha to be turned back off after it has been enabled
* Update .gitreview file for project rename
* Fix support for auth_uri setting in neutron provider
* Reduce neutron API timeout to 10 seconds
**5.0.0**
* Stable Juno release
* Added neutron::policy to control policy.json
* Added parameter allow_automatic_l3agent_failover to neutron::agents::l3
* Added parameter metadata_memory_cache_ttl to neutron::agents::metadata
* Added l3_ext as a provider_network_type property for neutron_network type
* Changed user_group parameter in neutron::agents::lbaas to have different defaults depending on operating system
* Changed openswan package to libreswan for RHEL 7 for vpnaas
* Ensured neutron package was installed before nova_admin_tenant_id_setter is called
* Added api_extensions_path parameter to neutron class
* Added database tuning parameters
* Changed management of file lines in /etc/default/neutron-server only for Ubuntu
* Add parameters to enable DVR and HA support in neutron::agents::l3 for Juno
* Fixed meaning of manage_service parameter in neutron::agents::ovs
* Made keystone user creation optional when creating a service
* Fixed the enable_dhcp property of neutron_subnet
* Added the ability to override the keystone service name in neutron::keystone::auth
* Fixed bug in parsing allocation pools in neutron_subnet type
* Added relationship to refresh neutron-server when nova_admin_tenant_id_setter changes
* Migrated the neutron::db::mysql class to use openstacklib::db::mysql and deprecated the mysql_module parameter
* Fixed the relationship between the HA proxy package and the neutron-lbaas-agent package
* Added kombu_reconnect_delay parameter to neutron class
* Fixed plugin.ini error when cisco class is used
* Fixed relationship between vs_pridge types and the neutron-plugin-ovs service
* Added neutron::agents::n1kv_vem to deploy N1KV VEM
* Added SSL support for nova_admin_tenant_id_setter
* Fixed relationship between neutron-server package and neutron_plugin_ml2 types
* Stopped puppet from trying to manage the ovs cleanup service
* Deprecated the network_device_mtu parameter in neutron::agents::l3 and moved it to the neutron class
* Added vpnaas_agent_package parameter to neutron::services::fwaas to install the vpnaas agent package
**4.3.0**
* Added parameter to specify number of RPC workers to spawn
* Added ability to manage Neutron ML2 plugin
* Fixed ssl parameter requirements when using kombu and rabbit
* Added ability to hide secret neutron configs from logs and fixed password leaking
* Added neutron plugin config file specification in neutron-server config
* Fixed installation of ML2 plugin on Ubuntu
* Added support for Cisco ML2 Mech Driver
* Fixed quotas parameters in neutron config
* Added parameter to configure dhcp_agent_notification in neutron config
* Added class for linuxbridge support
* Fixed neutron-server restart
* Undeprecated enable_security_group parameter
**4.2.0**
* Added ml2/ovs support.
* Added multi-region support.
* Set default metadata backlog to 4096.
* Fixed neutron-server refresh bug.
**4.1.0**
* Added parameter to set veth MTU.
* Added RabbitMQ SSL support.
* Added support for '' as a valid value for gateway_ip.
* Fixed potential OVS resource duplication.
* Pinned major gems.
**4.0.0**
* Stable Icehouse release.
* Added Neutron-Nova interactions support.
* Added external network bridge and interface driver for vpn agent.
* Added support for puppetlabs-mysql 2.2 and greater.
* Added neutron::config to handle additional custom options.
* Added https support to metadata agent.
* Added manage_service paraneter.
* Added quota parameters.
* Added support to configure ovs without installing package.
* Added support for optional haproxy package management.
* Added support to configure plugins by name rather than class name.
* Added multi-worker support.
* Added isolated network support.
* Updated security group option for ml2 plugin.
* Updated packaging changes for Red Hat and Ubuntu systems.
* Updated parameter defaults to track upstream (Icehouse).
* Fixed bug for subnets with empty values.
* Fixed typos and misconfiguration in neutron.conf.
* Fixed max_retries parameter warning.
* Fixed database creation bugs.
**3.3.0**
* Added neutron_port resource.
* Added external network bridge for vpn agent.
* Changed dhcp_lease_duration to Havana default of 86400
* Fixed VPNaaS installation for Red Hat systems.
* Fixed conflicting symlink.
* Fixed network_vlan_ranges parameter for OVS plugin
**3.2.0**
* Added write support for dns, allocation pools, and host routes to Neutron router provider.
* Fixed multi-line attribute detection in base Neutron provider.
* Fixed bugs with neutron router gateway id parsing.
**3.1.0**
* Added VXLAN support.
* Configures security group when using ML2 plugin.
* Ensures installation of ML2 plugin.
* Fixed server deprecated warnings.
* Tuned report and downtime intervals for l2 agent.
* Added support for neutron nvp plugin.
* Ensures linuxbridge dependency is installed on RHEL.
* Improved L3 scheduler support.
* Fixed improper test for tunnel_types param.
* Allows log_dir to be set to false in order to disable file logging.
* Improves consistency with other puppet modules for OpenStack by prefixing database related parameters with database.
* Removed strict checks for vlan_ranges.
* Fixed neutron-metering-agent package for Ubuntu.
* Fixed VPNaaS service name for Ubuntu.
* Fixed FWaaS race condition.
* Fixed ML2 package dependency for Ubuntu.
* Removed erronious check for service_plugins.
* Added support for https auth endpoints.
* Makes haproxy package management optional.
**3.0.0**
* Major release for OpenStack Havana.
* Renamed project from quantum to neutron.
* Changed the default quota_driver.
* Removed provider setting requirement.
* Fixed file permissions.
* Fixed bug to ensure that keystone endpoint is set before service starts.
* Added database configuration support for Havana.
* Ensured dnsmasq package resource for compatibility with modules that define the same resource
* Added multi-worker support.
* Added metering agent support.
* Added vpnaas agent support.
* Added ml2 plugin support.
* Fixed lbass driver name.
**2.2.0**
* Improved documentation.
* Added syslog support.
* Added quantum-plugin-cisco package resource.
* Various lint and bug fixes.
The github [contributor graph](https://github.com/openstack/puppet-neutron/graphs/contributors).

View File

@ -53,12 +53,14 @@ Puppet::Type.type(:neutron_network).provide(
def create
network_opts = Array.new
#TODO(skolekonov) Contribute the change to upstream
# Check whether shared is true or not this way
if @resource[:shared] =~ /true/i
network_opts << '--shared'
end
if @resource[:tenant_name]
tenant_id = self.class.get_tenant_id(model.catalog,
tenant_id = self.class.get_tenant_id(@resource.catalog,
@resource[:tenant_name])
notice("***N*** neutron_network::create *** tenant_id='#{tenant_id.inspect}'")
network_opts << "--tenant_id=#{tenant_id}"

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:neutron_plugin_opencontrail).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini'
end
end

View File

@ -72,7 +72,7 @@ Puppet::Type.type(:neutron_port).provide(
if @resource[:tenant_name]
tenant_id = self.class.get_tenant_id(
model.catalog,
@resource.catalog,
@resource[:tenant_name]
)
opts << "--tenant_id=#{tenant_id}"

View File

@ -51,7 +51,7 @@ Puppet::Type.type(:neutron_router).provide(
end
if @resource[:tenant_name]
tenant_id = self.class.get_tenant_id(model.catalog,
tenant_id = self.class.get_tenant_id(@resource.catalog,
@resource[:tenant_name])
opts << "--tenant_id=#{tenant_id}"
elsif @resource[:tenant_id]
@ -119,7 +119,7 @@ EOT
end
def parse_gateway_network_id(external_gateway_info_)
match_data = /\{"network_id": "(.*?)"/.match(external_gateway_info_)
match_data = /\{"network_id": "(.*?)"/.match(external_gateway_info_.gsub(/\\"/,'"'))
if match_data
match_data[1]
else

View File

@ -69,10 +69,10 @@ Puppet::Type.type(:neutron_subnet).provide(
host_routes = []
return [] if values.empty?
for value in Array(values)
matchdata = /\{\s*"destination"\s*:\s*"(.*)"\s*,\s*"nexthop"\s*:\s*"(.*)"\s*\}/.match(value.gsub(/\\"/,'"'))
destination = matchdata[1]
nexthop = matchdata[2]
host_routes << "destination=#{destination},nexthop=#{nexthop}"
matchdata = /\{\s*"nexthop"\s*:\s*"(.*)"\s*,\s*"destination"\s*:\s*"(.*)"\s*\}/.match(value.gsub(/\\"/,'"'))
nexthop = matchdata[1]
destination = matchdata[2]
host_routes << "nexthop=#{nexthop},destination=#{destination}"
end
return host_routes
end
@ -126,7 +126,7 @@ Puppet::Type.type(:neutron_subnet).provide(
end
if @resource[:tenant_name]
tenant_id = self.class.get_tenant_id(model.catalog,
tenant_id = self.class.get_tenant_id(@resource.catalog,
@resource[:tenant_name])
opts << "--tenant_id=#{tenant_id}"
elsif @resource[:tenant_id]

View File

@ -0,0 +1,49 @@
Puppet::Type.newtype(:neutron_plugin_opencontrail) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from ContrailPlugin.ini'
newvalues(/\S+\/\S+/)
end
autorequire(:file) do
['/etc/neutron/plugins/opencontrail']
end
autorequire(:package) do ['neutron'] end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
end

View File

@ -12,6 +12,10 @@
# (required) Whether or not to enable the agent.
# Defaults to true.
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*tunnel_types*]
# (optional) List of types of tunnels to use when utilizing tunnels.
# Supported tunnel types are: vxlan.
@ -57,6 +61,7 @@
class neutron::agents::ml2::linuxbridge (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$tunnel_types = [],
$local_ip = false,
$vxlan_group = '224.0.0.1',
@ -143,10 +148,12 @@ class neutron::agents::ml2::linuxbridge (
}
}
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'neutron-plugin-linuxbridge-agent':

View File

@ -29,6 +29,10 @@
# (required) Whether or not to enable the OVS Agent
# Defaults to true
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*bridge_uplinks*]
# (optional) List of interfaces to connect to the bridge when doing
# bridge mapping.
@ -91,9 +95,6 @@
class neutron::agents::ml2::ovs (
$package_ensure = 'present',
$enabled = true,
# TODO(bogdando) contribute change to upstream:
# new manage_service param is required for pacemaker OCF control plane.
# perhaps, could be removed once pacemaker wrappers implemented
$manage_service = true,
$bridge_uplinks = [],
$bridge_mappings = [],
@ -174,20 +175,7 @@ class neutron::agents::ml2::ovs (
neutron_agent_ovs { 'securitygroup/firewall_driver': ensure => absent }
}
# TODO(skolekonov) contribute change to upstream:
# do not create ovs bridges from manifests
# as Neutron handles them itself
# https://review.openstack.org/#/c/168848/
#vs_bridge { $integration_bridge:
# ensure => present,
# before => Service['neutron-ovs-agent-service'],
#}
if $enable_tunneling {
# vs_bridge { $tunnel_bridge:
# ensure => present,
# before => Service['neutron-ovs-agent-service'],
# }
neutron_agent_ovs {
'ovs/enable_tunneling': value => true;
'ovs/tunnel_bridge': value => $tunnel_bridge;
@ -233,9 +221,6 @@ class neutron::agents::ml2::ovs (
}
}
# TODO(bogdando) contribute change to upstream:
# new manage_service param is required for pacemaker OCF control plane
# perhaps, could be removed once pacemaker wrappers implemented
if $manage_service {
if $enabled {
$service_ensure = 'running'

View File

@ -29,6 +29,10 @@
# (required) Whether or not to enable the OVS Agent
# Defaults to true
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*physical_device_mappings*]
# (optional) List of <physical_network>:<physical device>
# All physical networks listed in network_vlan_ranges
@ -50,6 +54,7 @@
class neutron::agents::ml2::sriov (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$physical_device_mappings = [],
$polling_interval = 2,
$exclude_devices = [],
@ -73,10 +78,12 @@ class neutron::agents::ml2::sriov (
tag => 'openstack',
}
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'neutron-sriov-nic-agent-service':

View File

@ -60,6 +60,9 @@
# [**plugin_plumgrid_config**]
# (optional) Manage configuration of plugins/plumgrid/plumgrid.ini
#
# [**plugin_opencontrail_config**]
# (optional) Manage configuration of plugins/opencontrail/ContrailPlugin.ini
#
# [**plugin_ml2_config**]
# (optional) Manage configuration of ml2_conf.ini
#
@ -84,6 +87,7 @@ class neutron::config (
$plugin_cisco_config = {},
$plugin_midonet_config = {},
$plugin_plumgrid_config = {},
$plugin_opencontrail_config = {},
$plugin_ml2_config = {},
$plugin_ovs_config = {},
) {
@ -102,6 +106,7 @@ class neutron::config (
validate_hash($plugin_cisco_config)
validate_hash($plugin_midonet_config)
validate_hash($plugin_plumgrid_config)
validate_hash($plugin_opencontrail_config)
validate_hash($plugin_ml2_config)
validate_hash($plugin_ovs_config)
@ -118,6 +123,7 @@ class neutron::config (
create_resources('neutron_plugin_cisco', $plugin_cisco_config)
create_resources('neutron_plugin_midonet', $plugin_midonet_config)
create_resources('neutron_plugin_plumgrid', $plugin_plumgrid_config)
create_resources('neutron_plugin_opencontrail', $plugin_opencontrail_config)
create_resources('neutron_plugin_ml2', $plugin_ml2_config)
create_resources('neutron_plugin_ovs', $plugin_ovs_config)
}

View File

@ -32,7 +32,13 @@
# [*core_plugin*]
# (optional) Neutron plugin provider
# Defaults to openvswitch
# Could be bigswitch, brocade, cisco, embrane, hyperv, linuxbridge, midonet, ml2, mlnx, nec, nicira, plumgrid, ryu
# Could be bigswitch, brocade, cisco, embrane, hyperv, linuxbridge, midonet, ml2, mlnx, nec, nicira, plumgrid, ryu, opencontrail (full path)
#
# Example for opencontrail:
#
# class {'neutron' :
# core_plugin => 'neutron.plugins.opencontrail.contrail_plugin:NeutronPluginContrailCoreV2'
# }
#
# [*service_plugins*]
# (optional) Advanced service modules.

View File

@ -31,6 +31,9 @@ class neutron::params {
$cisco_config_file = '/etc/neutron/plugins/cisco/cisco_plugins.ini'
$cisco_ml2_config_file = '/etc/neutron/plugins/ml2/ml2_conf_cisco.ini'
$opencontrail_plugin_package = 'neutron-plugin-contrail'
$opencontrail_config_file = '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini'
$midonet_server_package = 'python-neutron-plugin-midonet'
$midonet_config_file = '/etc/neutron/plugins/midonet/midonet.ini'
@ -107,6 +110,9 @@ class neutron::params {
$cisco_config_file = '/etc/neutron/plugins/cisco/cisco_plugins.ini'
$cisco_ml2_config_file = '/etc/neutron/plugins/ml2/ml2_conf_cisco.ini'
$opencontrail_plugin_package = 'neutron-plugin-contrail'
$opencontrail_config_file = '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini'
$midonet_server_package = 'python-neutron-plugin-midonet'
$midonet_config_file = '/etc/neutron/plugins/midonet/midonet.ini'

View File

@ -0,0 +1,120 @@
# This class installs and configures Opencontrail Neutron Plugin.
#
# === Parameters
#
# [*api_server_ip*]
# IP address of the API Server
# Defaults to undef
#
# [*api_server_port*]
# Port of the API Server.
# Defaults to undef
#
# [*multi_tenancy*]
# Whether to enable multi-tenancy
# Default to undef
#
# [*contrail_extensions*]
# Array of OpenContrail extensions to be supported
# Defaults to undef
# Example:
#
# class {'neutron::plugins::opencontrail' :
# contrail_extensions => ['ipam:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_ipam.NeutronPluginContrailIpam']
# }
#
# [*keystone_auth_url*]
# Url of the keystone auth server
# Defaults to undef
#
# [*keystone_admin_user*]
# Admin user name
# Defaults to undef
#
# [*keystone_admin_tenant_name*]
# Admin_tenant_name
# Defaults to undef
#
# [*keystone_admin_password*]
# Admin password
# Defaults to undef
#
# [*keystone_admin_token*]
# Admin token
# Defaults to undef
#
class neutron::plugins::opencontrail (
$api_server_ip = undef,
$api_server_port = undef,
$multi_tenancy = undef,
$contrail_extensions = undef,
$keystone_auth_url = undef,
$keystone_admin_user = undef,
$keystone_admin_tenant_name = undef,
$keystone_admin_password = undef,
$keystone_admin_token = undef,
$package_ensure = 'present',
) {
include ::neutron::params
validate_array($contrail_extensions)
package { 'neutron-plugin-contrail':
ensure => $package_ensure,
name => $::neutron::params::opencontrail_plugin_package,
tag => 'openstack',
}
# Although this manifest does not install opencontrail plugin package because it
# is not available in common distro repos, this statement forces you to
# have an orchestrator/wrapper manifest that does that job.
Package[$::neutron::params::opencontrail_plugin_package] -> Neutron_plugin_opencontrail<||>
Neutron_plugin_opencontrail<||> ~> Service['neutron-server']
ensure_resource('file', '/etc/neutron/plugins/opencontrail', {
ensure => directory,
owner => 'root',
group => 'neutron',
mode => '0640'}
)
# Ensure the neutron package is installed before config is set
# under both RHEL and Ubuntu
if ($::neutron::params::server_package) {
Package['neutron-server'] -> Neutron_plugin_opencontrail<||>
} else {
Package['neutron'] -> Neutron_plugin_opencontrail<||>
}
if $::osfamily == 'Debian' {
file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
path => '/etc/default/neutron-server',
match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
line => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::opencontrail_config_file}",
require => [ Package['neutron-server'], Package[$::neutron::params::opencontrail_plugin_package] ],
notify => Service['neutron-server'],
}
}
if $::osfamily == 'Redhat' {
file { '/etc/neutron/plugin.ini':
ensure => link,
target => $::neutron::params::opencontrail_config_file,
require => Package[$::neutron::params::opencontrail_plugin_package],
}
}
neutron_plugin_opencontrail {
'APISERVER/api_server_ip': value => $api_server_ip;
'APISERVER/api_server_port': value => $api_server_port;
'APISERVER/multi_tenancy': value => $multi_tenancy;
'APISERVER/contrail_extensions': value => join($contrail_extensions, ',');
'KEYSTONE/auth_url': value => $keystone_auth_url;
'KEYSTONE/admin_user' : value => $keystone_admin_user;
'KEYSTONE/admin_tenant_name': value => $keystone_admin_tenant_name;
'KEYSTONE/admin_password': value => $keystone_admin_password, secret =>true;
'KEYSTONE/admin_token': value => $keystone_admin_token, secret =>true;
}
}

View File

@ -23,17 +23,32 @@
# [*controller_priv_host*]
# Controller private host IP
# Defaults to 127.0.0.1
# [*auth_protocol*]
# Authorization protocol
# Defaults to http
# [*nova_metadata_ip*]
# Nova metadata IP
# Defaults to 127.0.0.1
# [*nova_metadata_port*]
# Nova metadata port
# Defaults to 8775
# [*metadata_proxy_shared_secret*]
# Neutron metadata shared secret key
class neutron::plugins::plumgrid (
$director_server = '127.0.0.1',
$director_server_port = '443',
$username = undef,
$password = undef,
$servertimeout = '99',
$connection = 'http://127.0.0.1:35357/v2.0',
$admin_password = undef,
$controller_priv_host = '127.0.0.1',
$package_ensure = 'present'
$director_server = '127.0.0.1',
$director_server_port = '443',
$username = undef,
$password = undef,
$servertimeout = '99',
$connection = 'http://127.0.0.1:35357/v2.0',
$admin_password = undef,
$controller_priv_host = '127.0.0.1',
$auth_protocol = 'http',
$nova_metadata_ip = '127.0.0.1',
$nova_metadata_port = '8775',
$metadata_proxy_shared_secret = undef,
$package_ensure = 'present'
) {
include ::neutron::params
@ -98,11 +113,14 @@ class neutron::plugins::plumgrid (
}
neutron_plumlib_plumgrid {
'keystone_authtoken/admin_user' : value => 'admin';
'keystone_authtoken/admin_password': value => $admin_password, secret =>true;
'keystone_authtoken/auth_uri': value => "http://${controller_priv_host}:35357/v2.0";
'keystone_authtoken/admin_tenant_name': value => 'admin';
'PLUMgridMetadata/enable_pg_metadata' : value => 'True';
'PLUMgridMetadata/metadata_mode': value => 'local';
'keystone_authtoken/admin_user' : value => 'admin';
'keystone_authtoken/admin_password': value => $admin_password, secret =>true;
'keystone_authtoken/auth_uri': value => "${auth_protocol}://${controller_priv_host}:35357/v2.0";
'keystone_authtoken/admin_tenant_name': value => 'admin';
'PLUMgridMetadata/enable_pg_metadata' : value => 'True';
'PLUMgridMetadata/metadata_mode': value => 'local';
'PLUMgridMetadata/nova_metadata_ip': value => $nova_metadata_ip;
'PLUMgridMetadata/nova_metadata_port': value => $nova_metadata_port;
'PLUMgridMetadata/metadata_proxy_shared_secret': value => $metadata_proxy_shared_secret;
}
}

View File

@ -53,9 +53,9 @@
# Defaults to false for empty. If defined, should be a string with a leading '/' and no trailing '/'.
#
# [*auth_region*]
# (optional) The authentication region. Note this value is case-sensitive and
# must match the endpoint region defined in Keystone.
# Defaults to undef
# (optional) The authentication region. Note this value is case-sensitive and
# must match the endpoint region defined in Keystone.
# Defaults to undef
#
# [*auth_tenant*]
# (optional) The tenant of the auth user

View File

@ -1,6 +1,6 @@
{
"name": "stackforge-neutron",
"version": "5.1.0",
"name": "openstack-neutron",
"version": "6.0.0",
"author": "OpenStack Contributors",
"summary": "Puppet module for OpenStack Neutron",
"license": "Apache-2.0",
@ -32,11 +32,11 @@
"description": "Installs and configures OpenStack Neutron (Networking).",
"dependencies": [
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "stackforge/keystone", "version_requirement": ">=5.0.0 <6.0.0" },
{ "name": "stackforge/nova", "version_requirement": ">=5.0.0 <6.0.0" },
{ "name": "openstack/keystone", "version_requirement": ">=6.0.0 <7.0.0" },
{ "name": "openstack/nova", "version_requirement": ">=6.0.0 <7.0.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" },
{ "name": "stackforge/vswitch", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "openstack/vswitch", "version_requirement": ">=2.0.0 <3.0.0" },
{ "name": "duritong/sysctl", "version_requirement": ">=0.0.1 <1.0.0" },
{ "name": "stackforge/openstacklib", "version_requirement": ">=5.0.0 <6.0.0" }
{ "name": "openstack/openstacklib", "version_requirement": ">=6.0.0 <7.0.0" }
]
}

View File

@ -20,17 +20,9 @@ describe 'basic neutron' do
}
'RedHat': {
class { '::openstack_extras::repo::redhat::redhat':
# Kilo is not GA yet, so let's use the testing repo
manage_rdo => false,
repo_hash => {
'rdo-kilo-testing' => {
'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/testing/el7/',
# packages are not GA so not signed
'gpgcheck' => '0',
'priority' => 97,
},
},
release => 'kilo',
}
package { 'openstack-selinux': ensure => 'latest' }
$package_provider = 'yum'
}
default: {
@ -42,7 +34,6 @@ describe 'basic neutron' do
class { '::rabbitmq':
delete_guest_user => true,
erlang_cookie => 'secrete',
package_provider => $package_provider,
}

View File

@ -9,6 +9,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
let :default_params do
{ :package_ensure => 'present',
:enabled => true,
:manage_service => true,
:tunnel_types => [],
:local_ip => false,
:vxlan_group => '224.0.0.1',
@ -66,6 +67,15 @@ describe 'neutron::agents::ml2::linuxbridge' do
)
end
context 'with manage_service as false' do
before :each do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-plugin-linuxbridge-agent').without_ensure
end
end
it 'does not configre VXLAN tunneling' do
is_expected.to contain_neutron_agent_linuxbridge('vxlan/enable_vxlan').with_value(false)
is_expected.to contain_neutron_agent_linuxbridge('vxlan/local_ip').with_ensure('absent')

View File

@ -51,18 +51,6 @@ describe 'neutron::agents::ml2::ovs' do
is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_ensure('absent')
end
# TODO(skolekonov) contribute change to upstream:
# do not create ovs bridges from manifests
# as Neutron handles them itself
# https://review.openstack.org/#/c/168848/
# it 'configures vs_bridge' do
# is_expected.to contain_vs_bridge(p[:integration_bridge]).with(
# :ensure => 'present',
# :before => 'Service[neutron-ovs-agent-service]'
# )
# is_expected.not_to contain_vs_brige(p[:integration_bridge])
# end
it 'installs neutron ovs agent package' do
if platform_params.has_key?(:ovs_agent_package)
is_expected.to contain_package('neutron-ovs-agent').with(
@ -84,6 +72,15 @@ describe 'neutron::agents::ml2::ovs' do
)
end
context 'with manage_service as false' do
before :each do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-ovs-agent-service').without_ensure
end
end
context 'when supplying a firewall driver' do
before :each do
params.merge!(:firewall_driver => false)
@ -155,14 +152,6 @@ describe 'neutron::agents::ml2::ovs' do
is_expected.to contain_neutron_agent_ovs('ovs/enable_tunneling').with_value(true)
is_expected.to contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1')
# TODO(skolekonov) contribute change to upstream:
# do not create ovs bridges from manifests
# as Neutron handles them itself
# https://review.openstack.org/#/c/168848/
# is_expected.to contain_vs_bridge(default_params[:tunnel_bridge]).with(
# :ensure => 'present',
# :before => 'Service[neutron-ovs-agent-service]'
# )
end
end

View File

@ -9,6 +9,7 @@ describe 'neutron::agents::ml2::sriov' do
let :default_params do
{ :package_ensure => 'present',
:enabled => true,
:manage_service => true,
:physical_device_mappings => [],
:exclude_devices => [],
:polling_interval => 2,
@ -47,7 +48,7 @@ describe 'neutron::agents::ml2::sriov' do
is_expected.to contain_package('neutron-sriov-nic-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
end
it 'configures neutron ovs agent service' do
it 'configures neutron sriov agent service' do
is_expected.to contain_service('neutron-sriov-nic-agent-service').with(
:name => platform_params[:sriov_nic_agent_service],
:enable => true,
@ -56,6 +57,15 @@ describe 'neutron::agents::ml2::sriov' do
)
end
context 'with manage_service as false' do
before :each do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-sriov-nic-agent-service').without_ensure
end
end
context 'when supplying device mapping' do
before :each do
params.merge!(:physical_device_mappings => ['physnet1:eth1'],

View File

@ -0,0 +1,93 @@
require 'spec_helper'
describe 'neutron::plugins::opencontrail' do
let :pre_condition do
"class { 'neutron::server': auth_password => 'password' }
class { 'neutron': rabbit_password => 'passw0rd' }"
end
let :default_params do
{ :api_server_ip => '10.0.0.1',
:api_server_port => '8082',
:multi_tenancy => 'true',
:contrail_extensions => ['ipam:ipam','policy:policy','route-table'],
:keystone_auth_url => 'http://keystone-server:5000/v2.0',
:keystone_admin_user => 'admin',
:keystone_admin_tenant_name => 'admin',
:keystone_admin_password => 'admin',
:keystone_admin_token => 'token1'
}
end
let :default_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron opencontrail plugin' do
let :params do
{}
end
before do
params.merge!(default_params)
end
it 'should perform default configuration of' do
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/api_server_ip').with_value(params[:api_server_ip])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/api_server_port').with_value(params[:api_server_port])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/multi_tenancy').with_value(params[:multi_tenancy])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value(params[:contrail_extensions].join(','))
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/auth_url').with_value(params[:keystone_auth_url])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_user').with_value(params[:keystone_admin_user])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_tenant_name').with_value(params[:keystone_admin_tenant_name])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_password').with_value(params[:keystone_admin_password])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_token').with_value(params[:keystone_admin_token])
end
end
context 'on Debian platforms' do
let :facts do
default_facts.merge({ :osfamily => 'Debian' })
end
let :params do
{ :contrail_extensions => ['ipam:ipam','policy:policy','route-table'] }
end
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
:path => '/etc/default/neutron-server',
:match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
:line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
:require => ['Package[neutron-server]', 'Package[neutron-plugin-contrail]'],
:notify => 'Service[neutron-server]'
)
end
it_configures 'neutron opencontrail plugin'
end
context 'on RedHat platforms' do
let :facts do
default_facts.merge({ :osfamily => 'RedHat' })
end
let :params do
{ :contrail_extensions => ['ipam:ipam','policy:policy','route-table'] }
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
:require => 'Package[neutron-plugin-contrail]'
)
end
it_configures 'neutron opencontrail plugin'
end
end

View File

@ -13,7 +13,10 @@ describe 'neutron::plugins::plumgrid' do
:director_server_port => '443',
:servertimeout => '99',
:connection => 'http://127.0.0.1:35357/v2.0',
:controller_priv_host => '127.0.0.1'
:controller_priv_host => '127.0.0.1',
:auth_protocol => 'http',
:nova_metadata_ip => '127.0.0.1',
:nova_metadata_port => '8775',
}
end
@ -58,10 +61,13 @@ describe 'neutron::plugins::plumgrid' do
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/admin_user').with_value('admin')
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/admin_password').with_value(params[:admin_password])
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/admin_tenant_name').with_value('admin')
auth_uri = "http://" + params[:controller_priv_host] + ":" + "35357/v2.0";
auth_uri = params[:auth_protocol] + "://" + params[:controller_priv_host] + ":" + "35357/v2.0";
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/auth_uri').with_value(auth_uri)
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/enable_pg_metadata').with_value('True')
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_mode').with_value('local')
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_ip').with_value(params[:nova_metadata_ip])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_port').with_value(params[:nova_metadata_port])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_proxy_shared_secret').with_value(params[:metadata_proxy_shared_secret])
end
end

View File

@ -316,6 +316,20 @@ describe 'neutron::server' do
end
end
describe "with custom auth region" do
let :facts do
default_facts.merge({ :osfamily => 'RedHat' })
end
before do
params.merge!({
:auth_region => 'MyRegion',
})
end
it 'configures auth_region' do
is_expected.to contain_neutron_config('keystone_authtoken/auth_region').with_value('MyRegion');
end
end
context 'on Debian platforms' do
let :facts do
default_facts.merge(

View File

@ -1,15 +1,12 @@
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
hosts.each do |host|
install_puppet
on host, "mkdir -p #{host['distmoduledir']}"
end
run_puppet_install_helper
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
# Readable test descriptions
c.formatter = :documentation
@ -22,31 +19,38 @@ RSpec.configure do |c|
# install git
install_package host, 'git'
# clean out any module cruft
shell('rm -fr /etc/puppet/modules/*')
zuul_ref = ENV['ZUUL_REF']
zuul_branch = ENV['ZUUL_BRANCH']
zuul_url = ENV['ZUUL_URL']
# install library modules from the forge
on host, puppet('module','install','puppetlabs-mysql'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','duritong/sysctl'), { :acceptable_exit_codes => 0 }
# pin apt module until openstack_extras use >= 2.0.0 version
on host, puppet('module','install','puppetlabs-apt','--version','1.8.0'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => 0 }
repo = 'openstack/puppet-openstack-integration'
# install puppet modules from git, use master
shell('git clone https://git.openstack.org/openstack/puppet-openstacklib /etc/puppet/modules/openstacklib')
shell('git clone https://git.openstack.org/openstack/puppet-vswitch /etc/puppet/modules/vswitch')
shell('git clone https://git.openstack.org/openstack/puppet-keystone /etc/puppet/modules/keystone')
shell('git clone https://git.openstack.org/openstack/puppet-openstack_extras /etc/puppet/modules/openstack_extras')
# TODO(EmilienM) Cloning RabbitMQ module for now because we wait for a release including
# https://github.com/enovance/puppetlabs-rabbitmq/commit/0227f762070ffbbea3c28d6a60174de98fa4cc1c
shell('git clone https://github.com/puppetlabs/puppetlabs-rabbitmq/ /etc/puppet/modules/rabbitmq')
# Start out with clean moduledir, don't trust r10k to purge it
on host, "rm -rf /etc/puppet/modules/*"
# Install dependent modules via git or zuul
r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
if r.exit_code == 0
zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
zuul_clone_cmd += '--cache-dir /opt/git '
zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
zuul_clone_cmd += "--zuul-url #{zuul_url} "
zuul_clone_cmd += "git://git.openstack.org #{repo}"
on host, zuul_clone_cmd
else
on host, "git clone https://git.openstack.org/#{repo} #{repo}"
end
on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh"
# Install the module being tested
puppet_module_install(:source => proj_root, :module_name => 'neutron')
on host, "rm -fr /etc/puppet/modules/#{modname}"
puppet_module_install(:source => proj_root, :module_name => modname)
on host, "rm -fr #{repo}"
# List modules installed to help with debugging
on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
on host, puppet('module','list'), { :acceptable_exit_codes => 0 }
end
end
end

View File

@ -17,55 +17,100 @@ describe provider_class do
:admin_state_up => 'True',
:router_external => 'False',
:shared => 'False',
:tenant_id => '',
:tenant_id => '60f9544eb94c42a6b7e8e98c2be981b1',
}
end
describe 'when updating a network' do
let :resource do
Puppet::Type::Neutron_network.new(net_attrs)
end
let :provider do
provider_class.new(resource)
end
shared_examples 'neutron_network' do
describe 'when creating a network' do
it 'should call net-create with appropriate command line options' do
provider.class.stubs(:get_tenant_id).returns(net_attrs[:tenant_id])
output = 'Created a new network:
admin_state_up="True"
id="d9ac3494-20ea-406c-a4ba-145923dfadc9"
name="net1"
shared="False"
status="ACTIVE"
subnets=""
tenant_id="60f9544eb94c42a6b7e8e98c2be981b1"'
provider.expects(:auth_neutron).with('net-create',
'--format=shell', ["--tenant_id=#{net_attrs[:tenant_id]}"],
net_name).returns(output)
provider.create
end
end
describe 'when updating a network' do
it 'should call net-update to change admin_state_up' do
provider.expects(:auth_neutron).with('net-update',
'--admin_state_up=False',
net_name)
provider.admin_state_up=('False')
end
it 'should call net-update to change shared' do
provider.expects(:auth_neutron).with('net-update',
'--shared=True',
net_name)
provider.shared=('True')
end
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external=False',
net_name)
provider.router_external=('False')
end
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external',
net_name)
provider.router_external=('True')
end
[:provider_network_type, :provider_physical_network, :provider_segmentation_id].each do |attr|
it "should fail when #{attr.to_s} is update " do
expect do
provider.send("#{attr}=", 'foo')
end.to raise_error(Puppet::Error, /does not support being updated/)
end
end
end
end
describe "with tenant_name set" do
let :local_attrs do
attrs = net_attrs.merge({:tenant_name => 'a_person'})
attrs.delete(:tenant_id)
attrs
end
let :resource do
Puppet::Type::Neutron_network.new(net_attrs)
Puppet::Type::Neutron_network.new(local_attrs)
end
let :provider do
provider_class.new(resource)
end
it 'should call net-update to change admin_state_up' do
provider.expects(:auth_neutron).with('net-update',
'--admin_state_up=False',
net_name)
provider.admin_state_up=('False')
end
it 'should call net-update to change shared' do
provider.expects(:auth_neutron).with('net-update',
'--shared=True',
net_name)
provider.shared=('True')
end
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external=False',
net_name)
provider.router_external=('False')
end
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external',
net_name)
provider.router_external=('True')
end
[:provider_network_type, :provider_physical_network, :provider_segmentation_id].each do |attr|
it "should fail when #{attr.to_s} is update " do
expect do
provider.send("#{attr}=", 'foo')
end.to raise_error(Puppet::Error, /does not support being updated/)
end
end
it_behaves_like('neutron_network')
end
end

View File

@ -0,0 +1,36 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_opencontrail).provider(:ini_setting)
describe provider_class do
let(:resource ) do
Puppet::Type::Neutron_plugin_opencontrail.new({
:name => 'DEFAULT/foo',
:value => 'bar',
})
end
let (:provider) { resource.provider }
[ 'RedHat', 'Debian' ].each do |os|
context "on #{os} with default setting" do
it 'it should fall back to default and use ContrailPlugin.ini' do
Facter.fact(:operatingsystem).stubs(:value).returns("#{os}")
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/opencontrail/ContrailPlugin.ini')
end
end
end
end

View File

@ -0,0 +1,57 @@
require 'puppet'
require 'spec_helper'
require 'puppet/provider/neutron_port/neutron'
provider_class = Puppet::Type.type(:neutron_port).provider(:neutron)
describe provider_class do
let :port_name do
'port1'
end
let :port_attrs do
{
:name => port_name,
:ensure => 'present',
:admin_state_up => 'True',
:tenant_id => '60f9544eb94c42a6b7e8e98c2be981b1',
:network_name => 'net1'
}
end
let :resource do
Puppet::Type::Neutron_port.new(port_attrs)
end
let :provider do
provider_class.new(resource)
end
describe 'when creating a port' do
it 'should call port-create with appropriate command line options' do
provider.class.stubs(:get_tenant_id).returns(port_attrs[:tenant_id])
output = 'Created a new port:
admin_state_up="True"
device_id=""
device_owner=""
fixed_ips="{\"subnet_id\": \"40af01ac-52c7-4235-bbcf-d9c02325ab5e\", \"ip_address\": \"192.168.0.39\"}"
id="5222573b-314d-45f9-b6bd-299288ba667a"
mac_address="fa:16:3e:45:3c:10"
name="port1"
network_id="98873773-aa34-4b87-af05-70903659246f"
security_groups="f1f0c3a3-9f2c-46b9-b2a5-b97d9a87bd7e"
status="ACTIVE"
tenant_id="60f9544eb94c42a6b7e8e98c2be981b1"'
provider.expects(:auth_neutron).with('port-create',
'--format=shell', "--name=#{port_attrs[:name]}",
["--tenant_id=#{port_attrs[:tenant_id]}"],
port_attrs[:network_name]).returns(output)
provider.create
end
end
end

View File

@ -3,6 +3,7 @@ require 'spec_helper'
require 'puppet/provider/neutron_router/neutron'
provider_class = Puppet::Type.type(:neutron_router).provider(:neutron)
klass = Puppet::Provider::Neutron
describe provider_class do
@ -15,18 +16,40 @@ describe provider_class do
:name => router_name,
:ensure => 'present',
:admin_state_up => 'True',
:tenant_id => '',
:tenant_id => '60f9544eb94c42a6b7e8e98c2be981b1',
}
end
describe 'when updating a router' do
let :resource do
Puppet::Type::Neutron_router.new(router_attrs)
end
let :resource do
Puppet::Type::Neutron_router.new(router_attrs)
end
let :provider do
provider_class.new(resource)
let :provider do
provider_class.new(resource)
end
describe 'when creating a router' do
it 'should call router-create with appropriate command line options' do
provider.class.stubs(:get_tenant_id).returns(router_attrs[:tenant_id])
output = 'Created a new router:
admin_state_up="True"
external_gateway_info=""
id="c5f799fa-b3e0-47ca-bdb7-abeff209b816"
name="router1"
status="ACTIVE"
tenant_id="60f9544eb94c42a6b7e8e98c2be981b1"'
provider.expects(:auth_neutron).with('router-create',
'--format=shell', ["--tenant_id=#{router_attrs[:tenant_id]}"],
router_name).returns(output)
provider.create
end
end
describe 'when updating a router' do
it 'should call router-update to change admin_state_up' do
provider.expects(:auth_neutron).with('router-update',
@ -50,4 +73,33 @@ describe provider_class do
end
describe 'when parsing an external gateway info' do
let :resource do
Puppet::Type::Neutron_router.new(router_attrs)
end
let :provider do
provider_class.new(resource)
end
after :each do
klass.reset
end
it 'should detect a gateway net id' do
klass.stubs(:auth_neutron).returns(
'external_gateway_info="{\"network_id\": \"1b-b1\", \"enable_snat\": true, \"external_fixed_ips\": [{\"subnet_id\": \"1b-b1\", \"ip_address\": \"1.1.1.1\"}]}"'
)
result = klass.get_neutron_resource_attrs 'foo', nil
expect(provider.parse_gateway_network_id(result['external_gateway_info'])).to eql('1b-b1')
end
it 'should return empty value, if there is no net id found' do
klass.stubs(:auth_neutron).returns('external_gateway_info="{}"')
result = klass.get_neutron_resource_attrs 'foo', nil
expect(provider.parse_gateway_network_id(result['external_gateway_info'])).to eql('')
end
end
end

View File

@ -0,0 +1,49 @@
require 'puppet'
require 'spec_helper'
require 'puppet/provider/neutron_router_interface/neutron'
provider_class = Puppet::Type.type(:neutron_router_interface).provider(:neutron)
describe provider_class do
let :interface_attrs do
{
:name => 'router:subnet',
:ensure => 'present',
}
end
let :resource do
Puppet::Type::Neutron_router_interface.new(interface_attrs)
end
let :provider do
provider_class.new(resource)
end
describe 'when creating a router interface' do
it 'should call port-create with appropriate command line options' do
provider.class.stubs(:get_tenant_id).returns(interface_attrs[:tenant_id])
output = 'Added interface b03610fd-ac31-4521-ad06-2ac74af959ad to router router'
provider.expects(:auth_neutron).with(['router-interface-add',
'--format=shell', 'router', 'subnet=subnet']).returns(output)
provider.create
end
end
describe 'when accessing attributes of an interface' do
it 'should return the correct router name' do
expect(provider.router_name).to eql('router')
end
it 'should return the correct subnet name' do
expect(provider.subnet_name).to eql('subnet')
end
end
end

View File

@ -19,22 +19,56 @@ describe provider_class do
:gateway_ip => '10.0.0.1',
:enable_dhcp => 'False',
:network_name => 'net1',
:tenant_id => '',
:allocation_pools => 'start=7.0.0.1,end=7.0.0.10',
:tenant_id => '60f9544eb94c42a6b7e8e98c2be981b1',
:allocation_pools => 'start=10.0.0.2,end=10.0.0.10',
:dns_nameservers => '8.8.8.8',
:host_routes => 'destination=12.0.0.0/24,nexthop=10.0.0.1',
}
end
let :resource do
Puppet::Type::Neutron_subnet.new(subnet_attrs)
end
let :provider do
provider_class.new(resource)
end
describe 'when creating a subnet' do
it 'should call subnet-create with appropriate command line options' do
provider.class.stubs(:get_tenant_id).returns(subnet_attrs[:tenant_id])
output = 'Created a new subnet:
allocation_pools="{\"start\": \"10.0.0.2\", \"end\": \"10.0.0.10\"}"
cidr="10.0.0.0/24"
dns_nameservers="8.8.8.8"
enable_dhcp="False"
gateway_ip="10.0.0.1"
host_routes="{\"nexthop\": \"10.0.0.1\", \"destination\": \"12.0.0.0/24\"}"
id="dd5e0ef1-2c88-4b0b-ba08-7df65be87963"
ip_version="4"
name="net1"
network_id="98873773-aa34-4b87-af05-70903659246f"
tenant_id="60f9544eb94c42a6b7e8e98c2be981b1"'
provider.expects(:auth_neutron).with('subnet-create', '--format=shell',
["--name=#{subnet_attrs[:name]}",
"--ip-version=#{subnet_attrs[:ip_version]}",
"--gateway-ip=#{subnet_attrs[:gateway_ip]}",
"--disable-dhcp",
"--allocation-pool=#{subnet_attrs[:allocation_pools]}",
"--dns-nameserver=#{subnet_attrs[:dns_nameservers]}",
"--host-route=#{subnet_attrs[:host_routes]}",
"--tenant_id=#{subnet_attrs[:tenant_id]}",
subnet_name],
subnet_attrs[:cidr]).returns(output)
provider.create
end
end
describe 'when updating a subnet' do
let :resource do
Puppet::Type::Neutron_subnet.new(subnet_attrs)
end
let :provider do
provider_class.new(resource)
end
it 'should call subnet-update to change gateway_ip' do
provider.expects(:auth_neutron).with('subnet-update',
'--gateway-ip=10.0.0.2',