diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 790a6be..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -payload/* -.tox -bin -.testrepository -*.sw[nop] -*.pyc -interfaces -build diff --git a/.project b/.project deleted file mode 100644 index fe7878b..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - neutron-api-odl - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/.pydevproject b/.pydevproject deleted file mode 100644 index a6c713a..0000000 --- a/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/neutron-api-odl - -python 2.7 -Default - diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 801646b..0000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION - -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/.zuul.yaml b/.zuul.yaml index 5e75d94..e7c200a 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,3 @@ - project: templates: - - python-charm-jobs - - openstack-python35-jobs + - noop-jobs diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d645695..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +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. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b72ee4f --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +This project is no longer maintained. + +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". diff --git a/actions/.keep b/actions/.keep deleted file mode 100644 index f49b91a..0000000 --- a/actions/.keep +++ /dev/null @@ -1,3 +0,0 @@ - This file was created by release-tools to ensure that this empty - directory is preserved in vcs re: lint check definitions in global - tox.ini files. This file can be removed if/when this dir is actually in use. diff --git a/lib/.keep b/lib/.keep deleted file mode 100644 index f49b91a..0000000 --- a/lib/.keep +++ /dev/null @@ -1,3 +0,0 @@ - This file was created by release-tools to ensure that this empty - directory is preserved in vcs re: lint check definitions in global - tox.ini files. This file can be removed if/when this dir is actually in use. diff --git a/rebuild b/rebuild deleted file mode 100644 index 3be1b80..0000000 --- a/rebuild +++ /dev/null @@ -1,5 +0,0 @@ -# This file is used to trigger rebuilds -# when dependencies of the charm change, -# but nothing in the charm needs to. -# simply change the uuid to something new -a17bf1c0-2152-11e8-b051-135052a09299 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 20f335d..0000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -# This file is managed centrally. If you find the need to modify this as a -# one-off, please don't. Intead, consult #openstack-charms and ask about -# requirements management in charms via bot-control. Thank you. -# -# Build requirements -charm-tools>=2.4.4 -simplejson diff --git a/src/README.md b/src/README.md deleted file mode 100644 index 174ee2a..0000000 --- a/src/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Restrictions - -This charm supports deployment with OpenStack Icehouse or better. diff --git a/src/TODO b/src/TODO deleted file mode 100644 index 8c3cfbc..0000000 --- a/src/TODO +++ /dev/null @@ -1,17 +0,0 @@ -Todo: -* Figure out how to do new world v oldworld rendering -* Just about everything. -* I: No icon.svg file. -* W: no copyright file -* W: no README file -* I: missing recommended hook start -* Confd ssh keys installed from /cisco/etc/confd/ssh -* Interfaces allocated to VPP should be configured within the /cisco/etc/qn.conf file via a Cisco provided script - -Done-ish -* QEMU 2.2 and libvirt 1.2.8 or greater. - -Done -* 1GB of hugepages allocated upon system boot. Adjusting vm.nr_hugepages within the /etc/sysctl.conf. -* vm.max_map_count should be adjusted in line with hugepages (The default of 65536 equals 1GB of hugepages) -* For debugging purposes, apport needs to be uninstalled and corekeeper installed in its place on compute hosts. diff --git a/src/config.yaml b/src/config.yaml deleted file mode 100644 index a832465..0000000 --- a/src/config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -options: - vlan-ranges: - type: string - default: "physnet1:1000:2000" - description: | - Space-delimited list of Neutron network-provider & vlan-id-ranges using - the following format ":: ...". - overlay-network-type: - default: gre - type: string - description: | - Overlay network types to use, valid options include: - . - gre - vxlan - . - Multiple types can be provided - field is space delimited. - security-groups: - default: false - type: boolean - description: Enable OpenDayLight managed security groups. diff --git a/src/copyright b/src/copyright deleted file mode 100644 index 92252ff..0000000 --- a/src/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 - -Files: * -Copyright: 2015, Canonical Ltd. -License: Apache-2.0 - 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. diff --git a/src/files/qemu-hugefsdir b/src/files/qemu-hugefsdir deleted file mode 100755 index 48b33e0..0000000 --- a/src/files/qemu-hugefsdir +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh -# -### BEGIN INIT INFO -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Provides: qemu-hugefsdir -# Default-Start: 2 3 4 5 -# Default-Stop: 0 6 -# Short-Description: Make sure qemu gets a temp hugetblfs dir -# Description: Make sure qemu gets a temp hugetblfs dir -### END INIT INFO - -mkdir -p /mnt/huge/libvirt/qemu || true -chown libvirt-qemu:libvirtd /mnt/huge/libvirt/qemu diff --git a/src/icon.svg b/src/icon.svg deleted file mode 100644 index 16db19c..0000000 --- a/src/icon.svg +++ /dev/null @@ -1,664 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/layer.yaml b/src/layer.yaml deleted file mode 100644 index b16ef13..0000000 --- a/src/layer.yaml +++ /dev/null @@ -1,5 +0,0 @@ -includes: ['layer:openstack', 'interface:neutron-plugin-api-subordinate', 'interface:odl-controller-api'] -options: - basic: - use_venv: True - include_system_packages: True diff --git a/src/lib/charm/openstack/neutron_api_odl.py b/src/lib/charm/openstack/neutron_api_odl.py deleted file mode 100644 index e4ed619..0000000 --- a/src/lib/charm/openstack/neutron_api_odl.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -import charms_openstack.adapters -import charms_openstack.charm -import charmhelpers.contrib.openstack.utils as ch_utils - - -ML2_CONF = '/etc/neutron/plugins/ml2/ml2_conf.ini' -VLAN = 'vlan' -VXLAN = 'vxlan' -GRE = 'gre' -OVERLAY_NET_TYPES = [VXLAN, GRE] - - -@charms_openstack.adapters.config_property -def overlay_net_types(config): - overlay_networks = config.overlay_network_type.split() - for overlay_net in overlay_networks: - if overlay_net not in OVERLAY_NET_TYPES: - raise ValueError( - 'Unsupported overlay-network-type {}'.format(overlay_net)) - return ','.join(overlay_networks) - - -@charms_openstack.charm.register_os_release_selector -def choose_charm_class(): - """Choose the charm class based on the neutron-common package installed""" - return ch_utils.os_release('neutron-common') - - -class IcehouseNeutronAPIODLCharm(charms_openstack.charm.OpenStackCharm): - - name = 'neutron-api-odl' - release = 'icehouse' - - packages = ['neutron-common', 'neutron-plugin-ml2'] - - required_relations = ['neutron-plugin-api-subordinate', 'odl-controller'] - - restart_map = {ML2_CONF: []} - adapters_class = charms_openstack.adapters.OpenStackRelationAdapters - - # Custom configure for the class - service_plugins = 'router,firewall,lbaas,vpnaas,metering' - - def configure_plugin(self, api_principle): - """Add sections and tuples to insert values into neutron-server's - neutron.conf - """ - inject_config = { - "neutron-api": { - "/etc/neutron/neutron.conf": { - "sections": { - 'DEFAULT': [ - ], - } - } - } - } - - api_principle.configure_plugin( - neutron_plugin='odl', - core_plugin='neutron.plugins.ml2.plugin.Ml2Plugin', - neutron_plugin_config='/etc/neutron/plugins/ml2/ml2_conf.ini', - service_plugins=self.service_plugins, - subordinate_configuration=inject_config) - - -class KiloNeutronAPIODLCharm(IcehouseNeutronAPIODLCharm): - """For the kilo release we have an additional package to install: - 'python-networking-odl' - """ - - release = 'kilo' - - packages = ['neutron-common', - 'neutron-plugin-ml2', - 'python-networking-odl', - ] - - -class NewtonNeutronAPIODLCharm(KiloNeutronAPIODLCharm): - """For Newton, the service_plugins on the configuration is different. - """ - - release = 'newton' - - # NOTE: LBaaS v2 for >= newton - service_plugins = ('router,firewall,vpnaas,metering,' - 'neutron_lbaas.services.loadbalancer.' - 'plugin.LoadBalancerPluginv2') diff --git a/src/metadata.yaml b/src/metadata.yaml deleted file mode 100644 index b47cc0a..0000000 --- a/src/metadata.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: neutron-api-odl -subordinate: true -summary: OpenStack Networking - OpenDayLight mechanism driver -maintainer: OpenStack Charmers -description: | - Neutron is a virtual network service for OpenStack, and a part of - Netstack. Just like OpenStack Nova provides an API to dynamically - request and configure virtual servers, Neutron provides an API to - dynamically request and configure virtual networks. These networks - connect "interfaces" from other OpenStack services (e.g., virtual NICs - from Nova VMs). The Neutron API supports extensions to provide - advanced network capabilities (e.g., QoS, ACLs, network monitoring, - etc.) - . - This charm configures the neutron-api service with the OpenDayLight - SDN solution. -tags: - - openstack -series: - - xenial - - bionic - - cosmic - - trusty -provides: - neutron-plugin-api-subordinate: - interface: neutron-plugin-api-subordinate - scope: container -requires: - odl-controller: - interface: odl-controller-api - container: - interface: juju-info - scope: container diff --git a/src/reactive/neutron_api_odl_handlers.py b/src/reactive/neutron_api_odl_handlers.py deleted file mode 100644 index 79c1e03..0000000 --- a/src/reactive/neutron_api_odl_handlers.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -import charms.reactive as reactive - -import charms_openstack.charm as charm - -# This charm's library contains all of the handler code associated with -# neutron_api_odl -import charm.openstack.neutron_api_odl as neutron_api_odl - - -charm.use_defaults( - 'charm.installed', - 'config.changed', - 'update-status') - - -@reactive.when('odl-controller.available') -def render_config(*args): - with charm.provide_charm_instance() as neutron_api_odl_charm: - neutron_api_odl_charm.render_with_interfaces(args) - neutron_api_odl_charm.assess_status() - - -@reactive.when('neutron-plugin-api-subordinate.connected') -def configure_plugin(api_principle): - with charm.provide_charm_instance() as neutron_api_odl_charm: - neutron_api_odl_charm.configure_plugin(api_principle) - neutron_api_odl_charm.assess_status() - - -@reactive.when_file_changed(neutron_api_odl.ML2_CONF) -@reactive.when('neutron-plugin-api-subordinate.connected') -def remote_restart(api_principle): - api_principle.request_restart() diff --git a/src/templates/ml2_conf.ini b/src/templates/ml2_conf.ini deleted file mode 100644 index 67b69d3..0000000 --- a/src/templates/ml2_conf.ini +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################### -# [ WARNING ] -# Configuration file maintained by Juju. Local changes may be overwritten. -############################################################################### -[ml2] -type_drivers = {{ options.overlay_net_types }},local,flat,vlan -tenant_network_types = {{ options.overlay_net_types }} -mechanism_drivers = opendaylight - -[ml2_type_flat] -# Provider nets only - -[ml2_type_vlan] -# Provider nets only - -[ml2_type_gre] -tunnel_id_ranges = 1:1000 - -[ml2_type_vxlan] -vni_ranges = 1001:2000 - -[ml2_odl] -username = {{ odl_controller.username }} -password = {{ odl_controller.password }} -url = http://{{ odl_controller.private_address }}:{{ odl_controller.port }}/controller/nb/v2/neutron - -[securitygroup] -{% if options.security_groups -%} -enable_security_group = True -{% else -%} -enable_security_group = False -{% endif -%} diff --git a/src/test-requirements.txt b/src/test-requirements.txt deleted file mode 100644 index f013863..0000000 --- a/src/test-requirements.txt +++ /dev/null @@ -1,33 +0,0 @@ -# This file is managed centrally. If you find the need to modify this as a -# one-off, please don't. Intead, consult #openstack-charms and ask about -# requirements management in charms via bot-control. Thank you. -charm-tools>=2.4.4 -coverage>=3.6 -mock>=1.2 -flake8>=2.2.4,<=2.4.1 -os-testr>=0.4.1 -requests>=2.18.4 -# BEGIN: Amulet OpenStack Charm Helper Requirements -# Liberty client lower constraints -amulet>=1.14.3,<2.0;python_version=='2.7' -bundletester>=0.6.1,<1.0;python_version=='2.7' -aodhclient>=0.1.0 -gnocchiclient>=3.1.0,<3.2.0 -python-barbicanclient>=4.0.1 -python-ceilometerclient>=1.5.0 -python-cinderclient>=1.4.0 -python-designateclient>=1.5 -python-glanceclient>=1.1.0 -python-heatclient>=0.8.0 -python-keystoneclient>=1.7.1 -python-manilaclient>=1.8.1 -python-neutronclient>=3.1.0 -python-novaclient>=2.30.1 -python-openstackclient>=1.7.0 -python-swiftclient>=2.6.0 -pika>=0.10.0,<1.0 -distro-info -git+https://github.com/juju/charm-helpers.git#egg=charmhelpers -# END: Amulet OpenStack Charm Helper Requirements -pytz # workaround for 14.04 pip/tox -pyudev # for ceph-* charm unit tests (not mocked?) diff --git a/src/tests/README.md b/src/tests/README.md deleted file mode 100644 index 046be7f..0000000 --- a/src/tests/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Overview - -This directory provides Amulet tests to verify basic deployment functionality -from the perspective of this charm, its requirements and its features, as -exercised in a subset of the full OpenStack deployment test bundle topology. - -For full details on functional testing of OpenStack charms please refer to -the [functional testing](http://docs.openstack.org/developer/charm-guide/testing.html#functional-testing) -section of the OpenStack Charm Guide. diff --git a/src/tests/basic_deployment.py b/src/tests/basic_deployment.py deleted file mode 100644 index c935adf..0000000 --- a/src/tests/basic_deployment.py +++ /dev/null @@ -1,275 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -import amulet -import os -from neutronclient.v2_0 import client as neutronclient - -from charmhelpers.contrib.openstack.amulet.deployment import ( - OpenStackAmuletDeployment -) - -from charmhelpers.contrib.openstack.amulet.utils import ( - OpenStackAmuletUtils, - DEBUG, -) - -# Use DEBUG to turn on debug logging -u = OpenStackAmuletUtils(DEBUG) - -ODL_QUERY_PATH = '/restconf/operational/opendaylight-inventory:nodes/' -ODL_PROFILES = { - 'helium': { - 'location': 'AMULET_ODL_LOCATION', - 'profile': 'openvswitch-odl' - }, - 'beryllium': { - 'location': 'AMULET_ODL_BE_LOCATION', - 'profile': 'openvswitch-odl-beryllium' - }, -} - - -class NeutronAPIODLBasicDeployment(OpenStackAmuletDeployment): - """Amulet tests on a basic neutron-openvswitch deployment.""" - - def __init__(self, series, openstack=None, source=None, git=False, - stable=False, odl_version='helium'): - """Deploy the entire test environment.""" - super(NeutronAPIODLBasicDeployment, self).__init__(series, openstack, - source, stable) - self.odl_version = odl_version - self._add_services() - self._add_relations() - self._configure_services() - self._deploy() - - # XXX: Need to wait for workload status before initializing tests. - - self.d.sentry.wait() - self._initialize_tests() - - def _add_services(self): - """Add services - - Add the services that we're testing, where openvswitch-odl is local, - and the rest of the service are from lp branches that are - compatible with the local charm (e.g. stable or next). - """ - this_service = {'name': 'neutron-api-odl'} - other_services = [ - { - 'name': 'nova-compute', - 'constraints': {'mem': '4G'}, - }, - { - 'name': 'openvswitch-odl', - }, - { - 'name': 'neutron-gateway', - }, - { - 'name': 'odl-controller', - 'constraints': {'mem': '8G'}, - }, - { - 'name': 'neutron-api', - }, - {'name': 'percona-cluster', 'constraints': {'mem': '3072M'}}, - {'name': 'rabbitmq-server'}, - {'name': 'keystone'}, - {'name': 'nova-cloud-controller'}, - {'name': 'glance'}, - ] - super(NeutronAPIODLBasicDeployment, self)._add_services(this_service, - other_services) - - def _add_relations(self): - """Add all of the relations for the services.""" - relations = { - 'neutron-api:neutron-plugin-api-subordinate': - 'neutron-api-odl:neutron-plugin-api-subordinate', - 'nova-compute:neutron-plugin': 'openvswitch-odl:neutron-plugin', - 'openvswitch-odl:ovsdb-manager': 'odl-controller:ovsdb-manager', - 'neutron-api-odl:odl-controller': 'odl-controller:controller-api', - 'keystone:shared-db': 'percona-cluster:shared-db', - 'nova-cloud-controller:shared-db': 'percona-cluster:shared-db', - 'nova-cloud-controller:amqp': 'rabbitmq-server:amqp', - 'nova-cloud-controller:image-service': 'glance:image-service', - 'nova-cloud-controller:identity-service': - 'keystone:identity-service', - 'nova-compute:cloud-compute': - 'nova-cloud-controller:cloud-compute', - 'nova-compute:amqp': 'rabbitmq-server:amqp', - 'nova-compute:image-service': 'glance:image-service', - 'glance:shared-db': 'percona-cluster:shared-db', - 'glance:identity-service': 'keystone:identity-service', - 'glance:amqp': 'rabbitmq-server:amqp', - 'neutron-api:shared-db': 'percona-cluster:shared-db', - 'neutron-api:amqp': 'rabbitmq-server:amqp', - 'neutron-api:neutron-api': 'nova-cloud-controller:neutron-api', - 'neutron-api:identity-service': 'keystone:identity-service', - 'neutron-gateway:amqp': 'rabbitmq-server:amqp', - 'neutron-gateway:neutron-plugin-api': - 'neutron-api:neutron-plugin-api', - 'neutron-gateway:quantum-network-service': - 'nova-cloud-controller:quantum-network-service', - 'neutron-gateway:juju-info': 'openvswitch-odl:container', - } - super(NeutronAPIODLBasicDeployment, self)._add_relations(relations) - - def _configure_services(self): - """Configure all of the services.""" - neutron_api = { - 'neutron-security-groups': False, - } - nova_compute = { - 'enable-live-migration': False, - } - keystone = { - 'admin-password': 'openstack', - 'admin-token': 'ubuntutesting', - } - pxc_config = { - 'dataset-size': '25%', - 'max-connections': 1000, - 'root-password': 'ChangeMe123', - 'sst-password': 'ChangeMe123', - } - odl_controller = {} - if os.environ.get(ODL_PROFILES[self.odl_version]['location']): - odl_controller['install-url'] = \ - os.environ.get(ODL_PROFILES[self.odl_version]['location']) - if os.environ.get('AMULET_HTTP_PROXY'): - odl_controller['http-proxy'] = \ - os.environ['AMULET_HTTP_PROXY'] - if os.environ.get('AMULET_HTTP_PROXY'): - odl_controller['https-proxy'] = \ - os.environ['AMULET_HTTP_PROXY'] - odl_controller['profile'] = \ - ODL_PROFILES[self.odl_version]['profile'] - neutron_gateway = { - 'plugin': 'ovs-odl' - } - neutron_api_odl = { - 'overlay-network-type': 'vxlan gre', - } - nova_cc = { - 'network-manager': 'Neutron', - } - configs = { - 'neutron-api': neutron_api, - 'nova-compute': nova_compute, - 'keystone': keystone, - 'percona-cluster': pxc_config, - 'odl-controller': odl_controller, - 'neutron-api-odl': neutron_api_odl, - 'neutron-gateway': neutron_gateway, - 'nova-cloud-controller': nova_cc, - } - super(NeutronAPIODLBasicDeployment, self)._configure_services(configs) - - def _initialize_tests(self): - """Perform final initialization before tests get run.""" - # Access the sentries for inspecting service units - self.compute_sentry = self.d.sentry['nova-compute'][0] - self.neutron_api_sentry = self.d.sentry['neutron-api'][0] - self.ovsodl_sentry = self.d.sentry['openvswitch-odl'][0] - self.pxc_sentry = self.d.sentry['percona-cluster'][0] - self.rabbitmq_server_sentry = self.d.sentry['rabbitmq-server'][0] - self.keystone_sentry = self.d.sentry['keystone'][0] - self.glance_sentry = self.d.sentry['glance'][0] - self.nova_cc_sentry = self.d.sentry['nova-cloud-controller'][0] - self.neutron_api_odl_sentry = self.d.sentry['neutron-api-odl'][0] - self.odl_controller_sentry = self.d.sentry['odl-controller'][0] - self.gateway_sentry = self.d.sentry['neutron-gateway'][0] - - self.keystone = u.authenticate_keystone_admin(self.keystone_sentry, - user='admin', - password='openstack', - tenant='admin') - ep = self.keystone.service_catalog.url_for(service_type='identity', - interface='publicURL') - self.neutron = neutronclient.Client(auth_url=ep, - username='admin', - password='openstack', - tenant_name='admin', - region_name='RegionOne') - - def test_services(self): - """Verify the expected services are running on the corresponding - service units.""" - - commands = { - self.compute_sentry: ['nova-compute', - 'openvswitch-switch'], - self.gateway_sentry: ['openvswitch-switch', - 'neutron-dhcp-agent', - 'neutron-l3-agent', - 'neutron-metadata-agent', - 'neutron-metering-agent', - 'neutron-lbaas-agent', - 'nova-api-metadata'], - self.odl_controller_sentry: ['odl-controller'], - } - - if self._get_openstack_release() >= self.xenial_newton: - commands[self.gateway_sentry].remove('neutron-lbaas-agent') - commands[self.gateway_sentry].append('neutron-lbaasv2-agent') - - ret = u.validate_services_by_name(commands) - if ret: - amulet.raise_status(amulet.FAIL, msg=ret) - - def test_gateway_bridges(self): - """Ensure that all bridges are present and configured with the - ODL controller as their NorthBound controller URL.""" - odl_ip = self.odl_controller_sentry.relation( - 'ovsdb-manager', - 'openvswitch-odl:ovsdb-manager' - )['private-address'] - # NOTE: 6633 is legacy 6653 is IANA assigned - if self.odl_version == 'helium': - controller_url = "tcp:{}:6633".format(odl_ip) - check_bridges = ['br-int', 'br-ex', 'br-data'] - else: - controller_url = "tcp:{}:6653".format(odl_ip) - # NOTE: later ODL releases only manage br-int - check_bridges = ['br-int'] - cmd = 'ovs-vsctl list-br' - output, _ = self.gateway_sentry.run(cmd) - bridges = output.split() - for bridge in check_bridges: - if bridge not in bridges: - amulet.raise_status( - amulet.FAIL, - msg="Missing bridge {} from gateway unit".format(bridge) - ) - cmd = 'ovs-vsctl get-controller {}'.format(bridge) - br_controllers, _ = self.gateway_sentry.run(cmd) - # Beware of duplicate entries: - # https://bugs.opendaylight.org/show_bug.cgi?id=960 - br_controllers = list(set(br_controllers.split('\n'))) - if len(br_controllers) != 1 or \ - str(br_controllers[0]) != controller_url: - status, _ = self.gateway_sentry.run('ovs-vsctl show') - amulet.raise_status( - amulet.FAIL, - msg="Controller configuration on bridge" - " {} incorrect: {} != {}\n" - "{}".format(bridge, - br_controllers, - controller_url, - status) - ) diff --git a/src/tests/dev-basic-bionic-queens b/src/tests/dev-basic-bionic-queens deleted file mode 100755 index 0311ade..0000000 --- a/src/tests/dev-basic-bionic-queens +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on bionic-queens.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='bionic', - odl_version='beryllium') - deployment.run_tests() diff --git a/src/tests/dev-basic-xenial-queens b/src/tests/dev-basic-xenial-queens deleted file mode 100755 index 6e54b5f..0000000 --- a/src/tests/dev-basic-xenial-queens +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on xenial-queens.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='xenial', - openstack='cloud:xenial-queens', - source='cloud:xenial-updates/queens', - odl_version='beryllium') - deployment.run_tests() diff --git a/src/tests/gate-basic-trusty-icehouse b/src/tests/gate-basic-trusty-icehouse deleted file mode 100755 index 069f879..0000000 --- a/src/tests/gate-basic-trusty-icehouse +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on trusty-icehouse.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='trusty') - deployment.run_tests() diff --git a/src/tests/gate-basic-trusty-mitaka b/src/tests/gate-basic-trusty-mitaka deleted file mode 100755 index 8d32dc7..0000000 --- a/src/tests/gate-basic-trusty-mitaka +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on trusty-mitaka.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='trusty', - openstack='cloud:trusty-mitaka', - source='cloud:trusty-updates/mitaka') - deployment.run_tests() diff --git a/src/tests/gate-basic-xenial-mitaka b/src/tests/gate-basic-xenial-mitaka deleted file mode 100755 index fc9ad04..0000000 --- a/src/tests/gate-basic-xenial-mitaka +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on xenial-mitaka.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='xenial', - odl_version='beryllium') - deployment.run_tests() diff --git a/src/tests/gate-basic-xenial-ocata b/src/tests/gate-basic-xenial-ocata deleted file mode 100755 index fb7abaa..0000000 --- a/src/tests/gate-basic-xenial-ocata +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on xenial-ocata.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='xenial', - openstack='cloud:xenial-ocata', - source='cloud:xenial-updates/ocata', - odl_version='beryllium') - deployment.run_tests() diff --git a/src/tests/gate-basic-xenial-pike b/src/tests/gate-basic-xenial-pike deleted file mode 100755 index 706c00e..0000000 --- a/src/tests/gate-basic-xenial-pike +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic openvswitch ODL deployment on xenial-pike.""" - -from basic_deployment import NeutronAPIODLBasicDeployment - -if __name__ == '__main__': - deployment = NeutronAPIODLBasicDeployment(series='xenial', - openstack='cloud:xenial-pike', - source='cloud:xenial-updates/pike', - odl_version='beryllium') - deployment.run_tests() diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml deleted file mode 100644 index a03e7ba..0000000 --- a/src/tests/tests.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Bootstrap the model if necessary. -bootstrap: True -# Re-use bootstrap node. -reset: True -# Use tox/requirements to drive the venv instead of bundletester's venv feature. -virtualenv: False -# Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet. -makefile: [] -# Do not specify juju PPA sources. Juju is presumed to be pre-installed -# and configured in all test runner environments. -#sources: -# Do not specify or rely on system packages. -#packages: -# Do not specify python packages here. Use test-requirements.txt -# and tox instead. ie. The venv is constructed before bundletester -# is invoked. -#python-packages: -reset_timeout: 600 diff --git a/src/tox.ini b/src/tox.ini deleted file mode 100644 index 61948d7..0000000 --- a/src/tox.ini +++ /dev/null @@ -1,53 +0,0 @@ -# Source charm: ./src/tox.ini -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. -[tox] -envlist = pep8 -skipsdist = True - -[testenv] -setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 - AMULET_SETUP_TIMEOUT=5400 -whitelist_externals = juju -passenv = HOME TERM AMULET_* CS_* -deps = -r{toxinidir}/test-requirements.txt -install_command = - pip install {opts} {packages} - -[testenv:pep8] -basepython = python2.7 -commands = charm-proof - -[testenv:func27-noop] -# DRY RUN - For Debug -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy - -[testenv:func27] -# Run all gate tests which are +x (expected to always pass) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy - -[testenv:func27-smoke] -# Run a specific test as an Amulet smoke test (expected to always pass) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json gate-basic-xenial-pike --no-destroy - -[testenv:func27-dfs] -# Run all deploy-from-source tests which are +x (may not always pass!) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dfs-*" --no-destroy - -[testenv:func27-dev] -# Run all development test targets which are +x (may not always pass!) -basepython = python2.7 -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy - -[testenv:venv] -commands = {posargs} diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index ca62003..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -# This file is managed centrally. If you find the need to modify this as a -# one-off, please don't. Intead, consult #openstack-charms and ask about -# requirements management in charms via bot-control. Thank you. -# -# Lint and unit test requirements -flake8>=2.2.4,<=2.4.1 -os-testr>=0.4.1 -requests>=2.18.4 -charms.reactive -mock>=1.2 -nose>=1.3.7 -coverage>=3.6 -git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack diff --git a/tox.ini b/tox.ini deleted file mode 100644 index f51dd0c..0000000 --- a/tox.ini +++ /dev/null @@ -1,61 +0,0 @@ -# Source charm: ./tox.ini -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. -[tox] -skipsdist = True -envlist = pep8,py34,py35 -skip_missing_interpreters = True - -[testenv] -setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 - TERM=linux - LAYER_PATH={toxinidir}/layers - INTERFACE_PATH={toxinidir}/interfaces - JUJU_REPOSITORY={toxinidir}/build -passenv = http_proxy https_proxy -install_command = - pip install {opts} {packages} -deps = - -r{toxinidir}/requirements.txt - -[testenv:build] -basepython = python2.7 -commands = - charm-build --log-level DEBUG -o {toxinidir}/build src {posargs} - -[testenv:py27] -basepython = python2.7 -# Reactive source charms are Python3-only, but a py27 unit test target -# is required by OpenStack Governance. Remove this shim as soon as -# permitted. http://governance.openstack.org/reference/cti/python_cti.html -whitelist_externals = true -commands = true - -[testenv:py34] -basepython = python3.4 -deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} - -[testenv:py35] -basepython = python3.5 -deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} - -[testenv:py36] -basepython = python3.6 -deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} - -[testenv:pep8] -basepython = python3.5 -deps = -r{toxinidir}/test-requirements.txt -commands = flake8 {posargs} src unit_tests - -[testenv:venv] -basepython = python3 -commands = {posargs} - -[flake8] -# E402 ignore necessary for path append before sys module import in actions -ignore = E402 diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py deleted file mode 100644 index a95cae2..0000000 --- a/unit_tests/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -import sys - -sys.path.append('src') -sys.path.append('src/lib') - -# Mock out charmhelpers so that we can test without it. -import charms_openstack.test_mocks # noqa -charms_openstack.test_mocks.mock_charmhelpers() -sys.modules['charmhelpers.core.decorators'] = ( - charms_openstack.test_mocks.charmhelpers.core.decorators) diff --git a/unit_tests/test_lib_charm_neutron_api_odl.py b/unit_tests/test_lib_charm_neutron_api_odl.py deleted file mode 100644 index 5906fb6..0000000 --- a/unit_tests/test_lib_charm_neutron_api_odl.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -from __future__ import absolute_import -from __future__ import print_function - -import mock -import charms_openstack.test_utils as test_utils - -import charm.openstack.neutron_api_odl as neutron_api_odl - - -class Helper(test_utils.PatchHelper): - - def setUp(self): - super().setUp() - self.patch_release(neutron_api_odl.IcehouseNeutronAPIODLCharm.release) - - -class TestCustomProperties(Helper): - - def test_overlay_net_types(self): - config = mock.MagicMock() - for v in ['gre', 'gre vxlan', 'vxlan']: - config.overlay_network_type = v - neutron_api_odl.overlay_net_types(config) - # ensure that it fails - with self.assertRaises(ValueError): - config.overlay_network_type = 'fail-me' - neutron_api_odl.overlay_net_types(config) - - -class TestNeutronAPIODLCharm(Helper): - - def test_all_packages(self): - self.patch_object(neutron_api_odl.ch_utils, 'os_release') - self.os_release.return_value = 'kilo' - c = neutron_api_odl.KiloNeutronAPIODLCharm() - self.assertEqual( - c.all_packages, - ['neutron-common', 'neutron-plugin-ml2', 'python-networking-odl']) - - def test_configure_plugin(self): - principle_interface = mock.MagicMock() - self.patch_object(neutron_api_odl.ch_utils, 'os_release') - self.os_release.return_value = 'icehouse' - c = neutron_api_odl.IcehouseNeutronAPIODLCharm() - c.configure_plugin(principle_interface) - config_dict = { - 'neutron-api': { - '/etc/neutron/neutron.conf': {'sections': {'DEFAULT': []}}}} - principle_interface.configure_plugin.assert_called_once_with( - neutron_plugin='odl', - core_plugin='neutron.plugins.ml2.plugin.Ml2Plugin', - neutron_plugin_config='/etc/neutron/plugins/ml2/ml2_conf.ini', - service_plugins='router,firewall,lbaas,vpnaas,metering', - subordinate_configuration=config_dict) - - def test_configure_plugin_newton(self): - principle_interface = mock.MagicMock() - self.patch_object(neutron_api_odl.ch_utils, 'os_release') - self.os_release.return_value = 'newton' - c = neutron_api_odl.NewtonNeutronAPIODLCharm() - c.configure_plugin(principle_interface) - config_dict = { - 'neutron-api': { - '/etc/neutron/neutron.conf': {'sections': {'DEFAULT': []}}}} - principle_interface.configure_plugin.assert_called_once_with( - neutron_plugin='odl', - core_plugin='neutron.plugins.ml2.plugin.Ml2Plugin', - neutron_plugin_config='/etc/neutron/plugins/ml2/ml2_conf.ini', - service_plugins=('router,firewall,vpnaas,metering,' - 'neutron_lbaas.services.loadbalancer.' - 'plugin.LoadBalancerPluginv2'), - subordinate_configuration=config_dict) diff --git a/unit_tests/test_neutron_api_odl_handlers.py b/unit_tests/test_neutron_api_odl_handlers.py deleted file mode 100644 index c54769b..0000000 --- a/unit_tests/test_neutron_api_odl_handlers.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -from __future__ import absolute_import -from __future__ import print_function - -import mock - -import reactive.neutron_api_odl_handlers as handlers - -import charms_openstack.test_utils as test_utils - - -class TestRegisteredHooks(test_utils.TestRegisteredHooks): - - def test_hooks(self): - defaults = [ - 'charm.installed', - 'config.changed', - 'update-status'] - hook_set = { - 'when': { - 'render_config': ( - 'odl-controller.available',), - 'configure_plugin': ( - 'neutron-plugin-api-subordinate.connected',), - 'remote_restart': ( - 'neutron-plugin-api-subordinate.connected',), - }, - 'when_file_changed': { - 'remote_restart': ( - '/etc/neutron/plugins/ml2/ml2_conf.ini',), - }, - } - # test that the hooks were registered via the - # reactive.barbican_handlers - self.registered_hooks_test_helper(handlers, hook_set, defaults) - - -class TestHandlers(test_utils.PatchHelper): - - def test_render_config(self): - napi_odl_charm = mock.MagicMock() - self.patch_object(handlers.charm, 'provide_charm_instance', - new=mock.MagicMock()) - self.provide_charm_instance().__enter__.return_value = napi_odl_charm - - handlers.render_config('arg1') - napi_odl_charm.render_with_interfaces.assert_called_once_with( - ('arg1',)) - napi_odl_charm.assess_status.assert_called_once_with() - - def test_configure_plugin(self): - napi_odl_charm = mock.MagicMock() - self.patch_object(handlers.charm, 'provide_charm_instance', - new=mock.MagicMock()) - self.provide_charm_instance().__enter__.return_value = napi_odl_charm - - handlers.configure_plugin('arg1') - napi_odl_charm.configure_plugin.assert_called_once_with('arg1') - - def test_remote_restart(self): - principle_interface = mock.MagicMock() - handlers.remote_restart(principle_interface) - principle_interface.request_restart.assert_called_once_with()