diff options
Diffstat (limited to 'aria/multivim-plugin/src/main')
14 files changed, 0 insertions, 2341 deletions
diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/CHANGELOG.txt b/aria/multivim-plugin/src/main/python/multivim-plugin/CHANGELOG.txt deleted file mode 100644 index da9875a5bc..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/CHANGELOG.txt +++ /dev/null @@ -1,30 +0,0 @@ -2.2.0
: - - Fix duplicated mapping key in plugin.yaml. - - Create Server with security groups from instance relationships. This prevents a window of time when a server can - be unsecured. (OPENSTACK-38) - - Fix floating IP detach issue. (OPENSTACK-12) - - Allow openstack_config as runtime property. (OPENSTACK-112) - - Fix key creation when folders don't exist. (OPENSTACK-7) -2.0.1: - - Don't overwrite server['image'] when server is booted from volume - - Fix loading auth_url from environment (OPENSTACK-101) - - Raise an error if server is not attached to a network. Previously an IndexError would be raised. - - Make sure security_group is removed if a later step (rule creation) fails (OPENSTACK-106) - - Fix attempt to access `volume.display_name` (is now .name) (OPENSTACK-108) - - Correctly handle nova_url and neutron_url in openstack_configuration (these are deprecated) (OPENSTACK-109) -2.0: - - Don't require a Server image to be specified if a boot_volume is attached - - Add support for keystone auth v3. auth_url setting must now include version - - Upgraded openstack library dependencies - - Use availability_zone from connected boot_volume if Server doesn't specify - - Embed full docs in plugin repo. Now using sphinxify sphinx extension -1.5: - - Create project, assign existing users with roles and customize quotas. - - Create image from file (local workflow only) or url. - - Add conditional creation to all resources. Create a resource only if it doesn't already exist. Previously, could - either use an existing resource, or create it. - - Boot server from volume. Support boot from block storage and not only from image like in previous versions. - - Fix connect port to security group race-condition. - - Get mac address from port after creation. - - Raise error also when external network is missing in floating ip creation. Previously, an error was raised only - when floating network id or name was missing. diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/LICENSE b/aria/multivim-plugin/src/main/python/multivim-plugin/LICENSE deleted file mode 100644 index e06d208186..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/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/aria/multivim-plugin/src/main/python/multivim-plugin/Makefile b/aria/multivim-plugin/src/main/python/multivim-plugin/Makefile deleted file mode 100644 index cfb7416fa7..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -.PHONY: release install files test docs prepare publish - -all: - @echo "make release - prepares a release and publishes it" - @echo "make dev - prepares a development environment" - @echo "make install - install on local system" - @echo "make files - update changelog and todo files" - @echo "make test - run tox" - @echo "make docs - build docs" - @echo "prepare - prepare module for release (CURRENTLY IRRELEVANT)" - @echo "make publish - upload to pypi" - -release: test docs publish - -dev: - pip install -rdev-requirements.txt - python setup.py develop - -install: - python setup.py install - -files: - grep '# TODO' -rn * --exclude-dir=docs --exclude-dir=build --exclude=TODO.md | sed 's/: \+#/: # /g;s/:#/: # /g' | sed -e 's/^/- /' | grep -v Makefile > TODO.md - git log --oneline --decorate --color > CHANGELOG - -test: - pip install tox - tox - -docs: - pip install sphinx sphinx-rtd-theme - cd docs && make html - pandoc README.md -f markdown -t rst -s -o README.rst - -prepare: - python scripts/make-release.py - -publish: - python setup.py sdist upload
\ No newline at end of file diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/README.md b/aria/multivim-plugin/src/main/python/multivim-plugin/README.md deleted file mode 100644 index 3b5b8df721..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/README.md +++ /dev/null @@ -1,11 +0,0 @@ -cloudify-openstack-plugin -========================= - -[![Circle CI](https://circleci.com/gh/cloudify-cosmo/cloudify-openstack-plugin/tree/master.svg?style=shield)](https://circleci.com/gh/cloudify-cosmo/cloudify-openstack-plugin/tree/master) -[![Build Status](https://travis-ci.org/cloudify-cosmo/cloudify-openstack-plugin.svg?branch=master)](https://travis-ci.org/cloudify-cosmo/cloudify-openstack-plugin) - -Cloudify OpenStack Plugin - -## Usage - -See [Openstack Plugin](http://docs.getcloudify.org/latest/plugins/openstack/) diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/README.rst b/aria/multivim-plugin/src/main/python/multivim-plugin/README.rst deleted file mode 100644 index eaa0de6eaf..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -cloudify-openstack-plugin -========================= - -Cloudify OpenStack Plugin diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/circle.yml b/aria/multivim-plugin/src/main/python/multivim-plugin/circle.yml deleted file mode 100644 index 2a2c66e88c..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/circle.yml +++ /dev/null @@ -1,27 +0,0 @@ -machine: - python: - version: 2.7.9 - -checkout: - post: - - > - if [ -n "$CI_PULL_REQUEST" ]; then - PR_ID=${CI_PULL_REQUEST##*/} - git fetch origin +refs/pull/$PR_ID/merge: - git checkout -qf FETCH_HEAD - fi - -dependencies: - override: - - pip install --upgrade tox virtualenv - -test: - override: - # - tox -e docs - - tox -e flake8 - - tox -e py27 - -# Docs artifacts -general: - artifacts: - - .tox/docs/tmp/html diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/dev-requirements.txt b/aria/multivim-plugin/src/main/python/multivim-plugin/dev-requirements.txt deleted file mode 100644 index fcb6a806cd..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/dev-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/cloudify-cosmo/cloudify-dsl-parser/archive/3.4.1.zip -https://github.com/cloudify-cosmo/cloudify-rest-client/archive/3.4.1.zip -https://github.com/cloudify-cosmo/cloudify-plugins-common/archive/3.4.1.zip diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/plugin.yaml b/aria/multivim-plugin/src/main/python/multivim-plugin/plugin.yaml deleted file mode 100644 index 6df0764e94..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/plugin.yaml +++ /dev/null @@ -1,1178 +0,0 @@ -# -# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved. -# -# 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. -# -tosca_definitions_version: tosca_simple_yaml_1_0 - - -topology_template: - policies: - onap-multivim-plugin: - description: >- - multivim plugin executes operations. - type: aria.Plugin - properties: - version: 2.0.1 - - -data_types: - - onap.multivim.datatypes.Config: - description: >- - multivim configuration - properties: - username: - type: string - password: - type: string - tenant_name: - type: string - auth_url: - type: string - region: - type: string - required: false - nova_url: - type: string - required: false - neutron_url: - type: string - required: false - - onap.multivim.datatypes.Rules: - description: >- - multivim security group rules - properties: - remote_ip_prefix: - type: string - default: 0.0.0.0/0 - port: - type: integer - default: - - # source: https://developer.multivim.org/api-ref/compute/ - - onap.multivim.datatypes.Server: - description: >- - multivim Server args. - properties: - security_groups: - type: list - entry_schema: string - required: false - availability_zone: - type: string - required: false - userdata: - type: string - required: false - metadata: - type: map - entry_schema: string - required: false - - onap.multivim.datatypes.Keypair: - description: >- - multivim keypair args. - properties: - public_key: - type: string - required: false - type: - type: string - required: false - user_id: - type: string - required: false - - # source: https://developer.multivim.org/api-ref/block-storage/v2/index.html - - onap.multivim.datatypes.Volume: - description: >- - multivim volume args. - properties: - size: - type: integer - required: false - description: - type: string - required: false - availability_zone: - type: string - required: false - consistencygroup_id: - type: string - required: false - volume_type: - type: string - required: false - snapshot_id: - type: string - required: false - source_replica: - type: string - required: false - tenant_id: - type: string - required: false - - # source: https://developer.multivim.org/api-ref/image/ - - onap.multivim.datatypes.Image: - description: >- - multivim image args. - properties: - id: - type: string - required: false - min_disk: - type: integer - required: false - min_ram: - type: integer - required: false - name: - type: string - required: false - protected: - type: boolean - required: false - tags: - type: list - entry_schema: string - required: false - visibility: - type: string - required: false - - # source: https://developer.multivim.org/api-ref/identity/v3/ - - onap.multivim.datatypes.Project: - description: >- - multivim image args. - properties: - is_domain: - type: boolean - required: false - description: - type: string - required: false - domain_id: - type: string - required: false - name: - type: string - required: false - enabled: - type: boolean - required: false - parent_id: - type: string - required: false - - # source: https://developer.multivim.org/api-ref/networking/v2/index.html - - onap.multivim.datatypes.Subnet: - description: >- - multivim subnet args. - properties: - network_id: - type: string - required: false - ip_version: - type: integer - required: false - default: 4 - cidr: - type: string - required: false - gateway_ip: - type: string - required: false - dns_nameservers: - type: list - entry_schema: string - required: false - enable_dhcp: - type: boolean - required: false - tenant_id: - type: string - required: false - - onap.multivim.datatypes.Port: - description: >- - multivim port args - properties: - network_id: - type: string - required: false - admin_state_up: - type: boolean - required: false - status: - type: string - required: false - mac_address: - type: string - required: false - device_id: - type: string - required: false - device_owner: - type: string - required: false - tenant_id: - type: string - required: false - - onap.multivim.datatypes.Network: - description: >- - multivim network args - properties: - admin_state_up: - type: boolean - required: false - status: - type: string - required: false - subnets: - type: list - entry_schema: string - required: false - shared: - type: boolean - required: false - tenant_id: - type: string - required: false - - onap.multivim.datatypes.SecurityGroup: - description: >- - multivim network args - properties: - admin_state_up: - type: boolean - required: false - port_security_enabled: - type: boolean - required: false - project_id: - type: string - required: false - qos_policy_id: - type: string - required: false - segments: - type: list - entry_schema: string - required: false - shared: - type: boolean - required: false - vlan_transparent: - type: boolean - required: false - tenant_id: - type: string - required: false - - onap.multivim.datatypes.Router: - description: >- - multivim network args - properties: - bgpvpn_id: - type: string - required: false - router_id: - type: string - required: false - - onap.multivim.datatypes.FloatingIP: - description: >- - multivim network args - properties: - tenant_id: - type: string - required: false - project_id: - type: string - required: false - floating_network_id: - type: string - required: false - floating_network_name: - type: string - required: false - fixed_ip_address: - type: string - required: false - floating_ip_address: - type: string - required: false - port_id: - type: string - required: false - subnet_id: - type: string - required: false - - -interface_types: - - onap.multivim.interfaces.validation: - derived_from: tosca.interfaces.Root - creation: - description: >- - creation operation for the multivim validation interface - deletion: - description: >- - deletion operation for the multivim validation interface - - -node_types: - - onap.multivim.nodes.Server: - derived_from: tosca.nodes.Compute - properties: - server: - default: {} - type: onap.multivim.datatypes.Server - required: false - ip: - default: - type: string - os_family: - description: >- - Property specifying what type of operating system family - this compute node will run. - default: linux - type: string - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - image: - default: '' - type: string - description: >- - The image for the server. - May receive either the ID or the name of the image. - note: This property is currently optional for backwards compatibility, - but will be modified to become a required property in future versions - (Default: ''). - flavor: - default: '' - type: string - description: >- - The flavor for the server. - May receive either the ID or the name of the flavor. - note: This property is currently optional for backwards compatibility, - but will be modified to become a required property in future versions - (Default: ''). - use_password: - default: false - type: boolean - description: >- - A boolean describing whether this server image supports user-password authentication. - Images that do should post the administrator user's password to the Openstack metadata service (e.g. via cloudbase); - The password would then be retrieved by the plugin, - decrypted using the server's keypair and then saved in the server's runtime properties. - management_network_name: - type: string - description: >- - The current implementation of the multivim plugin requires this field. The value of - this field should be set to the multivim name of a network this server is attached to. - multivim_config: - type: onap.multivim.datatypes.Config - required: false - description: >- - see Openstack Configuraion - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > nova_plugin.server.create - inputs: - args: - required: false - default: {} - type: onap.multivim.datatypes.Server - start: - implementation: onap-multivim-plugin > nova_plugin.server.start - inputs: - start_retry_interval: - default: 30 - type: integer - private_key_path: - type: string - default: '' - required: true - stop: onap-multivim-plugin > nova_plugin.server.stop - delete: onap-multivim-plugin > nova_plugin.server.delete - Validation: - type: onap.multivim.interfaces.validation - creation: - implementation: onap-multivim-plugin > nova_plugin.server.creation_validation - inputs: - args: - required: false - default: {} - type: onap.multivim.datatypes.Server - - requirements: - - floating_ip: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.FloatingIP - relationship: onap.multivim.server_connected_to_floating_ip - occurrences: [ 0, UNBOUNDED ] - - security_group: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.SecurityGroup - relationship: onap.multivim.server_connected_to_security_group - occurrences: [ 0, UNBOUNDED ] - - port: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Port - relationship: onap.multivim.server_connected_to_port - occurrences: [ 0, UNBOUNDED ] - - key_pair: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.KeyPair - relationship: onap.multivim.server_connected_to_keypair - occurrences: [ 0, UNBOUNDED ] - capabilities: - multivim_container: - type: Node - - onap.multivim.nodes.WindowsServer: - derived_from: onap.multivim.nodes.Server - properties: - use_password: - default: true - type: boolean - description: >- - Default changed for derived type - because Windows instances need a password for agent installation - os_family: - default: windows - type: string - description: >- - (updates the os_family default as a convenience) - - onap.multivim.nodes.KeyPair: - derived_from: tosca.nodes.Root - properties: - keypair: - default: {} - type: onap.multivim.datatypes.Keypair - required: false - description: >- - the path (on the machine the plugin is running on) to - where the private key should be stored. If - use_external_resource is set to "true", the existing - private key is expected to be at this path. - private_key_path: - description: > - the path (on the machine the plugin is running on) to - where the private key should be stored. If - use_external_resource is set to "true", the existing - private key is expected to be at this path. - type: string - use_external_resource: - type: boolean - default: false - description: >- - a boolean describing whether this resource should be - created or rather that it already exists on Openstack - and should be used as-is. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - the name that will be given to the resource on Openstack (excluding optional prefix). - If not provided, a default name will be given instead. - If use_external_resource is set to "true", this exact - value (without any prefixes applied) will be looked for - as either the name or id of an existing keypair to be used. - multivim_config: - type: onap.multivim.datatypes.Config - required: false - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > nova_plugin.keypair.create - inputs: - args: - required: false - default: {} - type: onap.multivim.datatypes.Keypair - - delete: onap-multivim-plugin > nova_plugin.keypair.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > nova_plugin.keypair.creation_validation - - capabilities: - keypair: - type: tosca.capabilities.Node - - onap.multivim.nodes.Subnet: - derived_from: tosca.nodes.Root - properties: - subnet: - type: onap.multivim.datatypes.Subnet - required: false - default: - cidr: 172.16.0.0/16 - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.subnet.create - inputs: - args: - required: false - type: onap.multivim.datatypes.Subnet - default: - cidr: 172.16.0.0/16 - delete: onap-multivim-plugin > neutron_plugin.subnet.delete - Validation: - type: onap.multivim.interfaces.validation - creation: - implementation: onap-multivim-plugin > neutron_plugin.subnet.creation_validation - inputs: - args: - type: onap.multivim.datatypes.Subnet - required: false - default: - cidr: 172.16.0.0/16 - - requirements: - - router: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Router - relationship: onap.multivim.subnet_connected_to_router - occurrences: [ 0, UNBOUNDED ] - - network: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Network - capabilities: - subnet: - type: tosca.capabilities.Node - - onap.multivim.nodes.SecurityGroup: - derived_from: tosca.nodes.Root - properties: - security_group: - type: onap.multivim.datatypes.SecurityGroup - required: false - default: {} - description: - type: string - default: '' - description: >- - SecurityGroup description. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - rules: - default: [] - type: list - entry_schema: onap.multivim.datatypes.Rules - disable_default_egress_rules: - default: false - type: boolean - description: >- - a flag for removing the default rules which https://wiki.multivim.org/wiki/Neutron/SecurityGroups#Behavior. If not set to `true`, these rules will remain, and exist alongside any additional rules passed using the `rules` property. - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.security_group.create - inputs: - args: - type: onap.multivim.datatypes.SecurityGroup - required: false - default: {} - delete: onap-multivim-plugin > neutron_plugin.security_group.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > neutron_plugin.security_group.creation_validation - - capabilities: - security: - type: tosca.capabilities.Node - - onap.multivim.nodes.Router: - derived_from: tosca.nodes.Root - properties: - router: - type: onap.multivim.datatypes.Router - required: false - default: {} - external_network: - default: '' - type: string - description: >- - An external network name or ID. - If given, the router will use this external network as a gateway. - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - type: string - multivim_config: - type: onap.multivim.datatypes.Config - required: false - - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.router.create - inputs: - args: - default: {} - type: onap.multivim.datatypes.Router - required: false - delete: onap-multivim-plugin > neutron_plugin.router.delete - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > neutron_plugin.router.creation_validation - - capabilities: - gateway: - type: tosca.capabilities.Node - - onap.multivim.nodes.Port: - derived_from: tosca.nodes.Root - properties: - port: - type: onap.multivim.datatypes.Port - required: false - default: {} - fixed_ip: - default: '' - type: string - description: >- - may be used to request a specific fixed IP for the port. - If the IP is unavailable - (either already taken or does not belong to a subnet the port is on) - an error will be raised. - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.port.create - inputs: - args: - default: {} - type: onap.multivim.datatypes.Port - required: false - - delete: onap-multivim-plugin > neutron_plugin.port.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > neutron_plugin.port.creation_validation - - requirements: - - security_group: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.SecurityGroup - relationship: onap.multivim.port_connected_to_security_group - occurrences: [ 0, UNBOUNDED ] - - floating_ip: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.FloatingIP - relationship: onap.multivim.port_connected_to_floating_ip - occurrences: [ 0, UNBOUNDED ] - - subnet: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Subnet - relationship: onap.multivim.port_connected_to_subnet - - network: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Network - occurrences: [ 0, UNBOUNDED ] - capabilities: - entry_point: - type: tosca.capabilities.Node - - onap.multivim.nodes.Network: - derived_from: tosca.nodes.Root - properties: - network: - type: onap.multivim.datatypes.Network - required: false - default: {} - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.network.create - inputs: - args: - default: {} - type: onap.multivim.datatypes.Network - required: false - - delete: onap-multivim-plugin > neutron_plugin.network.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > neutron_plugin.network.creation_validation - - capabilities: - address_space: - type: tosca.capabilities.Node - - onap.multivim.nodes.FloatingIP: - derived_from: tosca.nodes.Root - attributes: - floating_ip_address: - type: string - properties: - floatingip: - type: onap.multivim.datatypes.FloatingIP - required: false - default: {} - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - description: IP address of the floating IP - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > neutron_plugin.floatingip.create - inputs: - args: - default: {} - type: onap.multivim.datatypes.FloatingIP - required: false - - delete: onap-multivim-plugin > neutron_plugin.floatingip.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > neutron_plugin.floatingip.creation_validation - - capabilities: - address: - type: tosca.capabilities.Node - - onap.multivim.nodes.Volume: - derived_from: tosca.nodes.Root - properties: - volume: - default: {} - type: onap.multivim.datatypes.Volume - description: >- - key-value volume configuration as described in http://developer.multivim.org/api-ref-blockstorage-v1.html#volumes-v1. (**DEPRECATED - Use the `args` input in create operation instead**) - use_external_resource: - type: boolean - default: false - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - device_name: - default: auto - type: string - description: >- - The device name this volume will be attached to. - Default value is *auto*, - which means multivim will auto-assign a device. - Note that if you do explicitly set a value, - this value may not be the actual device name assigned. - Sometimes the device requested will not be available and multivim will assign it to a different device, - this is why we recommend using *auto*. - multivim_config: - type: onap.multivim.datatypes.Config - required: false - boot: - type: boolean - default: false - description: >- - If a Server instance is connected to this Volume by a relationship, - this volume will be used as the boot volume for that Server. - interfaces: - Standard: - create: - implementation: onap-multivim-plugin > cinder_plugin.volume.create - inputs: - args: - default: {} - type: onap.multivim.datatypes.Volume - required: false - - status_attempts: - description: >- - Number of times to check for the creation's status before failing - type: integer - default: 20 - status_timeout: - description: >- - Interval (in seconds) between subsequent inquiries of the creation's - status - type: integer - default: 15 - delete: onap-multivim-plugin > cinder_plugin.volume.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > cinder_plugin.volume.creation_validation - - requirements: - - server: - capability: tosca.capabilities.Node - node: onap.multivim.nodes.Server - relationship: onap.multivim.volume_attached_to_server - - onap.multivim.nodes.Image: - derived_from: tosca.nodes.Root - properties: - image: - description: >- - Required parameters are (container_format, disk_format). Accepted - types are available on - http://docs.multivim.org/developer/glance/formats.html - To create an image from the local file its path should be added - in data parameter. - default: {} - type: map - entry_schema: string - image_url: - default: '' - type: string - description: >- - The multivim resource URL for the image. - use_external_resource: - default: false - type: boolean - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - interfaces: - Standard: - create: onap-multivim-plugin > glance_plugin.image.create - - start: - implementation: onap-multivim-plugin > glance_plugin.image.start - inputs: - start_retry_interval: - default: 30 - type: integer - - delete: onap-multivim-plugin > glance_plugin.image.delete - - Validation: - type: onap.multivim.interfaces.validation - creation: onap-multivim-plugin > glance_plugin.image.creation_validation - - onap.multivim.nodes.Project: - derived_from: tosca.nodes.Root - properties: - project: - default: {} - type: onap.multivim.datatypes.Project - description: >- - key-value project configuration. - users: - default: [] - type: list - entry_schema: string - description: >- - List of users assigned to this project in the following format: - { name: string, roles: [string] } - quota: - default: {} - type: map - entry_schema: string - description: | - A dictionary mapping service names to quota definitions for a proejct - - e.g:: - - quota: - neutron: <quota> - nova: <quota> - use_external_resource: - default: false - type: boolean - description: >- - a boolean for setting whether to create the resource or use an existing one. - See the using existing resources section. - create_if_missing: - default: false - type: boolean - description: >- - If use_external_resource is ``true`` and the resource is missing, - create it instead of failing. - resource_id: - default: '' - type: string - description: >- - name to give to the new resource or the name or ID of an existing resource when the ``use_external_resource`` property is set to ``true`` (see the using existing resources section). Defaults to '' (empty string). - multivim_config: - type: onap.multivim.datatypes.Config - required: false - interfaces: - Standard: - create: multivim.keystone_plugin.project.create - start: multivim.keystone_plugin.project.start - delete: multivim.keystone_plugin.project.delete - Validation: - type: onap.multivim.interfaces.validation - creation: multivim.keystone_plugin.project.creation_validation - - -relationship_types: - - onap.multivim.port_connected_to_security_group: - derived_from: ConnectsTo - interfaces: - Configure: - add_source: onap-multivim-plugin > neutron_plugin.port.connect_security_group - - onap.multivim.subnet_connected_to_router: - derived_from: ConnectsTo - interfaces: - Configure: - add_target: onap-multivim-plugin > neutron_plugin.router.connect_subnet - remove_target: onap-multivim-plugin > neutron_plugin.router.disconnect_subnet - - onap.multivim.server_connected_to_floating_ip: - derived_from: ConnectsTo - interfaces: - Configure: - add_source: - implementation: onap-multivim-plugin > nova_plugin.server.connect_floatingip - inputs: - fixed_ip: - description: > - The fixed IP to be associated with the floating IP. - If omitted, Openstack will choose which port to associate. - type: string - default: '' - remove_source: onap-multivim-plugin > nova_plugin.server.disconnect_floatingip - - onap.multivim.port_connected_to_floating_ip: - derived_from: ConnectsTo - interfaces: - Configure: - add_source: onap-multivim-plugin > neutron_plugin.floatingip.connect_port - remove_source: onap-multivim-plugin > neutron_plugin.floatingip.disconnect_port - - onap.multivim.server_connected_to_security_group: - derived_from: ConnectsTo - interfaces: - Configure: - add_source: onap-multivim-plugin > nova_plugin.server.connect_security_group - remove_source: onap-multivim-plugin > nova_plugin.server.disconnect_security_group - - onap.multivim.server_connected_to_port: - derived_from: ConnectsTo - interfaces: - Configure: - remove_source: onap-multivim-plugin > neutron_plugin.port.detach - - onap.multivim.server_connected_to_keypair: - derived_from: ConnectsTo - - onap.multivim.port_connected_to_subnet: - derived_from: ConnectsTo - - onap.multivim.volume_attached_to_server: - derived_from: ConnectsTo - interfaces: - Configure: - add_target: - implementation: onap-multivim-plugin > nova_plugin.server.attach_volume - inputs: - - status_attempts: - description: > - Number of times to check for the attachment's status before failing - type: integer - default: 10 - status_timeout: - description: > - Interval (in seconds) between subsequent inquiries of the attachment's - status - type: integer - default: 2 - remove_target: - implementation: onap-multivim-plugin > nova_plugin.server.detach_volume - inputs: - - status_attempts: - description: > - Number of times to check for the detachment's status before failing - type: integer - default: 10 - status_timeout: - description: > - Interval (in seconds) between subsequent inquiries of the detachment's - status - type: integer - default: 2 diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/readthedocs.yml b/aria/multivim-plugin/src/main/python/multivim-plugin/readthedocs.yml deleted file mode 100644 index af59f269aa..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/readthedocs.yml +++ /dev/null @@ -1 +0,0 @@ -requirements_file: docs/requirements.txt diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/setup.py b/aria/multivim-plugin/src/main/python/multivim-plugin/setup.py deleted file mode 100644 index 51387c098d..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/setup.py +++ /dev/null @@ -1,45 +0,0 @@ -######### -# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved -# -# 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 setuptools import setup - - -setup( - zip_safe=True, - name='onap-multivim-plugin', - version='2.2.0', - author='idanmo', - author_email='idan@gigaspaces.com', - packages=[ - 'openstack_plugin_common', - 'nova_plugin', - 'neutron_plugin', - 'cinder_plugin', - 'glance_plugin', - 'keystone_plugin' - ], - license='LICENSE', - description='ONAP plugin for multivim infrastructure.', - install_requires=[ - 'cloudify-plugins-common>=3.3.1', - 'keystoneauth1>=2.16.0,<3', - 'python-novaclient==7.0.0', - 'python-keystoneclient==3.5.0', - 'python-neutronclient==6.0.0', - 'python-cinderclient==1.9.0', - 'python-glanceclient==2.5.0', - 'IPy==0.81' - ] -) diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/__init__.py b/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/__init__.py deleted file mode 100644 index 3ad9513f40..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_handler.py b/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_handler.py deleted file mode 100644 index 76368fa10a..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_handler.py +++ /dev/null @@ -1,657 +0,0 @@ -######## -# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved -# -# 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 random -import logging -import os -import time -import copy -from contextlib import contextmanager - -from cinderclient import client as cinderclient -from keystoneauth1 import loading, session -import novaclient.client as nvclient -import neutronclient.v2_0.client as neclient -from retrying import retry - -from cosmo_tester.framework.handlers import ( - BaseHandler, - BaseCloudifyInputsConfigReader) -from cosmo_tester.framework.util import get_actual_keypath - -logging.getLogger('neutronclient.client').setLevel(logging.INFO) -logging.getLogger('novaclient.client').setLevel(logging.INFO) - - -VOLUME_TERMINATION_TIMEOUT_SECS = 300 - - -class OpenstackCleanupContext(BaseHandler.CleanupContext): - - def __init__(self, context_name, env): - super(OpenstackCleanupContext, self).__init__(context_name, env) - self.before_run = self.env.handler.openstack_infra_state() - - def cleanup(self): - """ - Cleans resources created by the test. - Resource that existed before the test will not be removed - """ - super(OpenstackCleanupContext, self).cleanup() - resources_to_teardown = self.get_resources_to_teardown( - self.env, resources_to_keep=self.before_run) - if self.skip_cleanup: - self.logger.warn('[{0}] SKIPPING cleanup of resources: {1}' - .format(self.context_name, resources_to_teardown)) - else: - self._clean(self.env, resources_to_teardown) - - @classmethod - def clean_all(cls, env): - """ - Cleans *all* resources, including resources that were not - created by the test - """ - super(OpenstackCleanupContext, cls).clean_all(env) - resources_to_teardown = cls.get_resources_to_teardown(env) - cls._clean(env, resources_to_teardown) - - @classmethod - def _clean(cls, env, resources_to_teardown): - cls.logger.info('Openstack handler will try to remove these resources:' - ' {0}'.format(resources_to_teardown)) - failed_to_remove = env.handler.remove_openstack_resources( - resources_to_teardown) - if failed_to_remove: - trimmed_failed_to_remove = {key: value for key, value in - failed_to_remove.iteritems() - if value} - if len(trimmed_failed_to_remove) > 0: - msg = 'Openstack handler failed to remove some resources:' \ - ' {0}'.format(trimmed_failed_to_remove) - cls.logger.error(msg) - raise RuntimeError(msg) - - @classmethod - def get_resources_to_teardown(cls, env, resources_to_keep=None): - all_existing_resources = env.handler.openstack_infra_state() - if resources_to_keep: - return env.handler.openstack_infra_state_delta( - before=resources_to_keep, after=all_existing_resources) - else: - return all_existing_resources - - def update_server_id(self, server_name): - - # retrieve the id of the new server - nova, _, _ = self.env.handler.openstack_clients() - servers = nova.servers.list( - search_opts={'name': server_name}) - if len(servers) > 1: - raise RuntimeError( - 'Expected 1 server with name {0}, but found {1}' - .format(server_name, len(servers))) - - new_server_id = servers[0].id - - # retrieve the id of the old server - old_server_id = None - servers = self.before_run['servers'] - for server_id, name in servers.iteritems(): - if server_name == name: - old_server_id = server_id - break - if old_server_id is None: - raise RuntimeError( - 'Could not find a server with name {0} ' - 'in the internal cleanup context state' - .format(server_name)) - - # replace the id in the internal state - servers[new_server_id] = servers.pop(old_server_id) - - -class CloudifyOpenstackInputsConfigReader(BaseCloudifyInputsConfigReader): - - def __init__(self, cloudify_config, manager_blueprint_path, **kwargs): - super(CloudifyOpenstackInputsConfigReader, self).__init__( - cloudify_config, manager_blueprint_path=manager_blueprint_path, - **kwargs) - - @property - def region(self): - return self.config['region'] - - @property - def management_server_name(self): - return self.config['manager_server_name'] - - @property - def agent_key_path(self): - return self.config['agent_private_key_path'] - - @property - def management_user_name(self): - return self.config['ssh_user'] - - @property - def management_key_path(self): - return self.config['ssh_key_filename'] - - @property - def agent_keypair_name(self): - return self.config['agent_public_key_name'] - - @property - def management_keypair_name(self): - return self.config['manager_public_key_name'] - - @property - def use_existing_agent_keypair(self): - return self.config['use_existing_agent_keypair'] - - @property - def use_existing_manager_keypair(self): - return self.config['use_existing_manager_keypair'] - - @property - def external_network_name(self): - return self.config['external_network_name'] - - @property - def keystone_username(self): - return self.config['keystone_username'] - - @property - def keystone_password(self): - return self.config['keystone_password'] - - @property - def keystone_tenant_name(self): - return self.config['keystone_tenant_name'] - - @property - def keystone_url(self): - return self.config['keystone_url'] - - @property - def neutron_url(self): - return self.config.get('neutron_url', None) - - @property - def management_network_name(self): - return self.config['management_network_name'] - - @property - def management_subnet_name(self): - return self.config['management_subnet_name'] - - @property - def management_router_name(self): - return self.config['management_router'] - - @property - def agents_security_group(self): - return self.config['agents_security_group_name'] - - @property - def management_security_group(self): - return self.config['manager_security_group_name'] - - -class OpenstackHandler(BaseHandler): - - CleanupContext = OpenstackCleanupContext - CloudifyConfigReader = CloudifyOpenstackInputsConfigReader - - def before_bootstrap(self): - super(OpenstackHandler, self).before_bootstrap() - with self.update_cloudify_config() as patch: - suffix = '-%06x' % random.randrange(16 ** 6) - server_name_prop_path = 'manager_server_name' - patch.append_value(server_name_prop_path, suffix) - - def after_bootstrap(self, provider_context): - super(OpenstackHandler, self).after_bootstrap(provider_context) - resources = provider_context['resources'] - agent_keypair = resources['agents_keypair'] - management_keypair = resources['management_keypair'] - self.remove_agent_keypair = agent_keypair['external_resource'] is False - self.remove_management_keypair = \ - management_keypair['external_resource'] is False - - def after_teardown(self): - super(OpenstackHandler, self).after_teardown() - if self.remove_agent_keypair: - agent_key_path = get_actual_keypath(self.env, - self.env.agent_key_path, - raise_on_missing=False) - if agent_key_path: - os.remove(agent_key_path) - if self.remove_management_keypair: - management_key_path = get_actual_keypath( - self.env, - self.env.management_key_path, - raise_on_missing=False) - if management_key_path: - os.remove(management_key_path) - - def openstack_clients(self): - creds = self._client_creds() - params = { - 'region_name': creds.pop('region_name'), - } - - loader = loading.get_plugin_loader("password") - auth = loader.load_from_options(**creds) - sess = session.Session(auth=auth, verify=True) - - params['session'] = sess - - nova = nvclient.Client('2', **params) - neutron = neclient.Client(**params) - cinder = cinderclient.Client('2', **params) - - return (nova, neutron, cinder) - - @retry(stop_max_attempt_number=5, wait_fixed=20000) - def openstack_infra_state(self): - """ - @retry decorator is used because this error sometimes occur: - ConnectionFailed: Connection to neutron failed: Maximum - attempts reached - """ - nova, neutron, cinder = self.openstack_clients() - try: - prefix = self.env.resources_prefix - except (AttributeError, KeyError): - prefix = '' - return { - 'networks': dict(self._networks(neutron, prefix)), - 'subnets': dict(self._subnets(neutron, prefix)), - 'routers': dict(self._routers(neutron, prefix)), - 'security_groups': dict(self._security_groups(neutron, prefix)), - 'servers': dict(self._servers(nova, prefix)), - 'key_pairs': dict(self._key_pairs(nova, prefix)), - 'floatingips': dict(self._floatingips(neutron, prefix)), - 'ports': dict(self._ports(neutron, prefix)), - 'volumes': dict(self._volumes(cinder, prefix)) - } - - def openstack_infra_state_delta(self, before, after): - after = copy.deepcopy(after) - return { - prop: self._remove_keys(after[prop], before[prop].keys()) - for prop in before - } - - def _find_keypairs_to_delete(self, nodes, node_instances): - """Filter the nodes only returning the names of keypair nodes - - Examine node_instances and nodes, return the external_name of - those node_instances, which correspond to a node that has a - type == KeyPair - - To filter by deployment_id, simply make sure that the nodes and - node_instances this method receives, are pre-filtered - (ie. filter the nodes while fetching them from the manager) - """ - keypairs = set() # a set of (deployment_id, node_id) tuples - - for node in nodes: - if node.get('type') != 'cloudify.openstack.nodes.KeyPair': - continue - # deployment_id isnt always present in local_env runs - key = (node.get('deployment_id'), node['id']) - keypairs.add(key) - - for node_instance in node_instances: - key = (node_instance.get('deployment_id'), - node_instance['node_id']) - if key not in keypairs: - continue - - runtime_properties = node_instance['runtime_properties'] - if not runtime_properties: - continue - name = runtime_properties.get('external_name') - if name: - yield name - - def _delete_keypairs_by_name(self, keypair_names): - nova, neutron, cinder = self.openstack_clients() - existing_keypairs = nova.keypairs.list() - - for name in keypair_names: - for keypair in existing_keypairs: - if keypair.name == name: - nova.keypairs.delete(keypair) - - def remove_keypairs_from_local_env(self, local_env): - """Query the local_env for nodes which are keypairs, remove them - - Similar to querying the manager, we can look up nodes in the local_env - which is used for tests. - """ - nodes = local_env.storage.get_nodes() - node_instances = local_env.storage.get_node_instances() - names = self._find_keypairs_to_delete(nodes, node_instances) - self._delete_keypairs_by_name(names) - - def remove_keypairs_from_manager(self, deployment_id=None, - rest_client=None): - """Query the manager for nodes by deployment_id, delete keypairs - - Fetch nodes and node_instances from the manager by deployment_id - (or all if not given), find which ones represent openstack keypairs, - remove them. - """ - if rest_client is None: - rest_client = self.env.rest_client - - nodes = rest_client.nodes.list(deployment_id=deployment_id) - node_instances = rest_client.node_instances.list( - deployment_id=deployment_id) - keypairs = self._find_keypairs_to_delete(nodes, node_instances) - self._delete_keypairs_by_name(keypairs) - - def remove_keypair(self, name): - """Delete an openstack keypair by name. If it doesnt exist, do nothing. - """ - self._delete_keypairs_by_name([name]) - - def remove_openstack_resources(self, resources_to_remove): - # basically sort of a workaround, but if we get the order wrong - # the first time, there is a chance things would better next time - # 3'rd time can't really hurt, can it? - # 3 is a charm - for _ in range(3): - resources_to_remove = self._remove_openstack_resources_impl( - resources_to_remove) - if all([len(g) == 0 for g in resources_to_remove.values()]): - break - # give openstack some time to update its data structures - time.sleep(3) - return resources_to_remove - - def _remove_openstack_resources_impl(self, resources_to_remove): - nova, neutron, cinder = self.openstack_clients() - - servers = nova.servers.list() - ports = neutron.list_ports()['ports'] - routers = neutron.list_routers()['routers'] - subnets = neutron.list_subnets()['subnets'] - networks = neutron.list_networks()['networks'] - # keypairs = nova.keypairs.list() - floatingips = neutron.list_floatingips()['floatingips'] - security_groups = neutron.list_security_groups()['security_groups'] - volumes = cinder.volumes.list() - - failed = { - 'servers': {}, - 'routers': {}, - 'ports': {}, - 'subnets': {}, - 'networks': {}, - 'key_pairs': {}, - 'floatingips': {}, - 'security_groups': {}, - 'volumes': {} - } - - volumes_to_remove = [] - for volume in volumes: - if volume.id in resources_to_remove['volumes']: - volumes_to_remove.append(volume) - - left_volumes = self._delete_volumes(nova, cinder, volumes_to_remove) - for volume_id, ex in left_volumes.iteritems(): - failed['volumes'][volume_id] = ex - - for server in servers: - if server.id in resources_to_remove['servers']: - with self._handled_exception(server.id, failed, 'servers'): - nova.servers.delete(server) - - for router in routers: - if router['id'] in resources_to_remove['routers']: - with self._handled_exception(router['id'], failed, 'routers'): - for p in neutron.list_ports( - device_id=router['id'])['ports']: - neutron.remove_interface_router(router['id'], { - 'port_id': p['id'] - }) - neutron.delete_router(router['id']) - - for port in ports: - if port['id'] in resources_to_remove['ports']: - with self._handled_exception(port['id'], failed, 'ports'): - neutron.delete_port(port['id']) - - for subnet in subnets: - if subnet['id'] in resources_to_remove['subnets']: - with self._handled_exception(subnet['id'], failed, 'subnets'): - neutron.delete_subnet(subnet['id']) - - for network in networks: - if network['name'] == self.env.external_network_name: - continue - if network['id'] in resources_to_remove['networks']: - with self._handled_exception(network['id'], failed, - 'networks'): - neutron.delete_network(network['id']) - - # TODO: implement key-pair creation and cleanup per tenant - # - # IMPORTANT: Do not remove key-pairs, they might be used - # by another tenant (of the same user) - # - # for key_pair in keypairs: - # if key_pair.name == self.env.agent_keypair_name and \ - # self.env.use_existing_agent_keypair: - # # this is a pre-existing agent key-pair, do not remove - # continue - # elif key_pair.name == self.env.management_keypair_name and \ - # self.env.use_existing_manager_keypair: - # # this is a pre-existing manager key-pair, do not remove - # continue - # elif key_pair.id in resources_to_remove['key_pairs']: - # with self._handled_exception(key_pair.id, failed, - # 'key_pairs'): - # nova.keypairs.delete(key_pair) - - for floatingip in floatingips: - if floatingip['id'] in resources_to_remove['floatingips']: - with self._handled_exception(floatingip['id'], failed, - 'floatingips'): - neutron.delete_floatingip(floatingip['id']) - - for security_group in security_groups: - if security_group['name'] == 'default': - continue - if security_group['id'] in resources_to_remove['security_groups']: - with self._handled_exception(security_group['id'], - failed, 'security_groups'): - neutron.delete_security_group(security_group['id']) - - return failed - - def _delete_volumes(self, nova, cinder, existing_volumes): - unremovables = {} - end_time = time.time() + VOLUME_TERMINATION_TIMEOUT_SECS - - for volume in existing_volumes: - # detach the volume - if volume.status in ['available', 'error', 'in-use']: - try: - self.logger.info('Detaching volume {0} ({1}), currently in' - ' status {2} ...'. - format(volume.name, volume.id, - volume.status)) - for attachment in volume.attachments: - nova.volumes.delete_server_volume( - server_id=attachment['server_id'], - attachment_id=attachment['id']) - except Exception as e: - self.logger.warning('Attempt to detach volume {0} ({1})' - ' yielded exception: "{2}"'. - format(volume.name, volume.id, - e)) - unremovables[volume.id] = e - existing_volumes.remove(volume) - - time.sleep(3) - for volume in existing_volumes: - # delete the volume - if volume.status in ['available', 'error', 'in-use']: - try: - self.logger.info('Deleting volume {0} ({1}), currently in' - ' status {2} ...'. - format(volume.name, volume.id, - volume.status)) - cinder.volumes.delete(volume) - except Exception as e: - self.logger.warning('Attempt to delete volume {0} ({1})' - ' yielded exception: "{2}"'. - format(volume.name, volume.id, - e)) - unremovables[volume.id] = e - existing_volumes.remove(volume) - - # wait for all volumes deletion until completed or timeout is reached - while existing_volumes and time.time() < end_time: - time.sleep(3) - for volume in existing_volumes: - volume_id = volume.id - volume_name = volume.name - try: - vol = cinder.volumes.get(volume_id) - if vol.status == 'deleting': - self.logger.debug('volume {0} ({1}) is being ' - 'deleted...'.format(volume_name, - volume_id)) - else: - self.logger.warning('volume {0} ({1}) is in ' - 'unexpected status: {2}'. - format(volume_name, volume_id, - vol.status)) - except Exception as e: - # the volume wasn't found, it was deleted - if hasattr(e, 'code') and e.code == 404: - self.logger.info('deleted volume {0} ({1})'. - format(volume_name, volume_id)) - existing_volumes.remove(volume) - else: - self.logger.warning('failed to remove volume {0} ' - '({1}), exception: {2}'. - format(volume_name, - volume_id, e)) - unremovables[volume_id] = e - existing_volumes.remove(volume) - - if existing_volumes: - for volume in existing_volumes: - # try to get the volume's status - try: - vol = cinder.volumes.get(volume.id) - vol_status = vol.status - except: - # failed to get volume... status is unknown - vol_status = 'unknown' - - unremovables[volume.id] = 'timed out while removing volume '\ - '{0} ({1}), current volume status '\ - 'is {2}'.format(volume.name, - volume.id, - vol_status) - - if unremovables: - self.logger.warning('failed to remove volumes: {0}'.format( - unremovables)) - - return unremovables - - def _client_creds(self): - return { - 'username': self.env.keystone_username, - 'password': self.env.keystone_password, - 'auth_url': self.env.keystone_url, - 'project_name': self.env.keystone_tenant_name, - 'region_name': self.env.region - } - - def _networks(self, neutron, prefix): - return [(n['id'], n['name']) - for n in neutron.list_networks()['networks'] - if self._check_prefix(n['name'], prefix)] - - def _subnets(self, neutron, prefix): - return [(n['id'], n['name']) - for n in neutron.list_subnets()['subnets'] - if self._check_prefix(n['name'], prefix)] - - def _routers(self, neutron, prefix): - return [(n['id'], n['name']) - for n in neutron.list_routers()['routers'] - if self._check_prefix(n['name'], prefix)] - - def _security_groups(self, neutron, prefix): - return [(n['id'], n['name']) - for n in neutron.list_security_groups()['security_groups'] - if self._check_prefix(n['name'], prefix)] - - def _servers(self, nova, prefix): - return [(s.id, s.human_id) - for s in nova.servers.list() - if self._check_prefix(s.human_id, prefix)] - - def _key_pairs(self, nova, prefix): - return [(kp.id, kp.name) - for kp in nova.keypairs.list() - if self._check_prefix(kp.name, prefix)] - - def _floatingips(self, neutron, prefix): - return [(ip['id'], ip['floating_ip_address']) - for ip in neutron.list_floatingips()['floatingips']] - - def _ports(self, neutron, prefix): - return [(p['id'], p['name']) - for p in neutron.list_ports()['ports'] - if self._check_prefix(p['name'], prefix)] - - def _volumes(self, cinder, prefix): - return [(v.id, v.name) for v in cinder.volumes.list() - if self._check_prefix(v.name, prefix)] - - def _check_prefix(self, name, prefix): - # some openstack resources (eg. volumes) can have no display_name, - # in which case it's None - return name is None or name.startswith(prefix) - - def _remove_keys(self, dct, keys): - for key in keys: - if key in dct: - del dct[key] - return dct - - @contextmanager - def _handled_exception(self, resource_id, failed, resource_group): - try: - yield - except BaseException, ex: - failed[resource_group][resource_id] = ex - - -handler = OpenstackHandler diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_nova_net_handler.py b/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_nova_net_handler.py deleted file mode 100644 index 06fa0ab4d0..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/system_tests/openstack_nova_net_handler.py +++ /dev/null @@ -1,98 +0,0 @@ -######## -# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved -# -# 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 novaclient.v2.client as nvclient - -from system_tests.openstack_handler import OpenstackHandler - - -class OpenstackNovaNetHandler(OpenstackHandler): - - # using the Config Readers of the regular OpenstackHandler - attempts - # of reading neutron-related data may fail but shouldn't happen from - # nova-net tests in the first place - # CloudifyConfigReader = None - - def openstack_clients(self): - creds = self._client_creds() - return nvclient.Client(**creds) - - def openstack_infra_state(self): - nova = self.openstack_clients() - prefix = self.env.resources_prefix - return { - 'security_groups': dict(self._security_groups(nova, prefix)), - 'servers': dict(self._servers(nova, prefix)), - 'key_pairs': dict(self._key_pairs(nova, prefix)), - 'floatingips': dict(self._floatingips(nova, prefix)), - } - - def _floatingips(self, nova, prefix): - return [(ip.id, ip.ip) - for ip in nova.floating_ips.list()] - - def _security_groups(self, nova, prefix): - return [(n.id, n.name) - for n in nova.security_groups.list() - if self._check_prefix(n.name, prefix)] - - def _remove_openstack_resources_impl(self, resources_to_remove): - nova = self.openstack_clients() - - servers = nova.servers.list() - keypairs = nova.keypairs.list() - floatingips = nova.floating_ips.list() - security_groups = nova.security_groups.list() - - failed = { - 'servers': {}, - 'key_pairs': {}, - 'floatingips': {}, - 'security_groups': {} - } - - for server in servers: - if server.id in resources_to_remove['servers']: - with self._handled_exception(server.id, failed, 'servers'): - nova.servers.delete(server) - for key_pair in keypairs: - if key_pair.name == self.env.agent_keypair_name and \ - self.env.use_existing_agent_keypair: - # this is a pre-existing agent key-pair, do not remove - continue - elif key_pair.name == self.env.management_keypair_name and \ - self.env.use_existing_manager_keypair: - # this is a pre-existing manager key-pair, do not remove - continue - elif key_pair.id in resources_to_remove['key_pairs']: - with self._handled_exception(key_pair.id, failed, 'key_pairs'): - nova.keypairs.delete(key_pair) - for floatingip in floatingips: - if floatingip.id in resources_to_remove['floatingips']: - with self._handled_exception(floatingip.id, failed, - 'floatingips'): - nova.floating_ips.delete(floatingip) - for security_group in security_groups: - if security_group.name == 'default': - continue - if security_group.id in resources_to_remove['security_groups']: - with self._handled_exception(security_group.id, failed, - 'security_groups'): - nova.security_groups.delete(security_group) - - return failed - - -handler = OpenstackNovaNetHandler diff --git a/aria/multivim-plugin/src/main/python/multivim-plugin/tox.ini b/aria/multivim-plugin/src/main/python/multivim-plugin/tox.ini deleted file mode 100644 index b3572d70d2..0000000000 --- a/aria/multivim-plugin/src/main/python/multivim-plugin/tox.ini +++ /dev/null @@ -1,44 +0,0 @@ -# content of: tox.ini , put in same dir as setup.py -[tox] -envlist=flake8,docs,py27 - -[testenv] -deps = - -rdev-requirements.txt - -[testenv:py27] -deps = - coverage==3.7.1 - nose - nose-cov - mock - testfixtures - {[testenv]deps} -commands = - nosetests --with-cov --cov-report term-missing \ - --cov cinder_plugin cinder_plugin/tests \ - --cov glance_plugin glance_plugin/tests \ - --cov keystone_plugin keystone_plugin/tests \ - --cov neutron_plugin \ - neutron_plugin/tests/test_port.py neutron_plugin/tests/test_security_group.py \ - --cov nova_plugin nova_plugin/tests \ - --cov openstack_plugin_common openstack_plugin_common/tests - -[testenv:docs] -changedir=docs -deps = - git+https://github.com/cloudify-cosmo/sphinxify.git@initial-work -commands = - sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html - -[testenv:flake8] -deps = - flake8 - {[testenv]deps} -commands = - flake8 cinder_plugin - flake8 neutron_plugin - flake8 nova_plugin - flake8 openstack_plugin_common - flake8 glance_plugin - flake8 keystone_plugin |