aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/features/promise.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-02-01 18:29:24 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2016-02-01 17:33:29 +0000
commitb794c911087074245a7584c290217e0b2d84eccf (patch)
treeaddfa8baf21d38ed0f2977b770eb82a87c333da0 /testcases/features/promise.py
parentfa415dc1de69e47b84e020ec166bfe84ae646240 (diff)
Use promise-flavor if exists and don't try to create it again
Change-Id: I02ba76acb02f9785d13ca9bcd61ebe1290fa1cd7 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com> (cherry picked from commit 81d7877b7f124f393c929e3a862e64125218e945)
Diffstat (limited to 'testcases/features/promise.py')
-rw-r--r--testcases/features/promise.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index 22d28fb99..b0fadf708 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -162,17 +162,24 @@ def main():
exit(-1)
logger.debug("Image '%s' with ID '%s' created successfully." % (IMAGE_NAME,
image_id))
-
- flavor_id = functest_utils.create_flavor(nova,
- FLAVOR_NAME,
- FLAVOR_RAM,
- FLAVOR_DISK,
- FLAVOR_VCPUS)
- if not flavor_id:
- logger.error("Failed to create the Flavor...")
- exit(-1)
- logger.debug("Flavor '%s' with ID '%s' created successfully." % (FLAVOR_NAME,
+ flavor_id = functest_utils.get_flavor_id(nova, FLAVOR_NAME)
+ if flavor_id == '':
+ logger.info("Creating flavor '%s'..." % FLAVOR_NAME)
+ flavor_id = functest_utils.create_flavor(nova,
+ FLAVOR_NAME,
+ FLAVOR_RAM,
+ FLAVOR_DISK,
+ FLAVOR_VCPUS)
+ if not flavor_id:
+ logger.error("Failed to create the Flavor...")
+ exit(-1)
+ logger.debug("Flavor '%s' with ID '%s' created successfully." %
+ (FLAVOR_NAME, flavor_id))
+ else:
+ logger.debug("Using existing flavor '%s' with ID '%s'..." % (FLAVOR_NAME,
flavor_id))
+
+
neutron = ntclient.Client(**nt_creds)
private_net=functest_utils.get_private_net(neutron)
if private_net == None: