aboutsummaryrefslogtreecommitdiffstats
path: root/aria/multivim-plugin/system_tests/openstack_nova_net_handler.py
diff options
context:
space:
mode:
authordfilppi <dewayne@cloudify.co>2017-08-31 00:15:51 +0000
committerDeWayne Filppi <dewayne@cloudify.co>2017-09-07 16:37:00 +0000
commitdf40f6f09f11aa823c1fd07e85887885f20d356b (patch)
treec5d186d21602ad4464e0b7ec6cc8618d9a7a8f54 /aria/multivim-plugin/system_tests/openstack_nova_net_handler.py
parentdcb890a6fa153900a0562872ccc31a5df2dffd24 (diff)
reorg and add pom build for wheel
Change-Id: Iab761e263f1e2380471dd38c2b7ce9b77f0aab0e Signed-off-by: DeWayne Filppi <dewayne@cloudify.co> Issue-id: SO-106
Diffstat (limited to 'aria/multivim-plugin/system_tests/openstack_nova_net_handler.py')
-rw-r--r--aria/multivim-plugin/system_tests/openstack_nova_net_handler.py98
1 files changed, 0 insertions, 98 deletions
diff --git a/aria/multivim-plugin/system_tests/openstack_nova_net_handler.py b/aria/multivim-plugin/system_tests/openstack_nova_net_handler.py
deleted file mode 100644
index 06fa0ab4d0..0000000000
--- a/aria/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