aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/lib/utils.py
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2017-02-16 09:28:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-16 09:28:03 +0000
commit86fb3c2459f85e728d4a1d6a35e38f13b9032bd5 (patch)
treefe77c083cb8fb9ce9a379d286cd46fc91a0c0956 /sfc/lib/utils.py
parentca7b72ad1a50c353b7ffc4e2934e654f73603c62 (diff)
parentcbd1cf8b06a89a9c4021048b6a6dd466bf72d4c8 (diff)
Merge "Pass availability zone as param on vnf create"
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 5ca53077..c7247dbe 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()
@@ -76,6 +78,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,