aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2019-01-28 14:59:01 -0800
committerstark, steven <steven.stark@att.com>2019-01-29 08:03:41 -0800
commit48a07b6942d3956666d30947372653feb702fdae (patch)
tree5a5fc3135f2703ad19543b78e661ea954e98bb33 /ice_validator/tests
parent43130f8b173d9053ad4f56f264376851d3fb890c (diff)
[VVP] stand alone tool, script updates
1) Validation script updates: Various bug fixes and script enhancements New tests for: R-18683 R-94669 R-304011 R-01455 R-86476 R-708564 R-85734 R-18683 R-94669 R-304011 R-01455 R-86476 R-86476 R-589037 Removed tests for: R-75202 R-62954 R-22441 R-49177 R-16576 R-86237 R-44491 R-70757 R-01896 R-26124 2) Stand Alone tool introduced 3) Added optional "categories" capability Change-Id: I193cd5c267750791d97b350e91fc36faa72d8d5f Issue-ID: VVP-143 Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'ice_validator/tests')
-rw-r--r--ice_validator/tests/conftest.py160
-rw-r--r--ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env40
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env40
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/fail/STARKDB-nested.yaml103
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env40
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/pass/STARKDB-nested.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.env46
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/parent.yaml (renamed from ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.yaml)40
-rw-r--r--ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml7
-rw-r--r--ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml2
-rw-r--r--ice_validator/tests/fixtures/test_nested_parameters/pass/heat_template.yaml4
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh40
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh40
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/settings40
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml14
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml129
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml133
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml135
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml12
-rw-r--r--ice_validator/tests/fixtures/test_oam_address_outputs/fail/base_fail.yaml45
-rw-r--r--ice_validator/tests/fixtures/test_oam_address_outputs/fail/module_fail.yaml45
-rw-r--r--ice_validator/tests/fixtures/test_oam_address_outputs/pass/base_pass.yaml41
-rw-r--r--ice_validator/tests/fixtures/test_oam_address_outputs/pass/module_pass.yaml41
-rw-r--r--ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/fail/fail.yaml49
-rw-r--r--ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/pass/pass.yaml49
-rw-r--r--ice_validator/tests/fixtures/test_vm_class_has_unique_type/fail/fail.yaml (renamed from ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.yaml)56
-rw-r--r--ice_validator/tests/fixtures/test_vm_class_has_unique_type/pass/pass.yaml75
-rw-r--r--ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.env (renamed from ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.env)12
-rw-r--r--ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.yaml53
-rw-r--r--ice_validator/tests/fixtures/test_vm_role_value/pass/pass_hardcoded.yaml43
-rw-r--r--ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.env (renamed from ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.env)13
-rw-r--r--ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.yaml47
-rw-r--r--ice_validator/tests/helpers.py56
-rw-r--r--ice_validator/tests/report.html.jinja24
-rw-r--r--ice_validator/tests/structures.py731
-rw-r--r--ice_validator/tests/test_all_parameters_used_in_template.py51
-rw-r--r--ice_validator/tests/test_contrail_instance_ip_resource_id.py24
-rw-r--r--ice_validator/tests/test_contrail_resource_id.py31
-rw-r--r--ice_validator/tests/test_contrail_vmi_resource_id.py22
-rw-r--r--ice_validator/tests/test_contrail_vn_resource_id.py8
-rw-r--r--ice_validator/tests/test_env_parameters_defined_in_template.py6
-rw-r--r--ice_validator/tests/test_environment_file_parameters.py551
-rw-r--r--ice_validator/tests/test_filename_is_vmtype_dot_yaml.py34
-rw-r--r--ice_validator/tests/test_nested_parameters.py99
-rw-r--r--ice_validator/tests/test_neutron_net_resource_id.py11
-rw-r--r--ice_validator/tests/test_neutron_port_addresses.py26
-rw-r--r--ice_validator/tests/test_neutron_port_fixed_ips.py6
-rw-r--r--ice_validator/tests/test_neutron_port_internal_network.py3
-rw-r--r--ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py93
-rw-r--r--ice_validator/tests/test_non_server_name.py34
-rw-r--r--ice_validator/tests/test_nova_server_resource_id.py13
-rw-r--r--ice_validator/tests/test_nova_servers_resource_ids.py8
-rw-r--r--ice_validator/tests/test_nova_servers_vm_types.py14
-rw-r--r--ice_validator/tests/test_oam_address_outputs.py65
-rw-r--r--ice_validator/tests/test_port_resource_ids.py4
-rw-r--r--ice_validator/tests/test_server_and_port_vm_indices_match.py84
-rw-r--r--ice_validator/tests/test_servers_have_required_metadata.py7
-rw-r--r--ice_validator/tests/test_vm_class_has_unique_type.py155
-rw-r--r--ice_validator/tests/test_vm_role_value.py99
-rw-r--r--ice_validator/tests/test_volume_module_naming.py5
-rw-r--r--ice_validator/tests/test_volume_resource_ids.py5
-rw-r--r--ice_validator/tests/utils/vm_types.py20
74 files changed, 2817 insertions, 1566 deletions
diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py
index 5184fb6..5621354 100644
--- a/ice_validator/tests/conftest.py
+++ b/ice_validator/tests/conftest.py
@@ -58,6 +58,8 @@ from more_itertools import partition
import xlsxwriter
from six import string_types
+import version
+
__path__ = [os.path.dirname(os.path.abspath(__file__))]
DEFAULT_OUTPUT_DIR = "{}/../output".format(__path__[0])
@@ -312,9 +314,7 @@ def pytest_runtest_makereport(item, call):
msg = "!!Base Test Failure!! Halting test suite execution...\n{}".format(
result.error_message
)
- pytest.exit(
- "{}\n{}\n{}".format(msg, result.files, result.test_case)
- )
+ pytest.exit("{}\n{}\n{}".format(msg, result.files, result.test_case))
def make_timestamp():
@@ -339,12 +339,17 @@ def pytest_sessionfinish(session, exitstatus):
"""
if not session.config.option.template_dir:
return
- template_path = os.path.abspath(session.config.option.template_dir[0])
- profile_name = session.config.option.validation_profile_name or ""
+
+ if session.config.option.template_source:
+ template_source = session.config.option.template_source[0]
+ else:
+ template_source = os.path.abspath(session.config.option.template_dir[0])
+
+ categories_selected = session.config.option.test_categories or ""
generate_report(
get_output_dir(session.config),
- template_path,
- profile_name,
+ template_source,
+ categories_selected,
session.config.option.report_format,
)
@@ -352,33 +357,33 @@ def pytest_sessionfinish(session, exitstatus):
# noinspection PyUnusedLocal
def pytest_collection_modifyitems(session, config, items):
"""
- Selects tests based on the validation profile requested. Tests without
- pytest markers will always be executed.
+ Selects tests based on the categories requested. Tests without
+ categories will always be executed.
"""
- allowed_marks = ["xfail", "base"]
- profile = config.option.validation_profile
-
- for item in items:
- markers = set(m.name for m in item.iter_markers())
- if not profile and markers and set(markers).isdisjoint(allowed_marks):
- item.add_marker(
- pytest.mark.skip(
- reason="No validation profile selected. "
- "Skipping tests with marks."
- )
- )
- if (
- profile
- and markers
- and profile not in markers
- and set(markers).isdisjoint(allowed_marks)
- ):
- item.add_marker(
- pytest.mark.skip(reason="Doesn't match selection " "validation profile")
- )
-
+ config.traceability_items = list(items) # save all items for traceability
+ if not config.option.self_test:
+ for item in items:
+ # checking if test belongs to a category
+ if hasattr(item.function, "categories"):
+ if config.option.test_categories:
+ test_categories = getattr(item.function, "categories")
+ passed_categories = config.option.test_categories
+ if not all(
+ category in passed_categories for category in test_categories
+ ):
+ item.add_marker(
+ pytest.mark.skip(
+ reason="Test categories do not match all the passed categories"
+ )
+ )
+ else:
+ item.add_marker(
+ pytest.mark.skip(
+ reason="Test belongs to a category but no categories were passed"
+ )
+ )
items.sort(
- key=lambda i: 0 if "base" in set(m.name for m in i.iter_markers()) else 1
+ key=lambda item: 0 if "base" in set(m.name for m in item.iter_markers()) else 1
)
@@ -412,13 +417,13 @@ def load_resolutions_file():
return json.loads(f.read())
-def generate_report(outpath, template_path, profile_name, output_format="html"):
+def generate_report(outpath, template_path, categories, output_format="html"):
"""
Generates the various output reports.
:param outpath: destination directory for all reports
:param template_path: directory containing the Heat templates validated
- :param profile_name: Optional validation profile selected
+ :param categories: Optional categories selected
:param output_format: One of "html", "excel", or "csv". Default is "html"
:raises: ValueError if requested output format is unknown
"""
@@ -426,13 +431,13 @@ def generate_report(outpath, template_path, profile_name, output_format="html"):
generate_failure_file(outpath)
output_format = output_format.lower().strip() if output_format else "html"
if output_format == "html":
- generate_html_report(outpath, profile_name, template_path, failures)
+ generate_html_report(outpath, categories, template_path, failures)
elif output_format == "excel":
- generate_excel_report(outpath, profile_name, template_path, failures)
+ generate_excel_report(outpath, categories, template_path, failures)
elif output_format == "json":
- generate_json(outpath, template_path, profile_name)
+ generate_json(outpath, template_path, categories)
elif output_format == "csv":
- generate_csv_report(outpath, profile_name, template_path, failures)
+ generate_csv_report(outpath, categories, template_path, failures)
else:
raise ValueError("Unsupported output format: " + output_format)
@@ -469,10 +474,11 @@ def generate_failure_file(outpath):
write_json(data, failure_path)
-def generate_csv_report(output_dir, profile_name, template_path, failures):
+def generate_csv_report(output_dir, categories, template_path, failures):
rows = [["Validation Failures"]]
headers = [
- ("Profile Selected:", profile_name),
+ ("Categories Selected:", categories),
+ ("Tool Version:", version.VERSION),
("Report Generated At:", make_timestamp()),
("Directory Validated:", template_path),
("Checksum:", hash_directory(template_path)),
@@ -523,7 +529,7 @@ def generate_csv_report(output_dir, profile_name, template_path, failures):
writer.writerow(row)
-def generate_excel_report(output_dir, profile_name, template_path, failures):
+def generate_excel_report(output_dir, categories, template_path, failures):
output_path = os.path.join(output_dir, "report.xlsx")
workbook = xlsxwriter.Workbook(output_path)
bold = workbook.add_format({"bold": True})
@@ -534,7 +540,8 @@ def generate_excel_report(output_dir, profile_name, template_path, failures):
worksheet.write(0, 0, "Validation Failures", heading)
headers = [
- ("Profile Selected:", profile_name),
+ ("Categories Selected:", ",".join(categories)),
+ ("Tool Version:", version.VERSION),
("Report Generated At:", make_timestamp()),
("Directory Validated:", template_path),
("Checksum:", hash_directory(template_path)),
@@ -636,7 +643,8 @@ def aggregate_results(has_errors, outcomes, r_id=None):
else:
pytest.warns(
"Unexpected error aggregating outcomes ({}) for requirement {}".format(
- outcomes, r_id)
+ outcomes, r_id
+ )
)
return "ERROR"
@@ -693,18 +701,18 @@ def collect_errors(r_id, collection_failures, test_result):
r_id is None, then it collects all errors that occur on failures and
results that are not mapped to requirements
"""
+
def selector(item):
if r_id:
return r_id in req_ids(item)
else:
return not req_ids(item)
- errors = (error(x) for x in chain(collection_failures, test_result)
- if selector(x))
+ errors = (error(x) for x in chain(collection_failures, test_result) if selector(x))
return [e for e in errors if e]
-def generate_json(outpath, template_path, profile_name):
+def generate_json(outpath, template_path, categories):
"""
Creates a JSON summary of the entire test run.
"""
@@ -714,7 +722,7 @@ def generate_json(outpath, template_path, profile_name):
"template_directory": template_path,
"timestamp": make_iso_timestamp(),
"checksum": hash_directory(template_path),
- "profile": profile_name,
+ "categories": categories,
"outcome": aggregate_run_results(COLLECTION_FAILURES, ALL_RESULTS),
"tests": [],
"requirements": [],
@@ -754,7 +762,7 @@ def generate_json(outpath, template_path, profile_name):
"text": r_data["description"],
"keyword": r_data["keyword"],
"result": result,
- "errors": collect_errors(r_id, COLLECTION_FAILURES, ALL_RESULTS)
+ "errors": collect_errors(r_id, COLLECTION_FAILURES, ALL_RESULTS),
}
)
# If there are tests that aren't mapped to a requirement, then we'll
@@ -767,7 +775,7 @@ def generate_json(outpath, template_path, profile_name):
"id": "Unmapped",
"text": "Tests not mapped to requirements (see tests)",
"result": aggregate_results(has_errors, unmapped_outcomes),
- "errors": collect_errors(None, COLLECTION_FAILURES, ALL_RESULTS)
+ "errors": collect_errors(None, COLLECTION_FAILURES, ALL_RESULTS),
}
)
@@ -775,7 +783,7 @@ def generate_json(outpath, template_path, profile_name):
write_json(data, report_path)
-def generate_html_report(outpath, profile_name, template_path, failures):
+def generate_html_report(outpath, categories, template_path, failures):
reqs = load_current_requirements()
resolutions = load_resolutions_file()
fail_data = []
@@ -797,8 +805,9 @@ def generate_html_report(outpath, profile_name, template_path, failures):
with open(j2_template_path, "r") as f:
report_template = jinja2.Template(f.read())
contents = report_template.render(
+ version=version.VERSION,
num_failures=len(failures) + len(COLLECTION_FAILURES),
- profile_name=profile_name,
+ categories=categories,
template_dir=make_href(template_path),
checksum=hash_directory(template_path),
timestamp=make_timestamp(),
@@ -821,6 +830,13 @@ def pytest_addoption(parser):
)
parser.addoption(
+ "--template-source",
+ dest="template_source",
+ action="append",
+ help="Source Directory which holds the templates for validation",
+ )
+
+ parser.addoption(
"--self-test",
dest="self_test",
action="store_true",
@@ -828,20 +844,6 @@ def pytest_addoption(parser):
)
parser.addoption(
- "--validation-profile",
- dest="validation_profile",
- action="store",
- help="Runs all unmarked tests plus test with a matching marker",
- )
-
- parser.addoption(
- "--validation-profile-name",
- dest="validation_profile_name",
- action="store",
- help="Friendly name of the validation profile used in reports",
- )
-
- parser.addoption(
"--report-format",
dest="report_format",
action="store",
@@ -860,7 +862,14 @@ def pytest_addoption(parser):
dest="output_dir",
action="store",
default=None,
- help="Alternate "
+ help="Alternate ",
+ )
+
+ parser.addoption(
+ "--category",
+ dest="test_categories",
+ action="append",
+ help="optional category of test to execute",
)
@@ -1040,6 +1049,21 @@ def unicode_writerow(writer, row):
writer.writerow(row)
+def parse_heat_requirements(reqs):
+ """Takes requirements and returns list of only Heat requirements"""
+ data = json.loads(reqs)
+ for key, values in list(data.items()):
+ if "Heat" in (values["docname"]):
+ if "MUST" not in (values["keyword"]):
+ del data[key]
+ else:
+ if "none" in (values["validation_mode"]):
+ del data[key]
+ else:
+ del data[key]
+ return data
+
+
# noinspection PyUnusedLocal
def pytest_report_collectionfinish(config, startdir, items):
"""Generates a simple traceability report to output/traceability.csv"""
@@ -1047,7 +1071,9 @@ def pytest_report_collectionfinish(config, startdir, items):
output_dir = os.path.split(traceability_path)[0]
if not os.path.exists(output_dir):
os.makedirs(output_dir)
- requirements = load_current_requirements()
+ reqs = load_current_requirements()
+ reqs = json.dumps(reqs)
+ requirements = parse_heat_requirements(reqs)
unmapped, mapped = partition(
lambda i: hasattr(i.function, "requirement_ids"), items
)
diff --git a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml
index 6064c91..6f65d89 100644
--- a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml
+++ b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml
index ee9311f..51cefa4 100644
--- a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml
+++ b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env
index 4ea6ee3..4d1f3a4 100644
--- a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
test123: nsdafjk
bad: ndfaskl \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml
index 90d0f3c..bb46456 100644
--- a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
test123:
type: string
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env
index de8d3e0..c6b67b6 100644
--- a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env
@@ -1,2 +1,42 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
test123: nsdafjk \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml
index 90d0f3c..bb46456 100644
--- a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
test123:
type: string
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/STARKDB-nested.yaml b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/STARKDB-nested.yaml
index 97bc4cf..0f15cfa 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/STARKDB-nested.yaml
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/STARKDB-nested.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
@@ -7,15 +47,76 @@ parameters:
my_nested_parameter:
type: number
description: sdfnklafd
+ STARKDB_image_name:
+ type: number
+ description: sdfnklafd
+ STARKDB_name:
+ type: number
+ description: sdfnklafd
+ my_nested_parameter:
+ type: number
+ description: sdfnklafd
#constraints:
# - range: { min: 100, max: 400 }
resources:
+ STARKDB_server_2:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: STARKDB_image_name }
+ flavor: { get_param: STARKDB_flavor_dvdfg }
+ name: { get_param: STARKDB_name }
+ availability_zone: { get_param: availability_zone_0 }
+
my_nested_resource2:
type: test
properties:
- my_nested_parameter: {get_param: my_nested_parameter}
+ name: { get_param: asfasf }
+
+ STARKDB_2_crazy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: crazy_net_id }
+ fixed_ips:
+ - subnet: { get_param: crazy_subnet_id }
+ - ip_address: { get_param: STARKDB_crazy_ip_0 }
+ allowed_address_pairs: [ { "ip_address": {get_param:
+ STARKDB_crazy_floating_ip}}]
+
+ int_private_net_id:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_priv_net_id }
+
+ STARKDB_0_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_private_net_id }
+ fixed_ips:
+ - subnet: { get_resource: int_priv_subnet }
+ - ip_address: { get_param: STARKDB_int_private_v6_ips }
+
+ myrouteprefix:
+ type: OS::ContrailV2::InterfaceRouteTable
+ properties:
+ name:
+ str_replace:
+ template: VNF_NAME_interface_route_table
+ params:
+ VNF_NAME: { get_param: vnf_name }
+ interface_route_table_routes:
+ interface_route_table_routes_route: { get_param: fw_oam_route_prefixes }
+ test: safd
+
+ stark_rg:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: { get_param: stark_rg_count }
+ resource_def:
+ type: STARKDB-nested.yaml
+ properties:
+ my_nested_parameter: 4
outputs:
test_value:
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
index 9187b10..19ab746 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
fw_oam_route_prefixes: nsaflj
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
index d84cc1f..efe09bb 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/STARKDB-nested.yaml b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/STARKDB-nested.yaml
index 97bc4cf..89077ac 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/STARKDB-nested.yaml
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/STARKDB-nested.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.env b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.env
index 46d2728..3879ffa 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.env
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.env
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
parameters:
#fw_oam_route_prefixes: nsaflj
@@ -20,7 +60,7 @@ parameters:
#TESTDB_name: bghbhjb
- TESTDB_avail_hosts: test
+ #TESTDB_avail_hosts: test
TESTDB_image_name: sadfadf
@@ -30,7 +70,7 @@ parameters:
param_X: sadnfklsadnfl
- priv_net_id: 123214
+ #priv_net_id: 123214
#priv_sub2net_id: 123123
@@ -48,7 +88,7 @@ parameters:
#STARKDB_crazy_floating_ip: safd
- crazy_net_id: safd
+ #crazy_net_id: safd
#crazy_subnet_id: asfd
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.yaml b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.yaml
index 42f23ee..8099410 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.yaml
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/pass/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.yaml b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/parent.yaml
index dc48c50..d1e1b9c 100644
--- a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.yaml
+++ b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/parent.yaml
@@ -1,8 +1,8 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,29 +37,19 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
----
-parameters:
- out:
- type: string
- description: test for output
- res:
- type: string
- description: test for resources
- indexed:
- type: comma_delimited_list
- description: test for indexed param
- indx:
- type: number
- description: Index of the current instance
+# VERSION = '1.0.0'
+
+---
resources:
- test:
- type: abc
- properties:
- test_res: {get_param: res}
- test_ind_param: { get_param: [ indexed, { get_param: indx } ] }
+ testvm_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: testvm_name_0 }
+ flavor: { get_param: testvm_flavor_name}
+ image: { get_param: testvm_image_name}
-outputs:
- test_out:
- description: test getting output param
- value: {get_param: out} \ No newline at end of file
+ nested_resource:
+ type: testvm.yaml
+ properties:
+ param1: abc
diff --git a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml
index 87c54e2..ffb4e39 100644
--- a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml
+++ b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -42,10 +42,9 @@
---
resources:
- testvm_server_0:
+ testvm_server_1:
type: OS::Nova::Server
properties:
name: { get_param: testvm_name_0 }
flavor: { get_param: testvm_flavor_name}
- image: { get_param: testvm_image_name}
-
+ image: { get_param: testvm_image_name} \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml
index 87c54e2..e54ad54 100644
--- a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml
+++ b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
diff --git a/ice_validator/tests/fixtures/test_nested_parameters/pass/heat_template.yaml b/ice_validator/tests/fixtures/test_nested_parameters/pass/heat_template.yaml
index bb9585b..fe5aa59 100644
--- a/ice_validator/tests/fixtures/test_nested_parameters/pass/heat_template.yaml
+++ b/ice_validator/tests/fixtures/test_nested_parameters/pass/heat_template.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -53,7 +53,7 @@ resources:
server_0:
type: nested_template_1.yaml
properties:
- name: { get_param: server_name_0 }
+ name: { get_param: name }
my_resource_group_1:
type: OS::Heat::ResourceGroup
properties:
diff --git a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml
index 8beb00a..8fa5a80 100644
--- a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml
+++ b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml
index 86da04e..88f5502 100644
--- a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml
+++ b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh
index 739dc11..1227b1f 100644
--- a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh
@@ -1 +1,41 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
echo "test" \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml
index 86da04e..88f5502 100644
--- a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh
index 739dc11..1227b1f 100644
--- a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh
@@ -1 +1,41 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
echo "test" \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml
index 86da04e..88f5502 100644
--- a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2015-04-30
description: fdsafsfsa
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/settings b/ice_validator/tests/fixtures/test_no_image_files/pass/settings
index ad78c6f..736231c 100644
--- a/ice_validator/tests/fixtures/test_no_image_files/pass/settings
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/settings
@@ -1 +1,41 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
test=one \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml
index 50acd30..dc04ca7 100644
--- a/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml
+++ b/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -56,7 +56,11 @@ resources:
vm_typeX_0_bialy_port_2:
type: OS::Neutron::Port
properties:
- name: mynameistrouble
+ name:
+ str_replace:
+ template: mynameisstilltrouble
+ param:
+ still: safnlk
network: { get_param: int_intranet_net_name }
fixed_ips:
- ip_address: { get_param: lb_1_int_intranet_floating_ip }
@@ -75,7 +79,10 @@ resources:
type: OS::Neutron::Port
properties:
name:
- str_replace: mynameisstilltrouble
+ str_replace:
+ template: mynameisstilltrouble
+ param:
+ still: safnlk
network: { get_param: int_intranet_net_id }
fixed_ips:
- ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
@@ -93,6 +100,7 @@ resources:
vm_typeX_2_bialy_port_2:
type: OS::Neutron::Port
properties:
+ name: ansdjlf
network: { get_param: extnet_net_name }
fixed_ips:
- ip_address: { get_param: lb_1_extnet_floating_ip }
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml
deleted file mode 100644
index daa2045..0000000
--- a/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START====================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-# VERSION: '1.0.0'
-
----
-parameters:
-
- vm_typeX_bialy_vlan_filter:
- type: comma_delimited_list
- vm_typeX_bialy_public_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_private_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_guest_vlans:
- type: comma_delimited_list
-
-resources:
-
- vm_typeX_0_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace:
- template:
- params: mynameisstilltrouble
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_int_intranet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Trunk
-
- vm_typeX_1_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace: {}
- network: { get_param: int_intranet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Non_Trunk
-
- vm_typeX_2_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: OVS
-
- vm_typeX_3_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Mirrored_Trunk
-
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml
deleted file mode 100644
index 64a519b..0000000
--- a/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml
+++ /dev/null
@@ -1,133 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START====================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-# VERSION: '1.0.0'
-
----
-parameters:
-
- vm_typeX_bialy_vlan_filter:
- type: comma_delimited_list
- vm_typeX_bialy_public_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_private_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_guest_vlans:
- type: comma_delimited_list
-
-resources:
-
- vm_typeX_0_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace:
- template:
- params:
- mynameisstillbad: foozle
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_int_intranet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Trunk
-
- vm_typeX_1_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace:
- template:
- params:
- mynameisstilltrouble:
- network: { get_param: int_intranet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Non_Trunk
-
- vm_typeX_2_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: OVS
-
- vm_typeX_3_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Mirrored_Trunk
-
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml
deleted file mode 100644
index 2def749..0000000
--- a/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml
+++ /dev/null
@@ -1,135 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START====================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-# VERSION: '1.0.0'
-
----
-parameters:
-
- vm_typeX_bialy_vlan_filter:
- type: comma_delimited_list
- vm_typeX_bialy_public_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_private_vlans:
- type: comma_delimited_list
- vm_typeX_bialy_guest_vlans:
- type: comma_delimited_list
-
-resources:
-
- vm_typeX_0_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace:
- template:
- params:
- mynameisstillbad:
- get_param: foozle
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_int_intranet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Trunk
-
- vm_typeX_1_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- name:
- str_replace:
- template:
- params:
- mynameisstilltrouble:
- get_param:
- network: { get_param: int_intranet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Non_Trunk
-
- vm_typeX_2_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_floating_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: OVS
-
- vm_typeX_3_bialy_port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
- binding:vnic_type: direct
- value_specs:
- vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
- public_vlans: {get_param: vm_typeX_bialy_public_vlans}
- private_vlans: {get_param: vm_typeX_bialy_private_vlans}
- guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
- vlan_mirror:
- ATT_FABRIC_CONFIGURATION_REQUIRED: true
- metadata:
- port_type: SR-IOV_Mirrored_Trunk
-
diff --git a/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml
index ff96331..e825b03 100644
--- a/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml
+++ b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,7 +37,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-# VERSION: '1.0.0'
+# VERSION: '1.2.0'
---
parameters:
@@ -58,10 +58,12 @@ resources:
properties:
name:
str_replace:
- template: mynameisok_port2
+ template: mynameisok_myindex
params:
mynameisok:
get_param: vnf_name
+ myindex:
+ get_param: 0
network: { get_param: int_intranet_net_name }
fixed_ips:
- ip_address: { get_param: lb_1_int_intranet_floating_ip }
@@ -81,10 +83,12 @@ resources:
properties:
name:
str_replace:
- template: mynameisok_port2
+ template: mynameisok_myindex
params:
mynameisok:
get_param: vnf_name
+ myindex:
+ get_param: 1
network: { get_param: int_intranet_net_id }
fixed_ips:
- ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
diff --git a/ice_validator/tests/fixtures/test_oam_address_outputs/fail/base_fail.yaml b/ice_validator/tests/fixtures/test_oam_address_outputs/fail/base_fail.yaml
new file mode 100644
index 0000000..c31c735
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_oam_address_outputs/fail/base_fail.yaml
@@ -0,0 +1,45 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+outputs:
+ oam_management_v6_address:
+ description: OAM management address
+ value: {get_param: oam_address}
+
+ oam_management_v4_address:
+ description: OAM management address
+ value: {get_param: oam_address}
diff --git a/ice_validator/tests/fixtures/test_oam_address_outputs/fail/module_fail.yaml b/ice_validator/tests/fixtures/test_oam_address_outputs/fail/module_fail.yaml
new file mode 100644
index 0000000..1c63c9c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_oam_address_outputs/fail/module_fail.yaml
@@ -0,0 +1,45 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+outputs:
+ oam_management_v4_address:
+ description: OAM management address
+ value: {get_param: oam_address}
+
+ oam_management_v6_address:
+ description: OAM management address
+ value: {get_param: oam_address} \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_oam_address_outputs/pass/base_pass.yaml b/ice_validator/tests/fixtures/test_oam_address_outputs/pass/base_pass.yaml
new file mode 100644
index 0000000..6fbcb2c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_oam_address_outputs/pass/base_pass.yaml
@@ -0,0 +1,41 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+outputs:
+ oam_management_v6_address:
+ description: OAM management address
+ value: {get_param: oam_address}
diff --git a/ice_validator/tests/fixtures/test_oam_address_outputs/pass/module_pass.yaml b/ice_validator/tests/fixtures/test_oam_address_outputs/pass/module_pass.yaml
new file mode 100644
index 0000000..2ba45e5
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_oam_address_outputs/pass/module_pass.yaml
@@ -0,0 +1,41 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+outputs:
+ oam_management_v4_address:
+ description: OAM management address
+ value: {get_param: oam_address}
diff --git a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml
index 0dc304e..7721fe6 100644
--- a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml
+++ b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2014-10-16
resources:
diff --git a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml
index 36d3f6e..64fca0a 100644
--- a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml
+++ b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml
@@ -1,3 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
heat_template_version: 2014-10-16
resources:
diff --git a/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/fail/fail.yaml b/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/fail/fail.yaml
new file mode 100644
index 0000000..a734a30
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/fail/fail.yaml
@@ -0,0 +1,49 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+
+resources:
+ sf_server_0:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: {get_resource: sf_1_int_di_port_2}
+ - port: {get_resource: sf_2_int_icsr_port_0}
+ - port: {get_resource: sf_3_gn_vmi_port_0}
+ - port: {get_resource: sf_4_cor_vmi_port_1}
+ - port: {get_resource: sf_5_rad_vmi_port_2}
+ - port: {get_resource: sf_6_calea_vmi_3}
diff --git a/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/pass/pass.yaml b/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/pass/pass.yaml
new file mode 100644
index 0000000..6f644e5
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_server_and_port_vm_indices_match/pass/pass.yaml
@@ -0,0 +1,49 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+
+resources:
+ sf_server_0:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: {get_resource: sf_0_int_di_port_2}
+ - port: {get_resource: sf_0_int_icsr_port_0}
+ - port: {get_resource: sf_0_gn_vmi_0}
+ - port: {get_resource: sf_0_cor_vmi_1}
+ - port: {get_resource: sf_0_rad_vmi_2}
+ - port: {get_resource: sf_0_calea_vmi_3}
diff --git a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.yaml b/ice_validator/tests/fixtures/test_vm_class_has_unique_type/fail/fail.yaml
index 51cacba..d50ddbc 100644
--- a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.yaml
+++ b/ice_validator/tests/fixtures/test_vm_class_has_unique_type/fail/fail.yaml
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -34,34 +34,36 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
+
parameters:
- out:
+ vm_role:
type: string
- description: test for output
- res:
- type: string
- description: test for resources
- indexed:
- type: comma_delimited_list
- description: test for indexed param
- indx:
- type: number
- description: Index of the current instance
- unused_yaml:
- type: number
- description: unused param in yaml file
+
resources:
- test:
- type: abc
+ dns_server_0:
+ type: OS::Nova::Server
properties:
- test_res: {get_param: res}
- test_ind_param: { get_param: [ indexed, { get_param: indx } ] }
+ metadata:
+ vm_role: {get_param: vm_role}
+ networks:
+ - port: { get_resource: dns_0_oam_port_0 }
-outputs:
- test_out:
- description: test getting output param
- value: {get_param: out} \ No newline at end of file
+ dns_server_1:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: {get_param: vm_role}
+ networks:
+ - port: { get_resource: dns_1_oam_port_0 }
+
+ dns_0_oam_port_0:
+ type: OS::Neutron::Port
+
+ dns_1_oam_port_0:
+ type: OS::Neutron::Port
+
+ cinder_attach_0:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: 1234
+ instance_uuid: { get_resource: dns_server_0 }
diff --git a/ice_validator/tests/fixtures/test_vm_class_has_unique_type/pass/pass.yaml b/ice_validator/tests/fixtures/test_vm_class_has_unique_type/pass/pass.yaml
new file mode 100644
index 0000000..f162887
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_class_has_unique_type/pass/pass.yaml
@@ -0,0 +1,75 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+parameters:
+ vm_role:
+ type: string
+
+resources:
+ dns_server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: {get_param: vm_role}
+ networks:
+ - port: { get_resource: dns_0_oam_port_0 }
+
+ dns_server_1:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: {get_param: vm_role}
+ networks:
+ - port: { get_resource: dns_1_oam_port_0 }
+
+ dns_0_oam_port_0:
+ type: OS::Neutron::Port
+
+ dns_1_oam_port_0:
+ type: OS::Neutron::Port
+
+ cinder_attach_0:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: 1234
+ instance_uuid: { get_resource: dns_server_0 }
+
+ cinder_attach_1:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: 1234
+ instance_uuid: { get_resource: dns_server_1 }
diff --git a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.env b/ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.env
index 9477fac..8f27823 100644
--- a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.env
+++ b/ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.env
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -34,12 +34,6 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
+
parameters:
- out: 2
- res: 3
- indexed: 4
- indx: 1 \ No newline at end of file
+ vm_role: dns$1
diff --git a/ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.yaml b/ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.yaml
new file mode 100644
index 0000000..4d3b8af
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_role_value/fail/fail_parameter.yaml
@@ -0,0 +1,53 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+parameters:
+ vm_role:
+ type: string
+
+resources:
+ dns_server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: dns$1
+
+ dns_server_1:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: {get_param: vm_role} \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_hardcoded.yaml b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_hardcoded.yaml
new file mode 100644
index 0000000..19af492
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_hardcoded.yaml
@@ -0,0 +1,43 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+resources:
+ dns_server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: dns \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.env b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.env
index 487bc4e..5556831 100644
--- a/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.env
+++ b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.env
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -34,13 +34,6 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
+
parameters:
- out: 2
- res: 3
- indexed: 4
- unused_env: 4
- indx: 1 \ No newline at end of file
+ vm_role: dns \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.yaml b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.yaml
new file mode 100644
index 0000000..9c36767
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_role_value/pass/pass_parameter.yaml
@@ -0,0 +1,47 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+parameters:
+ vm_role:
+ type: string
+
+resources:
+ dns_server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: {get_param: vm_role} \ No newline at end of file
diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py
index fa106c3..0b33c0c 100644
--- a/ice_validator/tests/helpers.py
+++ b/ice_validator/tests/helpers.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -113,6 +113,19 @@ def validates(*requirement_ids):
return decorator
+def categories(*categories):
+ def decorator(func):
+ @funcutils.wraps(func)
+ def wrapper(*args, **kw):
+ return func(*args, **kw)
+
+ wrapper.categories = categories
+ return wrapper
+
+ decorator.categories = categories
+ return decorator
+
+
def get_environment_pair(heat_template):
"""Returns a yaml/env pair given a yaml file"""
base_dir, filename = os.path.split(heat_template)
@@ -130,6 +143,47 @@ def get_environment_pair(heat_template):
return None
+def find_environment_file(yaml_files):
+ """
+ Pass file and recursively step backwards until environment file is found
+
+ :param yaml_files: list or string, start at size 1 and grows recursively
+ :return: corresponding environment file for a file, or None
+ """
+ # sanitize
+ if isinstance(yaml_files, str):
+ yaml_files = [yaml_files]
+
+ yaml_file = yaml_files[-1]
+ filepath, filename = os.path.split(yaml_file)
+
+ environment_pair = get_environment_pair(yaml_file)
+ if environment_pair:
+ return environment_pair
+
+ for file in os.listdir(filepath):
+ fq_name = "{}/{}".format(filepath, file)
+ if fq_name.endswith("yaml") or fq_name.endswith("yml"):
+ if fq_name not in yaml_files:
+ with open(fq_name) as f:
+ yml = yaml.load(f)
+ resources = yml.get("resources", {})
+ for resource_id, resource in resources.items():
+ resource_type = resource.get("type", "")
+ if resource_type == "OS::Heat::ResourceGroup":
+ resource_type = (
+ resource.get("properties", {})
+ .get("resource_def", {})
+ .get("type", "")
+ )
+ # found called nested file
+ if resource_type == filename:
+ yaml_files.append(fq_name)
+ environment_pair = find_environment_file(yaml_files)
+
+ return environment_pair
+
+
def load_yaml(yaml_file):
"""
Load the YAML file at the given path. If the file has previously been
diff --git a/ice_validator/tests/report.html.jinja2 b/ice_validator/tests/report.html.jinja2
index 5856c5d..9b98514 100644
--- a/ice_validator/tests/report.html.jinja2
+++ b/ice_validator/tests/report.html.jinja2
@@ -1,7 +1,7 @@
{## ============LICENSE_START=======================================================#}
{## org.onap.vvp/validation-scripts#}
{## ===================================================================#}
-{## Copyright © 2018 AT&T Intellectual Property. All rights reserved.#}
+{## Copyright © 2019 AT&T Intellectual Property. All rights reserved.#}
{## ===================================================================#}
{###}
{## Unless otherwise specified, all software contained herein is licensed#}
@@ -96,7 +96,7 @@
<div class="callout {{ "alert" if failures or collection_failures else "success" }}">
<h1>Validation Report</h1>
<ul>
- <li><b>Profile:</b> {{ profile_name }}</li>
+ <li><b>Categories:</b> {{ categories }}</li>
<li><b>Tool Version:</b> {{ version }}</li>
<li><b>Directory Validated:</b> {{ template_dir }}</li>
<li><b>Checksum:</b> {{ checksum }}</li>
diff --git a/ice_validator/tests/structures.py b/ice_validator/tests/structures.py
index 3f48422..6461879 100644
--- a/ice_validator/tests/structures.py
+++ b/ice_validator/tests/structures.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -35,23 +35,21 @@
#
# ============LICENSE_END============================================
#
-
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
"""structures
"""
-import sys
-
-
import collections
import inspect
import os
import re
+import sys
from tests import cached_yaml as yaml
from tests.helpers import load_yaml
-
from .utils import nested_dict
-VERSION = "3.5.0"
+VERSION = "4.2.0"
# key = pattern, value = regex compiled from pattern
_REGEX_CACHE = {}
@@ -68,34 +66,61 @@ def _get_regex(pattern):
return regex
-class HeatObject(object):
- """base class for xxxx::xxxx::xxxx objects
+class Hashabledict(dict):
+ """A hashable dict.
+ dicts with the same keys and whose keys have the same values
+ are assigned the same hash.
"""
- resource_type = None
+ def __hash__(self):
+ return hash((frozenset(self), frozenset(self.values())))
+
+
+class HeatProcessor(object):
+ """base class for xxxx::xxxx::xxxx processors
+ """
- def __init__(self):
- self.re_rids = self.get_re_rids()
+ resource_type = None # string 'xxxx::xxxx::xxxx'
+ re_rids = collections.OrderedDict() # OrderedDict of name: regex
+ # name is a string to name the regex.
+ # regex parses the proper resource id format.
@staticmethod
- def get_re_rids():
- """Return OrderedDict of name: regex
- Each regex parses the proper format for a given rid
- (resource id).
+ def get_param_value(value):
+ """Return get_param value of `value`
"""
- return collections.OrderedDict()
+ if isinstance(value, dict) and len(value) == 1:
+ v = value.get("get_param")
+ if isinstance(v, list) and v:
+ v = v[0]
+ else:
+ v = None
+ return v
- def get_rid_match_tuple(self, rid):
+ @classmethod
+ def get_resource_or_param_value(cls, value):
+ """Return the get_resource or get_param value of `value`
+ """
+ if isinstance(value, dict) and len(value) == 1:
+ v = value.get("get_resource") or cls.get_param_value(value)
+ else:
+ v = None
+ return v
+
+ @classmethod
+ def get_rid_match_tuple(cls, rid):
"""find the first regex matching `rid` and return the tuple
(name, match object) or ('', None) if no match.
"""
- for name, regex in self.re_rids.items():
+ rid = "" if rid is None else rid
+ for name, regex in cls.re_rids.items():
match = regex.match(rid)
if match:
return name, match
return "", None
- def get_rid_patterns(self):
+ @classmethod
+ def get_rid_patterns(cls):
"""Return OrderedDict of name: friendly regex.pattern
"friendly" means the group notation is replaced with
braces, and the trailing "$" is removed.
@@ -106,7 +131,7 @@ class HeatObject(object):
"""
friendly_pattern = _get_regex(r"\(\?P<(.*?)>.*?\)")
rid_patterns = collections.OrderedDict()
- for name, regex in self.re_rids.items():
+ for name, regex in cls.re_rids.items():
rid_patterns[name] = friendly_pattern.sub(
r"{\1}", regex.pattern # replace groups with braces
)[
@@ -114,8 +139,86 @@ class HeatObject(object):
] # remove trailing $
return rid_patterns
+ @classmethod
+ def get_str_replace_name(cls, resource_dict):
+ """Return the name modified by str_replace of `resource_dict`,
+ a resource (i.e. a value in some template's resources).
+ Return None, if there is no name, str_replace, its template,
+ or any missing parameters.
+ """
+ str_replace = Heat.nested_get(
+ resource_dict, "properties", "name", "str_replace"
+ )
+ if not str_replace:
+ return None
+ template = Heat.nested_get(str_replace, "template")
+ if not isinstance(template, str):
+ return None
+ params = Heat.nested_get(str_replace, "params", default={})
+ if not isinstance(params, dict):
+ return None
+ # WARNING
+ # The user must choose non-overlapping keys for params since they
+ # are replaced in the template in arbitrary order.
+ name = template
+ for key, value in params.items():
+ param = cls.get_param_value(value)
+ if param is None:
+ return None
+ name = name.replace(key, str(param))
+ return name
+
+
+class CinderVolumeAttachmentProcessor(HeatProcessor):
+ """ Cinder VolumeAttachment
+ """
-class ContrailV2NetworkHeatObject(HeatObject):
+ resource_type = "OS::Cinder::VolumeAttachment"
+
+ @classmethod
+ def get_config(cls, resources):
+ """Return a tuple (va_config, va_count)
+ va_config - Hashabledict of Cinder Volume Attachment config
+ indexed by rid.
+ va_count - dict of attachment counts indexed by rid.
+ """
+ va_count = collections.defaultdict(int)
+ va_config = Hashabledict()
+ for resource in resources.values():
+ resource_type = nested_dict.get(resource, "type")
+ if resource_type == cls.resource_type:
+ config, rids = cls.get_volume_attachment_config(resource)
+ for rid in rids:
+ va_config[rid] = config
+ va_count[rid] += 1
+ return va_config, va_count
+
+ @classmethod
+ def get_volume_attachment_config(cls, resource):
+ """Returns the cinder volume attachment configuration
+ of `resource` as a tuple (config, rids)
+ where:
+ - config is a Hashabledict whose keys are the keys of the
+ properties of resource, and whose values are the
+ corresponding property values (nova server resource ids)
+ replaced with the vm-type they reference.
+ - rids is the set of nova server resource ids referenced by
+ the property values.
+ """
+ config = Hashabledict()
+ rids = set()
+ for key, value in (resource.get("properties") or {}).items():
+ rid = cls.get_resource_or_param_value(value)
+ if rid:
+ name, match = NovaServerProcessor.get_rid_match_tuple(rid)
+ if name == "server":
+ vm_type = match.groupdict()["vm_type"]
+ config[key] = vm_type
+ rids.add(rid)
+ return config, rids
+
+
+class ContrailV2NetworkFlavorBaseProcessor(HeatProcessor):
"""ContrailV2 objects which have network_flavor
"""
@@ -123,7 +226,8 @@ class ContrailV2NetworkHeatObject(HeatObject):
network_flavor_internal = "internal"
network_flavor_subint = "subint"
- def get_network_flavor(self, resource):
+ @classmethod
+ def get_network_flavor(cls, resource):
"""Return the network flavor of resource, one of
"internal" - get_resource, or get_param contains _int_
"subint" - get_param contains _subint_
@@ -140,324 +244,376 @@ class ContrailV2NetworkHeatObject(HeatObject):
param = network_refs[0]
if isinstance(param, dict):
if "get_resource" in param:
- network_flavor = self.network_flavor_internal
+ network_flavor = cls.network_flavor_internal
else:
p = param.get("get_param")
if isinstance(p, str):
if "_int_" in p or p.startswith("int_"):
- network_flavor = self.network_flavor_internal
+ network_flavor = cls.network_flavor_internal
elif "_subint_" in p:
- network_flavor = self.network_flavor_subint
+ network_flavor = cls.network_flavor_subint
else:
- network_flavor = self.network_flavor_external
+ network_flavor = cls.network_flavor_external
return network_flavor
-class ContrailV2InstanceIp(ContrailV2NetworkHeatObject):
+class ContrailV2InstanceIpProcessor(ContrailV2NetworkFlavorBaseProcessor):
""" ContrailV2 InstanceIp
"""
resource_type = "OS::ContrailV2::InstanceIp"
-
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [
- (
- "int_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_int"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ re_rids = collections.OrderedDict(
+ [
+ (
+ "int_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- (
- "int_v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_int"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "int_v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- (
- "subint_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_subint"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "subint_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- (
- "subint_v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_subint"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "subint_v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- (
- "ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- (
- "v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
),
- ]
- )
+ ),
+ ]
+ )
-class ContrailV2InterfaceRouteTable(HeatObject):
+class ContrailV2InterfaceRouteTableProcessor(HeatProcessor):
""" ContrailV2 InterfaceRouteTable
"""
resource_type = "OS::ContrailV2::InterfaceRouteTable"
-class ContrailV2NetworkIpam(HeatObject):
+class ContrailV2NetworkIpamProcessor(HeatProcessor):
""" ContrailV2 NetworkIpam
"""
resource_type = "OS::ContrailV2::NetworkIpam"
-class ContrailV2PortTuple(HeatObject):
+class ContrailV2PortTupleProcessor(HeatProcessor):
""" ContrailV2 PortTuple
"""
resource_type = "OS::ContrailV2::PortTuple"
-class ContrailV2ServiceHealthCheck(HeatObject):
+class ContrailV2ServiceHealthCheckProcessor(HeatProcessor):
""" ContrailV2 ServiceHealthCheck
"""
resource_type = "OS::ContrailV2::ServiceHealthCheck"
-class ContrailV2ServiceInstance(HeatObject):
+class ContrailV2ServiceInstanceProcessor(HeatProcessor):
""" ContrailV2 ServiceInstance
"""
resource_type = "OS::ContrailV2::ServiceInstance"
-class ContrailV2ServiceInstanceIp(HeatObject):
+class ContrailV2ServiceInstanceIpProcessor(HeatProcessor):
""" ContrailV2 ServiceInstanceIp
"""
resource_type = "OS::ContrailV2::ServiceInstanceIp"
-class ContrailV2ServiceTemplate(HeatObject):
+class ContrailV2ServiceTemplateProcessor(HeatProcessor):
""" ContrailV2 ServiceTemplate
"""
resource_type = "OS::ContrailV2::ServiceTemplate"
-class ContrailV2VirtualMachineInterface(ContrailV2NetworkHeatObject):
+class ContrailV2VirtualMachineInterfaceProcessor(ContrailV2NetworkFlavorBaseProcessor):
""" ContrailV2 Virtual Machine Interface resource
"""
resource_type = "OS::ContrailV2::VirtualMachineInterface"
-
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [
- (
- "vmi_internal",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_int"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"$"
- ),
+ re_rids = collections.OrderedDict(
+ [
+ (
+ "vmi_internal",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
),
- (
- "vmi_subint",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_subint"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "vmi_subint",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
),
- (
- "vmi_external",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "vmi_external",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
),
- ]
- )
+ ),
+ ]
+ )
-class ContrailV2VirtualNetwork(HeatObject):
+class ContrailV2VirtualNetworkProcessor(HeatProcessor):
""" ContrailV2 VirtualNetwork
"""
resource_type = "OS::ContrailV2::VirtualNetwork"
+ re_rids = collections.OrderedDict(
+ [
+ ("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$")),
+ ("rvn", _get_regex(r"int" r"_(?P<network_role>.+)" r"_RVN" r"$")),
+ ]
+ )
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [
- (
- "network",
- _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$"),
+
+class HeatResourceGroupProcessor(HeatProcessor):
+ """ Heat ResourceGroup
+ """
+
+ resource_type = "OS::Heat::ResourceGroup"
+ re_rids = collections.OrderedDict(
+ [
+ (
+ "subint",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_port_(?P<port_index>\d+)"
+ r"_subinterfaces"
+ r"$"
),
- ("rvn", _get_regex(r"int" r"_(?P<network_role>.+)" r"_RVN" r"$")),
- ]
- )
+ )
+ ]
+ )
-class NeutronNet(HeatObject):
+class NeutronNetProcessor(HeatProcessor):
""" Neutron Net resource
"""
resource_type = "OS::Neutron::Net"
+ re_rids = collections.OrderedDict(
+ [("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$"))]
+ )
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$"))]
- )
-
-class NeutronPort(HeatObject):
+class NeutronPortProcessor(HeatProcessor):
""" Neutron Port resource
"""
resource_type = "OS::Neutron::Port"
-
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [
- (
- "internal_port",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_int"
- r"_(?P<network_role>.+)"
- r"_port_(?P<port_index>\d+)"
- r"$"
- ),
+ re_rids = collections.OrderedDict(
+ [
+ (
+ "internal_port",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_port_(?P<port_index>\d+)"
+ r"$"
),
- (
- "port",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_(?P<network_role>.+)"
- r"_port_(?P<port_index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "port",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_port_(?P<port_index>\d+)"
+ r"$"
),
- (
- "floating_ip",
- _get_regex(
- r"reserve_port"
- r"_(?P<vm_type>.+)"
- r"_(?P<network_role>.+)"
- r"_floating_ip_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "floating_ip",
+ _get_regex(
+ r"reserve_port"
+ r"_(?P<vm_type>.+)"
+ r"_(?P<network_role>.+)"
+ r"_floating_ip_(?P<index>\d+)"
+ r"$"
),
- (
- "floating_v6_ip",
- _get_regex(
- r"reserve_port"
- r"_(?P<vm_type>.+)"
- r"_(?P<network_role>.+)"
- r"_floating_v6_ip_(?P<index>\d+)"
- r"$"
- ),
+ ),
+ (
+ "floating_v6_ip",
+ _get_regex(
+ r"reserve_port"
+ r"_(?P<vm_type>.+)"
+ r"_(?P<network_role>.+)"
+ r"_floating_v6_ip_(?P<index>\d+)"
+ r"$"
),
- ]
+ ),
+ ]
+ )
+
+ @classmethod
+ def uses_sr_iov(cls, resource):
+ """Returns True/False as `resource` is/not
+ An OS::Nova:Port with the property binding:vnic_type
+ """
+ return nested_dict.get(
+ resource, "type"
+ ) == cls.resource_type and "binding:vnic_type" in nested_dict.get(
+ resource, "properties", default={}
)
-class NovaServer(HeatObject):
+class NovaServerProcessor(HeatProcessor):
""" Nova Server resource
"""
resource_type = "OS::Nova::Server"
+ re_rids = collections.OrderedDict(
+ [
+ (
+ "server",
+ _get_regex(r"(?P<vm_type>.+)" r"_server_(?P<vm_type_index>\d+)" r"$"),
+ )
+ ]
+ )
- def get_re_rids(self):
- """Return OrderedDict of name: regex
- """
- return collections.OrderedDict(
- [
- (
- "server",
- _get_regex(
- r"(?P<vm_type>.+)" r"_server_(?P<vm_type_index>\d+)" r"$"
- ),
- )
- ]
- )
+ @classmethod
+ def get_flavor(cls, resource):
+ """Return the flavor property of `resource`
+ """
+ return cls.get_param_value(nested_dict.get(resource, "properties", "flavor"))
+
+ @classmethod
+ def get_image(cls, resource):
+ """Return the image property of `resource`
+ """
+ return cls.get_param_value(nested_dict.get(resource, "properties", "image"))
+
+ @classmethod
+ def get_network(cls, resource):
+ """Return the network configuration of `resource` as a
+ frozenset of network-roles.
+ """
+ network = set()
+ networks = nested_dict.get(resource, "properties", "networks")
+ if isinstance(networks, list):
+ for port in networks:
+ value = cls.get_resource_or_param_value(nested_dict.get(port, "port"))
+ name, match = NeutronPortProcessor.get_rid_match_tuple(value)
+ if name:
+ network_role = match.groupdict().get("network_role")
+ if network_role:
+ network.add(network_role)
+ return frozenset(network)
+
+ @classmethod
+ def get_vm_class(cls, resource):
+ """Return the vm_class of `resource`, a Hashabledict (of
+ hashable values) whose keys are only the required keys.
+ Return empty Hashabledict if `resource` is not a NovaServer.
+ """
+ vm_class = Hashabledict()
+ resource_type = nested_dict.get(resource, "type")
+ if resource_type == cls.resource_type:
+ d = dict(
+ flavor=cls.get_flavor(resource),
+ image=cls.get_image(resource),
+ networks=cls.get_network(resource),
+ )
+ if all(d.values()):
+ vm_class.update(d)
+ return vm_class
class Heat(object):
@@ -466,9 +622,15 @@ class Heat(object):
envpath - absolute path to environmnt file.
"""
+ type_bool = "boolean"
+ type_boolean = "boolean"
type_cdl = "comma_delimited_list"
+ type_comma_delimited_list = "comma_delimited_list"
+ type_json = "json"
type_num = "number"
+ type_number = "number"
type_str = "string"
+ type_string = "string"
def __init__(self, filepath=None, envpath=None):
self.filepath = None
@@ -487,22 +649,37 @@ class Heat(object):
self.env = None
if envpath:
self.load_env(envpath)
- self.heat_objects = self.get_heat_objects()
+ self.heat_processors = self.get_heat_processors()
@property
def contrail_resources(self):
"""This attribute is a dict of Contrail resources.
"""
return self.get_resource_by_type(
- resource_type=ContrailV2VirtualMachineInterface.resource_type
+ resource_type=ContrailV2VirtualMachineInterfaceProcessor.resource_type
)
+ def get_all_resources(self, base_dir):
+ """
+ Like ``resources``,
+ but this returns all the resources definitions
+ defined in the template, resource groups, and nested YAML files.
+ """
+ resources = {}
+ for r_id, r_data in self.resources.items():
+ resources[r_id] = r_data
+ resource = Resource(r_id, r_data)
+ if resource.is_nested():
+ nested = Heat(os.path.join(base_dir, resource.get_nested_filename()))
+ resources.update(nested.get_all_resources(base_dir))
+ return resources
+
@staticmethod
- def get_heat_objects():
+ def get_heat_processors():
"""Return a dict, key is resource_type, value is the
- HeatObject subclass whose resource_type is the key.
+ HeatProcessor subclass whose resource_type is the key.
"""
- return _HEAT_OBJECTS
+ return _HEAT_PROCESSORS
def get_resource_by_type(self, resource_type):
"""Return dict of resources whose type is `resource_type`.
@@ -518,8 +695,8 @@ class Heat(object):
"""return get_rid_match_tuple(rid) called on the class
corresponding to the given resource_type.
"""
- hoc = self.heat_objects.get(resource_type, HeatObject)
- return hoc().get_rid_match_tuple(rid)
+ processor = self.heat_processors.get(resource_type, HeatProcessor)
+ return processor.get_rid_match_tuple(rid)
def get_vm_type(self, rid, resource=None):
"""return the vm_type
@@ -541,29 +718,14 @@ class Heat(object):
self.yml = yaml.load(fi)
self.heat_template_version = self.yml.get("heat_template_version", None)
self.description = self.yml.get("description", "")
- self.parameter_groups = self.yml.get("parameter_groups", {})
+ self.parameter_groups = self.yml.get("parameter_groups") or {}
self.parameters = self.yml.get("parameters") or {}
- self.resources = self.yml.get("resources", {})
- self.outputs = self.yml.get("outputs", {})
- self.conditions = self.yml.get("conditions", {})
-
- def get_all_resources(self, base_dir):
- """
- Like ``resources``, but this returns all the resources definitions
- defined in the template, resource groups, and nested YAML files.
- """
- resources = {}
- for r_id, r_data in self.resources.items():
- resources[r_id] = r_data
- resource = Resource(r_id, r_data)
- if resource.is_nested():
- nested = Heat(os.path.join(base_dir, resource.get_nested_filename()))
- resources.update(nested.get_all_resources(base_dir))
- return resources
+ self.resources = self.yml.get("resources") or {}
+ self.outputs = self.yml.get("outputs") or {}
+ self.conditions = self.yml.get("conditions") or {}
def load_env(self, envpath):
- """
- Load the Environment template given a envpath.
+ """Load the Environment template given a envpath.
"""
self.env = Env(filepath=envpath)
@@ -577,13 +739,17 @@ class Heat(object):
def neutron_port_resources(self):
"""This attribute is a dict of Neutron Ports
"""
- return self.get_resource_by_type(resource_type=NeutronPort.resource_type)
+ return self.get_resource_by_type(
+ resource_type=NeutronPortProcessor.resource_type
+ )
@property
def nova_server_resources(self):
"""This attribute is a dict of Nova Servers
"""
- return self.get_resource_by_type(resource_type=NovaServer.resource_type)
+ return self.get_resource_by_type(
+ resource_type=NovaServerProcessor.resource_type
+ )
@staticmethod
def part_is_in_name(part, name):
@@ -614,7 +780,7 @@ class Resource(object):
self.resource_id = resource_id or ""
self.resource = resource or {}
self.properties = self.resource.get("properties", {})
- self.resource_type = resource.get("type", "")
+ self.resource_type = self.resource.get("type", "")
@staticmethod
def get_index_var(resource):
@@ -681,19 +847,30 @@ class Resource(object):
return {}
-def _get_heat_objects():
+def get_all_resources(yaml_files):
+ """Return a dict, resource id: resource
+ of the union of resources across all files.
"""
- Introspect this module and return a dict of all HeatObject sub-classes with
- a (True) resource_type. Key is the resource_type, value is the
- corresponding class.
+ resources = {}
+ for heat_template in yaml_files:
+ heat = Heat(filepath=heat_template)
+ dirname = os.path.dirname(heat_template)
+ resources.update(heat.get_all_resources(dirname))
+ return resources
+
+
+def _get_heat_processors():
+ """Introspect this module and return a
+ dict of all HeatProcessor sub-classes with a (True) resource_type.
+ Key is the resource_type, value is the corrresponding class.
"""
mod_classes = inspect.getmembers(sys.modules[__name__], inspect.isclass)
- heat_objects = {
+ heat_processors = {
c.resource_type: c
for _, c in mod_classes
- if issubclass(c, HeatObject) and c.resource_type
+ if issubclass(c, HeatProcessor) and c.resource_type
}
- return heat_objects
+ return heat_processors
-_HEAT_OBJECTS = _get_heat_objects()
+_HEAT_PROCESSORS = _get_heat_processors()
diff --git a/ice_validator/tests/test_all_parameters_used_in_template.py b/ice_validator/tests/test_all_parameters_used_in_template.py
index 41356d4..44fe9da 100644
--- a/ice_validator/tests/test_all_parameters_used_in_template.py
+++ b/ice_validator/tests/test_all_parameters_used_in_template.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -35,46 +35,21 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-import pytest
-from tests import cached_yaml as yaml
-
-from .helpers import validates
-from .utils.nested_iterables import find_all_get_param_in_yml
+import re
-VERSION = "1.0.0"
+from tests.helpers import validates, load_yaml
+from tests.utils.nested_iterables import find_all_get_param_in_yml
-# pylint: disable=invalid-name
+AVAILABILITY_ZONE = re.compile(r"availability_zone_?\d*")
@validates("R-90279")
def test_all_parameters_used_in_template(yaml_file):
-
- invalid_params = []
- get_params = []
- skip_params = ["availability_zone"]
-
- with open(yaml_file, "r") as f:
- yml = yaml.load(f)
-
- template_parameters = yml.get("parameters")
- if not template_parameters:
- pytest.skip("no parameters found in template")
-
- get_params = find_all_get_param_in_yml(yml)
- if not get_params:
- pytest.skip("no get_params found in template")
-
- template_parameters = list(template_parameters.keys())
- for param in template_parameters:
- for sparam in skip_params:
- if param.find(sparam) != -1:
- template_parameters.remove(param)
-
- invalid_params = set(template_parameters) - set(get_params)
-
- assert not invalid_params, "Unused parameters detected in template {}".format(
- invalid_params
- )
+ yml = load_yaml(yaml_file)
+ params = (yml.get("parameters") or {}).keys()
+ expected_params = {p for p in params if not AVAILABILITY_ZONE.match(p)}
+ used_params = set(find_all_get_param_in_yml(yml))
+ unused_params = expected_params.difference(used_params)
+
+ msg = "Unused parameters detected in template {}".format(unused_params)
+ assert not unused_params, msg
diff --git a/ice_validator/tests/test_contrail_instance_ip_resource_id.py b/ice_validator/tests/test_contrail_instance_ip_resource_id.py
index c7c8c57..e1c1977 100644
--- a/ice_validator/tests/test_contrail_instance_ip_resource_id.py
+++ b/ice_validator/tests/test_contrail_instance_ip_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,7 +37,6 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
"""
resources:
{vm-type}_server_{vm-type_index}
@@ -45,29 +44,28 @@ resources:
import pytest
from .structures import Heat
-from .structures import ContrailV2InstanceIp
+from .structures import ContrailV2InstanceIpProcessor
from .helpers import validates
-VERSION = "1.1.0"
+VERSION = "2.0.0"
def run_test(heat_template, regex_names, network_flavor):
"""run test
"""
heat = Heat(filepath=heat_template)
- heat_object_class = ContrailV2InstanceIp
- resource_type = heat_object_class.resource_type
+ processor = ContrailV2InstanceIpProcessor
+ resource_type = processor.resource_type
resources = heat.get_resource_by_type(resource_type=resource_type)
if not resources:
pytest.skip("No %s resources found" % resource_type)
bad = []
- heat_object = heat_object_class()
- rid_patterns = heat_object.get_rid_patterns()
+ rid_patterns = processor.get_rid_patterns()
for rid, resource in resources.items():
- flavor = heat_object.get_network_flavor(resource)
+ flavor = processor.get_network_flavor(resource)
if flavor != network_flavor:
continue
- regex_name = heat_object.get_rid_match_tuple(rid)[0]
+ regex_name = processor.get_rid_match_tuple(rid)[0]
if regex_name in regex_names:
continue
bad.append(rid)
@@ -105,7 +103,7 @@ def test_contrail_instance_ip_resource_id_external(heat_template):
run_test(
heat_template,
regex_names=("ip", "v6_ip"),
- network_flavor=ContrailV2InstanceIp.network_flavor_external,
+ network_flavor=ContrailV2InstanceIpProcessor.network_flavor_external,
)
@@ -121,7 +119,7 @@ def test_contrail_instance_ip_resource_id_internal(heat_template):
run_test(
heat_template,
regex_names=("int_ip", "int_v6_ip"),
- network_flavor=ContrailV2InstanceIp.network_flavor_internal,
+ network_flavor=ContrailV2InstanceIpProcessor.network_flavor_internal,
)
@@ -137,5 +135,5 @@ def test_contrail_instance_ip_resource_id_subint(heat_template):
run_test(
heat_template,
regex_names=("subint_ip", "subint_v6_ip"),
- network_flavor=ContrailV2InstanceIp.network_flavor_subint,
+ network_flavor=ContrailV2InstanceIpProcessor.network_flavor_subint,
)
diff --git a/ice_validator/tests/test_contrail_resource_id.py b/ice_validator/tests/test_contrail_resource_id.py
index 7667600..88cc2f0 100644
--- a/ice_validator/tests/test_contrail_resource_id.py
+++ b/ice_validator/tests/test_contrail_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -43,17 +43,17 @@ contrail
"""
import pytest
-from .structures import ContrailV2InterfaceRouteTable
-from .structures import ContrailV2NetworkIpam
-from .structures import ContrailV2PortTuple
-from .structures import ContrailV2ServiceHealthCheck
-from .structures import ContrailV2ServiceTemplate
+from .structures import ContrailV2InterfaceRouteTableProcessor
+from .structures import ContrailV2NetworkIpamProcessor
+from .structures import ContrailV2PortTupleProcessor
+from .structures import ContrailV2ServiceHealthCheckProcessor
+from .structures import ContrailV2ServiceTemplateProcessor
from .utils.network_roles import get_network_roles
from .utils.vm_types import get_vm_types
from .structures import Heat
from .helpers import validates
-VERSION = "1.0.1"
+VERSION = "2.0.0"
def run_test(heat_template, contrail_class, get_parts, part_name):
@@ -98,7 +98,10 @@ def test_contrail_interfaceroutetable_resource_id(heat_template):
contain the ``{network-role}``.
"""
run_test(
- heat_template, ContrailV2InterfaceRouteTable, get_network_roles, "network_role"
+ heat_template,
+ ContrailV2InterfaceRouteTableProcessor,
+ get_network_roles,
+ "network_role",
)
@@ -111,7 +114,9 @@ def test_contrail_networkipam_resource_id(heat_template):
**MUST**
contain the ``{network-role}``.
"""
- run_test(heat_template, ContrailV2NetworkIpam, get_network_roles, "network_role")
+ run_test(
+ heat_template, ContrailV2NetworkIpamProcessor, get_network_roles, "network_role"
+ )
@validates("R-20065")
@@ -123,7 +128,7 @@ def test_contrail_porttuple_resource_id(heat_template):
**MUST**
contain the ``{vm-type}``.
"""
- run_test(heat_template, ContrailV2PortTuple, get_vm_types, "vm_type")
+ run_test(heat_template, ContrailV2PortTupleProcessor, get_vm_types, "vm_type")
@validates("R-76014")
@@ -135,7 +140,9 @@ def test_contrail_servicehealthcheck_resource_id(heat_template):
**MUST**
contain the ``{vm-type}``.
"""
- run_test(heat_template, ContrailV2ServiceHealthCheck, get_vm_types, "vm_type")
+ run_test(
+ heat_template, ContrailV2ServiceHealthCheckProcessor, get_vm_types, "vm_type"
+ )
@validates("R-16437")
@@ -147,4 +154,4 @@ def test_contrail_servicetemplate_resource_id(heat_template):
**MUST**
contain the ``{vm-type}``.
"""
- run_test(heat_template, ContrailV2ServiceTemplate, get_vm_types, "vm_type")
+ run_test(heat_template, ContrailV2ServiceTemplateProcessor, get_vm_types, "vm_type")
diff --git a/ice_validator/tests/test_contrail_vmi_resource_id.py b/ice_validator/tests/test_contrail_vmi_resource_id.py
index 35f16e6..9e9641d 100644
--- a/ice_validator/tests/test_contrail_vmi_resource_id.py
+++ b/ice_validator/tests/test_contrail_vmi_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,25 +37,25 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import pytest
-
-from .structures import Heat
-from .structures import ContrailV2VirtualMachineInterface
-from .helpers import validates
"""
resources:
{vm-type}_server_{vm-type_index}
"""
+import pytest
+
+from .structures import Heat
+from .structures import ContrailV2VirtualMachineInterfaceProcessor
+from .helpers import validates
-VERSION = "1.0.0"
+VERSION = "2.0.0"
def run_test(heat_template, regex_name, network_flavor):
"""run test
"""
heat = Heat(filepath=heat_template)
- heat_object_class = ContrailV2VirtualMachineInterface
+ heat_object_class = ContrailV2VirtualMachineInterfaceProcessor
resource_type = heat_object_class.resource_type
resources = heat.get_resource_by_type(resource_type=resource_type)
if not resources:
@@ -94,7 +94,7 @@ def test_contrail_instance_ip_resource_id_external(heat_template):
run_test(
heat_template,
regex_name="vmi_external",
- network_flavor=ContrailV2VirtualMachineInterface.network_flavor_external,
+ network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_external,
)
@@ -111,7 +111,7 @@ def test_contrail_instance_ip_resource_id_internal(heat_template):
run_test(
heat_template,
regex_name="vmi_internal",
- network_flavor=ContrailV2VirtualMachineInterface.network_flavor_internal,
+ network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_internal,
)
@@ -128,5 +128,5 @@ def test_contrail_instance_ip_resource_id_subint(heat_template):
run_test(
heat_template,
regex_name="vmi_subint",
- network_flavor=ContrailV2VirtualMachineInterface.network_flavor_subint,
+ network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_subint,
)
diff --git a/ice_validator/tests/test_contrail_vn_resource_id.py b/ice_validator/tests/test_contrail_vn_resource_id.py
index 4045eee..2e27259 100644
--- a/ice_validator/tests/test_contrail_vn_resource_id.py
+++ b/ice_validator/tests/test_contrail_vn_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -46,9 +46,9 @@ import pytest
from .helpers import validates
from .structures import Heat
-from .structures import ContrailV2VirtualNetwork
+from .structures import ContrailV2VirtualNetworkProcessor
-VERSION = "1.0.0"
+VERSION = "2.0.0"
# pylint: disable=invalid-name
@@ -65,7 +65,7 @@ def test_neutron_net_resource_id(heat_template):
2) int_{network-role}_RVN`` where RVN represents Resource Virtual
"""
heat = Heat(filepath=heat_template)
- heat_object_class = ContrailV2VirtualNetwork
+ heat_object_class = ContrailV2VirtualNetworkProcessor
resource_type = heat_object_class.resource_type
resources = heat.get_resource_by_type(resource_type)
if not resources:
diff --git a/ice_validator/tests/test_env_parameters_defined_in_template.py b/ice_validator/tests/test_env_parameters_defined_in_template.py
index 9bdd56e..afb2473 100644
--- a/ice_validator/tests/test_env_parameters_defined_in_template.py
+++ b/ice_validator/tests/test_env_parameters_defined_in_template.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -43,12 +43,12 @@ from .helpers import validates, get_environment_pair
@validates("R-599443")
-def test_env_params_are_defined_in_template(heat_template):
+def test_env_params_are_defined_in_template(yaml_file):
"""Test that each paraemter defined in an environment file
is also defined in the paired heat template"""
bad = []
- template_pair = get_environment_pair(heat_template)
+ template_pair = get_environment_pair(yaml_file)
if not template_pair:
pytest.skip("No yaml/env pair could be determined")
diff --git a/ice_validator/tests/test_environment_file_parameters.py b/ice_validator/tests/test_environment_file_parameters.py
index 031f898..f13821d 100644
--- a/ice_validator/tests/test_environment_file_parameters.py
+++ b/ice_validator/tests/test_environment_file_parameters.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,14 +37,13 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
""" environment file structure
"""
+import os
+from .helpers import validates, categories, get_environment_pair, find_environment_file
import re
import pytest
-
-from .helpers import validates, get_environment_pair
-
+from tests import cached_yaml as yaml
VERSION = "1.0.0"
@@ -96,6 +95,7 @@ resource_id:
- nested_prop_1: { get_param: [parameter_2, {index}] }
prop2: # this is a dict of dicts
nested_prop_0: { get_param: parameter_1 }
+ prop3: { get_param: [parameter_3, 0]}
"""
@@ -109,7 +109,6 @@ def check_resource_parameter(
exclude_resource="",
exclude_parameter="",
):
-
if not environment_pair:
pytest.skip("No heat/env pair could be identified")
@@ -120,7 +119,6 @@ def check_resource_parameter(
pytest.skip("No parameters specified in the environment file")
invalid_parameters = []
-
if template_file:
for resource, resource_prop in template_file.get("resources", {}).items():
@@ -141,10 +139,8 @@ def check_resource_parameter(
if not resource_parameter:
continue
-
if isinstance(resource_parameter, list) and nested_prop:
for param in resource_parameter:
-
nested_param = param.get(nested_prop)
if not nested_param:
continue
@@ -169,7 +165,6 @@ def check_resource_parameter(
invalid_parameters.append(pattern)
elif isinstance(resource_parameter, dict):
-
if nested_prop and nested_prop in resource_parameter:
resource_parameter = resource_parameter.get(nested_prop)
@@ -177,6 +172,9 @@ def check_resource_parameter(
if not pattern:
continue
+ if isinstance(pattern, list):
+ pattern = pattern[0]
+
if check_param_in_env_file(
environment_pair,
pattern,
@@ -190,498 +188,227 @@ def check_resource_parameter(
return set(invalid_parameters)
-@validates("R-91125")
-def test_nova_server_image_parameter_exists_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
+def run_check_resource_parameter(
+ yaml_file, prop, DESIRED, resource_type, check_resource=True, **kwargs
+):
- prop = "image"
- DESIRED = True
- resource_type = "OS::Nova::Server"
+ filepath, filename = os.path.split(yaml_file)
+ environment_pair = get_environment_pair(yaml_file)
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type
- )
-
- assert not invalid_parameters, (
- "OS::Nova::Server {} parameters not"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
+ if not environment_pair:
+ # this is a nested file
+
+ if not check_resource:
+ # dont check env for nested files
+ # This will be tested separately for parent template
+ pytest.skip("This test doesn't apply to nested files")
+
+ environment_pair = find_environment_file(yaml_file)
+ if environment_pair:
+ with open(yaml_file, "r") as f:
+ yml = yaml.load(f)
+ environment_pair["yyml"] = yml
+ else:
+ pytest.skip("unable to determine environment file for nested yaml file")
+
+ if check_resource:
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, **kwargs
)
- )
-
-
-@validates("R-69431")
-def test_nova_server_flavor_parameter_exists_in_environment_file(heat_template):
+ else:
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "flavor"
- DESIRED = True
- resource_type = "OS::Nova::Server"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type
- )
+ if kwargs.get("resource_type_inverse"):
+ resource_type = "non-{}".format(resource_type)
assert not invalid_parameters, (
- "OS::Nova::Server {} parameters not"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
+ "{} {} parameters in template {}{}"
+ " found in {} environment file: {}".format(
+ resource_type,
+ prop,
+ filename,
+ " not" if DESIRED else "",
+ environment_pair.get("name"),
+ invalid_parameters,
)
)
-@validates("R-22838")
-def test_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
+@validates("R-91125")
+def test_nova_server_image_parameter_exists_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "image", True, "OS::Nova::Server")
- environment_pair = get_environment_pair(heat_template)
- prop = "name"
- DESIRED = False
- resource_type = "OS::Nova::Server"
+@validates("R-69431")
+def test_nova_server_flavor_parameter_exists_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "flavor", True, "OS::Nova::Server")
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type
- )
- assert not invalid_parameters, (
- "OS::Nova::Server {} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
- )
+@categories("environment_file")
+@validates("R-22838")
+def test_nova_server_name_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "name", False, "OS::Nova::Server")
+@categories("environment_file")
@validates("R-59568")
-def test_nova_server_az_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "availability_zone"
- DESIRED = False
- resource_type = "OS::Nova::Server"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type
- )
-
- assert not invalid_parameters, (
- "OS::Nova::Server {} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+def test_nova_server_az_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file, "availability_zone", False, "OS::Nova::Server"
)
+@categories("environment_file")
@validates("R-20856")
-def test_nova_server_vnf_id_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "vnf_id"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
- )
+def test_nova_server_vnf_id_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "vnf_id", False, "", check_resource=False)
+@categories("environment_file")
@validates("R-72871")
-def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(
- heat_template
-):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "vf_module_id"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file, "vf_module_id", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-37039")
def test_nova_server_vf_module_index_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "vf_module_index"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file, "vf_module_index", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-36542")
-def test_nova_server_vnf_name_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "vnf_name"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
- )
+def test_nova_server_vnf_name_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "vnf_name", False, "", check_resource=False)
+@categories("environment_file")
@validates("R-80374")
def test_nova_server_vf_module_name_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "vf_module_name"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file, "vf_module_name", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-02691")
def test_nova_server_workload_context_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "workload_context"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file, "workload_context", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-13194")
def test_nova_server_environment_context_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "environment_context"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file, "environment_context", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-29872")
-def test_nova_server_network_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "networks"
- nested_prop = "network"
- DESIRED = False
- resource_type = "OS::Nova::Server"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
- )
-
- assert not invalid_parameters, (
- "{} {} parameters"
- " found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
- )
+def test_neutron_port_network_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(yaml_file, "network", False, "OS::Neutron::Port")
+@categories("environment_file")
@validates("R-39841", "R-87123", "R-62590", "R-98905", "R-93030", "R-62590")
def test_neutron_port_external_fixedips_ipaddress_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "fixed_ips"
- nested_prop = "ip_address"
- DESIRED = False
- resource_type = "OS::Neutron::Port"
- exclude_parameter = re.compile(r"^(.+?)_int_(.+?)$")
-
- invalid_parameters = check_resource_parameter(
- environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop,
- exclude_parameter=exclude_parameter,
- )
-
- assert not invalid_parameters, (
- "{} {} external parameters"
- " found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file,
+ "fixed_ips",
+ False,
+ "OS::Neutron::Port",
+ nested_prop="ip_address",
+ exclude_parameter=re.compile(r"^(.+?)_int_(.+?)$"),
)
@validates("R-28795", "R-97201", "R-93496", "R-90206", "R-98569", "R-93496")
def test_neutron_port_internal_fixedips_ipaddress_parameter_exists_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "fixed_ips"
- nested_prop = "ip_address"
- DESIRED = True
- resource_type = "OS::Neutron::Port"
- exclude_parameter = re.compile(r"^((?!_int_).)*$")
-
- invalid_parameters = check_resource_parameter(
- environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop,
- exclude_parameter=exclude_parameter,
- )
-
- assert not invalid_parameters, (
- "{} {} internal parameters"
- " not found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file,
+ "fixed_ips",
+ True,
+ "OS::Neutron::Port",
+ nested_prop="ip_address",
+ exclude_parameter=re.compile(r"^((?!_int_).)*$"),
)
+@categories("environment_file")
@validates("R-83677", "R-80829", "R-69634", "R-22288")
def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file(
- heat_template
+ yaml_file
):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "fixed_ips"
- nested_prop = "subnet"
- DESIRED = False
- resource_type = "OS::Neutron::Port"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
- )
-
- assert not invalid_parameters, (
- "{} {} parameters"
- " found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
+ run_check_resource_parameter(
+ yaml_file, "fixed_ips", False, "OS::Neutron::Port", nested_prop="subnet"
)
+@categories("environment_file")
@validates("R-83412", "R-83418")
-def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "allowed_address_pairs"
- nested_prop = "ip_address"
- DESIRED = False
- resource_type = "OS::Neutron::Port"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
- )
-
- assert not invalid_parameters, (
- "{} {} parameters"
- " found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
+def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file,
+ "allowed_address_pairs",
+ False,
+ "OS::Neutron::Port",
+ nested_prop="ip_address",
)
+@categories("environment_file")
@validates("R-99812")
-def test_non_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "name"
- DESIRED = False
- resource_type = "OS::Nova::Server"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type, resource_type_inverse=True
- )
-
- assert not invalid_parameters, (
- "non-{} {} parameters"
- " found in {} environment file {}".format(
- resource_type, prop, environment_pair.get("name"), invalid_parameters
- )
+def test_non_nova_server_name_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file, "name", False, "OS::Nova::Server", resource_type_inverse=True
)
+@categories("environment_file")
@validates("R-92193")
-def test_network_fqdn_parameter_doesnt_exist_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = r"^(.+?)_net_fqdn$"
- DESIRED = False
-
- invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
-
- assert not invalid_parameters, (
- "{} parameters"
- " found in {} environment file {}".format(
- prop, environment_pair.get("name"), invalid_parameters
- )
+def test_network_fqdn_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file, r"^(.+?)_net_fqdn$", False, "", check_resource=False
)
+@categories("environment_file")
@validates("R-76682")
-def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(
- heat_template
-):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "interface_route_table_routes"
- nested_prop = "interface_route_table_routes_route"
- DESIRED = False
- resource_type = "OS::ContrailV2::InterfaceRouteTable"
-
- invalid_parameters = check_resource_parameter(
- environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
- )
-
- assert not invalid_parameters, (
- "{} {} parameters"
- " found in {} environment file {}".format(
- resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
- )
+def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file,
+ "interface_route_table_routes",
+ False,
+ "OS::ContrailV2::InterfaceRouteTable",
+ nested_prop="interface_route_table_routes_route",
)
@validates("R-50011")
-def test_heat_rg_count_parameter_exists_in_environment_file(heat_template):
-
- if pytest.config.getoption("validation_profile") == "heat_only":
- pytest.skip("skipping test because validation profile is heat only")
-
- environment_pair = get_environment_pair(heat_template)
-
- prop = "count"
- DESIRED = True
- resource_type = "OS::Heat::ResourceGroup"
- exclude_resource = re.compile(r"^(.+?)_subint_(.+?)_port_(.+?)_subinterfaces$")
-
- invalid_parameters = check_resource_parameter(
- environment_pair,
- prop,
- DESIRED,
- resource_type,
- exclude_resource=exclude_resource,
- )
-
- assert not invalid_parameters, (
- "{} {} parameters not"
- " found in {} environment file {}".format(
- resource_type, prop, environment_pair.get("name"), invalid_parameters
- )
+def test_heat_rg_count_parameter_exists_in_environment_file(yaml_file):
+ run_check_resource_parameter(
+ yaml_file,
+ "count",
+ True,
+ "OS::Heat::ResourceGroup",
+ exclude_resource=re.compile(r"^(.+?)_subint_(.+?)_port_(.+?)_subinterfaces$"),
)
diff --git a/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py b/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py
index f31f370..49c917c 100644
--- a/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py
+++ b/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -36,12 +36,10 @@
# ============LICENSE_END============================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
import os
-from tests import cached_yaml as yaml
-
from .helpers import validates
-from .utils.vm_types import get_vm_types
+from .utils.vm_types import get_all_vm_types
+from .parametrizers import get_nested_files
VERSION = "1.0.0"
@@ -53,23 +51,17 @@ def test_filename_is_vmtype_dot_yaml(yaml_files):
vm_types = []
invalid_files = []
+ nested_files = []
- for yaml_file in yaml_files:
- with open(yaml_file, "r") as f:
- yml = yaml.load(f)
-
- if "resources" not in yml:
- continue
+ nested_files.extend(
+ os.path.splitext(os.path.basename(filename))[0]
+ for filename in get_nested_files(yaml_files)
+ )
- vm_types.extend(get_vm_types(yml["resources"]))
+ vm_types = get_all_vm_types(yaml_files)
- for yaml_file in yaml_files:
- basename, filename = os.path.split(yaml_file)
- file, ext = os.path.splitext(os.path.basename(filename))
- for vt in vm_types:
- if vt == file:
- invalid_files.append({"vm_type": vt, "file": yaml_file})
+ invalid_files.extend(vm_type for vm_type in vm_types if vm_type in nested_files)
- assert not invalid_files, "filenames must not be in format vm_type.yaml: {}".format(
- invalid_files
- )
+ assert (
+ not invalid_files
+ ), "Nested filenames must not be in format vm_type.yaml: {}".format(invalid_files)
diff --git a/ice_validator/tests/test_nested_parameters.py b/ice_validator/tests/test_nested_parameters.py
index 3e3bb06..5c93e77 100644
--- a/ice_validator/tests/test_nested_parameters.py
+++ b/ice_validator/tests/test_nested_parameters.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -40,17 +40,15 @@
"""heat parameters
"""
-
import pytest
from tests import cached_yaml as yaml
from tests.structures import Resource
-
from .helpers import validates
VERSION = "1.0.0"
-def check_nested_parameter_doesnt_change(yaml_file, parameter):
+def check_nested_parameter_doesnt_change(yaml_file):
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -62,37 +60,51 @@ def check_nested_parameter_doesnt_change(yaml_file, parameter):
invalid_parameters = []
"""
- checking if property: { get_param: <parameter> }, then property == <parameter>
+ checking if property: { get_param: parameter }, then property == parameter
resource_id:
type: nested.yaml
properties:
- property: { get_param: <parameter> }
+ property: { get_param: parameter }
resource_id:
type: OS::Heat::ResourceGroup
properties:
resource_def:
properties:
- property: { get_param: <parameter> }
+ property: { get_param: parameter }
"""
for resource_id, resource in yml.get("resources", {}).items():
- r = Resource(resource_id=resource_id, resource=resource)
- properties = r.get_nested_properties()
- for k1, v1 in properties.items():
- if (
- isinstance(v1, dict)
- and "get_param" in v1
- and parameter == v1.get("get_param")
- ):
- if k1 != parameter:
- invalid_parameters.append(
- {
- "resource": r.resource_id,
- "nested parameter": k1,
- "parameter": parameter,
- }
- )
+ resource_type = resource.get("type")
+ if resource_type and (
+ resource_type.endswith("yaml")
+ or resource_type.endswith("yml")
+ or resource_type == "OS::Heat::ResourceGroup"
+ ):
+ # workaround for subinterfaces
+ metadata = resource.get("metadata")
+ if metadata:
+ subinterface_type = metadata.get("subinterface_type")
+ if subinterface_type and subinterface_type == "network_collection":
+ continue
+
+ r = Resource(resource_id=resource_id, resource=resource)
+ properties = r.get_nested_properties()
+ for k1, v1 in properties.items():
+ if isinstance(v1, dict) and "get_param" in v1:
+ parameter = v1.get("get_param")
+ if isinstance(parameter, list):
+ parameter = parameter[0]
+
+ if k1 != parameter:
+ invalid_parameters.append(
+ {
+ "resource": r.resource_id,
+ "nested parameter": k1,
+ "parameter": parameter,
+ "file": yaml_file,
+ }
+ )
assert (
not invalid_parameters
@@ -101,41 +113,6 @@ def check_nested_parameter_doesnt_change(yaml_file, parameter):
)
-@validates("R-70757")
-def test_vm_role_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vm_role")
-
-
-@validates("R-44491")
-def test_vnf_id_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vnf_id")
-
-
-@validates("R-86237")
-def test_vf_module_id_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vf_module_id")
-
-
-@validates("R-16576")
-def test_vnf_name_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vnf_name")
-
-
-@validates("R-49177")
-def test_vf_module_name_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vf_module_name")
-
-
-@validates("R-22441")
-def test_vf_module_index_name_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "vf_module_index")
-
-
-@validates("R-62954")
-def test_environment_context_name_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "environment_context")
-
-
-@validates("R-75202")
-def test_workload_context_name_doesnt_change_in_nested_template(yaml_file):
- check_nested_parameter_doesnt_change(yaml_file, "workload_context")
+@validates("R-708564")
+def test_parameter_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file)
diff --git a/ice_validator/tests/test_neutron_net_resource_id.py b/ice_validator/tests/test_neutron_net_resource_id.py
index 36e77fa..1b0b322 100644
--- a/ice_validator/tests/test_neutron_net_resource_id.py
+++ b/ice_validator/tests/test_neutron_net_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -46,9 +46,9 @@ import pytest
from .helpers import validates
from .structures import Heat
-from .structures import NeutronNet
+from .structures import NeutronNetProcessor
-VERSION = "1.1.0"
+VERSION = "2.0.0"
# pylint: disable=invalid-name
@@ -62,12 +62,11 @@ def test_neutron_net_resource_id(heat_template):
* int_{network-role}_network
"""
heat = Heat(filepath=heat_template)
- neutron_nets = heat.get_resource_by_type(NeutronNet.resource_type)
+ neutron_nets = heat.get_resource_by_type(NeutronNetProcessor.resource_type)
if not neutron_nets:
pytest.skip("No neutron nets found")
- neutron_net = NeutronNet()
bad = []
for rid in neutron_nets:
- if not neutron_net.get_rid_match_tuple(rid)[0]:
+ if not NeutronNetProcessor.get_rid_match_tuple(rid)[0]:
bad.append("Neutron Net %s does not match any known format" % rid)
assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_neutron_port_addresses.py b/ice_validator/tests/test_neutron_port_addresses.py
index 0cd6b3b..95b8ddc 100644
--- a/ice_validator/tests/test_neutron_port_addresses.py
+++ b/ice_validator/tests/test_neutron_port_addresses.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -35,7 +35,6 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
"""
@@ -93,6 +92,8 @@ def get_port_addresses(filepath):
param = heat.nested_get(aa_pair, field, "get_param")
if param is None:
continue
+ else:
+ param = param[0] if isinstance(param, list) else param
port_addresses[field][param][basename].add(rid)
return port_addresses
@@ -166,6 +167,7 @@ def validate_field(heat, allowed_address_pairs, field, v6=False):
break
else:
# if v6 and testing v6, or inverse
+ param = param[0] if isinstance(param, list) else param
if v6 == is_v6_ip(param):
ports.add(param)
if error is None and len(ports) > 1:
@@ -197,7 +199,7 @@ def validate_external_ipaddress_v6(heat, allowed_address_pairs):
@validates("R-91810")
def test_neutron_port_external_ipaddress(heat_template):
"""
- If a VNF requires ECOMP to assign a Virtual IP (VIP) Address to
+ If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv4 VIP address.
"""
@@ -207,7 +209,7 @@ def test_neutron_port_external_ipaddress(heat_template):
@validates("R-41956")
def test_neutron_port_external_ipaddress_v6(heat_template):
"""
- If a VNF requires ECOMP to assign a Virtual IP (VIP) Address to
+ If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv6 VIP address.
"""
@@ -219,7 +221,7 @@ def test_neutron_port_floating(yaml_files):
"""
If a VNF has two or more ports that
attach to an external network that require a Virtual IP Address (VIP),
- and the VNF requires ECOMP automation to assign the IP address,
+ and the VNF requires ONAP automation to assign the IP address,
all the Virtual Machines using the VIP address **MUST**
be instantiated in the same Base Module Heat Orchestration Template
or in the same Incremental Module Heat Orchestration Template.
@@ -231,12 +233,12 @@ def test_neutron_port_floating(yaml_files):
for field, params in fields.items():
for param, files in params.items():
if len(files) > 1:
- bad.append(
- '"%s" "%s" in multiple templates: %s'
- % (
- field,
- param,
- ", ".join("%s: %s" % (k, list(v)) for k, v in files.items()),
+ error = ["{} {} assigned in multiple templates: ".format(field, param)]
+ for file_name, r_ids in files.items():
+ error.append(
+ "In {} it's assigned to {}. ".format(
+ file_name, ", ".join(r_ids)
+ )
)
- )
+ bad.append("".join(error))
assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_neutron_port_fixed_ips.py b/ice_validator/tests/test_neutron_port_fixed_ips.py
index f8cb7db..f69b995 100644
--- a/ice_validator/tests/test_neutron_port_fixed_ips.py
+++ b/ice_validator/tests/test_neutron_port_fixed_ips.py
@@ -286,8 +286,7 @@ def test_neutron_port_external_fixed_ips(heat_template):
"""
When the VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` is attaching
- to an external network (per the ECOMP definition, see
- Requirement R-57424),
+ to an external network,
and an IPv4 address is being cloud assigned by OpenStack's DHCP Service
and the external network IPv4 subnet is to be specified
using the property ``fixed_ips``
@@ -308,8 +307,7 @@ def test_neutron_port_internal_fixed_ips(heat_template):
* the VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` in an Incremental Module is attaching
- to an internal network (per the ECOMP definition, see
- Requirements R-52425 and R-46461)
+ to an internal network
that is created in the Base Module, AND
* an IPv4 address is being cloud assigned by OpenStack's DHCP Service AND
* the internal network IPv4 subnet is to be specified
diff --git a/ice_validator/tests/test_neutron_port_internal_network.py b/ice_validator/tests/test_neutron_port_internal_network.py
index b625be6..868930d 100644
--- a/ice_validator/tests/test_neutron_port_internal_network.py
+++ b/ice_validator/tests/test_neutron_port_internal_network.py
@@ -132,8 +132,7 @@ def get_neutron_ports(heat):
def test_neutron_port_internal_network(yaml_files):
"""
When the VNF's Heat Orchestration Template's Resource
- ``OS::Neutron::Port`` is attaching to an internal network (per the
- ECOMP definition, see Requirements R-52425 and R-46461),
+ ``OS::Neutron::Port`` is attaching to an internal network,
and the internal network is created in a
different Heat Orchestration Template than the ``OS::Neutron::Port``,
the ``network`` parameter name **MUST**
diff --git a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py
deleted file mode 100644
index 333e01e..0000000
--- a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-import os
-import pytest
-
-from .helpers import validates, get_environment_pair
-
-
-def get_keys(template, key):
- """
- Gets the set of keys from an expected dict from the ``template`` mapped to
- the ``key``. If the key is not found, or is not a dict, then an empty
- set is returned
- """
- value = template.get(key)
- if not value or not hasattr(value, "keys"):
- return set()
- else:
- return set(value.keys())
-
-
-@pytest.mark.heat_only
-@validates("R-01896", "R-26124")
-def test_no_unused_parameters_between_env_and_templates(heat_template):
- """
- Check all defined parameters are used in the appropriate Heat template.
- """
- environment_pair = get_environment_pair(heat_template)
- if not environment_pair:
- pytest.skip("No heat/env pair could be identified")
-
- env_parameters = get_keys(environment_pair["eyml"], "parameters")
- template_parameters = get_keys(environment_pair["yyml"], "parameters")
-
- extra_in_template = template_parameters.difference(env_parameters)
- extra_in_env = env_parameters.difference(template_parameters)
-
- msg = (
- "Mismatched parameters detected for the template and environment pair "
- "({basename}). Ensure the parameters exist in both "
- "templates indented under their respective parameters sections. "
- )
- if extra_in_env:
- msg += (
- "The following parameters exist in the env file, but not the "
- "template: {extra_in_env}. "
- )
- if extra_in_template:
- msg += (
- "The following parameters exist in the template file, but not the "
- "environment file: {extra_in_template}"
- )
-
- assert not (extra_in_template or extra_in_env), msg.format(
- basename=os.path.split(environment_pair["name"])[-1],
- extra_in_env=", ".join(extra_in_env),
- extra_in_template=", ".join(extra_in_template),
- )
diff --git a/ice_validator/tests/test_non_server_name.py b/ice_validator/tests/test_non_server_name.py
index 7d88155..f47e078 100644
--- a/ice_validator/tests/test_non_server_name.py
+++ b/ice_validator/tests/test_non_server_name.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -42,12 +42,15 @@
resource property name
"""
+import collections
+
import pytest
from .structures import Heat
+from .structures import HeatProcessor
from .helpers import validates
-VERSION = "1.1.0"
+VERSION = "1.2.0"
def get_non_servers(heat):
@@ -67,7 +70,7 @@ def test_non_server_name(heat_template):
"""
If a VNF's Heat Orchestration Template contains the property ``name``
for a non ``OS::Nova::Server`` resource, the intrinsic function
- ``str_replace`` **MUST** be used in conjunction with the ECOMP
+ ``str_replace`` **MUST** be used in conjunction with the ONAP
supplied metadata parameter ``vnf_name`` to generate a unique value.
"""
@@ -138,6 +141,29 @@ def test_non_server_name(heat_template):
+ "template ({})"
).format(rid, vnf_name_param, template)
)
- msg = "Improper name property for non-OS::Nova::Server resources. " + ". ".join(bad)
+ msg = (
+ "Improper name property for" " non-OS::Nova::Server resources. "
+ ) + ". ".join(bad)
assert not bad, msg
+
+
+@validates("R-85734")
+def test_non_server_name_unique(yaml_files):
+ """Test name has unique value
+ """
+ non_servers = {}
+ for yaml_file in yaml_files:
+ h = Heat(filepath=yaml_file)
+ non_servers.update(get_non_servers(h))
+ names = collections.defaultdict(set)
+ for rid, resource in non_servers.items():
+ name = HeatProcessor.get_str_replace_name(resource)
+ if name:
+ names[name].add(rid)
+ bad = {key: value for key, value in names.items() if len(value) > 1}
+ delim = "\n" + 4 * " "
+ assert not bad, "Names must be unique," " not shared across resource ids.%s%s" % (
+ delim,
+ delim.join("%s: %s" % (name, list(value)) for name, value in bad.items()),
+ )
diff --git a/ice_validator/tests/test_nova_server_resource_id.py b/ice_validator/tests/test_nova_server_resource_id.py
index 64462a5..4410586 100644
--- a/ice_validator/tests/test_nova_server_resource_id.py
+++ b/ice_validator/tests/test_nova_server_resource_id.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,18 +37,16 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
"""
resources:
{vm-type}_server_{vm-type_index}
"""
import pytest
-
from .structures import Heat
-from .structures import NovaServer
+from .structures import NovaServerProcessor
from .helpers import validates
-VERSION = "1.0.0"
+VERSION = "2.0.0"
# pylint: disable=invalid-name
@@ -67,12 +65,11 @@ def test_nova_server_resource_id(heat_template):
resources = heat.nova_server_resources
if not resources:
pytest.skip("No Nova Server resources found")
- nova_server = NovaServer()
bad = []
for rid in resources:
- if not nova_server.get_rid_match_tuple(rid)[0]:
+ if not NovaServerProcessor.get_rid_match_tuple(rid)[0]:
bad.append(rid)
assert not bad, "Resource ids %s must match %s" % (
bad,
- nova_server.get_rid_patterns(),
+ NovaServerProcessor.get_rid_patterns(),
)
diff --git a/ice_validator/tests/test_nova_servers_resource_ids.py b/ice_validator/tests/test_nova_servers_resource_ids.py
index 9747e29..b5c8754 100644
--- a/ice_validator/tests/test_nova_servers_resource_ids.py
+++ b/ice_validator/tests/test_nova_servers_resource_ids.py
@@ -37,10 +37,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
import pytest
from tests import cached_yaml as yaml
-
from .helpers import validates
from .utils.vm_types import get_vm_type_for_nova_server
@@ -102,9 +100,9 @@ def test_nova_servers_valid_resource_ids(yaml_file):
)
assert not invalid_nova_servers, (
- "Invalid OS::Nova::Server resource ids detected {}\n"
+ "Invalid OS::Nova::Server resource ids detected {}. "
"OS::Nova::Server resource ids must be in the form "
- "<vm_type>_server_<vm_type_index> \n"
- "<vm_type> is derived from flavor, image and name properties "
+ "{{vm_type}}_server_{{vm_type_index}} where "
+ "{{vm_type}} is derived from flavor, image and name properties."
"".format(invalid_nova_servers)
)
diff --git a/ice_validator/tests/test_nova_servers_vm_types.py b/ice_validator/tests/test_nova_servers_vm_types.py
index 786973e..a2d6a6e 100644
--- a/ice_validator/tests/test_nova_servers_vm_types.py
+++ b/ice_validator/tests/test_nova_servers_vm_types.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -118,23 +118,17 @@ def test_vm_type_network_role_collision(yaml_file):
@validates("R-50436", "R-45188", "R-40499")
def test_nova_server_flavor_parameter(yaml_file):
-
- prop = "flavor"
- check_nova_parameter_format(prop, yaml_file)
+ check_nova_parameter_format("flavor", yaml_file)
@validates("R-51430", "R-54171", "R-87817")
def test_nova_server_name_parameter(yaml_file):
-
- prop = "name"
- check_nova_parameter_format(prop, yaml_file)
+ check_nova_parameter_format("name", yaml_file)
@validates("R-71152", "R-57282", "R-58670")
def test_nova_server_image_parameter(yaml_file):
-
- prop = "image"
- check_nova_parameter_format(prop, yaml_file)
+ check_nova_parameter_format("image", yaml_file)
def check_nova_parameter_format(prop, yaml_file):
diff --git a/ice_validator/tests/test_oam_address_outputs.py b/ice_validator/tests/test_oam_address_outputs.py
new file mode 100644
index 0000000..287d472
--- /dev/null
+++ b/ice_validator/tests/test_oam_address_outputs.py
@@ -0,0 +1,65 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+import os
+
+from tests.helpers import validates
+from tests.structures import Heat
+
+MSG = (
+ "OAM management address can be declared as output in at most 1 template. "
+ + "Output parameter {} found in multiple templates: {}"
+)
+
+
+def find_output_param(param, templates):
+ templates = (t for t in templates if param in Heat(t).outputs)
+ return [os.path.basename(t) for t in templates]
+
+
+@validates("R-18683")
+def test_oam_address_v4_zero_or_one(heat_templates):
+ param = "oam_management_v4_address"
+ templates = find_output_param(param, heat_templates)
+ assert len(templates) <= 1, MSG.format(param, ", ".join(templates))
+
+
+@validates("R-94669")
+def test_oam_address_v6_zero_or_one(heat_templates):
+ param = "oam_management_v6_address"
+ templates = find_output_param(param, heat_templates)
+ assert len(templates) <= 1, MSG.format(param, ", ".join(templates))
diff --git a/ice_validator/tests/test_port_resource_ids.py b/ice_validator/tests/test_port_resource_ids.py
index f53370d..be80fe9 100644
--- a/ice_validator/tests/test_port_resource_ids.py
+++ b/ice_validator/tests/test_port_resource_ids.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -52,7 +52,7 @@ from .utils.network_roles import (
from .utils.vm_types import get_vm_type_for_nova_server
-@validates("R-20453", "R-26351", "R-26506" "R-681859")
+@validates("R-20453", "R-26351", "R-26506", "R-681859")
def test_port_resource_ids(heat_template):
"""
Check that all resource ids for ports follow the right
diff --git a/ice_validator/tests/test_server_and_port_vm_indices_match.py b/ice_validator/tests/test_server_and_port_vm_indices_match.py
new file mode 100644
index 0000000..20423bb
--- /dev/null
+++ b/ice_validator/tests/test_server_and_port_vm_indices_match.py
@@ -0,0 +1,84 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+import re
+
+from tests.helpers import validates
+from tests.structures import Heat
+from tests.utils import nested_dict
+
+SERVER_ID_PATTERN = re.compile(r"\w+_server_(\d+)")
+PORT_ID_PATTERN = re.compile(r"\w+_(\d+)_\w+\d+")
+
+
+def get_ports(server):
+ props = server.get("properties") or {}
+ networks = props.get("networks") or []
+ for network in networks:
+ r_id = nested_dict.get(network, "port", "get_resource")
+ if r_id:
+ yield r_id
+
+
+@validates("R-304011")
+def test_server_and_port_vmtype_indices_match(yaml_file):
+ # NOTE: This test is only going to validate that the index values
+ # match between the between the ports and server names. Other
+ # tests already cover the other aspects of this requirement
+
+ heat = Heat(filepath=yaml_file)
+ servers = heat.get_resource_by_type("OS::Nova::Server")
+ errors = []
+ for r_id, server in servers.items():
+ match = SERVER_ID_PATTERN.match(r_id)
+ if not match:
+ continue # other tests cover valid server ID format
+ server_index = match.group(1)
+ ports = get_ports(server)
+ for port in ports:
+ port_match = PORT_ID_PATTERN.match(port)
+ if port_match:
+ port_vm_index = port_match.group(1)
+ if port_vm_index != server_index:
+ errors.append(
+ (
+ "{{vm-type_index}} ({}) in port ID ({}) "
+ + "does not match the {{index}} ({}) in the "
+ + "servers resource ID ({})"
+ ).format(port_vm_index, port, server_index, r_id)
+ )
+ assert not errors, ". ".join(errors)
diff --git a/ice_validator/tests/test_servers_have_required_metadata.py b/ice_validator/tests/test_servers_have_required_metadata.py
index 8ea8869..4f76e7b 100644
--- a/ice_validator/tests/test_servers_have_required_metadata.py
+++ b/ice_validator/tests/test_servers_have_required_metadata.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -35,8 +35,6 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
import pytest
from tests import cached_yaml as yaml
@@ -48,12 +46,11 @@ from .helpers import validates
def test_servers_have_required_metadata(yaml_file):
"""
Check all defined nova server instances have the required metadata:
- vnf_id and vf_module_id
+ vnf_id, vf_module_id, and vnf_name
"""
with open(yaml_file) as fh:
yml = yaml.load(fh)
- # Check if the param vm_role is defined
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
diff --git a/ice_validator/tests/test_vm_class_has_unique_type.py b/ice_validator/tests/test_vm_class_has_unique_type.py
new file mode 100644
index 0000000..684c1b4
--- /dev/null
+++ b/ice_validator/tests/test_vm_class_has_unique_type.py
@@ -0,0 +1,155 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+"""heat parameters
+"""
+
+import collections
+
+import pytest
+
+from .structures import CinderVolumeAttachmentProcessor
+from .structures import NovaServerProcessor
+from .structures import get_all_resources
+from .helpers import validates
+
+VERSION = "2.0.0"
+
+
+class VmClassValidator(object):
+ """validate VM class has unique type
+ """
+
+ def __init__(self):
+ self.vm_counts = None
+ self.vm_classes = None
+ self.vm_rids = None
+ self.vm_types = None
+ self.va_count = None
+
+ def __call__(self, resources):
+ """return (possibly empty) list of error message strings
+ """
+ if not resources:
+ pytest.skip("No resources found")
+ self.vm_counts = collections.defaultdict(set)
+ self.vm_classes = collections.defaultdict(set)
+ self.vm_rids = collections.defaultdict(set)
+ self.vm_types = collections.defaultdict(set)
+ va_config, self.va_count = CinderVolumeAttachmentProcessor.get_config(resources)
+ if not va_config:
+ pytest.skip("No Cinder Volume Attachment configurations found")
+ for rid, resource in resources.items():
+ vm_class = NovaServerProcessor.get_vm_class(resource)
+ if vm_class:
+ vm_class["cinder_volume_attachment"] = va_config.get(rid)
+ match = NovaServerProcessor.get_rid_match_tuple(rid)[1]
+ if match:
+ vm_type = match.groupdict().get("vm_type")
+ if vm_type:
+ self.vm_classes[vm_class].add(rid)
+ self.vm_types[vm_type].add(vm_class)
+ self.vm_counts[vm_type].add(self.va_count.get(rid))
+ self.vm_rids[vm_type].add(rid)
+ if not self.vm_classes:
+ pytest.skip("No vm_classes found")
+ return self.get_errors()
+
+ def get_errors(self):
+ """return (possibly empty) list of error message strings
+ """
+ errors = []
+ for k, v in self.vm_types.items():
+ if len(v) > 1:
+ errors.append(
+ "vm-type %s has class conflict %s"
+ % (k, ", ".join(str(list(self.vm_classes[c])) for c in v))
+ )
+ classes = list(v)
+ errors.append(
+ "Differences %s"
+ % ", ".join([str(key_diff(classes[0], c)) for c in classes[1:]])
+ )
+ for k, v in self.vm_counts.items():
+ if len(v) > 1:
+ errors.append(
+ "Attachment count conflict %s"
+ % ({rid: self.va_count.get(rid) for rid in self.vm_rids[k]})
+ )
+ return errors
+
+
+def key_diff(d1, d2, prefix=""):
+ """Return list of keys which differ between d1 and d2 (dicts)
+ """
+ diff = [prefix + k for k in d1 if k not in d2]
+ diff.extend(prefix + k for k in d2 if k not in d1)
+ if isinstance(d1, dict) and isinstance(d2, dict):
+ for k, v1 in d1.items():
+ if k in d2 and v1 != d2[k]:
+ v2 = d2[k]
+ if isinstance(v1, type(v2)) and isinstance(v1, (dict, frozenset)):
+ diff.extend(key_diff(v1, v2, prefix=prefix + k + "."))
+ else:
+ diff.append(prefix + k)
+ return diff
+
+
+@validates("R-01455")
+def test_vm_class_has_unique_type(yaml_files):
+ """
+ When a VNF’s Heat Orchestration Template creates a Virtual
+ Machine (i.e., OS::Nova::Server), each “class” of VMs MUST be
+ assigned a VNF unique vm-type; where “class” defines VMs that
+ MUST have the following identical characteristics:
+
+ 1. OS::Nova::Server resource property flavor value
+ 2. OS::Nova::Server resource property image value
+ 3. Cinder Volume attachments
+ Each VM in the “class” MUST have the identical Cinder
+ Volume configuration
+ 4. Network attachments and IP address requirements
+ Each VM in the “class” MUST have the the identical number of
+ ports connecting to the identical networks and requiring the
+ identical IP address configuration
+ """
+ resources = get_all_resources(yaml_files)
+ errors = VmClassValidator()(resources)
+ assert not errors, "\n".join(errors)
diff --git a/ice_validator/tests/test_vm_role_value.py b/ice_validator/tests/test_vm_role_value.py
new file mode 100644
index 0000000..e7da73d
--- /dev/null
+++ b/ice_validator/tests/test_vm_role_value.py
@@ -0,0 +1,99 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+import re
+
+import pytest
+from six import string_types
+
+from tests.helpers import validates, get_environment_pair
+from tests.structures import Heat
+
+
+@validates("R-86476")
+def test_vm_role_hardcoded(yaml_file):
+ """
+ Validate vm_role value when hardcoded in the template
+ """
+ heat = Heat(filepath=yaml_file)
+ servers = heat.get_resource_by_type("OS::Nova::Server")
+ errors = []
+ for r_id, server in servers.items():
+ props = server.get("properties") or {}
+ metadata = props.get("metadata") or {}
+ if "vm_role" not in metadata:
+ continue
+ vm_role_value = metadata["vm_role"]
+ if isinstance(vm_role_value, dict):
+ continue # Likely using get_param - validate separately
+ if not re.match(r"^\w+$", vm_role_value):
+ errors.append(
+ "OS::Nova::Server {} vm_role = {}".format(r_id, vm_role_value)
+ )
+
+ msg = (
+ "vm_role's value must only contain alphanumerics and underscores. "
+ + "Invalid vm_role's detected: "
+ + ". ".join(errors)
+ )
+ assert not errors, msg
+
+
+@validates("R-86476")
+def test_vm_role_from_env_file(heat_template):
+ """
+ Validate vm_role when using parameters and env file
+ """
+ pair = get_environment_pair(heat_template)
+ if not pair:
+ pytest.skip("Unable to resolve environment pair")
+ template_params = pair["yyml"].get("parameters") or {}
+ env_params = pair["eyml"].get("parameters") or {}
+
+ if "vm_role" not in template_params:
+ pytest.skip("vm_role not in parameters")
+
+ if "vm_role" not in env_params:
+ pytest.skip("vm_role not in environment file. Error checked elsewhere")
+
+ vm_role = env_params.get("vm_role", "")
+ if not isinstance(vm_role, string_types):
+ vm_role = str(vm_role)
+ msg = "vm_role {} contains non-alphanumeric or non-underscore characters".format(
+ vm_role
+ )
+ assert re.match(r"^\w+$", vm_role), msg
diff --git a/ice_validator/tests/test_volume_module_naming.py b/ice_validator/tests/test_volume_module_naming.py
index 770ad26..68c2158 100644
--- a/ice_validator/tests/test_volume_module_naming.py
+++ b/ice_validator/tests/test_volume_module_naming.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -36,6 +36,7 @@
# ============LICENSE_END============================================
import os
+from tests.helpers import validates
from tests.parametrizers import get_nested_files
from tests.structures import Heat, Resource
@@ -45,7 +46,7 @@ def non_nested_files(filenames):
return set(filenames).difference(set(nested_files))
-# No requirement ID yet available
+@validates("R-589037")
def test_detected_volume_module_follows_naming_convention(template_dir):
all_files = [os.path.join(template_dir, f) for f in os.listdir(template_dir)]
yaml_files = [f for f in all_files if f.endswith(".yaml") or f.endswith(".yml")]
diff --git a/ice_validator/tests/test_volume_resource_ids.py b/ice_validator/tests/test_volume_resource_ids.py
index dc5ed7d..3beb79f 100644
--- a/ice_validator/tests/test_volume_resource_ids.py
+++ b/ice_validator/tests/test_volume_resource_ids.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,12 +37,9 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
import re
-
import pytest
from tests import cached_yaml as yaml
-
from .utils.vm_types import get_vm_type_for_nova_server
diff --git a/ice_validator/tests/utils/vm_types.py b/ice_validator/tests/utils/vm_types.py
index 78006b9..327b75b 100644
--- a/ice_validator/tests/utils/vm_types.py
+++ b/ice_validator/tests/utils/vm_types.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -39,6 +39,7 @@
#
import re
+from tests import cached_yaml as yaml
def get_vm_types_for_resource(resource):
@@ -111,3 +112,20 @@ def get_vm_types(resources):
vm_types.extend(list(get_vm_types_for_resource(v)))
return set(vm_types)
+
+
+def get_all_vm_types(yaml_files):
+ """
+ Get all vm_types for a list of yaml files
+ """
+ vm_types = []
+ for yaml_file in yaml_files:
+ with open(yaml_file, "r") as f:
+ yml = yaml.load(f)
+
+ if "resources" not in yml:
+ continue
+
+ vm_types.extend(get_vm_types(yml["resources"]))
+
+ return set(vm_types)