diff options
author | nikoskarandreas <nick@intracom-telecom.com> | 2018-07-12 19:40:30 +0300 |
---|---|---|
committer | Stamatis Katsaounis <mokats@intracom-telecom.com> | 2018-11-01 16:33:13 +0200 |
commit | 95dad3f4a73a22988c7a9b4694ce0d7e90cd8147 (patch) | |
tree | bee89fef29ce5f36b0d3f646cec44b51ad869ac6 /sdnvpn/lib/openstack_utils.py | |
parent | 5f3157c897eaa5ef538d716e905f55085654a6c5 (diff) |
Using heat orchestrator for sdnvpn - test case 1
Heat orchestrator and the use of Heat Orchestrator Templates
is introduced in sdnvpn test cases. The deployment of the
nodes and networks under test is performed as a stack with the
use of the heat api and the use of the other apis is kept to
as little as possible. The scenarios that are executed are the
same as in the orginal test cases.
This is the implementation of sdnvpn test case 1:
VPN provides connectivity between subnets
and also base functions for heat api access and some utilities.
JIRA: SDNVPN-237
JIRA: SDNVPN-219
Change-Id: Ic284722e600652c9058da96d349dff9398bcacf1
Signed-off-by: nikoskarandreas <nick@intracom-telecom.com>
(cherry picked from commit cfcb04c938abdcddd76bcdd2375b4a81ea28fa51)
Diffstat (limited to 'sdnvpn/lib/openstack_utils.py')
-rw-r--r-- | sdnvpn/lib/openstack_utils.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sdnvpn/lib/openstack_utils.py b/sdnvpn/lib/openstack_utils.py index 9126eeb..bc9a86b 100644 --- a/sdnvpn/lib/openstack_utils.py +++ b/sdnvpn/lib/openstack_utils.py @@ -1438,3 +1438,43 @@ def get_resource(heat_client, stack_id, resource): except Exception as e: logger.error("Error [get_resource]: %s" % e) return None + + +def create_stack(heat_client, **kwargs): + try: + stack = heat_client.stacks.create(**kwargs) + stack_id = stack['stack']['id'] + if stack_id is None: + logger.error("Stack create start failed") + raise SystemError("Stack create start failed") + return stack_id + except Exception as e: + logger.error("Error [create_stack]: %s" % e) + return None + + +def delete_stack(heat_client, stack_id): + try: + heat_client.stacks.delete(stack_id) + return True + except Exception as e: + logger.error("Error [delete_stack]: %s" % e) + return False + + +def list_stack(heat_client, **kwargs): + try: + result = heat_client.stacks.list(**kwargs) + return result + except Exception as e: + logger.error("Error [list_stack]: %s" % e) + return None + + +def get_output(heat_client, stack_id, output_key): + try: + output = heat_client.stacks.output_show(stack_id, output_key) + return output + except Exception as e: + logger.error("Error [get_output]: %s" % e) + return None |