aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests/test_heat_parameter_section.py
diff options
context:
space:
mode:
authorstark, steven <ss820f@att.com>2018-07-19 14:23:39 -0700
committerstark, steven <ss820f@att.com>2018-07-19 15:27:56 -0700
commite99347bb14318a57307e2809c3d9577fc29bcb68 (patch)
tree39e7752de2f9e15a6ed590b6d66594be62549637 /ice_validator/tests/test_heat_parameter_section.py
parentc42086a36bbfaf9286e1c08330f25d1b06a35f4b (diff)
[VNFRQTS] update decorator for validation script
update decorator for validation script corresponding to 5.2.1 of VNFRTQS update decorator for validation script corresponding to 5.2.2 of VNFRTQS Change-Id: I063e799a27c76bb58c031273aca48031965849d9 Issue-ID: VVP-88 Signed-off-by: stark, steven <ss820f@att.com>
Diffstat (limited to 'ice_validator/tests/test_heat_parameter_section.py')
-rw-r--r--ice_validator/tests/test_heat_parameter_section.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ice_validator/tests/test_heat_parameter_section.py b/ice_validator/tests/test_heat_parameter_section.py
index e5792fc..2aab7d3 100644
--- a/ice_validator/tests/test_heat_parameter_section.py
+++ b/ice_validator/tests/test_heat_parameter_section.py
@@ -39,8 +39,12 @@
#
from .helpers import validates
import pytest
+import re
import yaml
+# one or more (alphanumeric or underscore)
+RE_VALID_PARAMETER_NAME = re.compile(r'[\w_]+$')
+
def test_parameter_valid_keys(yaml_file):
'''
@@ -88,3 +92,24 @@ def test_default_values(yaml_file):
invalid_params.append(str(v1))
assert not set(invalid_params)
+
+
+@validates('R-25877')
+def test_parameter_names(yaml_file):
+ '''
+ A VNF's Heat Orchestration Template's parameter name
+ (i.e., <param name>) **MUST** contain only alphanumeric
+ characters and underscores ('_').
+ '''
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ # skip if parameters are not defined
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+
+ for key in yml['parameters']:
+ assert RE_VALID_PARAMETER_NAME.match(key), (
+ '%s parameter "%s" not alphanumeric or underscore' % (
+ yaml_file,
+ key))