summaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-02-02 19:05:56 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2016-02-03 07:44:10 +0000
commit6628a213ba1c167c34fdc92b12c4450114573bc3 (patch)
tree52f69a1f30858174e451cfc44fff3a9e1b13a061 /testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
parent82c5a7f92802973cd95e7919f9bc0848f5f3de1b (diff)
Consider volumes and floatingips as defaults in clean_openstack
Change-Id: I3ffc864768a7c474ee1063eecee1e2085de807b5 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com> (cherry picked from commit 16038f444c1e80006e13b72cb0597976a0b2f92e)
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries/generate_defaults.py')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/generate_defaults.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
index 0e34d6c7b..72987ddda 100644
--- a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
+++ b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
@@ -39,7 +39,7 @@ args = parser.parse_args()
""" logging configuration """
-logger = logging.getLogger('clean_openstack')
+logger = logging.getLogger('generate_defaults')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
@@ -85,6 +85,16 @@ def get_images(nova_client):
return {'images': dic_images}
+def get_volumes(cinder_client):
+ logger.debug("Getting volumes...")
+ dic_volumes = {}
+ volumes = functest_utils.get_volumes(cinder_client)
+ if volumes != None:
+ for volume in volumes:
+ dic_volumes.update({volume.id:volume.display_name})
+ return {'volumes': dic_volumes}
+
+
def get_networks(neutron_client):
logger.debug("Getting networks")
dic_networks = {}
@@ -94,6 +104,7 @@ def get_networks(neutron_client):
dic_networks.update({network['id']:network['name']})
return {'networks': dic_networks}
+
def get_routers(neutron_client):
logger.debug("Getting routers")
dic_routers = {}
@@ -114,6 +125,16 @@ def get_security_groups(neutron_client):
return {'secgroups': dic_secgroups}
+def get_floatinips(nova_client):
+ logger.debug("Getting Floating IPs...")
+ dic_floatingips = {}
+ floatingips = functest_utils.get_floating_ips(nova_client)
+ if not (floatingips is None or len(floatingips) == 0):
+ for floatingip in floatingips:
+ dic_floatingips.update({floatingip.id:floatingip.ip})
+ return {'floatingips': dic_floatingips}
+
+
def get_users(keystone_client):
logger.debug("Getting users...")
dic_users = {}
@@ -158,9 +179,11 @@ def main():
defaults = {}
defaults.update(get_instances(nova_client))
defaults.update(get_images(nova_client))
+ defaults.update(get_volumes(cinder_client))
defaults.update(get_networks(neutron_client))
defaults.update(get_routers(neutron_client))
defaults.update(get_security_groups(neutron_client))
+ defaults.update(get_floatinips(nova_client))
defaults.update(get_users(keystone_client))
defaults.update(get_tenants(keystone_client))