Retire openstack-chef: remove repo content

OpenStack-chef project is retiring
- https://review.opendev.org/c/openstack/governance/+/905279

this commit remove the content of this project repo

Depends-On: https://review.opendev.org/c/openstack/project-config/+/909134
Change-Id: Icfd5b97688d8906e0b873065a6e5f80cb63df451
This commit is contained in:
Ghanshyam Mann 2024-02-15 14:16:28 -08:00
parent 75e073a7b0
commit b4f5c8f670
55 changed files with 8 additions and 3101 deletions

View File

@ -1,9 +0,0 @@
[local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

9
.gitignore vendored
View File

@ -1,9 +0,0 @@
.bundle/
berks-cookbooks/
.kitchen
.vagrant
.coverage/
*.swp
Berksfile.lock
Vagrantfile
Gemfile.lock

View File

@ -1,4 +0,0 @@
Chef/Modernize/FoodcriticComments:
Enabled: true
Chef/Style/CopyrightCommentFormat:
Enabled: true

View File

@ -1,3 +0,0 @@
- project:
templates:
- openstack-chef-jobs

View File

@ -1,22 +0,0 @@
source 'https://supermarket.chef.io'
solver :ruby, :required
[
%w(client dep),
%w(-common dep),
%w(-dns integration),
%w(-identity dep),
%w(-image integration),
%w(-integration-test integration),
%w(-ops-database integration),
%w(-ops-messaging integration),
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end
end
metadata

View File

@ -1,36 +0,0 @@
Contributing
============
How To Get Started
------------------
If you would like to contribute to the development of OpenStack Chef Cookbooks,
you must follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
Gerrit Workflow
---------------
Once those steps have been completed, changes to OpenStack
should be submitted for review via the Gerrit tool, following
the workflow documented at:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs
----
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/openstack-chef
Contacts
--------
Mailing list: groups.google.com/group/opscode-chef-openstack
IRC: #openstack-chef is our channel on irc.oftc.net
Wiki: https://wiki.openstack.org/wiki/Chef/GettingStarted and https://docs.getchef.com/openstack.html
Twitter: @chefopenstack

176
LICENSE
View File

@ -1,176 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

View File

@ -1,243 +1,10 @@
OpenStack Chef Cookbook - network
=================================
This project is no longer maintained.
.. image:: https://governance.openstack.org/badges/cookbook-openstack-network.svg
:target: https://governance.openstack.org/reference/tags/index.html
The contents of this repository are still available in the Git
source code management system. To see the contents of this
repository before it reached its end of life, please check out the
previous commit with "git checkout HEAD^1".
Description
===========
This cookbook installs the OpenStack Network service **Neutron** as part
of a Chef reference deployment of OpenStack. The `OpenStack chef-repo`_
contains documentation for using this cookbook in the context of a full
OpenStack deployment. Neutron is currently installed from packages.
.. _OpenStack chef-repo: https://opendev.org/openstack/openstack-chef
https://docs.openstack.org/neutron/latest/
Usage
=====
OpenStack Network's design is modular, with plugins available that
handle L2 and L3 networking for various hardware vendors and standards.
Requirements
============
- Chef 16 or higher
- Chef Workstation 21.10.640 for testing (also includes Berkshelf for
cookbook dependency resolution)
Platform
========
- ubuntu
- redhat
- centos
Cookbooks
=========
The following cookbooks are dependencies:
- 'openstackclient'
- 'openstack-common', '>= 20.0.0'
- 'openstack-identity', '>= 20.0.0'
Attributes
==========
Please see the extensive inline documentation in ``attributes/*.rb`` for
descriptions of all the settable attributes for this cookbook.
Note that all attributes are in the ``default['openstack']`` "namespace"
The usage of attributes to generate the ``neutron.conf`` is described in
the openstack-common cookbook.
Recipes
=======
openstack-network::_bridge_config_example
-----------------------------------------
- Example bridge recipe used in kitchen tests
openstack-network::db_migration
-------------------------------
- Migrates the neutron database
openstack-network::default
--------------------------
- Configures common pieces needed for all neutron services and create
the ``neutron.conf``
openstack-network::dhcp_agent
-----------------------------
- Installs the DHCP agent
The configuration for ``neutron-dhcp-agent`` is generated from the
attributes in using the same template as for the ``neutron.conf``
.. code-block:: ruby
node['openstack']['network_dhcp']['conf']
openstack-network::identity_registration
----------------------------------------
- Registers the OpenStack Network API endpoint and service user with
Keystone
openstack-network::l3_agent
---------------------------
- Installs the L3 agent
The configuration for ``neutron-l3-agent`` is generated from the
attributes in using the same template as for the ``neutron.conf``
.. code-block:: ruby
node['openstack']['network_l3']['conf']
openstack-network::metadata_agent
---------------------------------
- Installs the metadata agent
The configuration for ``neutron-metadata-agent`` is generated from the
attributes in using the same template as for the ``neutron.conf``
.. code-block:: ruby
node['openstack']['network_metadata']['conf']
openstack-network::metering_agent
---------------------------------
- Installs the metering agent
The configuration for ``neutron-metadata-agent`` is generated from the
attributes in using the same template as for the ``neutron.conf``
.. code-block:: ruby
node['openstack']['network_metering']['conf']
openstack-network::ml2_core_plugin
----------------------------------
- Configure the ``ml2_core_plugin``
openstack-network::ml2_linuxbridge
----------------------------------
- Configure the ml2 linuxbridge plugin
openstack-network::ml2_openvswitch
----------------------------------
- Configure the ml2 openvswitch plugin
openstack-network::openvswitch
------------------------------
- Installs openvswitch
openstack-network::openvswitch_agent
------------------------------------
- Installs the openvswitch agent
openstack-network::plugin_config
--------------------------------
- Generates all the needed plugin configurations directly from the
attributes in:
.. code-block:: ruby
node['openstack']['network']['plugins'][myplugin]
The final configuration file is generated exactly like all OpenStack
service configuration files (e.g. ``neutron.conf``), but the attribute
mentioned above allows you additionally to define the file name and
patch with:
.. code-block:: ruby
# this will also generate the path recursively if not already existent
node['openstack']['network']['plugins'][myplugin]['path']
# this defines the filename for the plugin config (e.g. ml2_conf.ini)
node['openstack']['network']['plugins'][myplugin]['filename']
In the examples above, the variable ``myplugin`` can be used to generate
multiple plugin configurations with different configs and filenames.
Please refer to the recipe ``openstack-network::ml2_openvswitch`` for an
full example on the usage of this attributes.
openstack-network::server
-------------------------
- Installs the openstack-network API server (currently aka
neutron-server)
License and Author
==================
+-----------------+--------------------------------------------+
| **Authors** | Alan Meadows (alan.meadows@gmail.com) |
+-----------------+--------------------------------------------+
| **Authors** | Jay Pipes (jaypipes@gmail.com) |
+-----------------+--------------------------------------------+
| **Authors** | Ionut Artarisi (iartarisi@suse.cz) |
+-----------------+--------------------------------------------+
| **Authors** | Salman Baset (sabaset@us.ibm.com) |
+-----------------+--------------------------------------------+
| **Authors** | Jian Hua Geng (gengjh@cn.ibm.com) |
+-----------------+--------------------------------------------+
| **Authors** | Chen Zhiwei (zhiwchen@cn.ibm.com) |
+-----------------+--------------------------------------------+
| **Authors** | Mark Vanderwiel(vanderwl@us.ibm.com) |
+-----------------+--------------------------------------------+
| **Authors** | Eric Zhou(zyouzhou@cn.ibm.com) |
+-----------------+--------------------------------------------+
| **Authors** | Jan Klare (j.klare@x-ion.de) |
+-----------------+--------------------------------------------+
| **Authors** | Christoph Albers (c.albers@x-ion.de) |
+-----------------+--------------------------------------------+
| **Authors** | Lance Albertson (lance@osuosl.org) |
+-----------------+--------------------------------------------+
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, SUSE Linux GmbH |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2012, Rackspace US, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, IBM Corp. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2016, cloudbau GmbH |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2016-2021, Oregon State University |
+-----------------+--------------------------------------------------+
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.
For any further questions, please email
openstack-discuss@lists.openstack.org or join #openstack-dev on
OFTC.

View File

@ -1,39 +0,0 @@
task default: ['test']
task test: [:syntax, :lint, :unit]
desc 'Vendor the cookbooks in the Berksfile'
task :berks_prep do
sh %(chef exec berks vendor)
end
desc 'Run FoodCritic (syntax) tests'
task :syntax do
sh %(chef exec foodcritic --exclude spec -f any .)
end
desc 'Run RuboCop (lint) tests'
task :lint do
sh %(chef exec cookstyle)
end
desc 'Run RSpec (unit) tests'
task unit: :berks_prep do
sh %(chef exec rspec --format documentation)
end
desc 'Remove the berks-cookbooks directory and the Berksfile.lock'
task :clean do
rm_rf [
'berks-cookbooks',
'Berksfile.lock',
]
end
desc 'All-in-One Neutron build Infra using Common task'
task :integration do
# Use the common integration task
sh %(wget -nv -t 3 -O Rakefile-Common https://opendev.org/openstack/cookbook-openstack-common/raw/branch/master/Rakefile)
load './Rakefile-Common'
Rake::Task['common_integration'].invoke
end

View File

@ -1,30 +0,0 @@
# Testing the Cookbook #
This cookbook uses [chefdk](https://downloads.chef.io/chef-dk/) and [berkshelf](http://berkshelf.com/) to isolate dependencies. Make sure you have chefdk and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead). For more detailed information on what needs to be installed, you can have a quick look into the bootstrap.sh file in this repository, which does install all the needed things to get going on ubuntu trusty. The tests defined in the Rakefile include lint, style and unit. For integration testing please refere to the [openstack-chef-repo](https://github.com/openstack/openstack-chef-repo).
We have three test suites which you can run either, individually (there are three rake tasks):
$ chef exec rake lint
$ chef exec rake style
$ chef exec rake unit
or altogether:
$ chef exec rake
The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`.
## Rubocop ##
[Rubocop](https://github.com/bbatsov/rubocop) is a static Ruby code analyzer, based on the community [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits.
## Foodcritic ##
[Foodcritic](http://acrmp.github.io/foodcritic/) is a lint tool for Chef cookbooks. We ignore the following rules:
* [FC003](http://acrmp.github.io/foodcritic/#FC003) These cookbooks are not intended for Chef Solo.
* [FC023](http://acrmp.github.io/foodcritic/#FC023) Prefer conditional attributes.
## Chefspec
[ChefSpec](https://github.com/sethvargo/chefspec) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.

View File

@ -1,207 +0,0 @@
#
# Cookbook:: openstack-network
# Attributes:: default
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2014-2021, IBM Corp.
# Copyright:: 2016-2021, Oregon State University
#
# 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.
#
# Set the endpoints for the network service to allow all other cookbooks to
# access and use them
%w(public internal).each do |ep_type|
# openstack identity service endpoints (used by users and services)
default['openstack']['endpoints'][ep_type]['network']['host'] = '127.0.0.1'
default['openstack']['endpoints'][ep_type]['network']['scheme'] = 'http'
default['openstack']['endpoints'][ep_type]['network']['path'] = ''
default['openstack']['endpoints'][ep_type]['network']['port'] = 9696
# web-service (e.g. apache) listen address (can be different from openstack
# network endpoints)
end
default['openstack']['bind_service']['all']['network']['host'] = '127.0.0.1'
default['openstack']['bind_service']['all']['network']['port'] = 9696
# trigger the usage of syslog (will include the proper recipe to create a log
# config)
default['openstack']['network']['syslog']['use'] = false
# Name of the plugin to load
default['openstack']['network']['identity-api']['auth']['version'] = 'v3'
# Set dbsync command timeout value
default['openstack']['network']['dbsync_timeout'] = 3600
# Specify policy.json remote filwe to import
default['openstack']['network']['policyfile_url'] = nil
# Gets set in the Network Endpoint when registering with Keystone
default['openstack']['network']['region'] = node['openstack']['region']
default['openstack']['network']['service_role'] = 'admin'
default['openstack']['network']['service_name'] = 'neutron'
default['openstack']['network']['service_type'] = 'network'
default['openstack']['network']['description'] = 'OpenStack Networking service'
default['openstack']['network']['rabbit_server_chef_role'] = 'rabbitmq-server'
# The bridging interface driver.
# This is used by the L3 and DHCP agents.
# Options are:
#
# - neutron.agent.linux.interface.OVSInterfaceDriver
# - neutron.agent.linux.interface.BridgeInterfaceDriver
#
default['openstack']['network']['interface_driver'] = 'neutron.agent.linux.interface.OVSInterfaceDriver'
# The agent can use other DHCP drivers. Dnsmasq is the simplest and requires
# no additional setup of the DHCP server.
default['openstack']['network']['dhcp_driver'] = 'neutron.agent.linux.dhcp.Dnsmasq'
# Version for connection to nova
# TODO: (MRV) Need to allow for this in Common.
default['openstack']['network']['nova']['url_version'] = '/v2'
#
# ============================= rootwrap Configuration ===================
# use neutron root wrap
default['openstack']['network']['use_rootwrap'] = true
# rootwrap.conf
default['openstack']['network']['rootwrap']['conf'].tap do |conf|
conf['DEFAULT']['filters_path'] = '/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap'
conf['DEFAULT']['exec_dirs'] = '/sbin,/usr/sbin,/bin,/usr/bin'
conf['DEFAULT']['use_syslog'] = false
conf['DEFAULT']['syslog_log_facility'] = 'syslog'
conf['DEFAULT']['syslog_log_level'] = 'ERROR'
end
# ============================= dnsmasq Configuration ===================
# TODO: (jklare) this should be refactored and probably pull in the some dnsmasq
# cookbook to do the proper configuration
# Upstream resolver to use
# This will be used by dnsmasq to resolve recursively
# but will not be used if the tenant specifies a dns
# server in their subnet
#
# Defaults are spread out across multiple, presumably
# reliable, upstream providers. Deployers should replace these with their local
# resolvers when possible.
#
# 8.8.8.8 is Google
# 208.67.222.222 is OpenDNS
#
# May be a comma separated list of servers
default['openstack']['network']['dnsmasq']['upstream_dns_servers'] = %w(8.8.8.8 208.67.222.222)
# List of domains and corresponding IP addresses to override upstream DNS
# servers. The format expected by dnsmasq is /<domain>/<address>,
# e.g. "/double-click.net/127.0.0.1" or "/localhost/::1".
default['openstack']['network']['dnsmasq']['override_dns_address'] = %w()
# ============================= DHCP Agent Configuration ===================
default['openstack']['network_dhcp']['config_file'] = '/etc/neutron/dhcp_agent.ini'
default['openstack']['network_dhcp']['conf'].tap do |conf|
conf['DEFAULT']['interface_driver'] = 'openvswitch'
conf['DEFAULT']['dnsmasq_config_file '] = '/etc/neutron/dnsmasq.conf'
end
# ============================= L3 Agent Configuration =====================
default['openstack']['network_l3']['external_network_bridge_interface'] = 'enp0s8'
# Customize the l3 config file path
default['openstack']['network_l3']['config_file'] = '/etc/neutron/l3_agent.ini'
default['openstack']['network_l3']['conf'].tap do |conf|
conf['DEFAULT']['interface_driver'] = 'neutron.agent.linux.interface.OVSInterfaceDriver'
end
# ============================= Metadata Agent Configuration ===============
default['openstack']['network_metadata']['config_file'] = '/etc/neutron/metadata_agent.ini'
# The name of the secret databag containing the metadata secret
default['openstack']['network_metadata']['secret_name'] = 'neutron_metadata_secret'
node.default['openstack']['network_metadata']['conf'] = {}
# ============================= Metering Agent Configuration ===============
default['openstack']['network_metering']['config_file'] = '/etc/neutron/metering_agent.ini'
default['openstack']['network_metering']['conf'].tap do |conf|
conf['DEFAULT']['interface_driver'] = 'neutron.agent.linux.interface.OVSInterfaceDriver'
conf['DEFAULT']['driver'] = 'neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver'
end
# ============================= platform-specific settings ===========
default['openstack']['network']['platform'].tap do |platform|
platform['user'] = 'neutron'
platform['group'] = 'neutron'
platform['neutron_dhcp_agent_service'] = 'neutron-dhcp-agent'
platform['neutron_l3_agent_service'] = 'neutron-l3-agent'
platform['neutron_metadata_agent_service'] = 'neutron-metadata-agent'
platform['neutron_metering_agent_service'] = 'neutron-metering-agent'
platform['neutron_server_service'] = 'neutron-server'
platform['neutron_rpc_server_service'] = 'neutron-rpc-server'
case node['platform_family']
when 'rhel'
platform['neutron_packages'] =
%w(
ebtables
iproute
openstack-neutron
openstack-neutron-ml2
)
platform['neutron_dhcp_packages'] = %w(openstack-neutron iproute)
platform['neutron_l3_packages'] =
%w(
iproute
keepalived
openstack-neutron
radvd
)
platform['neutron_plugin_package'] = 'neutron-plugin-ml2'
platform['neutron_openvswitch_packages'] = %w(openvswitch)
platform['neutron_openvswitch_agent_packages'] = %w(openstack-neutron-openvswitch iproute)
platform['neutron_linuxbridge_agent_packages'] = %w(openstack-neutron-linuxbridge iproute)
platform['neutron_linuxbridge_agent_service'] = 'neutron-linuxbridge-agent'
platform['neutron_metadata_agent_packages'] = []
platform['neutron_metering_agent_packages'] = %w(openstack-neutron-metering-agent)
platform['neutron_server_packages'] = []
platform['neutron_openvswitch_service'] = 'openvswitch'
platform['neutron_openvswitch_agent_service'] = 'neutron-openvswitch-agent'
platform['package_overrides'] = ''
when 'debian'
platform['neutron_packages'] = %w(neutron-common python3-neutron)
platform['neutron_dhcp_packages'] = %w(neutron-dhcp-agent)
platform['neutron_l3_packages'] =
%w(
keepalived
neutron-l3-agent
radvd
)
platform['neutron_openvswitch_packages'] = %w(openvswitch-switch bridge-utils)
platform['neutron_openvswitch_build_packages'] =
%w(
autoconf
build-essential
debhelper
dkms
fakeroot
libssl-dev
openssl
pkg-config
python-all
python-qt4
python-twisted-conch
python-zopeinterface
)
platform['neutron_openvswitch_agent_packages'] = %w(neutron-openvswitch-agent)
platform['neutron_linuxbridge_agent_packages'] = %w(neutron-linuxbridge-agent)
platform['neutron_linuxbridge_agent_service'] = 'neutron-linuxbridge-agent'
platform['neutron_metadata_agent_packages'] = %w(neutron-metadata-agent)
platform['neutron_metering_agent_packages'] = %w(neutron-metering-agent)
platform['neutron_server_packages'] = %w(neutron-server)
platform['neutron_openvswitch_service'] = 'openvswitch-switch'
platform['neutron_openvswitch_agent_service'] = 'neutron-openvswitch-agent'
platform['package_overrides'] = ''
end
end

View File

@ -1,38 +0,0 @@
# attribute can be used in wrapper cookbooks to handover secrets (will not be
# saved after successfull chef run)
default['openstack']['network']['conf_secrets'] = {}
default['openstack']['network']['conf'].tap do |conf|
# [DEFAULT] section
if node['openstack']['network']['syslog']['use']
conf['DEFAULT']['log_config_append'] = '/etc/openstack/logging.conf'
else
conf['DEFAULT']['log_dir'] = '/var/log/neutron'
end
conf['DEFAULT']['control_exchange'] = 'neutron'
conf['DEFAULT']['core_plugin'] = 'ml2'
# [agent] section
if node['openstack']['network']['use_rootwrap']
conf['agent']['root_helper'] = 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf'
end
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_type'] = 'password'
conf['keystone_authtoken']['region_name'] = node['openstack']['region']
conf['keystone_authtoken']['username'] = 'neutron'
conf['keystone_authtoken']['user_domain_name'] = 'Default'
conf['keystone_authtoken']['project_domain_name'] = 'Default'
conf['keystone_authtoken']['project_name'] = 'service'
conf['keystone_authtoken']['auth_version'] = 'v3'
# [nova] section
conf['nova']['auth_type'] = 'password'
conf['nova']['region_name'] = node['openstack']['region']
conf['nova']['username'] = 'nova'
conf['nova']['user_domain_name'] = 'Default'
conf['nova']['project_name'] = 'service'
conf['nova']['project_domain_name'] = 'Default'
# [oslo_concurrency] section
conf['oslo_concurrency']['lock_path'] = '/var/lib/neutron/lock'
end

View File

@ -1,7 +0,0 @@
#!/bin/sh
# this script is intentionally reduced to an exit call to eliminate the
# automatic invocation of iptables.
# lp: https://bugs.launchpad.net/neutron/+bug/1622914
# bz: https://bugzilla.redhat.com/show_bug.cgi?id=1421022
exit 0

View File

@ -1,18 +0,0 @@
name 'openstack-network'
maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0'
description 'Installs and configures the OpenStack Network API Service and various agents and plugins'
version '20.0.0'
%w(ubuntu redhat centos).each do |os|
supports os
end
depends 'openstackclient'
depends 'openstack-common', '>= 20.0.0'
depends 'openstack-identity', '>= 20.0.0'
issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-network'
chef_version '>= 16.0'

View File

@ -1,119 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: _bridge_config_example
#
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
# This recipe is intended as an example of just one possible bridge
# configuration for ml2 and should not be used as is in production. The
# openstack-network cookbook tries to provide all the basic features to deploy
# the neutron services, but can not include all possible network and bridge
# configurations out there. To use the openstack-network cookbook in production,
# please create a wrapper to configure your network interfaces and adapt the
# configs accordingly. You should find fitting examples given below.
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
# set and get name for tun interface (can be overwritten in the environment,
# like shown for the multi-node scenario in the openstack-chef)
node.default['openstack']['network']['tun_network_bridge_interface'] = 'eth-tun'
tun_interface = node['openstack']['network']['tun_network_bridge_interface']
# Helper for creating dummy interfaces for ovs bridges on jenkins test nodes and
# in testing vagrant boxes.
# The created interfaces do not work for real network traffic, but are needed to
# test the bridge creation and usage in the recipes.
# This needs to be done during compile time to ensure that the address_for
# method used lateron works
execute 'create eth-ext dummy interface' do
command <<-EOF
ip link add eth-ext type dummy
ip link set dev eth-ext up
EOF
not_if 'ip link show | grep eth-ext'
end.run_action(:run)
execute 'create eth-vlan dummy interface' do
command <<-EOF
ip link add eth-vlan type dummy
ip link set dev eth-vlan up
EOF
not_if 'ip link show | grep eth-vlan'
end.run_action(:run)
execute "create #{tun_interface} dummy interface" do
command <<-EOF
ip link add #{tun_interface} type dummy
ip link set dev #{tun_interface} up
ip addr add 10.0.0.201/24 dev #{tun_interface}
EOF
not_if "ip link show | grep #{tun_interface}"
end.run_action(:run)
# reload node attributes to get configuration for newly created dummy interfaces
ohai('reload').run_action(:reload)
# set all the needed attributes according to the dummy interfaces added above
# vlan bridge
node.default['openstack']['network']['vlan_network_bridge_interface'] = 'eth-vlan'
node.default['openstack']['network']['plugins']['openvswitch']['conf'].[]('OVS')['bridge_mappings'] =
'vlan:br-vlan,external:br-ex'
# external bridge
node.default['openstack']['network_l3']['external_network_bridge_interface'] = 'eth-ext'
# tunnel bridge
node.default['openstack']['network']['plugins']['openvswitch']['conf'].[]('OVS')['tunnel_bridge'] = 'br-tun'
node.default['openstack']['network']['plugins']['openvswitch']['conf'].[]('OVS')['local_ip'] =
address_for(tun_interface)
node.default['openstack']['network']['plugins']['openvswitch']['conf'].[]('AGENT')['tunnel_types'] = 'gre,vxlan'
# ovs security groups
node.default['openstack']['network']['plugins']['openvswitch']['conf'].[]('SECURITYGROUP')['firewall_driver'] =
'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'
# define variables for bridge definitions below
ex_bridge_iface = node['openstack']['network_l3']['external_network_bridge_interface']
vlan_bridge_iface = node['openstack']['network']['vlan_network_bridge_interface']
tun_bridge = node['openstack']['network']['plugins']['openvswitch']['conf'].[]('OVS')['tunnel_bridge']
# get the bridge names from the ovs bridge_mappings
mappings = node['openstack']['network']['plugins']['openvswitch']['conf'].[]('OVS')['bridge_mappings'].split(',')
vlan_bridge = mappings.find { |mapping| mapping.split(':').first == 'vlan' }.split(':').last
ex_bridge = mappings.find { |mapping| mapping.split(':').first == 'external' }.split(':').last
execute 'create external network bridge' do
command "ovs-vsctl --may-exist add-br #{ex_bridge}"
end
execute 'create external network bridge port' do
command "ovs-vsctl --may-exist add-port #{ex_bridge} #{ex_bridge_iface}"
end
execute 'create vlan network bridge' do
command "ovs-vsctl --may-exist add-br #{vlan_bridge}"
end
execute 'create vlan network bridge port' do
command "ovs-vsctl --may-exist add-port #{vlan_bridge} #{vlan_bridge_iface}"
end
execute 'create tunnel network bridge' do
command "ovs-vsctl --may-exist add-br #{tun_bridge}"
end

View File

@ -1,27 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: db_migration
#
# Copyright:: 2015-2021, IBM Corp.
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
# The node['openstack']['network']['plugin_config_file'] attribute is set in the default.rb recipe
execute 'migrate network database' do
timeout node['openstack']['network']['dbsync_timeout']
command <<-EOF.gsub(/^ {4}/, '')
neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head
EOF
end

View File

@ -1,117 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: default
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2013-2021, SUSE Linux GmbH
# Copyright:: 2013-2021, IBM Corp.
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
require 'addressable'
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
platform_options = node['openstack']['network']['platform']
if node['openstack']['network']['syslog']['use']
include_recipe 'openstack-common::logging'
end
package platform_options['neutron_packages'] do
options platform_options['package_overrides']
action :upgrade
end
db_type = node['openstack']['db']['network']['service_type']
package node['openstack']['db']['python_packages'][db_type] do
options platform_options['package_overrides']
action :upgrade
end
template '/etc/neutron/rootwrap.conf' do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
variables(
service_config: node['openstack']['network']['rootwrap']['conf']
)
end
cookbook_file '/usr/bin/neutron-enable-bridge-firewall.sh' do
source 'neutron-enable-bridge-firewall.sh'
owner 'root'
group 'wheel'
mode '0755'
only_if { platform_family?('rhel') }
end
if node['openstack']['mq']['service_type'] == 'rabbit'
node.default['openstack']['network']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'network'
end
identity_endpoint = internal_endpoint 'identity'
auth_url = identity_endpoint.to_s
db_user = node['openstack']['db']['network']['username']
db_pass = get_password 'db', 'neutron'
bind_service = node['openstack']['bind_service']['all']['network']
bind_service_address = bind_address bind_service
node.default['openstack']['network']['conf'].tap do |conf|
if node['openstack']['network']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
end
conf['DEFAULT']['bind_host'] = bind_service_address
conf['DEFAULT']['bind_port'] = bind_service['port']
conf['nova']['auth_url'] = auth_url
conf['keystone_authtoken']['auth_url'] = auth_url
end
# define secrets that are needed in the neutron.conf.erb
node.default['openstack']['network']['conf_secrets'].tap do |conf_secrets|
conf_secrets['database']['connection'] = db_uri('network', db_user, db_pass)
conf_secrets['nova']['password'] = get_password 'service', 'openstack-compute'
conf_secrets['keystone_authtoken']['password'] = get_password 'service', 'openstack-network'
end
# merge all config options and secrets to be used in the neutron.conf.erb
neutron_conf_options = merge_config_options 'network'
template '/etc/neutron/neutron.conf' do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '640'
sensitive true
variables(
service_config: neutron_conf_options
)
end
# delete all secrets saved in the attribute
# node['openstack']['network']['conf_secrets'] after creating the neutron.conf
ruby_block "delete all attributes in node['openstack']['network']['conf_secrets']" do
block do
node.rm(:openstack, :network, :conf_secrets)
end
end

View File

@ -1,67 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: dhcp_agent
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_dhcp_packages'] do
options platform_options['package_overrides']
action :upgrade
end
# TODO: (jklare) this should be refactored and probably pull in the some dnsmasq
# cookbook to do the proper configuration
template '/etc/neutron/dnsmasq.conf' do
source 'dnsmasq.conf.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
end
service_config = merge_config_options 'network_dhcp'
template node['openstack']['network_dhcp']['config_file'] do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
variables(
service_config: service_config
)
end
# TODO: (jklare) this should be refactored and probably pull in the some dnsmasq
# cookbook to do the proper configuration
package 'dnsmasq' do
action :upgrade
end if platform_family?('rhel')
service 'neutron-dhcp-agent' do
service_name platform_options['neutron_dhcp_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/neutron/neutron.conf]',
'template[/etc/neutron/dnsmasq.conf]',
"template[#{node['openstack']['network_dhcp']['config_file']}]",
'package[dnsmasq]',
]
end

View File

@ -1,90 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: identity_registration
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2013-2021, SUSE Linux GmbH
# Copyright:: 2019-2021, Oregon State University
#
# 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.
#
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
identity_endpoint = internal_endpoint 'identity'
auth_url = identity_endpoint.to_s
interfaces = {
public: { url: public_endpoint('network') },
internal: { url: internal_endpoint('network') },
}
service_pass = get_password 'service', 'openstack-network'
service_tenant_name = node['openstack']['network']['conf']['keystone_authtoken']['project_name']
service_user = node['openstack']['network']['conf']['keystone_authtoken']['username']
service_role = node['openstack']['network']['service_role']
service_domain_name = node['openstack']['network']['conf']['keystone_authtoken']['user_domain_name']
admin_user = node['openstack']['identity']['admin_user']
admin_pass = get_password 'user', node['openstack']['identity']['admin_user']
admin_project = node['openstack']['identity']['admin_project']
admin_domain = node['openstack']['identity']['admin_domain_name']
region = node['openstack']['region']
# TODO(ramereth): commenting this out until
# https://github.com/fog/fog-openstack/pull/494 gets merged and released.
# endpoint_type = node['openstack']['identity']['endpoint_type']
connection_params = {
openstack_auth_url: auth_url,
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
# openstack_endpoint_type: endpoint_type,
}
# Register Network Service
openstack_service 'neutron' do
type 'network'
connection_params connection_params
end
# Register Network Public-Endpoint
interfaces.each do |interface, res|
# Register network Endpoints
openstack_endpoint 'network' do
service_name 'neutron'
interface interface.to_s
url res[:url].to_s
region region
connection_params connection_params
end
end
# Register Service Tenant
openstack_project service_tenant_name do
connection_params connection_params
end
# Register Service User
openstack_user service_user do
role_name service_role
project_name service_tenant_name
domain_name service_domain_name
password service_pass
connection_params connection_params
action [:create, :grant_role]
end

View File

@ -1,55 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: l3_agent
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_l3_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service_config = merge_config_options 'network_l3'
template node['openstack']['network_l3']['config_file'] do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '640'
variables(
service_config: service_config
)
notifies :restart, 'service[neutron-l3-agent]'
end
service 'neutron-l3-agent' do
service_name platform_options['neutron_l3_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/neutron/neutron.conf]',
]
end

View File

@ -1,68 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: metadata_agent
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
platform_options = node['openstack']['network']['platform']
# identity_endpoint = admin_endpoint 'identity'
metadata_secret = get_password 'token', node['openstack']['network_metadata']['secret_name']
# compute_metadata_api = internal_endpoint 'compute-metadata-api'
package platform_options['neutron_metadata_agent_packages'] do
action :upgrade
options platform_options['package_overrides']
end
node.default['openstack']['network_metadata']['conf_secrets'].tap do |conf|
conf['DEFAULT']['metadata_proxy_shared_secret'] = metadata_secret
end
service_config = merge_config_options 'network_metadata'
template node['openstack']['network_metadata']['config_file'] do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
sensitive true
variables(
service_config: service_config
)
end
# delete all secrets saved in the attribute
# node['openstack']['network_metadata']['conf_secrets'] after creating the neutron.conf
ruby_block 'delete all attributes in '\
"node['openstack']['network_metadata']['conf_secrets']" do
block do
node.rm(:openstack, :network_metadata, :conf_secrets)
end
end
service 'neutron-metadata-agent' do
service_name platform_options['neutron_metadata_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/neutron/neutron.conf]',
"template[#{node['openstack']['network_metadata']['config_file']}]",
]
end

View File

@ -1,49 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: metering_agent
#
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_metering_agent_packages'] do
action :upgrade
options platform_options['package_overrides']
end
service_config = merge_config_options 'network_metering'
template node['openstack']['network_metering']['config_file'] do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '640'
variables(
service_config: service_config
)
end
service 'neutron-metering-agent' do
service_name platform_options['neutron_metering_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/neutron/neutron.conf]',
"template[#{node['openstack']['network_metering']['config_file']}]",
]
end

View File

@ -1,38 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: ml2_core_plugin
#
# 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.
#
case node['platform_family']
when 'fedora', 'rhel'
node.default['openstack']['network']['plugins']['ml2']['path'] = '/etc/neutron'
node.default['openstack']['network']['plugins']['ml2']['filename'] = 'plugin.ini'
when 'debian'
node.default['openstack']['network']['plugins']['ml2']['path'] = '/etc/neutron/plugins/ml2'
node.default['openstack']['network']['plugins']['ml2']['filename'] = 'ml2_conf.ini'
end
# Per default the ml2 conf will be empty, since there is no need to add
# configuration without a mechanism_driver defined. The proper mechanism_drivers
# configuration will be included automatically when selecting a fitting
# ml2_plugin like ml2_openvswitch or ml2_linuxbridge
node.default['openstack']['network']['plugins']['ml2']['conf'] = {}
core_plugin = node['openstack']['network']['conf']['DEFAULT']['core_plugin']
node.default['openstack']['network']['core_plugin_config_file'] =
File.join(
node['openstack']['network']['plugins'][core_plugin]['path'],
node['openstack']['network']['plugins'][core_plugin]['filename']
)

View File

@ -1,56 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: ml2_linuxbridge
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2016-2021, Oregon State University
#
# 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.
#
# TODO: (jklare) This recipe is a WIP one, since we probably want to support
# ml2_linuxbridge, but are not testing it right now. It will install the needed
# packages on debian and rhel/fedora, set the proper ml2 mechanism_drivers and
# set the proper attributes to create an empty linuxbridge_conf.ini in the
# proper directory when including the plugin_conf recipe in this cookbook. The
# config can be filled via attributes (e.g. like done for the ml2_openvswitch).
include_recipe 'openstack-network'
node.default['openstack']['network']['plugins']['ml2']['conf']['ml2']['type_drivers'] = 'local,flat,vlan,gre,vxlan'
node.default['openstack']['network']['plugins']['ml2']['conf']['ml2']['mechanism_drivers'] = 'linuxbridge,l2population'
node.default['openstack']['network']['plugins']['ml2']['conf']['ml2_type_vxlan']['vni_ranges'] = 'VNI_START:VNI_END'
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_linuxbridge_agent_packages'] do
options platform_options['package_overrides']
action :upgrade
end
node.default['openstack']['network']['plugins']['linuxbridge'].tap do |lb|
lb['path'] = '/etc/neutron/plugins/ml2'
lb['filename'] = 'linuxbridge_agent.ini'
lb['conf']['securitygroup']['firewall_driver'] = 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver'
end
include_recipe 'openstack-network::plugin_config'
service 'neutron-plugin-linuxbridge-agent' do
service_name platform_options['neutron_linuxbridge_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart,
[
'template[/etc/neutron/neutron.conf]',
'template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]',
]
end

View File

@ -1,37 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: ml2_opensvswitch
#
# Copyright:: 2013-2021, AT&T
#
# 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.
#
require 'addressable'
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
include_recipe 'openstack-network::ml2_core_plugin'
node.default['openstack']['network']['plugins']['ml2']['conf']['ml2']['mechanism_drivers'] = 'openvswitch'
node.default['openstack']['network']['plugins']['openvswitch'].tap do |ovs|
ovs['path'] =
'/etc/neutron/plugins/ml2'
ovs['filename'] =
'openvswitch_agent.ini'
ovs['conf']['DEFAULT']['integration_bridge'] = 'br-int'
end

View File

@ -1,38 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: opensvswitch
#
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network::ml2_openvswitch'
plugin_file_path = File.join(
node['openstack']['network']['plugins']['openvswitch']['path'],
node['openstack']['network']['plugins']['openvswitch']['filename']
)
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_openvswitch_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service 'neutron-openvswitch-switch' do
service_name platform_options['neutron_openvswitch_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, "template[#{plugin_file_path}]"
end

View File

@ -1,47 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: openvswitch_agent
#
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
include_recipe 'openstack-network::ml2_openvswitch'
plugin_file_path = File.join(
node['openstack']['network']['plugins']['openvswitch']['path'],
node['openstack']['network']['plugins']['openvswitch']['filename']
)
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_openvswitch_agent_packages'] do
action :upgrade
options platform_options['package_overrides']
end
int_bridge = node['openstack']['network']['plugins']['openvswitch']['conf'].[]('DEFAULT')['integration_bridge']
execute 'create integration network bridge' do
command "ovs-vsctl --may-exist add-br #{int_bridge}"
end
service 'neutron-openvswitch-agent' do
service_name platform_options['neutron_openvswitch_agent_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/neutron/neutron.conf]',
"template[#{plugin_file_path}]",
]
end

View File

@ -1,39 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: plugin_config
#
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
node['openstack']['network']['plugins'].each_value do |plugin|
next if plugin['path'].nil?
directory plugin['path'] do
recursive true
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '700'
end
template File.join(plugin['path'], plugin['filename']) do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
variables(
service_config: plugin['conf']
)
end
end

View File

@ -1,80 +0,0 @@
#
# Cookbook:: openstack-network
# Recipe:: server
#
# Copyright:: 2013-2021, AT&T
# Copyright:: 2013-2021, SUSE Linux GmbH
# Copyright:: 2020-2021, Oregon State University
#
# 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.
#
include_recipe 'openstack-network'
# Make Openstack object available in Chef::Recipe
class ::Chef::Recipe
include ::Openstack
end
template '/etc/default/neutron-server' do
source 'neutron-server.erb'
owner 'root'
group 'root'
mode '644'
variables(
core_plugin_config: node['openstack']['network']['core_plugin_config_file']
)
only_if { platform_family?('debian') }
end
platform_options = node['openstack']['network']['platform']
package platform_options['neutron_server_packages'] do
options platform_options['package_overrides']
action :upgrade
end
db_type = node['openstack']['db']['network']['service_type']
package node['openstack']['db']['python_packages'][db_type] do
options platform_options['package_overrides']
action :upgrade
end
if node['openstack']['network']['policyfile_url']
remote_file '/etc/neutron/policy.json' do
source node['openstack']['network']['policyfile_url']
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode '644'
end
end
# Migrate network database to latest version
include_recipe 'openstack-network::db_migration'
plugin_templates = []
node['openstack']['network']['plugins'].each_value.to_s do |plugin|
plugin_templates << "template[#{File.join(plugin['path'], plugin['filename'])}]"
end
service 'neutron-server' do
service_name platform_options['neutron_server_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
plugin_templates,
'template[/etc/neutron/neutron.conf]',
'remote_file[/etc/neutron/policy.json]',
].flatten
end
include_recipe 'openstack-network::identity_registration'

View File

@ -1,55 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::_bridge_config_example' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
before do
%w(eth-ext eth-vlan eth-tun).each do |eth|
stub_command("ip link show | grep #{eth}")
end
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
.with('eth-tun')
.and_return('1.2.3.4')
end
describe 'create ovs external network bridge and port' do
let(:cmd_br) { 'ovs-vsctl --may-exist add-br br-ex' }
let(:cmd_port) { 'ovs-vsctl --may-exist add-port br-ex eth-ext' }
let(:name) { 'create external network bridge' }
it 'adds external network bridge' do
expect(chef_run).to run_execute(name).with(command: cmd_br)
end
it 'adds external network bridge port' do
expect(chef_run).to run_execute("#{name} port").with(command: cmd_port)
end
end
describe 'create vlan network bridge and port' do
let(:cmd_br) { 'ovs-vsctl --may-exist add-br br-vlan' }
let(:cmd_port) { 'ovs-vsctl --may-exist add-port br-vlan eth-vlan' }
let(:name) { 'create vlan network bridge' }
it 'adds vlan network bridge' do
expect(chef_run).to run_execute(name).with(command: cmd_br)
end
it 'adds vlan network bridge port' do
expect(chef_run).to run_execute("#{name} port").with(command: cmd_port)
end
end
describe 'create tunnel network bridge' do
let(:cmd_br) { 'ovs-vsctl --may-exist add-br br-tun' }
let(:name) { 'create tunnel network bridge' }
it 'adds tunnel network bridge' do
expect(chef_run).to run_execute(name).with(command: cmd_br)
end
end
end
end

View File

@ -1,32 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::db_migration' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
it 'uses db upgrade head with default timeout for neutron-server' do
expect(chef_run).to run_execute('migrate network database').with(
command: "neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head\n",
timeout: 3600
)
end
context 'uses db upgrade head with timeout override for neutron-server' do
cached(:chef_run) do
node.override['openstack']['network']['dbsync_timeout'] = 1234
runner.converge(described_recipe)
end
it do
expect(chef_run).to run_execute('migrate network database').with(
command: "neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head\n",
timeout: 1234
)
end
end
end
end

View File

@ -1,44 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
pkgs =
%w(
ebtables
iproute
openstack-neutron
openstack-neutron-ml2
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
case p
when REDHAT_7
it do
expect(chef_run).to upgrade_package('MySQL-python')
end
when REDHAT_8
it do
expect(chef_run).to upgrade_package('python3-PyMySQL')
end
end
it do
expect(chef_run).to create_cookbook_file('/usr/bin/neutron-enable-bridge-firewall.sh').with(
source: 'neutron-enable-bridge-firewall.sh',
owner: 'root',
group: 'wheel',
mode: '0755'
)
end
end
end
end

View File

@ -1,134 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
packages = %w(neutron-common python3-neutron)
it do
expect(chef_run).to upgrade_package(packages)
end
it do
expect(chef_run).to upgrade_package('python3-mysqldb')
end
it do
expect(chef_run).to_not create_cookbook_file('/usr/bin/neutron-enable-bridge-firewall.sh')
end
describe '/etc/neutron/rootwrap.conf' do
it do
expect(chef_run).to create_template('/etc/neutron/rootwrap.conf').with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
owner: 'neutron',
group: 'neutron',
mode: '644'
)
end
let(:file) { chef_run.template('/etc/neutron/rootwrap.conf') }
[
%r{^filters_path = /etc/neutron/rootwrap\.d,/usr/share/neutron/rootwrap$},
%r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$},
/^use_syslog = false$/,
/^syslog_log_facility = syslog$/,
/^syslog_log_level = ERROR$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
end
end
end
describe '/etc/neutron/neutron.conf' do
it do
expect(chef_run).to create_template('/etc/neutron/neutron.conf').with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
owner: 'neutron',
group: 'neutron',
mode: '640',
sensitive: true
)
end
let(:file) { chef_run.template('/etc/neutron/neutron.conf') }
[
%r{^log_dir = /var/log/neutron$},
/^control_exchange = neutron$/,
/^core_plugin = ml2$/,
/^bind_host = 127\.0\.0\.1$/,
/^bind_port = 9696$/,
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
[
%r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$},
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('agent', line)
end
end
[
/^auth_type = password$/,
/^region_name = RegionOne$/,
/^username = neutron$/,
/^user_domain_name = Default/,
/^project_domain_name = Default/,
/^project_name = service$/,
/^auth_version = v3$/,
%r{^auth_url = http://127.0.0.1:5000/v3$},
/^password = neutron-pass$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
end
end
[
/^auth_type = password$/,
/^region_name = RegionOne$/,
/^username = nova$/,
/^user_domain_name = Default/,
/^project_name = service$/,
/^project_domain_name = Default/,
%r{^auth_url = http://127.0.0.1:5000/v3$},
/^password = nova-pass$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('nova', line)
end
end
[
%r{^lock_path = /var/lib/neutron/lock$},
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', line)
end
end
[
%(connection = mysql+pymysql://neutron:neutron@127.0.0.1:3306/neutron?charset=utf8),
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('database', line)
end
end
end
it do
allow(chef_run).to receive(:"node['openstack']['network']['conf_secrets']").and_return(nil)
end
it do
expect(chef_run).to run_ruby_block("delete all attributes in node['openstack']['network']['conf_secrets']")
end
end
end

View File

@ -1,26 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
let(:file_cache_path) { Chef::Config[:file_cache_path] }
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron iproute))
end
it do
expect(chef_run).to upgrade_package('dnsmasq')
end
end
end
end

View File

@ -1,90 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to include_recipe('openstack-network')
end
%w(
template[/etc/neutron/neutron.conf]
template[/etc/neutron/dnsmasq.conf]
template[/etc/neutron/dhcp_agent.ini]
).each do |resource|
it do
expect(chef_run.service('neutron-dhcp-agent')).to subscribe_to(resource).delayed
end
end
it do
expect(chef_run).to_not upgrade_rpm_package('dnsmasq')
end
it do
expect(chef_run).to upgrade_package 'neutron-dhcp-agent'
end
it do
expect(chef_run).to enable_service('neutron-dhcp-agent').with(
service_name: 'neutron-dhcp-agent',
supports: {
restart: true,
status: true,
}
)
end
it do
expect(chef_run).to start_service 'neutron-dhcp-agent'
end
describe 'dhcp_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/dhcp_agent.ini') }
it 'creates dhcp_agent.ini' do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'neutron',
group: 'neutron',
mode: '644'
)
end
[
/^interface_driver = openvswitch$/,
%r{^dnsmasq_config_file = /etc/neutron/dnsmasq.conf$},
].each do |line|
it do
expect(chef_run).to render_config_file('/etc/neutron/dhcp_agent.ini').with_section_content('DEFAULT', line)
end
end
end
describe '/etc/neutron/dnsmasq.conf' do
let(:file) { chef_run.template('/etc/neutron/dnsmasq.conf') }
it 'creates dnsmasq.conf' do
expect(chef_run).to create_template(file.name).with(
source: 'dnsmasq.conf.erb',
user: 'neutron',
group: 'neutron',
mode: '644'
)
end
[
/^server=8.8.8.8$/,
/^server=208.67.222.222$/,
].each do |line|
it do
expect(chef_run).to render_file('/etc/neutron/dnsmasq.conf').with_content(line)
end
end
end
end
end

View File

@ -1,77 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::identity_registration' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
connection_params = {
openstack_auth_url: 'http://127.0.0.1:5000/v3',
openstack_username: 'admin',
openstack_api_key: 'admin-pass',
openstack_project_name: 'admin',
openstack_domain_name: 'default',
# openstack_endpoint_type: 'internalURL',
}
service_name = 'neutron'
service_type = 'network'
service_user = 'neutron'
url = 'http://127.0.0.1:9696'
region = 'RegionOne'
project_name = 'service'
role_name = 'admin'
password = 'neutron-pass'
domain_name = 'Default'
it "registers #{project_name} Project" do
expect(chef_run).to create_openstack_project(
project_name
).with(
connection_params: connection_params
)
end
it "registers #{service_name} service" do
expect(chef_run).to create_openstack_service(
service_name
).with(
connection_params: connection_params,
type: service_type
)
end
context "registers #{service_name} endpoint" do
%w(internal public).each do |interface|
it "#{interface} endpoint with default values" do
expect(chef_run).to create_openstack_endpoint(
service_type
).with(
service_name: service_name,
# interface: interface,
url: url,
region: region,
connection_params: connection_params
)
end
end
end
it 'registers service user' do
expect(chef_run).to create_openstack_user(
service_user
).with(
domain_name: domain_name,
project_name: project_name,
role_name: role_name,
password: password,
connection_params: connection_params
)
end
end
end

View File

@ -1,28 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::l3_agent' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
stub_command('ovs-vsctl br-exists br-ex').and_return(false)
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
pkgs =
%w(
iproute
keepalived
openstack-neutron
radvd
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
end
end
end

View File

@ -1,89 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::l3_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network_l3']['external_network_bridge_interface'] = 'enp0s8'
runner.converge(described_recipe)
end
describe 'recipe' do
include_context 'neutron-stubs'
it do
expect(chef_run).to enable_service('neutron-l3-agent').with(
service_name: 'neutron-l3-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-l3-agent')
end
it do
expect(chef_run.service('neutron-l3-agent')).to \
subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart)
end
pkgs =
%w(
keepalived
neutron-l3-agent
radvd
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
describe 'l3_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/l3_agent.ini') }
it 'creates l3_agent.ini' do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'neutron',
group: 'neutron',
mode: '640'
)
end
[
/^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
].each do |line|
it do
expect(chef_run).to render_config_file('/etc/neutron/l3_agent.ini').with_section_content('DEFAULT', line)
end
end
context 'template contents' do
cached(:chef_run) do
node.override['openstack']['network_l3']['conf']['DEFAULT']['external_network_bridge'] = 'network_l3_external_network_bridge_value'
runner.converge(described_recipe)
end
it_behaves_like 'common network attributes displayer', 'l3' do
let(:file_name) { file.name }
end
it 'displays the external_network_bridge l3 attribute' do
stub_command('ovs-vsctl br-exists network_l3_external_network_bridge_value').and_return(false)
expect(chef_run).to render_config_file(file.name)
.with_section_content(
'DEFAULT',
/^external_network_bridge = network_l3_external_network_bridge_value$/
)
end
end
it do
expect(file).to notify('service[neutron-l3-agent]').to(:restart).delayed
end
end
end
end
end

View File

@ -1,30 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::metadata_agent' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to enable_service('neutron-metadata-agent').with(
service_name: 'neutron-metadata-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-metadata-agent')
end
end
end
end

View File

@ -1,67 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::metadata_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package 'neutron-metadata-agent'
end
it do
expect(chef_run).to enable_service('neutron-metadata-agent').with(
service_name: 'neutron-metadata-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-metadata-agent')
end
%w(template[/etc/neutron/neutron.conf] template[/etc/neutron/metadata_agent.ini]).each do |resource|
it do
expect(chef_run.service('neutron-metadata-agent')).to subscribe_to(resource).delayed
end
end
describe 'metadata_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/metadata_agent.ini') }
it 'creates metadata_agent.ini' do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'neutron',
group: 'neutron',
mode: '644',
sensitive: true
)
end
context 'template contents' do
[
/^metadata_proxy_shared_secret = metadata-secret$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
end
end
it do
expect(chef_run).to run_ruby_block('delete all attributes in '\
"node['openstack']['network_metadata']['conf_secrets']")
end
end
end

View File

@ -1,27 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::metering_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package('neutron-metering-agent')
end
it do
expect(chef_run).to enable_service('neutron-metering-agent').with(
service_name: 'neutron-metering-agent',
supports: {
status: true,
restart: true,
}
)
end
end
end

View File

@ -1,56 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::metering_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package('neutron-metering-agent')
end
describe 'metering_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/metering_agent.ini') }
it do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'neutron',
group: 'neutron',
mode: '640'
)
end
it do
[
/^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
/^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
end
it do
expect(chef_run).to enable_service('neutron-metering-agent').with(
service_name: 'neutron-metering-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-metering-agent')
end
%w(template[/etc/neutron/neutron.conf] template[/etc/neutron/metering_agent.ini]).each do |resource|
it do
expect(chef_run.service('neutron-metering-agent')).to subscribe_to(resource).delayed
end
end
end
end

View File

@ -1,54 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::ml2_linuxbridge' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['plugins']['linuxbridge']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['linuxbridge']['filename'] = 'linuxbridge_agent.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it 'creates the /etc/neutron/plugins/ml2 agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/ml2').with(
owner: 'neutron',
group: 'neutron',
mode: '700'
)
end
it do
expect(chef_run).to include_recipe('openstack-network::plugin_config')
end
describe '/etc/neutron/plugins/ml2/linuxbridge_agent.ini' do
let(:file) do
chef_run.template('/etc/neutron/plugins/ml2/linuxbridge_agent.ini')
end
[
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name)
.with_section_content('securitygroup', line)
end
end
end
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron-linuxbridge iproute))
end
it do
expect(chef_run).to enable_service('neutron-linuxbridge-agent')
end
it do
service = chef_run.service('neutron-linuxbridge-agent')
expect(service).to(subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed) && subscribe_to('template[/etc/neutron/plugins/ml2/linuxbridge_agent.ini]').on(:restart).delayed
end
end
end
end

View File

@ -1,74 +0,0 @@
# pkg upgrade
# service
# Encoding: utf-8
require_relative 'spec_helper'
describe 'openstack-network::ml2_linuxbridge' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
node.override['openstack']['network']['plugins']['linuxbridge']['path'] = '/etc/neutron/plugins/linuxbridge'
node.override['openstack']['network']['plugins']['linuxbridge']['filename'] = 'linuxbridge_conf.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to create_directory('/etc/neutron/plugins/linuxbridge').with(
owner: 'neutron',
group: 'neutron',
mode: '700'
)
end
it do
expect(chef_run).to include_recipe('openstack-network::plugin_config')
end
describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
let(:file) do
chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
end
[
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
].each do |line|
it "[securitygroup] #{line}" do
expect(chef_run).to render_config_file(file.name).with_section_content('securitygroup', line)
end
end
end
it do
expect(chef_run).to upgrade_package 'neutron-linuxbridge-agent'
end
it do
expect(chef_run).to enable_service('neutron-plugin-linuxbridge-agent').with(
service_name: 'neutron-linuxbridge-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-plugin-linuxbridge-agent')
end
%w(
template[/etc/neutron/neutron.conf]
template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]
).each do |resource|
it do
expect(chef_run.service('neutron-plugin-linuxbridge-agent')).to subscribe_to(resource).delayed
end
end
end
end

View File

@ -1,36 +0,0 @@
# pkg upgrade
# service
# Encoding: utf-8
require_relative 'spec_helper'
describe 'openstack-network::ml2_openvswitch' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe, 'openstack-network::plugin_config')
end
include_context 'neutron-stubs'
it do
expect(chef_run).to include_recipe('openstack-network::ml2_core_plugin')
end
describe '/etc/neutron/plugins/ml2/openvswitch_agent.ini' do
let(:file) do
chef_run.template('/etc/neutron/plugins/ml2/openvswitch_agent.ini')
end
[
/^integration_bridge = br-int$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
end
end
end

View File

@ -1,29 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
it do
expect(chef_run).to upgrade_package 'openvswitch'
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-switch').with(
service_name: 'openvswitch',
supports: {
status: true,
restart: true,
}
)
end
end
end
end
end

View File

@ -1,34 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch_agent' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['openvswitch']['integration_bridge'] = 'br-int'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
before do
stub_command('ovs-vsctl --may-exist add-br br-int')
end
it do
expect(chef_run).to upgrade_package %w(openstack-neutron-openvswitch iproute)
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-agent').with(
service_name: 'neutron-openvswitch-agent',
supports: {
status: true,
restart: true,
}
)
end
end
end
end

View File

@ -1,49 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['openvswitch']['integration_bridge'] = 'br-int'
runner.converge(described_recipe, 'openstack-network::plugin_config')
end
include_context 'neutron-stubs'
before do
stub_command('ovs-vsctl --may-exist add-br br-int')
end
it do
expect(chef_run).to upgrade_package 'neutron-openvswitch-agent'
end
it do
expect(chef_run).to run_execute('create integration network bridge')
.with(command: 'ovs-vsctl --may-exist add-br br-int')
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-agent').with(
service_name: 'neutron-openvswitch-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service 'neutron-openvswitch-agent'
end
%w(
template[/etc/neutron/neutron.conf]
template[/etc/neutron/plugins/ml2/openvswitch_agent.ini]
).each do |t|
it t do
expect(chef_run.service('neutron-openvswitch-agent')).to subscribe_to(t).on(:restart)
end
end
end
end

View File

@ -1,34 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe, 'openstack-network::plugin_config')
end
it do
expect(chef_run).to upgrade_package %w(openvswitch-switch bridge-utils)
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-switch').with(
service_name: 'openvswitch-switch',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service 'neutron-openvswitch-switch'
end
it do
expect(chef_run.service('neutron-openvswitch-switch')).to \
subscribe_to('template[/etc/neutron/plugins/ml2/openvswitch_agent.ini]').on(:restart)
end
end
end

View File

@ -1,44 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::plugin_config' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['plugins']['ml2'].tap do |ml2|
ml2['path'] = '/etc/neutron/more_plugins'
ml2['filename'] = 'ml2_conf.ini'
ml2['conf'].tap do |conf|
conf['section']['key'] = 'value'
end
end
node.override['openstack']['network']['plugins']['openvswitch'].tap do |ovs|
ovs['path'] = '/etc/neutron/plugins/'
ovs['filename'] = 'openvswitch_conf.ini'
ovs['conf'].tap do |conf|
conf['section']['key'] = 'value'
end
end
runner.converge(described_recipe)
end
%w(/etc/neutron/more_plugins /etc/neutron/plugins/).each do |dir|
it do
expect(chef_run).to create_directory(dir)
.with(
recursive: true,
owner: 'neutron',
group: 'neutron',
mode: '700'
)
end
%w(ml2_conf.ini openvswitch_conf.ini).each do |conf|
let(:file) { chef_run.template(File.join(dir, conf)) }
it do
expect(chef_run).to render_config_file(file.name).with_section_content('section', 'key = value')
end
end
end
end
end

View File

@ -1,30 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::server' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
node.override['openstack']['network']['plugins']['ml2']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['ml2']['filename'] = 'openvswitch_agent.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package %w(ebtables iproute openstack-neutron openstack-neutron-ml2)
end
it do
expect(chef_run).to enable_service 'neutron-server'
end
it 'does not upgrade openvswitch package' do
expect(chef_run).not_to upgrade_package 'openvswitch'
expect(chef_run).not_to enable_service 'neutron-openvswitch-agent'
end
end
end
end

View File

@ -1,114 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-network::server' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
end
include_context 'neutron-stubs'
describe 'package and services' do
it do
expect(chef_run).to upgrade_package %w(neutron-server)
end
context 'allows overriding package names' do
cust_pkgs = %w(my-neutron my-other-neutron)
cached(:chef_run) do
node.override['openstack']['network']['platform']['neutron_server_packages'] = cust_pkgs
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
end
it do
expect(chef_run).to upgrade_package(cust_pkgs)
end
end
it do
expect(chef_run).to enable_service('neutron-server').with(
service_name: 'neutron-server',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service 'neutron-server'
end
let(:neutron_service) { chef_run.service('neutron-server') }
it do
expect(neutron_service).to subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed
end
it do
expect(neutron_service).to_not subscribe_to('remote_file[/etc/neutron/policy.json]').on(:restart).delayed
end
context 'set policyfile_url' do
cached(:chef_run) do
node.override['openstack']['network']['policyfile_url'] = 'http://www.someurl.com'
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
end
it do
expect(neutron_service).to subscribe_to('remote_file[/etc/neutron/policy.json]').on(:restart).delayed
end
end
context 'allows overriding service names' do
cached(:chef_run) do
node.override['openstack']['network']['platform']['neutron_server_service'] = 'my-neutron-server'
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
end
it do
expect(chef_run).to enable_service('neutron-server').with(
service_name: 'my-neutron-server'
)
end
end
context 'allows overriding package options' do
cust_opts = ['-o', 'Dpkg::Options::=--force-confold', '-o', 'Dpkg::Options::=--force-confdef', '--force-yes']
cached(:chef_run) do
node.override['openstack']['network']['platform']['package_overrides'] = cust_opts
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
end
it do
expect(chef_run).to upgrade_package('neutron-server').with(options: cust_opts)
end
end
it 'does not upgrade openvswitch package or the agent' do
expect(chef_run).not_to upgrade_package 'openvswitch'
expect(chef_run).not_to upgrade_package 'neutron-plugin-openvswitch-agent'
expect(chef_run).not_to enable_service 'neutron-plugin-openvswitch-agent'
end
end
describe '/etc/default/neutron-server' do
let(:file) { chef_run.template('/etc/default/neutron-server') }
it 'creates /etc/default/neutron-server' do
expect(chef_run).to create_template(file.name).with(
source: 'neutron-server.erb',
user: 'root',
group: 'root',
mode: '644',
variables: {
core_plugin_config: '/etc/neutron/plugins/ml2/ml2_conf.ini',
}
)
end
it do
expect(chef_run).to render_file(file.name).with_content(
%r{^NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini"$}
)
end
end
end
end

View File

@ -1,70 +0,0 @@
require 'chefspec'
require 'pry'
require 'chefspec/berkshelf'
require 'chef/application'
RSpec.configure do |config|
config.color = true
config.formatter = :documentation
config.log_level = :warn
end
REDHAT_7 = {
platform: 'redhat',
version: '7',
}.freeze
REDHAT_8 = {
platform: 'redhat',
version: '8',
}.freeze
ALL_RHEL = [
REDHAT_7,
REDHAT_8,
].freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '18.04',
}.freeze
shared_context 'neutron-stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_identity_bootstrap_token')
.and_return('bootstrap-token')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'neutron_metadata_secret')
.and_return('metadata-secret')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('db', anything)
.and_return('neutron')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-network')
.and_return('neutron-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'guest')
.and_return('mq-pass')
allow(Chef::Application).to receive(:fatal!)
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-compute')
.and_return('nova-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin-pass')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('network')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
end
shared_examples 'common network attributes displayer' do |plugin|
cached(:chef_run) do
node.override['openstack']["network_#{plugin}"]['conf']['DEFAULT']['interface_driver'] = 'network_interface_driver_value'
runner.converge(described_recipe)
end
it 'displays the interface_driver common attribute' do
expect(chef_run).to render_file(file_name).with_content(/^interface_driver = network_interface_driver_value$/)
end
end
end

View File

@ -1,6 +0,0 @@
<% node['openstack']['network']['dnsmasq']['upstream_dns_servers'].each do |dns_server| -%>
server=<%= dns_server %>
<% end -%>
<% node['openstack']['network']['dnsmasq']['override_dns_address'].each do |address_record| -%>
address=<%= address_record %>
<% end -%>

View File

@ -1,6 +0,0 @@
<%= node["openstack"]["network"]["custom_template_banner"] %>
# defaults for neutron-server
# path to config file corresponding to the core_plugin specified in
# neutron.conf
NEUTRON_PLUGIN_CONFIG="<%=@core_plugin_config%>"