aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/lib/utils.py
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-02-15 14:24:14 +0200
committerGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-02-15 16:59:11 +0200
commitcbd1cf8b06a89a9c4021048b6a6dd466bf72d4c8 (patch)
tree1b4cdf2a050653e9802b4b8608c135adb7e84e59 /sfc/lib/utils.py
parentf9a6e37b970ff3974ad9e3f0027354d04bbf3ce7 (diff)
Pass availability zone as param on vnf create
JIRA: SFC-63 JIRA: SFC-73 Instead of changing the vnfd-template file in runtime we can pass the availability zone as a parameter when the vnf is created This enables also the use of topology_shuffler for SFC-63 Change-Id: Ie650e3347e40aee030005b6a2272cae64968d303 Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'sfc/lib/utils.py')
-rw-r--r--sfc/lib/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index 9c191462..67dbff22 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -12,10 +12,12 @@ import os
import re
import subprocess
import time
+import yaml
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
+import functest.utils.openstack_tacker as os_tacker
logger = ft_logger.Logger("sfc_test_utils").getLogger()
@@ -75,6 +77,22 @@ def download_image(url, image_path):
logger.info("Using old image")
+def create_vnf_in_av_zone(tacker_client, vnf_name, vnfd_name, av_zone=None):
+ param_file = os.path.join(os.getcwd(),
+ 'vnfd-templates',
+ 'test-vnfd-default-params.yaml')
+ if av_zone is not None:
+ param_file = os.path.join('/tmp', 'param_{0}.yaml'.format(av_zone))
+ data = {'zone': av_zone}
+ with open(param_file) as f:
+ yaml.dump(data, f)
+
+ os_tacker.create_vnf(tacker_client,
+ vnf_name,
+ vnfd_name=vnfd_name,
+ param_file=param_file)
+
+
def setup_neutron(neutron_client, net, subnet, router, subnet_cidr):
n_dict = os_utils.create_network_full(neutron_client,
net,