Fixes for using the NFV Profile and Imports in the Tacker server
- Fixed a bug in full-path import processing for server-based usage, and added a test case - Updated the nfv extension to support the metadata section Change-Id: I2eb3d10c6d4ec82021601dce8ade7e211a2e5169
This commit is contained in:
parent
0e52b2918d
commit
832b659ea0
@ -15,3 +15,5 @@
|
||||
VERSION = 'tosca_simple_profile_for_nfv_1_0_0'
|
||||
|
||||
DEFS_FILE = "TOSCA_nfv_definition_1_0.yaml"
|
||||
|
||||
SECTIONS = ('metadata')
|
||||
|
@ -2,6 +2,9 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||
|
||||
description: Template for deploying a single server with predefined properties.
|
||||
|
||||
metadata:
|
||||
template_name: TOSCA NFV Sample Template
|
||||
|
||||
topology_template:
|
||||
node_templates:
|
||||
VNF1:
|
||||
|
@ -214,7 +214,8 @@ class ImportsLoader(object):
|
||||
ExceptionCollector.appendException
|
||||
(ValueError(msg))
|
||||
else: # template is pre-parsed
|
||||
if os.path.isabs(file_name):
|
||||
if os.path.isabs(file_name) and os.path.isfile(file_name):
|
||||
a_file = True
|
||||
import_template = file_name
|
||||
else:
|
||||
msg = (_('Relative file name "%(name)s" cannot be used '
|
||||
|
@ -633,6 +633,24 @@ class ToscaTemplateTest(TestCase):
|
||||
exception.ExceptionCollector.assertExceptionMessage(ImportError,
|
||||
err_msg)
|
||||
|
||||
def test_yaml_dict_tpl_with_fullpath_import(self):
|
||||
test_tpl = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"data/tosca_single_instance_wordpress.yaml")
|
||||
|
||||
yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl)
|
||||
|
||||
yaml_dict_tpl['imports'] = [os.path.join(os.path.dirname(
|
||||
os.path.abspath(__file__)), "data/custom_types/wordpress.yaml")]
|
||||
|
||||
params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user',
|
||||
'db_root_pwd': 'mypasswd'}
|
||||
|
||||
tosca = ToscaTemplate(parsed_params=params,
|
||||
yaml_dict_tpl=yaml_dict_tpl)
|
||||
|
||||
self.assertEqual(tosca.version, "tosca_simple_yaml_1_0")
|
||||
|
||||
def test_policies_for_node_templates(self):
|
||||
tosca_tpl = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
|
Loading…
Reference in New Issue
Block a user