summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/openstack_utils.py
diff options
context:
space:
mode:
authornikoskarandreas <nick@intracom-telecom.com>2018-07-12 19:40:30 +0300
committernikoskarandreas <nick@intracom-telecom.com>2018-10-15 12:13:29 +0300
commitcfcb04c938abdcddd76bcdd2375b4a81ea28fa51 (patch)
treef01f95abff0319d4b7d562e2b39b98b4d0fd2822 /sdnvpn/lib/openstack_utils.py
parentedd6cfe15ecd4e2bf608c23c6ca4612334df044b (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-219 Change-Id: Ic284722e600652c9058da96d349dff9398bcacf1 Signed-off-by: nikoskarandreas <nick@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/lib/openstack_utils.py')
-rw-r--r--sdnvpn/lib/openstack_utils.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/sdnvpn/lib/openstack_utils.py b/sdnvpn/lib/openstack_utils.py
index fc36c5b..3fa17e6 100644
--- a/sdnvpn/lib/openstack_utils.py
+++ b/sdnvpn/lib/openstack_utils.py
@@ -1441,3 +1441,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