summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/utils.py
diff options
context:
space:
mode:
authornikoskarandreas <nick@intracom-telecom.com>2018-11-06 17:31:11 +0200
committernikoskarandreas <nick@intracom-telecom.com>2018-12-11 11:38:24 +0200
commitba1eb0716b966256ed9ff1f160df0422a7b04776 (patch)
treeff1c01211f61c36316e4b34eccc87453e1a72f55 /sdnvpn/lib/utils.py
parent63ea4922aa8340e2d6ffde0cce3ddff775900f15 (diff)
Using heat orchestrator for sdnvpn - test case 8
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 8: Test floating IP and router assoc coexistence JIRA: SDNVPN-219 Change-Id: I8a61d40e9decf4297b8714c93ce77ba05f033b66 Signed-off-by: nikoskarandreas <nick@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/lib/utils.py')
-rw-r--r--sdnvpn/lib/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index eb245c5..4c35edc 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -14,6 +14,7 @@ import time
import requests
import re
import subprocess
+import yaml
from concurrent.futures import ThreadPoolExecutor
from openstack.exceptions import ResourceNotFound, NotFoundException
from requests.auth import HTTPBasicAuth
@@ -1150,3 +1151,20 @@ def get_vms_from_stack_outputs(conn, stack_id, vm_stack_output_keys):
if vm is not None:
vms.append(vm)
return vms
+
+
+def merge_yaml(y1, y2):
+ """ Merge two yaml HOT into one
+
+ The parameters, resources and outputs sections are merged.
+
+ :param y1: the first yaml
+ :param y2: the second yaml
+ :return y: merged yaml
+ """
+ d1 = yaml.load(y1)
+ d2 = yaml.load(y2)
+ for key in ('parameters', 'resources', 'outputs'):
+ if key in d2:
+ d1[key].update(d2[key])
+ return yaml.dump(d1, default_flow_style=False)