diff options
author | Michael F. Lamb <mike@datagrok.org> | 2017-09-05 11:21:28 -0700 |
---|---|---|
committer | Michael F. Lamb <mike@datagrok.org> | 2017-09-05 11:48:52 -0700 |
commit | cc21b8b08b6dbcec577bfb26ff397ac899da8002 (patch) | |
tree | 5d8a26586b0b0aee94002b472dfe995ffcb58fdf /ice_validator/tests | |
parent | 6755f61e44870ff65de0630a403f7b4ddfea4071 (diff) |
Commit seed code for validation-scripts
This imports the initial seed code for validation scripts.
These files were imported from a tarball with the SHA1SUM
ce2ae49c82546b987c8ad2f68ac43d94b4934818.
From the contents of the tarball, some errant .pyc files were removed,
and a .gitignore file was added. The result matches exactly the contents
of the origin private repository at hash 88c656e.
Change-Id: I97d19b11495e116890ca6577e83037b0934519cc
Issue-Id: VVP-11
Signed-off-by: Michael F. Lamb <mike@datagrok.org>
Diffstat (limited to 'ice_validator/tests')
285 files changed, 25656 insertions, 0 deletions
diff --git a/ice_validator/tests/__init__.py b/ice_validator/tests/__init__.py new file mode 100644 index 0000000..e8f24cd --- /dev/null +++ b/ice_validator/tests/__init__.py @@ -0,0 +1,39 @@ +# -*- 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. +# diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py new file mode 100644 index 0000000..69709af --- /dev/null +++ b/ice_validator/tests/conftest.py @@ -0,0 +1,149 @@ +# -*- 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. +# + +import os + + +__path__ = [os.path.dirname(os.path.abspath(__file__))] + + +def pytest_addoption(parser): + """ + Add needed CLI arguments + """ + parser.addoption("--template-directory", + dest="template_dir", + action="append", + help="Directory which holds the templates for validation") + + parser.addoption("--self-test", + dest="self_test", + action='store_true', + help="Test the unit tests against their fixtured data") + + +def pytest_configure(config): + """ + Ensure that we are receive either `--self-test` or + `--template-dir=<directory` as CLI arguments + """ + if config.getoption('template_dir') and config.getoption('self_test'): + raise Exception(('"--template-dir", and "--self-test"' + ' are mutually exclusive')) + if not (config.getoption('template_dir') or config.getoption('self_test')): + raise Exception(('One of "--template-dir" or' + ' "--self-test" must be specified')) + + +def pytest_generate_tests(metafunc): + """ + If a unit test requires an argument named 'filename' + we generate a test for the filenames selected. Either + the files contained in `template_dir` or if `template_dir` + is not specified on the CLI, the fixtures associated with this + test name. + """ + if 'filename' in metafunc.fixturenames: + from .parametrizers import parametrize_filename + parametrize_filename(metafunc) + + if 'filenames' in metafunc.fixturenames: + from .parametrizers import parametrize_filenames + parametrize_filenames(metafunc) + + if 'template_dir' in metafunc.fixturenames: + from .parametrizers import parametrize_template_dir + parametrize_template_dir(metafunc) + + if 'environment_pair' in metafunc.fixturenames: + from .parametrizers import parametrize_environment_pair + parametrize_environment_pair(metafunc) + + if 'heat_volume_pair' in metafunc.fixturenames: + from .parametrizers import parametrize_heat_volume_pair + parametrize_heat_volume_pair(metafunc) + + if 'yaml_files' in metafunc.fixturenames: + from .parametrizers import parametrize_yaml_files + parametrize_yaml_files(metafunc) + + if 'env_files' in metafunc.fixturenames: + from .parametrizers import parametrize_environment_files + parametrize_environment_files(metafunc) + + if 'yaml_file' in metafunc.fixturenames: + from .parametrizers import parametrize_yaml_file + parametrize_yaml_file(metafunc) + + if 'env_file' in metafunc.fixturenames: + from .parametrizers import parametrize_environment_file + parametrize_environment_file(metafunc) + + if 'parsed_yaml_file' in metafunc.fixturenames: + from .parametrizers import parametrize_parsed_yaml_file + parametrize_parsed_yaml_file(metafunc) + + if 'parsed_environment_file' in metafunc.fixturenames: + from .parametrizers import parametrize_parsed_environment_file + parametrize_parsed_environment_file(metafunc) + + if 'heat_template' in metafunc.fixturenames: + from .parametrizers import parametrize_heat_template + parametrize_heat_template(metafunc) + + if 'heat_templates' in metafunc.fixturenames: + from .parametrizers import parametrize_heat_templates + parametrize_heat_templates(metafunc) + + if 'volume_template' in metafunc.fixturenames: + from .parametrizers import parametrize_volume_template + parametrize_volume_template(metafunc) + + if 'volume_templates' in metafunc.fixturenames: + from .parametrizers import parametrize_volume_templates + parametrize_volume_templates(metafunc) + + if 'template' in metafunc.fixturenames: + from .parametrizers import parametrize_template + parametrize_template(metafunc) + + if 'templates' in metafunc.fixturenames: + from .parametrizers import parametrize_templates + parametrize_templates(metafunc) diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource.yaml new file mode 100644 index 0000000..b11db06 --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource.yaml @@ -0,0 +1,192 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_0_extnet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + db_1_int_intranet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_10_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 0] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_0_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_1_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + admin_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource_volume.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource_volume.yaml new file mode 100644 index 0000000..4304a70 --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_get_resource_volume.yaml @@ -0,0 +1,73 @@ +# -*- 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: 2013-05-23 + +description: > + An example volume template + +parameters: + + vm_type_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_10 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id.yaml new file mode 100644 index 0000000..bb6f22e --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id.yaml @@ -0,0 +1,192 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_0_extnet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + db_1_int_intranet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 0] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_0_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_1_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + admin_1_extnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id_volume.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id_volume.yaml new file mode 100644 index 0000000..2078b2d --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/fail/mismatch_resource_id_volume.yaml @@ -0,0 +1,73 @@ +# -*- 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: 2013-05-23 + +description: > + An example volume template + +parameters: + + vm_type_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + vm_type_volume_id1_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template.yaml new file mode 100644 index 0000000..783553f --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template.yaml @@ -0,0 +1,192 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_0_extnet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + db_1_int_intranet_0_port: + type: string + description: id of the admin_1_extnet_1_port + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 0] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_0_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_param: db_1_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + admin_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template_volume.yaml b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template_volume.yaml new file mode 100644 index 0000000..0d54d61 --- /dev/null +++ b/ice_validator/tests/fixtures/test_all_referenced_resources_exists/pass/valid_template_volume.yaml @@ -0,0 +1,73 @@ +# -*- 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: 2013-05-23 + +description: > + An example volume template + +parameters: + + vm_type_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/invalid_naming_for_allowed_address_pairs.yaml b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/invalid_naming_for_allowed_address_pairs.yaml new file mode 100644 index 0000000..db42cf6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/invalid_naming_for_allowed_address_pairs.yaml @@ -0,0 +1,125 @@ +# -*- 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. +# +--- +resources: + + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + vm_type_1_extnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + vm_type_1_extnet_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + vm_type_1_int_intranet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_ip_0 } + + vm_type_1_int_intranet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_v6_ip_0 } + + vm_type_1_extnet_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_ip } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_v6_ip_0 } + + vm_type_1_int_intranet_8_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_int_intranet_ip, 0] } + + vm_type_1_int_intranet_9_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_v6_ips, 0] } + + vm_type_1_extnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_ips } + + vm_type_1_extnet_11_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/single_ip_format_used_in_array.yaml b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/single_ip_format_used_in_array.yaml new file mode 100644 index 0000000..84774a1 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/single_ip_format_used_in_array.yaml @@ -0,0 +1,125 @@ +# -*- 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. +# +--- +resources: + + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + vm_type_1_extnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + vm_type_1_extnet_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + vm_type_1_int_intranet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_ip_0 } + + vm_type_1_int_intranet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_v6_ip_0 } + + vm_type_1_extnet_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_ip_0 } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_v6_ip_0 } + + vm_type_1_int_intranet_8_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_int_intranet_ip, 0] } + + vm_type_1_int_intranet_9_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_v6_ips, 0] } + + vm_type_1_extnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_extnet_ip, 0] } + + vm_type_1_extnet_11_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/wrong_network_role.yaml b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/wrong_network_role.yaml new file mode 100644 index 0000000..a3e7806 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pair_format/fail/wrong_network_role.yaml @@ -0,0 +1,125 @@ +# -*- 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. +# +--- +resources: + + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet2_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + vm_type_1_extnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + vm_type_1_extnet_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + vm_type_1_int_intranet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_ip_0 } + + vm_type_1_int_intranet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet3_v6_ip_0 } + + vm_type_1_extnet_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_ip_0 } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_v6_ip_0 } + + vm_type_1_int_intranet_8_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_int_intranet_ips, 0] } + + vm_type_1_int_intranet_9_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_v6_ips, 0] } + + vm_type_1_extnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_extnet_ips, 0] } + + vm_type_1_extnet_11_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml new file mode 100644 index 0000000..9a66ae5 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml @@ -0,0 +1,125 @@ +# -*- 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. +# +--- +resources: + + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + vm_type_1_extnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + vm_type_1_extnet_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + vm_type_1_int_intranet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_int_intranet_ip_0 } + + vm_type_1_int_intranet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_v6_ip_0 } + + vm_type_1_extnet_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_1_extnet_ip_0 } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_2_extnet_v6_ip_0 } + + vm_type_1_int_intranet_8_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_int_intranet_ips, 0] } + + vm_type_1_int_intranet_9_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_v6_ips, 0] } + + vm_type_1_extnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_1_extnet_ips, 0] } + + vm_type_1_extnet_11_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml new file mode 100644 index 0000000..655c60a --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet1_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml new file mode 100644 index 0000000..b5abb2b --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb1_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml new file mode 100644 index 0000000..71752dc --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet1_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml new file mode 100644 index 0000000..607a5cc --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db1_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml new file mode 100644 index 0000000..8a38509 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb1_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb1_names, 0] } + flavor: { get_param: lb1_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml new file mode 100644 index 0000000..03744d2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db1_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db1_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db1_names, 1] } + flavor: { get_param: db1_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/pass/valid_template.yaml new file mode 100644 index 0000000..3aa1d2e --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/pass/valid_template.yaml @@ -0,0 +1,259 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + db_int_intranet_floating_ip: + type: string + description: db_int_intranet_floating_ip + + db_int_intranet_floating_v6_ip: + type: string + description: db_int_intranet_floating_v6_ip + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + + lb_extnet_floating_ip: + type: string + description: lb_extnet_floating_ip + + lb_extnet_floating_v6_ip: + type: string + description: lb_extnet_floating_v6_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + - port: { get_resource: lb_4_extnet_0_port } + - port: { get_resource: lb_5_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + - port: { get_resource: db_3_int_intranet_0_port } + - port: { get_resource: db_4_int_intranet_0_port } + - port: { get_resource: db_5_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + + db_3_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_4_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_ip } + + db_5_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intranet_floating_v6_ip } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_ips, 0] } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_4_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_ip } + + lb_5_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + allowed_address_pairs: + - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_availability_zone/fail/missing_increment.yaml b/ice_validator/tests/fixtures/test_availability_zone/fail/missing_increment.yaml new file mode 100644 index 0000000..98d779a --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone/fail/missing_increment.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_ } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone/fail/not_starting_with_availability_zone.yaml b/ice_validator/tests/fixtures/test_availability_zone/fail/not_starting_with_availability_zone.yaml new file mode 100644 index 0000000..b07e8a1 --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone/fail/not_starting_with_availability_zone.yaml @@ -0,0 +1,65 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: wrong_availability_zone_0 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } + vm_type_b_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_1 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone/fail/using_a_non_digit_increment.yaml b/ice_validator/tests/fixtures/test_availability_zone/fail/using_a_non_digit_increment.yaml new file mode 100644 index 0000000..1a2be4a --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone/fail/using_a_non_digit_increment.yaml @@ -0,0 +1,34 @@ +# ============LICENSE_START======================================================= +# org.onap.vvp/validation-scripts +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file 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. +# ============LICENSE_END========================================================= +# +# ECOMP and OpenECOMP are trademarks +# and service marks of AT&T Intellectual Property. +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_a } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone/fail/using_list_instead_of_get_param.yaml b/ice_validator/tests/fixtures/test_availability_zone/fail/using_list_instead_of_get_param.yaml new file mode 100644 index 0000000..9bdf372 --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone/fail/using_list_instead_of_get_param.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: [availability_zones, 0] } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_availability_zone/pass/valid_heat_template.yaml new file mode 100644 index 0000000..9480b5a --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone/pass/valid_heat_template.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/not_using_get_param.yaml b/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/not_using_get_param.yaml new file mode 100644 index 0000000..bd11a89 --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/not_using_get_param.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { str_replace: availability_zone_0 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/only_specifying_param.yaml b/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/only_specifying_param.yaml new file mode 100644 index 0000000..e0cdba9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone_get_param/fail/only_specifying_param.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { availability_zone_0 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_availability_zone_get_param/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_availability_zone_get_param/pass/valid_heat_template.yaml new file mode 100644 index 0000000..9480b5a --- /dev/null +++ b/ice_validator/tests/fixtures/test_availability_zone_get_param/pass/valid_heat_template.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +resources: + vm_type_b_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + key_name: { get_param: vm_type_b_key_name } diff --git a/ice_validator/tests/fixtures/test_base_template_names/fail/failing_directory/check_cant_fail.yaml b/ice_validator/tests/fixtures/test_base_template_names/fail/failing_directory/check_cant_fail.yaml new file mode 100644 index 0000000..5f16fcc --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_names/fail/failing_directory/check_cant_fail.yaml @@ -0,0 +1,57 @@ +# -*- 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. +# +--- +description:
+ base
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: server_name_0}
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_1/base_well_named.yaml b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_1/base_well_named.yaml new file mode 100644 index 0000000..5f16fcc --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_1/base_well_named.yaml @@ -0,0 +1,57 @@ +# -*- 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. +# +--- +description:
+ base
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: server_name_0}
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_2/well_base_named.yaml b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_2/well_base_named.yaml new file mode 100644 index 0000000..5f16fcc --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_2/well_base_named.yaml @@ -0,0 +1,57 @@ +# -*- 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. +# +--- +description:
+ base
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: server_name_0}
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_3/well_named_base.yaml b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_3/well_named_base.yaml new file mode 100644 index 0000000..5f16fcc --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_3/well_named_base.yaml @@ -0,0 +1,57 @@ +# -*- 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. +# +--- +description:
+ base
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: server_name_0}
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/base_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/base_template.yaml new file mode 100644 index 0000000..103b380 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/base_template.yaml @@ -0,0 +1,100 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 0] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id } + +outputs: + + admin_server_id_0: + description: Admin server id 0 + value: { get_resource: admin_server_0 } + + oam_management_v4_address: + value: {get_attr: [admin_server, networks, { get_param: oam_net_id }, 0] } + + oam_management_v6_address: + value: {get_attr: [admin_server, networks, { get_param: oam_net_id }, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_1_template_missing_output_consumption.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_1_template_missing_output_consumption.yaml new file mode 100644 index 0000000..8fb2de2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_1_template_missing_output_consumption.yaml @@ -0,0 +1,88 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + admin_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 1] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_child_1_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_child_1_template.yaml new file mode 100644 index 0000000..31fc359 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_child_1_template.yaml @@ -0,0 +1,88 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + child_admin_server_3: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 3] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_template_missing_output_consumption.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_template_missing_output_consumption.yaml new file mode 100644 index 0000000..8768c46 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/fail/module_2_template_missing_output_consumption.yaml @@ -0,0 +1,91 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + admin_server_2: + type: OS::Nova::Server + properties: + name: { get_param: [ admin_names, 2 ] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id } + + admin_server_3: + type: module_2_child_1_template.yaml
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/base_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/base_template.yaml new file mode 100644 index 0000000..103b380 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/base_template.yaml @@ -0,0 +1,100 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 0] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id } + +outputs: + + admin_server_id_0: + description: Admin server id 0 + value: { get_resource: admin_server_0 } + + oam_management_v4_address: + value: {get_attr: [admin_server, networks, { get_param: oam_net_id }, 0] } + + oam_management_v6_address: + value: {get_attr: [admin_server, networks, { get_param: oam_net_id }, 0] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_1_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_1_template.yaml new file mode 100644 index 0000000..8fb2de2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_1_template.yaml @@ -0,0 +1,88 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + admin_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 1] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_child_1_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_child_1_template.yaml new file mode 100644 index 0000000..31fc359 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_child_1_template.yaml @@ -0,0 +1,88 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + +resources: + + child_admin_server_3: + type: OS::Nova::Server + properties: + name: { get_param: [admin_names, 3] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_template.yaml b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_template.yaml new file mode 100644 index 0000000..16ec503 --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_outputs_consumed/pass/module_2_template.yaml @@ -0,0 +1,95 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_image_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + oam_net_id: + type: string + description: OAM net id + + admin_server_id_0: + type: string + description: output parameter from base + +resources: + + admin_server_2: + type: OS::Nova::Server + properties: + name: { get_param: [ admin_names, 2 ] } + image: { get_param: admin_image_name } + flavor: { get_param: admin_flavor_name } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + networks: + - network: { get_param: oam_net_id } + + admin_server_3: + type: module_2_child_1_template.yaml
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_lon.yaml b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_lon.yaml new file mode 100644 index 0000000..b9c4ff7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_lon.yaml @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_long.env b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_long.env new file mode 100644 index 0000000..04fb338 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_long.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + parameters:
+ b: 2
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_shor.env b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_shor.env new file mode 100644 index 0000000..04fb338 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_shor.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + parameters:
+ b: 2
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_short.yaml b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_short.yaml new file mode 100644 index 0000000..b9c4ff7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/match_environment_filename_slightly_short.yaml @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/no_match_environment_filename.env b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/no_match_environment_filename.env new file mode 100644 index 0000000..04fb338 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/fail/no_match/no_match_environment_filename.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + parameters:
+ b: 2
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.env b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.env new file mode 100644 index 0000000..7cd88e3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters:
+ b: 2
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.yaml b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.yaml new file mode 100644 index 0000000..b9c4ff7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_and_yaml_same_name/pass/good_matches/good_yaml_eg.yaml @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template.yaml b/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template.yaml new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template.yaml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template_env.yaml b/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template_env.yaml new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_files_provided/fail/base_template_env.yaml @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.env b/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.env new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.env @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.yaml b/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.yaml new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_env_files_provided/pass/base_template.yaml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_invalid_key.env b/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_invalid_key.env new file mode 100644 index 0000000..2ef2317 --- /dev/null +++ b/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_invalid_key.env @@ -0,0 +1,63 @@ +# -*- 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. +# +--- +parameters: + b: 1 + c: "example" + d: 100 + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge + +dummy_section: + dummy_key: ""
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_no_keys.env b/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_no_keys.env new file mode 100644 index 0000000..b9c4ff7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_environment_file_structure/fail/non_environment_no_keys.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_environment_file_structure/pass/environment.env b/ice_validator/tests/fixtures/test_environment_file_structure/pass/environment.env new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_environment_file_structure/pass/environment.env @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format/fail/invalid_naming_for_fixed_ips.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format/fail/invalid_naming_for_fixed_ips.yaml new file mode 100644 index 0000000..445bebf --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_format/fail/invalid_naming_for_fixed_ips.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ip, 0] } + - ip_address: { get_param: db_1_int_vpnnet_ips } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - ip_address: { get_param: lb_1_extnet_ip_1 } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_ip } + + vm_type_1_int_vpnnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml new file mode 100644 index 0000000..f1b4f4d --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - ip_address: { get_param: lb_1_extnet_ip_1 } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_ip_0 } + + vm_type_1_int_vpnnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_param_not_used_for_fixed_ips.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_param_not_used_for_fixed_ips.yaml new file mode 100644 index 0000000..6444de3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_param_not_used_for_fixed_ips.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - ip_address: { get_param: lb_1_extnet_ip_1 } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_ip_0 } + + vm_type_1_int_vpnnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_resource_used_for_fixed_ips.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_resource_used_for_fixed_ips.yaml new file mode 100644 index 0000000..2b1a9da --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/fail/get_resource_used_for_fixed_ips.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_resource: lb_1_extnet_ip_0 } + - ip_address: { get_param: lb_1_extnet_ip_1 } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_ip_0 } + + vm_type_1_int_vpnnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml new file mode 100644 index 0000000..f1b4f4d --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - ip_address: { get_param: lb_1_extnet_ip_1 } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_ip_0 } + + vm_type_1_int_vpnnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_6_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_7_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml new file mode 100644 index 0000000..ec40ab7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb1_names, 0] } + flavor: { get_param: lb1_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml new file mode 100644 index 0000000..863a557 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet1_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml new file mode 100644 index 0000000..bafddc3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb1_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml new file mode 100644 index 0000000..e202460 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db1_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db1_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db1_names, 1] } + flavor: { get_param: db1_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml new file mode 100644 index 0000000..d9a0d1c --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet1_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml new file mode 100644 index 0000000..b7650c1 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db1_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml new file mode 100644 index 0000000..f67b794 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml @@ -0,0 +1,213 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intranet_ip_0: + type: string + description: db_int_intranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + lb_extnet_ip_0: + type: string + description: lb_extnet_ip_0 + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_0_port } + - port: { get_resource: lb_1_extnet_0_port } + - port: { get_resource: lb_2_extnet_0_port } + - port: { get_resource: lb_3_extnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + - port: { get_resource: db_1_int_intranet_0_port } + - port: { get_resource: db_2_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + db_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 0] } + - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } + + db_2_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: [db_int_intranet_ips, 1] } + + lb_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_0 } + - ip_address: { get_param: lb_extnet_v6_ip_0 } + + lb_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: [lb_extnet_ips, 0] } + - ip_address: { get_param: [lb_extnet_v6_ips, 0] } + + lb_2_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_extnet_ip_1 } + - subnet_id: { get_param: extnet_subnet_id } + + lb_3_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/personality_contains_http.yaml b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/personality_contains_http.yaml new file mode 100644 index 0000000..b0aac43 --- /dev/null +++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/personality_contains_http.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + user_data: + get_file: user_data.sh + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + personality: {"/opt/new.txt": { get_file: "http://my.server.us/personality/new.txt" } } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_ftp.yaml b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_ftp.yaml new file mode 100644 index 0000000..d7d6c2a --- /dev/null +++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_ftp.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + user_data: + get_file: user_data.sh + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + personality: {"/opt/new.txt": { get_file: "ftp://external.server.com" } } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_http.yaml b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_http.yaml new file mode 100644 index 0000000..fa5b5a4 --- /dev/null +++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/fail/user_data_contains_http.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + user_data: + get_file: http://server.example.com/files/user_data.sh + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + personality: {"/opt/new.txt": { get_file: "new.txt" } } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/valid_template.yaml new file mode 100644 index 0000000..c950f52 --- /dev/null +++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/valid_template.yaml @@ -0,0 +1,94 @@ +# -*- 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. +# +--- +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + user_data: + get_file: user_data.sh + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + personality: {"/opt/new.txt": { get_file: "new.txt"} } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_numeric_parameters/fail/parameter_numeric_value_missing_constraints.yaml b/ice_validator/tests/fixtures/test_heat_numeric_parameters/fail/parameter_numeric_value_missing_constraints.yaml new file mode 100644 index 0000000..d71b7af --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_numeric_parameters/fail/parameter_numeric_value_missing_constraints.yaml @@ -0,0 +1,46 @@ +# -*- 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. +# +--- +parameters: + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + default: "default"
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_numeric_parameters/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_heat_numeric_parameters/pass/valid_heat_template.yaml new file mode 100644 index 0000000..7f29136 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_numeric_parameters/pass/valid_heat_template.yaml @@ -0,0 +1,77 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + hidden: false + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + immutable: false + c: + type: json + label: human-readable name of the parameter + description: description of the parameter + d: + type: comma_delimited_list + label: human-readable name of the parameter + description: description of the parameter + e: + type: boolean + label: human-readable name of the parameter + description: description of the parameter
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/env_missing_yaml.env b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/env_missing_yaml.env new file mode 100644 index 0000000..d28ad59 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/env_missing_yaml.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters: + vnf_name: value + vnf_id: value + vf_module_id: value
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pair.yaml b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pair.yaml new file mode 100644 index 0000000..c83fa04 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pair.yaml @@ -0,0 +1,64 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pairr.env b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pairr.env new file mode 100644 index 0000000..d28ad59 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/misnamed_pairr.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters: + vnf_name: value + vnf_id: value + vf_module_id: value
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/yaml_missing_env.yaml b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/yaml_missing_env.yaml new file mode 100644 index 0000000..c83fa04 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/fail/yaml_missing_env.yaml @@ -0,0 +1,64 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.env b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.env new file mode 100644 index 0000000..d28ad59 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters: + vnf_name: value + vnf_id: value + vf_module_id: value
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.yaml b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.yaml new file mode 100644 index 0000000..c83fa04 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg.yaml @@ -0,0 +1,64 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.env b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.env new file mode 100644 index 0000000..43ac5b9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters: + vmtype_0_volume_name_0: name + vmtype_0_volume_type_0: SSD + vmtype_0_volume_name_0: 3
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.yaml b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.yaml new file mode 100644 index 0000000..47f7424 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_pairs_provided/pass/good_yaml_eg_volume.yaml @@ -0,0 +1,66 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single independent volume instance + +parameters: + vmtype_0_volume_name_0: + type: string + description: Unique name for this volume instance + vmtype_0_volume_type_0: + type: string + description: Type for this volume instance + vmtype_0_cinder_volume_size_0: + type: string + description: Size in GB for this volume instance + +resources: + vmtype_0_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vmtype_0_cinder_volume_size_0 } + volume_type: { get_param: vmtype_0_volume_type_0 } + name: { get_param: vmtype_0_volume_name_0 } + +outputs: + vmtype_0_volume_id_0: + value: { get_resource: vmtype_0_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_default_value_specified.yaml b/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_default_value_specified.yaml new file mode 100644 index 0000000..d9b1c8b --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_default_value_specified.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + default: default value for parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_invalid_keys.yaml b/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_invalid_keys.yaml new file mode 100644 index 0000000..99d8531 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_parameter_section/fail/parameter_invalid_keys.yaml @@ -0,0 +1,54 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + default: default value for parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + dummy_key: "dummy_key"
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_parameter_section/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_heat_parameter_section/pass/valid_heat_template.yaml new file mode 100644 index 0000000..7f29136 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_parameter_section/pass/valid_heat_template.yaml @@ -0,0 +1,77 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + hidden: false + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + immutable: false + c: + type: json + label: human-readable name of the parameter + description: description of the parameter + d: + type: comma_delimited_list + label: human-readable name of the parameter + description: description of the parameter + e: + type: boolean + label: human-readable name of the parameter + description: description of the parameter
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/environment.yaml b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/environment.yaml new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/environment.yaml @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/valid_heat_template.env b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/valid_heat_template.env new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/fail/valid_heat_template.env @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/environment.env b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/environment.env new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/environment.env @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yaml new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yaml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yml b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yml new file mode 100644 index 0000000..5d3cd17 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_and_env_file_extension/pass/valid_heat_template.yml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_description.yaml b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_description.yaml new file mode 100644 index 0000000..e8de8e3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_description.yaml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + hidden: false + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + immutable: false + c: + type: json + label: human-readable name of the parameter + description: description of the parameter + d: + type: comma_delimited_list + label: human-readable name of the parameter + description: description of the parameter + e: + type: boolean + label: human-readable name of the parameter + description: description of the parameter
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_type.yaml b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_type.yaml new file mode 100644 index 0000000..c547a59 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/fail/template_missing_type.yaml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + hidden: false + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + immutable: false + c: + label: human-readable name of the parameter + description: description of the parameter + d: + type: comma_delimited_list + label: human-readable name of the parameter + description: description of the parameter + e: + type: boolean + label: human-readable name of the parameter + description: description of the parameter
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/pass/valid_template.yaml new file mode 100644 index 0000000..7f29136 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_parameters_contain_required_fields/pass/valid_template.yaml @@ -0,0 +1,77 @@ +# -*- 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. +# +--- +parameters: + a: + type: string + label: human-readable name of the parameter + description: description of the parameter + hidden: true + constraints: + - length: { min: 6, max: 8 } + description: User name must be between 6 and 8 characters + - allowed_pattern: "[A-Z]+[a-zA-Z0-9]*" + description: User name must start with an uppercase character + immutable: true + b: + type: number + label: human-readable name of the parameter + description: description of the parameter + hidden: false + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + immutable: false + c: + type: json + label: human-readable name of the parameter + description: description of the parameter + d: + type: comma_delimited_list + label: human-readable name of the parameter + description: description of the parameter + e: + type: boolean + label: human-readable name of the parameter + description: description of the parameter
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yaml b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yaml new file mode 100644 index 0000000..bf64f9a --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yaml @@ -0,0 +1,63 @@ +# -*- 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. +# +--- +parameters: + b: 1 + c: "example" + d: 100 + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge + +dummy_section: + dummy_section: "dummy_value"
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yml b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yml new file mode 100644 index 0000000..bf64f9a --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_invalid_keys.yml @@ -0,0 +1,63 @@ +# -*- 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. +# +--- +parameters: + b: 1 + c: "example" + d: 100 + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge + +dummy_section: + dummy_section: "dummy_value"
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_no_valid_keys.yaml b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_no_valid_keys.yaml new file mode 100644 index 0000000..74bf184 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/fail/non_heat_template_no_valid_keys.yaml @@ -0,0 +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. +# +--- +b: 1 + c: "example" +d: 100
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yaml new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yaml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yml b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yml new file mode 100644 index 0000000..5d3cd17 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template.yml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template_minimal_sections.yaml b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template_minimal_sections.yaml new file mode 100644 index 0000000..260d284 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_template_structure/pass/valid_heat_template_minimal_sections.yaml @@ -0,0 +1,65 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.env b/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.env new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.env @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.template b/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.template new file mode 100644 index 0000000..4c1fdcc --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_templates_provided/fail/base_template.template @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a diff --git a/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.env b/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.env new file mode 100644 index 0000000..e7e2ac3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.env @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +parameters: + KeyName: heat_key + InstanceType: m1.micro + ImageId: F18-x86_64-cfntools + +parameter_defaults: + default_key: heat_key + +encrypted_parameters: + g: "" + +event_sinks: + - type: zaqar-queue + target: myqueue + ttl: 1200 + +parameter_merge_strategies: + default: merge + param1: overwrite + param2: deep_merge
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.yaml b/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.yaml new file mode 100644 index 0000000..fceb0ff --- /dev/null +++ b/ice_validator/tests/fixtures/test_heat_templates_provided/pass/base_template.yaml @@ -0,0 +1,114 @@ +# -*- 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: Simple template to deploy a single compute instance + +parameter_groups: + - label: human-readable label of parameter group + description: description of the parameter group + parameters: + - pga + - pgb + +parameters: + b: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + c: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + d: + type: string + label: Key Name + description: Name of key-pair to be used for compute instance + +resources: + my_instance: + type: OS::Nova::Server + properties: + key_name: my_key + image: F18-x86_64-cfntools + flavor: m1.small + +outputs: + instance_ip: + description: The IP address of the deployed instance + value: { get_attr: [my_instance, first_address] } + +conditions: + cd1: True + cd2: + get_param: param1 + cd3: + equals: + - get_param: param2 + - yes + cd4: + not: + equals: + - get_param: param3 + - yes + cd5: + and: + - equals: + - get_param: env_type + - prod + - not: + equals: + - get_param: zone + - beijing + cd6: + or: + - equals: + - get_param: zone + - shanghai + - equals: + - get_param: zone + - beijing + cd7: + not: cd4 + cd8: + and: + - cd1 + - cd2a
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates/fail/heat_template_missing_nested_files.yaml b/ice_validator/tests/fixtures/test_nested_templates/fail/heat_template_missing_nested_files.yaml new file mode 100644 index 0000000..b65d6ac --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates/fail/heat_template_missing_nested_files.yaml @@ -0,0 +1,62 @@ +# -*- 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. +# +--- +nested_template_description: base + +parameters: + vm_type_volume_name_0: + type: string + vm_type_volume_size_0: + type: number + +resources: + server_0: + type: nested_template_1.yaml + properties: + name: {get_param: server_name_0} + my_resource_group_1: + type: OS::Nova::Server + properties: + count: 5 + resource_def: { type: nested_template_2.yaml } + +outputs: + vm_type_volume_id_0: + value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_1.yaml b/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_1.yaml new file mode 100644 index 0000000..ef5a06e --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_1.yaml @@ -0,0 +1,59 @@ +# -*- 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: 2013-05-23 + +resources: + volume: + type: OS::Cinder::Volume + properties: + size: 1 + + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: volume } + instance_uuid: { get_resource: instance } + + instance: + type: OS::Nova::Server + properties: + image: myimage + flavor: m1.small
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_2.yaml b/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_2.yaml new file mode 100644 index 0000000..ef5a06e --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates/pass/nested_template_2.yaml @@ -0,0 +1,59 @@ +# -*- 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: 2013-05-23 + +resources: + volume: + type: OS::Cinder::Volume + properties: + size: 1 + + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: volume } + instance_uuid: { get_resource: instance } + + instance: + type: OS::Nova::Server + properties: + image: myimage + flavor: m1.small
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates/pass/valid_nested_heat_template.yaml b/ice_validator/tests/fixtures/test_nested_templates/pass/valid_nested_heat_template.yaml new file mode 100644 index 0000000..676437f --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates/pass/valid_nested_heat_template.yaml @@ -0,0 +1,50 @@ +# -*- 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. +# +--- +resources: + server_0: + type: nested_template_1.yaml + properties: + name: { get_param: server_name_0 } + my_resource_group_1: + type: OS::Heat::ResourceGroup + properties: + count: 5 + resource_def: { type: nested_template_2.yaml }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/fail/heat_template_invalid_nesting.yaml b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/fail/heat_template_invalid_nesting.yaml new file mode 100644 index 0000000..f1e47e0 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/fail/heat_template_invalid_nesting.yaml @@ -0,0 +1,70 @@ +# -*- 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. +# +--- +nested_template_description: base + +parameters: + vm_type_volume_name_0: + type: string + vm_type_volume_size_0: + type: number + +resources: + my_resource_group_1: + type: OS::Heat::ResourceGroup + properties: + count: 5 + resource_def: { nested_template_2.yaml } + + my_resource_group_2: + type: OS::Heat::ResourceGroup + properties: + count: 5 + resource_def: nested_template_2.yaml + + my_resource_group_3: + type: OS::Heat::ResourceGroup + properties: + count: 5 + resource_def: { type: nested_template_2 } + +outputs: + vm_type_volume_id_0: + value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_1.yaml b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_1.yaml new file mode 100644 index 0000000..ef5a06e --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_1.yaml @@ -0,0 +1,59 @@ +# -*- 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: 2013-05-23 + +resources: + volume: + type: OS::Cinder::Volume + properties: + size: 1 + + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: volume } + instance_uuid: { get_resource: instance } + + instance: + type: OS::Nova::Server + properties: + image: myimage + flavor: m1.small
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_2.yaml b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_2.yaml new file mode 100644 index 0000000..ef5a06e --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/nested_template_2.yaml @@ -0,0 +1,59 @@ +# -*- 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: 2013-05-23 + +resources: + volume: + type: OS::Cinder::Volume + properties: + size: 1 + + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: volume } + instance_uuid: { get_resource: instance } + + instance: + type: OS::Nova::Server + properties: + image: myimage + flavor: m1.small
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_nested_heat_template.yaml b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_nested_heat_template.yaml new file mode 100644 index 0000000..7782b56 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_nested_heat_template.yaml @@ -0,0 +1,62 @@ +# -*- 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. +# +--- +description: base + +parameters: + vm_type_volume_name_0: + type: string + vm_type_volume_size_0: + type: number + +resources: + server_0: + type: nested_template_1.yaml + properties: + name: { get_param: server_name_0 } + my_resource_group_1: + type: OS::Heat::ResourceGroup + properties: + count: 5 + resource_def: { type: nested_template_2.yaml } + +outputs: + vm_type_volume_id_0: + value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_non_nested_template.yaml b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_non_nested_template.yaml new file mode 100644 index 0000000..bc2e53d --- /dev/null +++ b/ice_validator/tests/fixtures/test_nested_templates_invalid_nesting/pass/valid_non_nested_template.yaml @@ -0,0 +1,69 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + max_count: + type: number + description: Max number of server groups + constraints: + - range: { min: 0, max: 20 } + description: max count must be between 0 and 20 + +resources: + multiple_server_groups: + type: OS::Heat::ResourceGroup + properties: + count: { get_param: max_count } + resource_def: + type: OS::Nova::ServerGroup + properties: + name: + str_replace: + template: $VNF_NAME_resource_group + params: + $VNF_NAME: { get_param: vnf_name } + policies: ['anti-affinity'] diff --git a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_internal_network_resource.yaml b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_internal_network_resource.yaml new file mode 100644 index 0000000..26d0709 --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_internal_network_resource.yaml @@ -0,0 +1,65 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + vm_type_1_extnet_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + + vm_type_1_int_oam_1_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } diff --git a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml new file mode 100644 index 0000000..85bc86c --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml @@ -0,0 +1,60 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net } + + vm_type_1_extnet_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } diff --git a/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml new file mode 100644 index 0000000..422a979 --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml @@ -0,0 +1,65 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + vm_type_1_extnet_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + + vm_type_1_int_oam_1_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net_id } diff --git a/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_param_not_used_for_network.yaml b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_param_not_used_for_network.yaml new file mode 100644 index 0000000..3673598 --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_param_not_used_for_network.yaml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + vm_type_1_external_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_name } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + + int_network: + type: OS::Neutron::Net + properties: + name: + str_replace: + template: $PREFIX_int_network + params: + $PREFIX: { get_param: vnf_name } + admin_state_up: True + shared: False + + vm_type_0_int_network_0_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_network }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml new file mode 100644 index 0000000..cf34fce --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml @@ -0,0 +1,65 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + vm_type_1_external_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_name } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + + vm_type_0_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_resource: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml new file mode 100644 index 0000000..bed976e --- /dev/null +++ b/ice_validator/tests/fixtures/test_network_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + + vm_type_1_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + vm_type_1_external_net_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_name } + + vm_type_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + + int_network: + type: OS::Neutron::Net + properties: + name: + str_replace: + template: $PREFIX_int_network + params: + $PREFIX: { get_param: vnf_name } + admin_state_up: True + shared: False + + vm_type_0_int_network_0_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_network }
\ 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_no_unused_parameters_between_env_and_templates/fail/unused_param.env new file mode 100644 index 0000000..3a136c9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.env @@ -0,0 +1,46 @@ +# -*- 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. +# +--- +parameters:
+ out: 2
+ res: 3
+ indexed: 4
+ unused_env: 4
+ indx: 1
\ No newline at end of file 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_no_unused_parameters_between_env_and_templates/fail/unused_param.yaml new file mode 100644 index 0000000..421a699 --- /dev/null +++ b/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/fail/unused_param.yaml @@ -0,0 +1,67 @@ +# -*- 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. +# +--- +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
+ unused_yaml:
+ type: number
+ description: unused param in yaml file
+resources:
+ test:
+ type: abc
+ properties:
+ test_res: {get_param: res}
+ test_ind_param: { get_param: [ indexed, { get_param: indx } ] }
+
+outputs:
+ test_out:
+ description: test getting output param
+ value: {get_param: out}
\ No newline at end of file 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_no_unused_parameters_between_env_and_templates/pass/no_unused_param.env new file mode 100644 index 0000000..06a9821 --- /dev/null +++ b/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.env @@ -0,0 +1,45 @@ +# -*- 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. +# +--- +parameters:
+ out: 2
+ res: 3
+ indexed: 4
+ indx: 1
\ No newline at end of file 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_no_unused_parameters_between_env_and_templates/pass/no_unused_param.yaml new file mode 100644 index 0000000..953191b --- /dev/null +++ b/ice_validator/tests/fixtures/test_no_unused_parameters_between_env_and_templates/pass/no_unused_param.yaml @@ -0,0 +1,65 @@ +# -*- 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. +# +--- +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
+
+resources:
+ test:
+ type: abc
+ properties:
+ test_res: {get_param: res}
+ test_ind_param: { get_param: [ indexed, { get_param: indx } ] }
+
+outputs:
+ test_out:
+ description: test getting output param
+ value: {get_param: out}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nova_servergroup_policies/fail/not_supported_policies.yml b/ice_validator/tests/fixtures/test_nova_servergroup_policies/fail/not_supported_policies.yml new file mode 100644 index 0000000..047673d --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servergroup_policies/fail/not_supported_policies.yml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +resources: + db_server_group: + type: OS::Nova::ServerGroup + properties: + name: + str_replace: + params: + $vnf_name: {get_param: vnf_name} + template: $vnf_name-server_group1 + policies: + - OS Profile + lb_server_group: + type: OS::Nova::ServerGroup + properties: + name: + str_replace: + params: + $vnf_name: {get_param: vnf_name} + template: $vnf_name-server_group2 + policies: + - affinity + db_0: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: db_server_group} + db_1: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: db_server_group} + lb_0: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: lb_server_group} diff --git a/ice_validator/tests/fixtures/test_nova_servergroup_policies/pass/with_supported_policies.yml b/ice_validator/tests/fixtures/test_nova_servergroup_policies/pass/with_supported_policies.yml new file mode 100644 index 0000000..5e50a1b --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servergroup_policies/pass/with_supported_policies.yml @@ -0,0 +1,76 @@ +# -*- 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. +# +--- +resources: + db_server_group: + type: OS::Nova::ServerGroup + properties: + name: + str_replace: + params: + $vnf_name: {get_param: vnf_name} + template: $vnf_name-server_group1 + policies: + - anti-affinity + lb_server_group: + type: OS::Nova::ServerGroup + properties: + name: + str_replace: + params: + $vnf_name: {get_param: vnf_name} + template: $vnf_name-server_group2 + policies: + - affinity + db_0: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: db_server_group} + db_1: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: db_server_group} + lb_0: + type: OS::Nova::Server + properties: + scheduler_hints: + group: {get_param: lb_server_group}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/fail/wrong_type_for_parameters.yaml b/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/fail/wrong_type_for_parameters.yaml new file mode 100644 index 0000000..6bddeee --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/fail/wrong_type_for_parameters.yaml @@ -0,0 +1,116 @@ +# -*- 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: Simple template + +parameters: + + vnf_name: + type: string + description: Unique name for this VNF instance + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vm_type_a_names: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_a_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_a_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + + vm_type_b_name_0: + type: comma_delimited_list + description: Names attribute for the VMs that are the my VNF + + vm_type_b_name_1: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_b_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_b_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + +resources: + + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} +
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/pass/valid_heat_template.yaml new file mode 100644 index 0000000..d51217c --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_correct_parameter_types/pass/valid_heat_template.yaml @@ -0,0 +1,102 @@ +# -*- 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: Simple template + +parameters: + + vm_type_a_names: + type: comma_delimited_list + description: Names attribute for the VMs that are the my VNF + + vm_type_a_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_a_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + + vm_type_b_name_0: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_b_name_1: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_b_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_b_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties.yaml b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties.yaml new file mode 100644 index 0000000..b8dfc76 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 2] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties_uppercase.yaml b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties_uppercase.yaml new file mode 100644 index 0000000..ecd9838 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_key_properties_uppercase.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + VM_TYPE_B_SERVER_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 2] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id.yaml b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id.yaml new file mode 100644 index 0000000..c1c55be --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_b_names, 1] } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id_uppercase.yaml b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id_uppercase.yaml new file mode 100644 index 0000000..d5f0cdc --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/fail/mismatch_vm_type_resource_id_uppercase.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + VM_TYPE_A_SERVER_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_b_names, 1] } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_resource_ids/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/pass/valid_heat_template.yaml new file mode 100644 index 0000000..0c1f8c0 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_resource_ids/pass/valid_heat_template.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + VM_TYPE_B_SERVER_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_vm_types/fail/inconsistent_vm_type.yaml b/ice_validator/tests/fixtures/test_nova_servers_vm_types/fail/inconsistent_vm_type.yaml new file mode 100644 index 0000000..c8b6403 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_vm_types/fail/inconsistent_vm_type.yaml @@ -0,0 +1,70 @@ +# -*- 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. +# +--- +resources: + + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a1_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a2_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} +
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nova_servers_vm_types/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_nova_servers_vm_types/pass/valid_heat_template.yaml new file mode 100644 index 0000000..8d3a0df --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_vm_types/pass/valid_heat_template.yaml @@ -0,0 +1,68 @@ +# -*- 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. +# +--- +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/missing_get_param.yaml b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/missing_get_param.yaml new file mode 100644 index 0000000..f3ec510 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/missing_get_param.yaml @@ -0,0 +1,70 @@ +# -*- 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. +# +--- +resources: + + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} +
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/using_str_replace_instead_of_get_param.yaml b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/using_str_replace_instead_of_get_param.yaml new file mode 100644 index 0000000..773b28d --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/fail/using_str_replace_instead_of_get_param.yaml @@ -0,0 +1,69 @@ +# -*- 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. +# +--- +resources: + + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { str_replace: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/pass/valid_heat_template.yaml new file mode 100644 index 0000000..bb37559 --- /dev/null +++ b/ice_validator/tests/fixtures/test_nova_servers_vm_types_use_get_param/pass/valid_heat_template.yaml @@ -0,0 +1,102 @@ +# -*- 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: Simple template + +parameters: + + vm_type_a_names: + type: comma_delimited_list + description: Names attribute for the VMs that are the my VNF + + vm_type_a_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_a_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + + vm_type_b_name_0: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_b_name_1: + type: string + description: Names attribute for the VMs that are the my VNF + + vm_type_b_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + vm_type_b_image_name: + type: string + description: image to be used to create this vm must be one of the following flavors + +resources: + vm_type_a_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_a_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + + vm_type_b_server_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_0 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} + + vm_type_b_server_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_b_name_1 } + flavor: { get_param: vm_type_b_flavor_name} + image: { get_param: vm_type_b_image_name} diff --git a/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_less_indent_on_value.yaml b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_less_indent_on_value.yaml new file mode 100644 index 0000000..59a58b4 --- /dev/null +++ b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_less_indent_on_value.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 3
+ g: 4
+ h: 3
+ i: 4
+ j: 3
+ d:
+ c: 3
+ lkf: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_multierror.yaml b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_multierror.yaml new file mode 100644 index 0000000..4e0636e --- /dev/null +++ b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_multierror.yaml @@ -0,0 +1,54 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 3
+ g: 4
+ h: 3
+ i: 4
+ j: 3
+ ddfg
+ c: 3
+ lkf:
+ fhe: 5
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_tab.yaml b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_tab.yaml new file mode 100644 index 0000000..b16ec7a --- /dev/null +++ b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_tab.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 3
+ g: 4
+ h: 3
+ i: 4
+ j: 3
+ d:
+ c: 3
+ lkf: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_value_and_keys.yaml b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_value_and_keys.yaml new file mode 100644 index 0000000..85e350b --- /dev/null +++ b/ice_validator/tests/fixtures/test_parse_yaml/fail/bad_yaml_value_and_keys.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 3
+ g: 4
+ h: 3
+ i: 4
+ j: 3
+ d:
+ c: 3
+ lkf: 4
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_parse_yaml/pass/good_yaml_eg.yaml b/ice_validator/tests/fixtures/test_parse_yaml/pass/good_yaml_eg.yaml new file mode 100644 index 0000000..8b5b820 --- /dev/null +++ b/ice_validator/tests/fixtures/test_parse_yaml/pass/good_yaml_eg.yaml @@ -0,0 +1,52 @@ +# -*- 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. +# +--- + a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 4
+ g:
+ h:
+ test: test
+ k: g
+
+ test: out
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_port_resource_ids/fail/mismatch_vm_type_port_id_get_resource.yaml b/ice_validator/tests/fixtures/test_port_resource_ids/fail/mismatch_vm_type_port_id_get_resource.yaml new file mode 100644 index 0000000..ac1b60c --- /dev/null +++ b/ice_validator/tests/fixtures/test_port_resource_ids/fail/mismatch_vm_type_port_id_get_resource.yaml @@ -0,0 +1,158 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin1_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin1_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + admin_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource.yaml b/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource.yaml new file mode 100644 index 0000000..e944a35 --- /dev/null +++ b/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource.yaml @@ -0,0 +1,158 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: admin_1_extnet_0_port } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + admin_1_extnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource_uppercase.yaml b/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource_uppercase.yaml new file mode 100644 index 0000000..62a264e --- /dev/null +++ b/ice_validator/tests/fixtures/test_port_resource_ids/fail/wrong_port_attached_to_nova_server_get_resource_uppercase.yaml @@ -0,0 +1,158 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: ADMIN_1_EXTNET_0_PORT } + - port: { get_resource: ADMIN_1_EXTNET_1_PORT } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + ADMIN_1_EXTNET_0_PORT: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + ADMIN_1_EXTNET_1_PORT: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml new file mode 100644 index 0000000..dd5d768 --- /dev/null +++ b/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml @@ -0,0 +1,158 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_vpnnet_net_id: + type: string + description: network id for the internal network vpnnet + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_0_exnet_0_port } + - port: { get_resource: admin_0_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: ADMIN_1_EXTNET_0_PORT } + - port: { get_resource: admin_1_extnet_1_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_0_exnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: exnet_net_name } + + admin_0_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + + ADMIN_1_EXTNET_0_PORT: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + + admin_1_extnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_1.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_1.yaml new file mode 100644 index 0000000..d5914ec --- /dev/null +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_1.yaml @@ -0,0 +1,139 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_id: + description: Unique ID for this VNF + type: string + vf_module_id: + description: Unique ID for this VF module + type: string + vnf_name: + type: string + description: Unique name for this VNF instance + ex_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex_vm_name: + type: string + description: Name of the VM + ex1_vm_names: + type: comma_delimited_list + description: Name of the VM + ex1_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex1_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex1_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex1_server_index: + type: number + label: server index + description: Index of server + constraint: + - range: { min: 1, max: 100 } + +resources: + ex_software_config_0: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + params: + $stack_name: { get_param: 'OS::stack_name' } + + ex_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: ex_vm_name } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex_image_name } + flavor: { get_param: ex_flavor_name } + key_name: { get_param: ex_key } + networks: + - network: { get_param: int_network_net_id } + user_data: + get_resource: ex_software_config_0 + + ex1_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, 0 ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + + ex1_nova_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_2.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_2.yaml new file mode 100644 index 0000000..23d0bd5 --- /dev/null +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_definition_2.yaml @@ -0,0 +1,132 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_id: + description: Unique ID for this VNF + type: string + vf_module_id: + description: Unique ID for this VF module + type: string + vnf_name: + type: string + description: Unique name for this VNF instance + ex_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex_vm_name: + type: string + description: Name of the VM + ex1_vm_names: + type: comma_delimited_list + description: Name of the VM + ex1_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex1_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex1_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + +resources: + ex_software_config_0: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + params: + $stack_name: { get_param: 'OS::stack_name' } + + ex_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: ex_vm_name } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex_image_name } + flavor: { get_param: ex_flavor_name } + key_name: { get_param: ex_key } + user_data: + get_resource: ex_software_config_0 + + ex1_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, 0 ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + metering.stack: { get_param: "OS::stack_id" } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + + ex1_nova_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml new file mode 100644 index 0000000..78632b8 --- /dev/null +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml @@ -0,0 +1,134 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_id: + description: Unique ID for this VNF + type: string + vf_module_id: + description: Unique ID for this VF module + type: string + vnf_name: + type: string + description: Unique name for this VNF instance + ex_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex_vm_name: + type: string + description: Name of the VM + ex1_vm_names: + type: comma_delimited_list + description: Name of the VM + ex1_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex1_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex1_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex1_server_index: + type: number + label: server index + description: Index of server + constraint: + - range: { min: 1, max: 100 } + +resources: + ex_software_config_0: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + params: + $stack_name: { get_param: 'OS::stack_name' } + + ex_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: ex_vm_name } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex_image_name } + flavor: { get_param: ex_flavor_name } + key_name: { get_param: ex_key } + user_data: + get_resource: ex_software_config_0 + + ex1_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, 0 ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + project_id: { get_param: "OS::project_id" } + image: { get_param: ex1_image_name } + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + + ex1_nova_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml new file mode 100644 index 0000000..3080018 --- /dev/null +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml @@ -0,0 +1,139 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_id: + description: Unique ID for this VNF + type: string + vf_module_id: + description: Unique ID for this VF module + type: string + vnf_name: + type: string + description: Unique name for this VNF instance + ex_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex_vm_name: + type: string + description: Name of the VM + ex1_vm_names: + type: comma_delimited_list + description: Name of the VM + ex1_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex1_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex1_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex1_server_index: + type: number + label: server index + description: Index of server + constraint: + - range: { min: 1, max: 100 } + +resources: + ex_software_config_0: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + params: + $stack_name: { get_param: 'OS::stack_name' } + + ex_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: ex_vm_name } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + metering.stack: { get_param: "OS::stack_id" } + project_id: { get_param: "OS::project_id" } + image: { get_param: ex_image_name } + flavor: { get_param: ex_flavor_name } + key_name: { get_param: ex_key } + user_data: + get_resource: ex_software_config_0 + + ex1_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, 0 ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + + ex1_nova_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_2.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_2.yaml new file mode 100644 index 0000000..46ea4cd --- /dev/null +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_2.yaml @@ -0,0 +1,143 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance + +parameters: + vnf_id: + description: Unique ID for this VNF + type: string + vf_module_id: + description: Unique ID for this VF module + type: string + vnf_name: + type: string + description: Unique name for this VNF instance + ex_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + ex_vm_name: + type: string + description: Name of the VM + ex1_vm_names: + type: comma_delimited_list + description: Name of the VM + ex1_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ex1_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ex1_key: + type: string + label: key pair + description: Name of the key apir the nova server will use + int_network_net_id: + type: string + label: Network name + description: Name of the network the nova server will connect to + ex1_server_index: + type: number + label: server index + description: Index of server + constraint: + - range: { min: 1, max: 100 } + +resources: + ex_software_config_0: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + params: + $stack_name: { get_param: 'OS::stack_name' } + + ex_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: ex_vm_name } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex_image_name } + flavor: { get_param: ex_flavor_name } + key_name: { get_param: ex_key } + networks: + - network: { get_param: int_network_net_id } + user_data: + get_resource: ex_software_config_0 + + ex1_nova_server_0: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, 0 ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + + ex1_nova_server_1: + type: OS::Nova::Server + properties: + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml new file mode 100644 index 0000000..030dfdf --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml @@ -0,0 +1,81 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + vnf_id: + type: string + description: Unique ID for this VNF instance + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + vf_module_name: + type: string + description: Unique name for this VNF Module instance + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10 + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + constraints: + - range: { min: 0, max: 10 } + description: allowed range of values + - allowed_values: + - 0 + - 5 + - 10
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_no_constraints/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/pass/valid_heat_template.yaml new file mode 100644 index 0000000..c939a89 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/pass/valid_heat_template.yaml @@ -0,0 +1,53 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_name: + type: string + description: Unique name for this VNF Module instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.env b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.env new file mode 100644 index 0000000..ab54063 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.env @@ -0,0 +1,44 @@ +# -*- 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. +# +--- +parameters: + vnf_name: dummyvalue + vf_module_id: dummyvalue4 + external_net_id: dummyvalue
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.yaml new file mode 100644 index 0000000..275b820 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/fail/missing_required_parameters_in_env_file.yaml @@ -0,0 +1,74 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0: + type: OS::Nova::Server + properties: + name: { get_param: server_name_0 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_1: + type: OS::Nova::Server + properties: + name: { get_param: server_name_1 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.env b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.env new file mode 100644 index 0000000..116a359 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.env @@ -0,0 +1,45 @@ +# -*- 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. +# +--- +parameters: + vnf_name: dummyvalue + vnf_id: dummyvalue2 + vf_module_id: dummyvalue4 + external_net_id: dummyvalue
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.yaml new file mode 100644 index 0000000..275b820 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified.yaml @@ -0,0 +1,74 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0: + type: OS::Nova::Server + properties: + name: { get_param: server_name_0 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_1: + type: OS::Nova::Server + properties: + name: { get_param: server_name_1 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.env b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.env new file mode 100644 index 0000000..cbf5f64 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.env @@ -0,0 +1,42 @@ +# -*- 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. +# +--- +parameters: + external_net_id: dummyvalue
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.yaml new file mode 100644 index 0000000..5ac62ae --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_env_files/pass/required_parameters_specified_not_needed.yaml @@ -0,0 +1,49 @@ +# -*- 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. +# +--- +parameters: + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/fail/missing_required_parameters_in_template.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/fail/missing_required_parameters_in_template.yaml new file mode 100644 index 0000000..1baef47 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/fail/missing_required_parameters_in_template.yaml @@ -0,0 +1,73 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_name: + type: string + description: Unique name for this VNF Module instance + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0: + type: OS::Nova::Server + properties: + name: { get_param: server_name_0 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_1: + type: OS::Nova::Server + properties: + name: { get_param: server_name_1 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified.yaml new file mode 100644 index 0000000..275b820 --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified.yaml @@ -0,0 +1,74 @@ +# -*- 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. +# +--- +parameters: + vnf_name: + type: string + description: Unique name for this VNF instance + vnf_id: + type: string + description: Unique ID for this VNF instance + vf_module_id: + type: string + description: Unique ID for this VNF Module instance + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0: + type: OS::Nova::Server + properties: + name: { get_param: server_name_0 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_1: + type: OS::Nova::Server + properties: + name: { get_param: server_name_1 } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified_not_needed.yaml b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified_not_needed.yaml new file mode 100644 index 0000000..5ac62ae --- /dev/null +++ b/ice_validator/tests/fixtures/test_required_parameters_specified_in_heat_templates/pass/required_parameters_specified_not_needed.yaml @@ -0,0 +1,49 @@ +# -*- 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. +# +--- +parameters: + external_net_id: + type: string + description: Unique name for this VNF instance +resources: + server_0_external_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: external_net_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/fail/invalid_characters_in_resource_id_template.yml b/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/fail/invalid_characters_in_resource_id_template.yml new file mode 100644 index 0000000..fc32cdf --- /dev/null +++ b/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/fail/invalid_characters_in_resource_id_template.yml @@ -0,0 +1,67 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_0 + params: + VNF_NAME: {get_param: vf_module_id } + "lb_volume_id::1": + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_1 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + lb_volume_id-2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_2 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/pass/valid_characters_in_resource_id_template.yml b/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/pass/valid_characters_in_resource_id_template.yml new file mode 100644 index 0000000..d63a6a9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_resource_ids_alphanumeric_only/pass/valid_characters_in_resource_id_template.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume+0 + params: + VNF_NAME: {get_param: vf_module_id } + lb_volume_id_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_1 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_index.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_index.yaml new file mode 100644 index 0000000..fd3db32 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_index.yaml @@ -0,0 +1,104 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + +resources: + + example_server_0: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_0 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + + example_server_1: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_1 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_index: { get_param: vf_module_index } diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name.yaml new file mode 100644 index 0000000..f4049e6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name.yaml @@ -0,0 +1,109 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + vf_module_index: + type: string + label: vf_role + description: Module index for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + +resources: + + example_server_0: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_0 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + + example_server_1: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_1 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_index: { get_param: vf_module_index }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name_in_rsg.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name_in_rsg.yaml new file mode 100644 index 0000000..6ecccc9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/fail/template_missing_specified_vf_module_name_in_rsg.yaml @@ -0,0 +1,100 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + vf_module_index: + type: string + label: vf_role + description: Module index for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + example_rsg__count_0: + type: number + constraints: + - range: { min: 0, max: 10 } + +resources: + + example_rsg_0: + type: OS::Heat::ResourceGroup + count: { get_param: example_rsg__count_0 } + resource_def: + type: OS::Nova::Server + properties: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + vf_module_index: { get_param: vf_module_index }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_1.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_1.yaml new file mode 100644 index 0000000..5a91f45 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_1.yaml @@ -0,0 +1,113 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + vf_module_name: + type: string + label: vf_role + description: Module name for the server + vf_module_index: + type: string + label: vf_role + description: Module index for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + +resources: + + example_server_0: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_0 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + vf_module_index: { get_param: vf_module_index } + + example_server_1: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_1 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_2.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_2.yaml new file mode 100644 index 0000000..09005ed --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_2.yaml @@ -0,0 +1,108 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + vf_module_name: + type: string + label: vf_role + description: Module name for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + +resources: + + example_server_0: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_0 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + + example_server_1: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_1 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_3.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_3.yaml new file mode 100644 index 0000000..41bfc06 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_3.yaml @@ -0,0 +1,104 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vf_module_name: + type: string + label: vf_role + description: Module name for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + +resources: + + example_server_0: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_0 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + + example_server_1: + type: OS::Nova::Server + properties: + name: { get_param: example_server_name_1 } + image: { get_param: example_server_image } + flavor: { get_param: example_server_flavor } + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { 'example server' }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_4.yaml b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_4.yaml new file mode 100644 index 0000000..dd45592 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_optional_metadata/pass/valid_heat_template_4.yaml @@ -0,0 +1,104 @@ +# -*- 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: 2013-05-23 + +description: Simple template to deploy a single compute instance - only one optional field and 2 servers + +parameters: + vf_module_id: + type: string + label: vf_module_id + description: Module ID for servers + vnf_id: + type: string + label: vnf_id + description: VNF ID for servers + vnf_name: + type: string + label: vnf_name + description: VNF name for servers + vm_role: + type: string + label: vf_role + description: Role of the server + vf_module_name: + type: string + label: vf_role + description: Module name for the server + vf_module_index: + type: string + label: vf_role + description: Module index for the server + example_server_name_0: + type: string + label: image + description: name for for server_0 + example_server_name_1: + type: string + label: image + description: name for for server_1 + example_server_image: + type: string + label: image + description: Glance image for server_0 + example_server_flavor: + type: string + label: flavor + description: Flavor for server_0 + example_rsg__count_0: + type: number + constraints: + - range: { min: 0, max: 10 } + +resources: + + example_rsg_0: + type: OS::Heat::ResourceGroup + count: { get_param: example_rsg__count_0 } + resource_def: + type: OS::Nova::Server + properties: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vm_role: { get_param: vm_role } + vf_module_name: { get_param: vf_module_name } + vf_module_index: { get_param: vf_module_index }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vf_module_id.yaml b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vf_module_id.yaml new file mode 100644 index 0000000..f8433c9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vf_module_id.yaml @@ -0,0 +1,48 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_id.yaml b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_id.yaml new file mode 100644 index 0000000..012bf20 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_id.yaml @@ -0,0 +1,48 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_name.yaml b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_name.yaml new file mode 100644 index 0000000..6a98246 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_required_metadata/fail/missing_vnf_name.yaml @@ -0,0 +1,48 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } diff --git a/ice_validator/tests/fixtures/test_servers_have_required_metadata/pass/has_required_metadata.yaml b/ice_validator/tests/fixtures/test_servers_have_required_metadata/pass/has_required_metadata.yaml new file mode 100644 index 0000000..4351101 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_have_required_metadata/pass/has_required_metadata.yaml @@ -0,0 +1,49 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_metadata_section.yaml b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_metadata_section.yaml new file mode 100644 index 0000000..8f44729 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_metadata_section.yaml @@ -0,0 +1,45 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} diff --git a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_properties_section.yaml b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_properties_section.yaml new file mode 100644 index 0000000..d43b745 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/missing_properties_section.yaml @@ -0,0 +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. +# +--- +resources: + server_0: + type: OS::Nova::Server diff --git a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml new file mode 100644 index 0000000..8301db6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml @@ -0,0 +1,52 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: + - vf_module_id + vnf_id: + - vnf_id + vnf_name: + - vnf_name diff --git a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/pass/has_required_metadata.yaml b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/pass/has_required_metadata.yaml new file mode 100644 index 0000000..4351101 --- /dev/null +++ b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/pass/has_required_metadata.yaml @@ -0,0 +1,49 @@ +# -*- 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. +# +--- +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + metadata: + vf_module_id: { get_param: vf_module_id } + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } diff --git a/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_param_subnet.yaml b/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_param_subnet.yaml new file mode 100644 index 0000000..4254287 --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_param_subnet.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet1_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_resource_subnet.yaml b/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_resource_subnet.yaml new file mode 100644 index 0000000..1af8d52 --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format/fail/invalid_naming_used_for_get_resource_subnet.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet1_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet1_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml new file mode 100644 index 0000000..76f92e6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml new file mode 100644 index 0000000..353fbe9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param1: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { int_vpnnet_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml new file mode 100644 index 0000000..4338edc --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_resource: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml new file mode 100644 index 0000000..76f92e6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml @@ -0,0 +1,86 @@ +# -*- 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. +# +--- +resources: + vm_type_1_int_intranet_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - subnet_id: { get_param: int_intranet_subnet_id } + - subnet_id: { get_param: int_intranet_v6_subnet_id } + + vm_type_1_int_vpnnet_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_param: int_vpnnet_subnet_id } + + vm_type_1_int_vpnnet_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: int_vpnnet_net_id } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + + vm_type_1_extnet_net_3_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_ip_0 } + - subnet_id: { get_param: extnet_subnet_id } + + vm_type_1_extnet_4_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - subnet_id: { get_param: extnet_subnet_id } + - subnet_id: { get_param: extnet_v6_subnet_id } + + vm_type_1_extnet_5_port: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml new file mode 100644 index 0000000..a65c45b --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml @@ -0,0 +1,108 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml new file mode 100644 index 0000000..a65c45b --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml @@ -0,0 +1,108 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml new file mode 100644 index 0000000..a65c45b --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml @@ -0,0 +1,108 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml new file mode 100644 index 0000000..253d861 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml @@ -0,0 +1,108 @@ +# -*- 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. +# +--- +resources: + lb_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 1] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_server_4: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + lb_volume_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + + lb_volume_3: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + lb_volume_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/fail/unique_resource_stack_name_without_vnf_name_or_module.yml b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/fail/unique_resource_stack_name_without_vnf_name_or_module.yml new file mode 100644 index 0000000..fb38c95 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/fail/unique_resource_stack_name_without_vnf_name_or_module.yml @@ -0,0 +1,89 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + MODULE_ID: { get_param: vnf_module_id } + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + MODULE_ID: { get_param: vnf_module_id } + public_key: {get_param: ssh_public_key} + save_private_key: false
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/pass/unique_resource_template.yml b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/pass/unique_resource_template.yml new file mode 100644 index 0000000..936e85d --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_params_in_tmpl/pass/unique_resource_template.yml @@ -0,0 +1,91 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: MODULE_ID_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vnf_module_id } + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/fail/unique_resource_stack_name_without_vnf_name_or_module.yml b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/fail/unique_resource_stack_name_without_vnf_name_or_module.yml new file mode 100644 index 0000000..a3af653 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/fail/unique_resource_stack_name_without_vnf_name_or_module.yml @@ -0,0 +1,71 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/pass/unique_resource_template.yml b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/pass/unique_resource_template.yml new file mode 100644 index 0000000..0a70283 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_name_str_replace_use_req_params/pass/unique_resource_template.yml @@ -0,0 +1,91 @@ +# -*- 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. +# +--- +resources: + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [vm_type_a_names, 0] } + flavor: { get_param: vm_type_a_flavor_name} + image: { get_param: vm_type_a_image_name} + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }] + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + lb_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vf_module_id } + lb_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + MODULE_ID: { get_param: vf_module_id } + my_keypair: + type: OS::Nova::Keypair + properties: + name: + str_replace: + template: VNF_NAME_key_pair + params: + VNF_NAME: { get_param: vnf_name } + public_key: {get_param: ssh_public_key} + save_private_key: false diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/duplicate_resource_template.yml b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/duplicate_resource_template.yml new file mode 100644 index 0000000..5ac2dc2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/duplicate_resource_template.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_2 + params: + VNF_NAME: {get_param: vf_module_id } + lb_volume_id_4: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_4 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/unique_resource_template.yml b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/unique_resource_template.yml new file mode 100644 index 0000000..3ef1600 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/fail/unique_resource_template.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_1 + params: + VNF_NAME: {get_param: vf_module_id } + lb_volume_id_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_2 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_1.yml b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_1.yml new file mode 100644 index 0000000..3ef1600 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_1.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_1 + params: + VNF_NAME: {get_param: vf_module_id } + lb_volume_id_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_2 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_2.yml b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_2.yml new file mode 100644 index 0000000..fc68cba --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_all_templates/pass/unique_resource_template_2.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + lb_volume_id_3: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_3 + params: + VNF_NAME: {get_param: vf_module_id } + lb_volume_id_4: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume_4 + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_template/fail/duplicate_resource_template.yml b/ice_validator/tests/fixtures/test_unique_resources_across_template/fail/duplicate_resource_template.yml new file mode 100644 index 0000000..16997d5 --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_template/fail/duplicate_resource_template.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: {get_param: vnf_module_id } + volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_unique_resources_across_template/pass/unique_resource_template.yml b/ice_validator/tests/fixtures/test_unique_resources_across_template/pass/unique_resource_template.yml new file mode 100644 index 0000000..4279b1c --- /dev/null +++ b/ice_validator/tests/fixtures/test_unique_resources_across_template/pass/unique_resource_template.yml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: {get_param: vnf_module_id } + volume_2: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VF_NAME_STACK_NAME_oam_volume + params: + VNF_NAME: {get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml b/ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml new file mode 100644 index 0000000..b630778 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml @@ -0,0 +1,69 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_id_1: + resource: { get_resource: vm_type_volume_id_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml b/ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml new file mode 100644 index 0000000..2766dda --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml @@ -0,0 +1,61 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_param: vm_type_volume_id_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml b/ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml new file mode 100644 index 0000000..97c6ab6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml @@ -0,0 +1,70 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters.yaml b/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters.yaml new file mode 100644 index 0000000..1057cb3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters.yaml @@ -0,0 +1,111 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_boot_volume_id_0: + type: string + description: reference to externally created cinder vol + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_boot_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_boot_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_boot_volume_id_2 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters_volume.yaml b/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters_volume.yaml new file mode 100644 index 0000000..3ff6c48 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_outputs_consumed/fail/more_outputs_than_parameters_volume.yaml @@ -0,0 +1,99 @@ +# -*- 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: Volume template description + +parameters: + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_image_name: + type: string + description: Image used to initialize the admin instance's bootable cinder_volume + + admin_boot_volume_size_0: + type: number + description: Size 0 of Cinder Volume to be built + constraints: + - range: { min: 0, max: 5000} + + admin_boot_volume_size_1: + type: number + description: Size 1 of Cinder Volume to be built + constraints: + - range: { min: 0, max: 10000} + +resources: + + admin_boot_data_volume_0: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_admin_boot_volume_0 + params: + "VNF_NAME": { get_param: vnf_name } + size: { get_param: admin_boot_volume_size_0 } + image: { get_param: admin_image_name } + + admin_boot_data_volume_1: + type: OS::Cinder::Volume + properties: + name: + str_replace: + template: VNF_NAME_admin_boot_volume_1 + params: + "VNF_NAME": { get_param: vnf_name } + size: { get_param: admin_boot_volume_size_1 } + image: { get_param: admin_image_name } + +outputs: + + admin_boot_volume_id_0: + description: Cinder volume 0 + value: { get_resource: admin_boot_data_volume_0 } + + admin_boot_volume_id_1: + description: Cinder volume 1 + value: { get_resource: admin_boot_data_volume_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template.yaml new file mode 100644 index 0000000..efdb26a --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template.yaml @@ -0,0 +1,103 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_boot_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_boot_volume_id_1: + type: string + description: reference to externally created cinder vol + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_boot_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_boot_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template_volume.yaml b/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template_volume.yaml new file mode 100644 index 0000000..7a4e40d --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_outputs_consumed/pass/valid_template_volume.yaml @@ -0,0 +1,81 @@ +# -*- 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: 2013-05-23 + +description: > + A template showing how to create a Nova instance, a Cinder volume and attach + the volume to the instance. The template uses only Heat OpenStack native + resource types. + +parameters: + + availability_zone: + type: string + description: The Availability Zone to launch the instance. + + admin_boot_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_boot_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_boot_volume_size_0} + availability_zone: { get_param: availability_zone } + + admin_boot_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_boot_volume_size_0} + availability_zone: { get_param: availability_zone } + +outputs: + + admin_boot_volume_id_0: + value: { get_resource: admin_boot_volume_id_0 } + + admin_boot_volume_id_1: + value: { get_resource: admin_boot_volume_id_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_instance_uuid_volume_attachment.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_instance_uuid_volume_attachment.yaml new file mode 100644 index 0000000..2b78e58 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_instance_uuid_volume_attachment.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: admin2_server_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_nova_server_id.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_nova_server_id.yaml new file mode 100644 index 0000000..76aa95e --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_nova_server_id.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin2_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin2_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: admin_server_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_param.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_param.yaml new file mode 100644 index 0000000..b0ff140 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_param.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin2_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: admin_server_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_resource.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_resource.yaml new file mode 100644 index 0000000..88fc6e2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_resource.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin2_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: admin_server_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment.yaml new file mode 100644 index 0000000..b07b2c1 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin2_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: admin_server_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment_uppercase.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment_uppercase.yaml new file mode 100644 index 0000000..53e76b9 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/fail/mismatch_vm_type_volume_id_volume_attachment_uppercase.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin2_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: ADMIN_SERVER_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_resource_ids/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_volume_resource_ids/pass/valid_template.yaml new file mode 100644 index 0000000..bd18829 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_resource_ids/pass/valid_template.yaml @@ -0,0 +1,150 @@ +# -*- 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: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + admin_names: + type: comma_delimited_list + description: Names attribute for the VMs + + availability_zone_0: + type: string + description: availability zone to be used + + admin_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + admin_volume_id_0: + type: string + description: reference to externally created cinder vol + + admin_volume_id_1: + type: string + description: reference to externally created cinder vol + + admin_volume_id_2: + type: string + description: reference to externally created cinder vol + + admin_volume_size_0: + type: number + description: Size of the volume to be created. + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + +resources: + + admin_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 0] } + block_device_mapping: [{ device_name: "vda", volume_id: { get_param : admin_volume_id_0 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_1: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 1] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_param : admin_volume_id_1 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + ADMIN_SERVER_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_server_3: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 3] } + block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : admin_volume_id_3 }, delete_on_termination : "false" }] + flavor: { get_param: admin_flavor_name} + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + admin_volume_id_3: + type: OS::Cinder::Volume + properties: + size: { get_param: admin_volume_size_0} + availability_zone: { get_param: availability_zone_0 } + + admin_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: admin_volume_id_2 } + mountpoint: /dev/vdb + instance_uuid: { get_resource: ADMIN_SERVER_2 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates/fail/badly_named_volume_1.yaml b/ice_validator/tests/fixtures/test_volume_templates/fail/badly_named_volume_1.yaml new file mode 100644 index 0000000..946c646 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates/fail/badly_named_volume_1.yaml @@ -0,0 +1,59 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates/fail/missing_keyword.yaml b/ice_validator/tests/fixtures/test_volume_templates/fail/missing_keyword.yaml new file mode 100644 index 0000000..946c646 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates/fail/missing_keyword.yaml @@ -0,0 +1,59 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates/fail/only_nova_severs_in_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates/fail/only_nova_severs_in_volume.yaml new file mode 100644 index 0000000..d7a218e --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates/fail/only_nova_severs_in_volume.yaml @@ -0,0 +1,51 @@ +# -*- 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. +# +--- +resources: + + vm_type_0: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_name_0 } + + vm_type_1: + type: OS::Nova::Server + properties: + name: { get_param: vm_type_name_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates/pass/well_named_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates/pass/well_named_volume.yaml new file mode 100644 index 0000000..7b29979 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates/pass/well_named_volume.yaml @@ -0,0 +1,59 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs/fail/missing_outputs_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs/fail/missing_outputs_volume.yaml new file mode 100644 index 0000000..248bb62 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs/fail/missing_outputs_volume.yaml @@ -0,0 +1,50 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs/pass/well_named_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs/pass/well_named_volume.yaml new file mode 100644 index 0000000..5ee2cf6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs/pass/well_named_volume.yaml @@ -0,0 +1,58 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_id_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_id_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_1_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_1_volume.yaml new file mode 100644 index 0000000..a55a4b2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_1_volume.yaml @@ -0,0 +1,71 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + volume_type: { get_param: vm_type_volume_type_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_2_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_2_volume.yaml new file mode 100644 index 0000000..0a196e3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_2_volume.yaml @@ -0,0 +1,71 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + volume_type: { get_param: vm_type_volume_type_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RS, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_3_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_3_volume.yaml new file mode 100644 index 0000000..6a05126 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/mismatch_resource_keys_outputs_keys_3_volume.yaml @@ -0,0 +1,71 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + volume_type: { get_param: vm_type_volume_type_0 } + + vm_type_volume_0_R: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RS, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_outputs_than_resources_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_outputs_than_resources_volume.yaml new file mode 100644 index 0000000..3f9cac7 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_outputs_than_resources_volume.yaml @@ -0,0 +1,72 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_id_1 } + + vm_type_volume_id_2: + value: { get_resource: vm_type_volume_id_2 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_resources_than_outputs_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_resources_than_outputs_volume.yaml new file mode 100644 index 0000000..d446a98 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/fail/more_resources_than_outputs_volume.yaml @@ -0,0 +1,66 @@ +# -*- 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. +# +--- +resources: + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_id_0 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/pass/valid_template_volume.yaml b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/pass/valid_template_volume.yaml new file mode 100644 index 0000000..1780dc6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_volume_templates_outputs_resources/pass/valid_template_volume.yaml @@ -0,0 +1,71 @@ +# -*- 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. +# +--- +resources: + + vm_type_volume_0: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + + vm_type_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + volume_type: { get_param: vm_type_volume_type_0 } + + vm_type_volume_0_RSG: + type: OS::Heat::ResourceGroup + count: { get_param: vm_type_volume_count_0_RSG } + resource_def: + type: OS::Cinder::Volume + properties: + size: { get_param: vm_type_volume_size_0 } + +outputs: + + vm_type_volume_id_0: + value: { get_resource: vm_type_volume_0 } + + vm_type_volume_id_1: + value: { get_resource: vm_type_volume_1 } + + vm_type_volume_ids_0: + value: { get_attr: [vm_type_volume_0_RSG, refs] }
\ No newline at end of file diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py new file mode 100644 index 0000000..9cde1fa --- /dev/null +++ b/ice_validator/tests/helpers.py @@ -0,0 +1,78 @@ +# -*- 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. +# + +import yaml + + +def check_basename_ending(template_type, basename): + ''' + return True/False if the template type is matching + the filename + ''' + if not template_type: + return True + elif template_type == 'volume': + return basename.endswith('_volume') + else: + return not basename.endswith('_volume') + + +def get_parsed_yml_for_yaml_files(yaml_files, sections=[]): + ''' + get the parsed yaml for a list of yaml files + ''' + parsed_yml_list = [] + for yaml_file in yaml_files: + yml = '' + + try: + with open(yaml_file) as fh: + yml = yaml.load(fh) + except Exception as e: + print(e) + + if yml: + if sections: + for k in yml.keys(): + if k not in sections: + del yml[k] + parsed_yml_list.append(yml) + + return parsed_yml_list diff --git a/ice_validator/tests/parametrizers.py b/ice_validator/tests/parametrizers.py new file mode 100644 index 0000000..0d9971f --- /dev/null +++ b/ice_validator/tests/parametrizers.py @@ -0,0 +1,456 @@ +# -*- 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. +# + +from os import path, listdir +import re +import yaml +import pytest +from .helpers import get_parsed_yml_for_yaml_files, check_basename_ending +from .utils.nested_files import get_list_of_nested_files + + +def get_template_dir(metafunc): + ''' + returns template_dir, either as its passed in on CLI + or, during --self-test, the directory whos name matches + the current tests module name + ''' + if metafunc.config.getoption('template_dir') is None: + return path.join( + path.dirname(path.realpath(__file__)), + 'fixtures', + metafunc.function.__module__.split('.')[-1]) + else: + return metafunc.config.getoption('template_dir')[0] + + +def get_nested_files(filenames): + ''' + returns all the nested files for a set of filenames + ''' + nested_files = [] + for filename in filenames: + try: + with open(filename) as fh: + yml = yaml.load(fh) + if "resources" not in yml: + continue + nested_files.extend(get_list_of_nested_files( + yml["resources"], path.dirname(filename))) + except Exception as e: + print(e) + continue + return nested_files + + +def list_filenames_in_template_dir(metafunc, extensions, template_type='', + sub_dirs=[]): + ''' + returns the filenames in a template_dir, either as its passed in + on CLI or, during --self-test, the directory whos name matches + the current tests module name + ''' + template_dir = get_template_dir(metafunc) + filenames = [] + + try: + if metafunc.config.getoption('self_test'): + filenames = [path.join(template_dir, s, f) + for s in sub_dirs + for f in listdir(path.join(template_dir, s)) + if path.isfile(path.join(template_dir, s, f)) and + path.splitext(f)[-1] in extensions and + check_basename_ending(template_type, + path.splitext(f)[0])] + else: + filenames = [path.join(template_dir, f) + for f in listdir(template_dir) + if path.isfile(path.join(template_dir, f)) and + path.splitext(f)[-1] in extensions and + check_basename_ending(template_type, + path.splitext(f)[0])] + + except Exception as e: + print(e) + + return filenames + + +def list_template_dir(metafunc, extensions, exclude_nested=True, + template_type='', sub_dirs=[]): + ''' + returns the filenames excluding the nested files for a template_dir, + either as its passed in on CLI or, during --self-test, the + directory whos name matches the current tests module name + ''' + filenames = [] + nested_files = [] + + try: + filenames = list_filenames_in_template_dir(metafunc, extensions, + template_type, sub_dirs) + if exclude_nested: + nested_files = get_nested_files(filenames) + except Exception as e: + print(e) + + return list(set(filenames) - set(nested_files)) + + +def get_filenames_list(metafunc, extensions=[".yaml", ".yml", ".env"], + exclude_nested=False, template_type=''): + ''' + returns the filename fixtures for the template dir, either as by how its + passed in on CLI or, during --self-test, the directory whos name + matches the current tests module name + ''' + if metafunc.config.getoption('self_test'): + filenames_list = list_template_dir(metafunc, + extensions, + exclude_nested, + template_type, + ['pass']) + filenames_list += [pytest.mark.xfail(f, strict=True) + for f in list_template_dir(metafunc, + extensions, + exclude_nested, + template_type, + ['fail'])] + else: + filenames_list = list_template_dir(metafunc, + extensions, + exclude_nested, + template_type) + + return filenames_list + + +def get_filenames_lists(metafunc, extensions=[".yaml", ".yml", ".env"], + exclude_nested=False, template_type=''): + ''' + returns the list of files in the template dir, either as by how its + passed in on CLI or, during --self-test, the directory whos name + matches the current tests module name + ''' + filenames_lists = [] + if metafunc.config.getoption('self_test'): + filenames_lists.append(list_template_dir(metafunc, + extensions, + exclude_nested, + template_type, + ['pass'])) + filenames_lists.append(pytest.mark.xfail( + list_template_dir(metafunc, + extensions, + exclude_nested, + template_type, + ['fail']), + strict=True)) + else: + filenames_lists.append(list_template_dir(metafunc, + extensions, + exclude_nested, + template_type)) + + return filenames_lists + + +def get_parsed_yaml_files(metafunc, extensions, exclude_nested=True, + template_type='', sections=[]): + ''' + returns the list of parsed yaml files in the specified template dir, + either as by how its passed in on CLI or, during --self-test, the + directory whos name matches the current tests module name + ''' + extensions = [".yaml", ".yml"] + + if metafunc.config.getoption('self_test'): + yaml_files = list_template_dir(metafunc, extensions, exclude_nested, + template_type, ['pass']) + parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, + sections) + + yaml_files = list_template_dir(metafunc, extensions, exclude_nested, + template_type, ['fail']) + parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, + sections) + parsed_yml_list += [pytest.mark.xfail(parsed_yml, strict=True) + for parsed_yml in parsed_yml_list] + else: + yaml_files = list_template_dir(metafunc, extensions) + parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, + sections) + + return parsed_yml_list + + +def parametrize_filenames(metafunc): + ''' + This param runs tests all files in the template dir + ''' + filenames = get_filenames_lists(metafunc) + metafunc.parametrize('filenames', filenames) + + +def parametrize_filename(metafunc): + ''' + This param runs tests once for every file in the template dir + ''' + filenames = get_filenames_list(metafunc) + metafunc.parametrize('filename', filenames) + + +def parametrize_yaml_files(metafunc): + ''' + This param runs tests for the yaml files in the template dir + ''' + yaml_files = get_filenames_lists(metafunc, ['.yaml', '.yml'], False) + metafunc.parametrize("yaml_files", yaml_files) + + +def parametrize_yaml_file(metafunc): + ''' + This param runs tests for every yaml file in the template dir + ''' + yaml_files = get_filenames_list(metafunc, ['.yaml', '.yml'], False) + metafunc.parametrize('yaml_file', yaml_files) + + +def parametrize_templates(metafunc): + ''' + This param runs tests for the template in the template dir + ''' + templates = get_filenames_lists(metafunc, ['.yaml', '.yml'], True) + metafunc.parametrize("templates", templates) + + +def parametrize_template(metafunc): + ''' + This param runs tests for every template in the template dir + ''' + templates = get_filenames_list(metafunc, ['.yaml', '.yml'], True) + metafunc.parametrize('template', templates) + + +def parametrize_parsed_yaml_file(metafunc): + ''' + This param runs tests for a parsed version of each yaml file + in the template dir + ''' + parsed_yaml_files = get_parsed_yaml_files(metafunc, ['.yaml', '.yml'], + False) + metafunc.parametrize('parsed_yaml_file', parsed_yaml_files) + + +def parametrize_heat_templates(metafunc): + ''' + This param runs tests for all heat templates in the template dir + ''' + heat_templates = get_filenames_lists(metafunc, ['.yaml', '.yml'], + True, 'heat') + metafunc.parametrize('heat_templates', heat_templates) + + +def parametrize_heat_template(metafunc): + ''' + This param runs tests for every heat template in the template dir + ''' + heat_templates = get_filenames_list(metafunc, ['.yaml', '.yml'], + True, 'heat') + metafunc.parametrize('heat_template', heat_templates) + + +def parametrize_volume_templates(metafunc): + ''' + This param runs tests for all volume templates in the template dir + ''' + volume_templates = get_filenames_lists(metafunc, ['.yaml', '.yml'], + True, 'volume') + metafunc.parametrize('volume_templates', volume_templates) + + +def parametrize_volume_template(metafunc): + ''' + + This param runs tests for every volume template in the template dir + ''' + volume_templates = get_filenames_list(metafunc, ['.yaml', '.yml'], + True, 'volume') + metafunc.parametrize('volume_template', volume_templates) + + +def parametrize_environment_files(metafunc): + ''' + This param runs tests for all environment files in the template dir + ''' + env_files = get_filenames_lists(metafunc, ['.env']) + metafunc.parametrize('env_files', env_files) + + +def parametrize_environment_file(metafunc): + ''' + This param runs tests for every environment file in the template dir + ''' + env_files = get_filenames_list(metafunc, ['.env']) + metafunc.parametrize('env_file', env_files) + + +def parametrize_parsed_environment_file(metafunc): + ''' + This param runs tests for every parsed environment file + in the template dir + ''' + parsed_env_files = get_parsed_yaml_files(metafunc, ['.env']) + metafunc.parametrize('parsed_env_file', parsed_env_files) + + +def parametrize_template_dir(metafunc): + ''' + This param passes a the template_dir as passed in on CLI + or, during --self-test, passes in the sub directories of + template_dir/pass/ and template_dir/fail + template_dir = get_template_dir(metafunc) + ''' + template_dir = get_template_dir(metafunc) + + if metafunc.config.getoption('self_test'): + dirs = [path.join(template_dir, s, t) + for s in ['pass'] + for t in listdir(path.join(template_dir, s)) + if path.isdir(path.join(template_dir, s, t))] + + dirs += [pytest.mark.xfail(path.join(template_dir, s, t)) + for s in ['fail'] + for t in listdir(path.join(template_dir, s)) + if path.isdir(path.join(template_dir, s, t))] + else: + dirs = [template_dir] + + metafunc.parametrize('template_dir', dirs) + + +def parametrize_environment_pair(metafunc, template_type=''): + ''' + Define a list of pairs of parsed yaml from the heat templates and + environment files + ''' + pairs = [] + if metafunc.config.getoption('self_test'): + sub_dirs = ['pass', 'fail'] + env_files = list_template_dir(metafunc, ['.env'], True, + template_type, sub_dirs) + yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], True, + template_type, sub_dirs) + else: + env_files = list_template_dir(metafunc, ['.env'], True, + template_type) + yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], + True, template_type) + + for filename in env_files: + basename = path.splitext(filename)[0] + if basename + '.yml' in yaml_files: + yfilename = basename + '.yml' + else: + yfilename = basename + '.yaml' + + try: + with open(filename) as fh: + eyml = yaml.load(fh) + with open(yfilename) as fh: + yyml = yaml.load(fh) + + if 'fail' in filename: + pairs.append(pytest.mark.xfail({"name": basename, + "yyml": yyml, + "eyml": eyml}, + strict=True)) + else: + pairs.append({"name": basename, "yyml": yyml, "eyml": eyml}) + + except Exception as e: + print(e) + + metafunc.parametrize('environment_pair', pairs) + + +def parametrize_heat_volume_pair(metafunc): + ''' + Define a list of pairs of parsed yaml from the a heat and volume + template + ''' + pairs = [] + if metafunc.config.getoption('self_test'): + sub_dirs = ['pass', 'fail'] + volume_files = list_template_dir(metafunc, ['.yaml', '.yml'], + True, 'volume', sub_dirs) + yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], + True, '', sub_dirs) + else: + volume_files = list_template_dir(metafunc, ['.yaml', '.yml'], + True, 'volume') + yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], True) + + pattern = re.compile(r'\_volume$') + for vfilename in volume_files: + basename = pattern.sub('', path.splitext(vfilename)[0]) + if basename + '.yml' in yaml_files: + yfilename = basename + '.yml' + else: + yfilename = basename + '.yaml' + + try: + with open(vfilename) as fh: + vyml = yaml.load(fh) + with open(yfilename) as fh: + yyml = yaml.load(fh) + + if 'fail' in vfilename: + pairs.append(pytest.mark.xfail({"name": basename, + "yyml": yyml, + "vyml": vyml}, + strict=True)) + else: + pairs.append({"name": basename, "yyml": yyml, "vyml": vyml}) + + except Exception as e: + print(e) + + metafunc.parametrize('heat_volume_pair', pairs) diff --git a/ice_validator/tests/test_all_referenced_resources_exists.py b/ice_validator/tests/test_all_referenced_resources_exists.py new file mode 100644 index 0000000..fd5b967 --- /dev/null +++ b/ice_validator/tests/test_all_referenced_resources_exists.py @@ -0,0 +1,66 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.nested_iterables import find_all_get_resource_in_yml + + +def test_all_referenced_resources_exists(yaml_file): + ''' + Check that all resources referenced by get_resource + actually exists in all yaml files + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the yaml file") + + resource_ids = yml['resources'].keys() + referenced_resource_ids = find_all_get_resource_in_yml(yml) + + missing_referenced_resources = [] + for referenced_resource_id in referenced_resource_ids: + if referenced_resource_id not in resource_ids: + missing_referenced_resources.append(referenced_resource_id) + + assert not set(missing_referenced_resources) diff --git a/ice_validator/tests/test_allowed_address_pair_format.py b/ice_validator/tests/test_allowed_address_pair_format.py new file mode 100644 index 0000000..c8a84c6 --- /dev/null +++ b/ice_validator/tests/test_allowed_address_pair_format.py @@ -0,0 +1,130 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.network_roles import get_network_role_from_port +import re + + +def test_allowed_address_pairs_format(heat_template): + ''' + Make sure all allowed_address_pairs properties follow the allowed + naming conventions + ''' + allowed_formats = [ + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_v6_ip')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_ip')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_floating_v6_ip')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_floating_ip')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ip_\d+')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_ip_\d+')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_v6_ip_\d+')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_ip_\d+')], + ["allowed_address_pairs", "comma_delimited_list", + "internal", re.compile(r'(.+?)_int_(.+?)_v6_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "internal", re.compile(r'(.+?)_int_(.+?)_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "external", re.compile(r'(.+?)_v6_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "external", re.compile(r'(.+?)_ips')], + ] + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + # check both valid and invalid patterns to catch edge cases + invalid_allowed_address_pairs = [] + + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + network_role = get_network_role_from_port(v1) + + for k2, v2 in v1["properties"].items(): + if k2 != "allowed_address_pairs": + continue + for v3 in v2: + if "ip_address" not in v3: + continue + if "get_param" not in v3["ip_address"]: + continue + + valid_allowed_address_pair = False + for v4 in allowed_formats: + param = v3["ip_address"]["get_param"] + if isinstance(param, list): + param = param[0] + + # check if pattern matches + m = v4[3].match(param) + if m: + if v4[2] == "internal" and\ + len(m.groups()) > 1 and\ + m.group(2) == network_role: + valid_allowed_address_pair = True + break + elif v4[2] == "external" and\ + len(m.groups()) > 0 and\ + m.group(1).endswith("_" + network_role): + valid_allowed_address_pair = True + break + + if not valid_allowed_address_pair: + invalid_allowed_address_pairs.append(param) + + assert not set(invalid_allowed_address_pairs) diff --git a/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py b/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py new file mode 100644 index 0000000..1841a4f --- /dev/null +++ b/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py @@ -0,0 +1,62 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.ports import get_invalid_ip_addresses + + +def test_allowed_address_pairs_include_vm_type_network_role(heat_template): + ''' + Check that all allowed_address_pairs include the {vm_type} of the + nova server it is associated to and also contains the + {network_role} of the network it is associated with + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_ip_addresses = get_invalid_ip_addresses(yml['resources'], + "allowed_address_pairs") + + assert not set(invalid_ip_addresses) diff --git a/ice_validator/tests/test_availability_zone.py b/ice_validator/tests/test_availability_zone.py new file mode 100644 index 0000000..6ff11c8 --- /dev/null +++ b/ice_validator/tests/test_availability_zone.py @@ -0,0 +1,76 @@ +# -*- 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. +# + +import pytest +import yaml +import re + + +def test_availability_zone_naming(heat_template): + ''' + Make sure all availability zones are properly formatted + ''' + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_availability_zones = [] + + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if "type" not in v1: + continue + + if v1["type"] == "OS::Nova::Server": + for k2, v2 in v1["properties"].items(): + if k2 != 'availability_zone': + continue + + if not re.match(r'availability_zone_\d+', v2["get_param"]): + invalid_availability_zones.append(v2["get_param"]) + + assert not set(invalid_availability_zones) diff --git a/ice_validator/tests/test_availability_zone_get_param.py b/ice_validator/tests/test_availability_zone_get_param.py new file mode 100644 index 0000000..088a272 --- /dev/null +++ b/ice_validator/tests/test_availability_zone_get_param.py @@ -0,0 +1,73 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_availability_zone_naming_use_get_param(heat_template): + ''' + Make sure all availability zones only use get_param + ''' + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_availability_zones = [] + + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if "type" not in v1: + continue + if v1["type"] != "OS::Nova::Server": + continue + + for k2, v2 in v1["properties"].items(): + if k2 == 'availability_zone' and not v2["get_param"]: + invalid_availability_zones.append(v2["get_param"]) + + assert not set(invalid_availability_zones) diff --git a/ice_validator/tests/test_base_template_names.py b/ice_validator/tests/test_base_template_names.py new file mode 100644 index 0000000..0f903bd --- /dev/null +++ b/ice_validator/tests/test_base_template_names.py @@ -0,0 +1,65 @@ +# -*- 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. +# + +from os import listdir +from os import path +from .helpers import check_basename_ending + + +def test_base_template_names(template_dir): + ''' + Check all base templates have a filename that includes "_base_". + ''' + base_template_count = 0 + filenames = [f for f in listdir(template_dir) + if path.isfile(path.join(template_dir, f)) and + path.splitext(f)[-1] in ['.yaml', '.yml']] + for filename in filenames: + filename = path.splitext(filename)[0] + + # volume templates are tied to their parent naming wise + if check_basename_ending('volume', filename): + continue + + if (filename.endswith("_base") or + filename.startswith("base_") or + filename.find("_base_") > 0): + base_template_count += 1 + assert base_template_count == 1 diff --git a/ice_validator/tests/test_base_template_outputs_consumed.py b/ice_validator/tests/test_base_template_outputs_consumed.py new file mode 100644 index 0000000..a0eb2ef --- /dev/null +++ b/ice_validator/tests/test_base_template_outputs_consumed.py @@ -0,0 +1,85 @@ +# -*- 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. +# + +from os import path, sep +import yaml +import pytest + + +def test_base_template_outputs_consumed(heat_templates): + ''' + Check that all outputs in the base template is consumed + by another template. The exception is the predefined output + parameters. + ''' + base_template = "" + base_template_yml = "" + for heat_template in heat_templates: + with open(heat_template) as fh: + yml = yaml.load(fh) + basename = path.splitext(heat_template)[0].rsplit(sep, 1)[1] + if (basename.endswith("_base") or + basename.startswith("base_") or + basename.find("_base_") > 0): + base_template = heat_template + base_template_yml = yml + + # get the base template outputs + if "outputs" not in base_template_yml: + pytest.skip("No outputs specified in the base template") + + predefined_outputs = ['oam_management_v4_address', + 'oam_management_v6_address'] + base_outputs = set(base_template_yml["outputs"]) - set(predefined_outputs) + + # get all add-on templates + addon_heat_templates = set(heat_templates) - set([base_template]) + + # get all parameters from add-on templates + non_base_parameters = [] + for addon_heat_template in addon_heat_templates: + with open(addon_heat_template) as fh: + yml = yaml.load(fh) + if "parameters" not in yml: + continue + parameters = yml["parameters"].keys() + non_base_parameters.extend(parameters) + + assert base_outputs <= set(non_base_parameters) diff --git a/ice_validator/tests/test_env_and_yaml_same_name.py b/ice_validator/tests/test_env_and_yaml_same_name.py new file mode 100644 index 0000000..884d965 --- /dev/null +++ b/ice_validator/tests/test_env_and_yaml_same_name.py @@ -0,0 +1,59 @@ +# -*- 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. +# + +from os import listdir +from os import path + + +def test_env_and_yaml_same_name(template_dir): + ''' + Check that all environment template filenames are identical to an + associated Heat template filenames. Log the result of the check and add the + filename of any environment file that is badly named. + ''' + files = listdir(template_dir) + env_files = [f for f in files + if path.splitext(f)[-1] == ".env"] + yaml_files = [f for f in files + if path.splitext(f)[-1] in ['.yml', '.yaml']] + for filename in env_files: + basename = path.splitext(filename)[0] + assert basename + '.yaml' in yaml_files or \ + basename + '.yml' in yaml_files diff --git a/ice_validator/tests/test_env_files_provided.py b/ice_validator/tests/test_env_files_provided.py new file mode 100644 index 0000000..285f200 --- /dev/null +++ b/ice_validator/tests/test_env_files_provided.py @@ -0,0 +1,46 @@ +# -*- 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. +# + + +def test_env_files_provided(env_files): + ''' + Make sure environment files have been provided + ''' + assert len(env_files) > 0 diff --git a/ice_validator/tests/test_environment_file_structure.py b/ice_validator/tests/test_environment_file_structure.py new file mode 100644 index 0000000..d8cba6d --- /dev/null +++ b/ice_validator/tests/test_environment_file_structure.py @@ -0,0 +1,98 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_environment_structure(env_file): + ''' + Check that all environments files only have the allowed sections + ''' + key_values = ["parameters", "event_sinks", "encrypted_parameters", + "parameter_merge_strategies"] + + with open(env_file) as fh: + yml = yaml.load(fh) + assert any(map(lambda v: v in yml, key_values)) + + +def test_environment_file_contains_required_sections(env_file): + ''' + Check that all environments files only have the allowed sections + ''' + required_key_values = ["parameters"] + + with open(env_file) as fh: + yml = yaml.load(fh) + assert any(map(lambda v: v in yml, required_key_values)) + + +def test_environment_file_sections_have_the_right_format(env_file): + ''' + Check that all environment files have sections of the right format. + Do note that it only tests for dicts or not dicts currently. + ''' + key_values = ["parameters", "event_sinks", "encrypted_parameters", + "parameter_merge_strategies"] + key_values_not_dicts = ["event_sinks"] + + with open(env_file) as fh: + yml = yaml.load(fh) + + if not any(map(lambda v: v in yml, key_values)): + pytest.skip('The fixture is not applicable for this test') + + is_dict = 0 + should_be_dict = 0 + is_not_dict = 0 + should_not_be_dict = 0 + for key_value in key_values: + if key_value in yml: + if isinstance(yml[key_value], dict): + is_dict += 1 + if key_value not in key_values_not_dicts: + should_be_dict += 1 + elif not isinstance(yml[key_value], list): + is_not_dict += 1 + if key_value in key_values_not_dicts: + should_not_be_dict += 1 + assert (is_dict == should_be_dict and + is_not_dict == should_not_be_dict) diff --git a/ice_validator/tests/test_fixed_ips_format.py b/ice_validator/tests/test_fixed_ips_format.py new file mode 100644 index 0000000..039c619 --- /dev/null +++ b/ice_validator/tests/test_fixed_ips_format.py @@ -0,0 +1,118 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.network_roles import get_network_role_from_port +import re + + +def test_fixed_ips_format(heat_template): + ''' + Make sure all fixed_ips properties follow the allowed + naming conventions + ''' + formats = [ + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_ip_\d+')], + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ip_\d+')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_ip_\d+')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_v6_ip_\d+')], + ["fixed_ips", "comma_delimited_list", "internal", + re.compile(r'(.+?)_int_(.+?)_ips')], + ["fixed_ips", "comma_delimited_list", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ips')], + ["fixed_ips", "comma_delimited_list", "external", + re.compile(r'(.+?)_ips')], + ["fixed_ips", "comma_delimited_list", "external", + re.compile(r'(.+?)_v6_ips')], + ] + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_fixed_ips = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + network_role = get_network_role_from_port(v1) + + for k2, v2 in v1["properties"].items(): + if k2 != "fixed_ips": + continue + for v3 in v2: + if "ip_address" not in v3: + continue + if "get_param" not in v3["ip_address"]: + continue + + valid_fixed_ip = False + for v4 in formats: + param = v3["ip_address"]["get_param"] + if isinstance(param, list): + param = param[0] + m = v4[3].match(param) + if m: + if v4[2] == "internal" and\ + len(m.groups()) > 1 and\ + m.group(2) == network_role: + valid_fixed_ip = True + break + elif v4[2] == "external" and\ + len(m.groups()) > 0 and\ + m.group(1).endswith("_" + network_role): + valid_fixed_ip = True + break + + if not valid_fixed_ip: + invalid_fixed_ips.append(param) + + assert not set(invalid_fixed_ips) diff --git a/ice_validator/tests/test_fixed_ips_format_use_get_param.py b/ice_validator/tests/test_fixed_ips_format_use_get_param.py new file mode 100644 index 0000000..afd52e5 --- /dev/null +++ b/ice_validator/tests/test_fixed_ips_format_use_get_param.py @@ -0,0 +1,78 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_fixed_ips_format_use_get_parm(heat_template): + ''' + Make sure all fixed_ips properties only use get_param + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_fixed_ips = [] + for k, v in yml["resources"].items(): + if not isinstance(v, dict): + continue + if "properties" not in v: + continue + if v.get("type") != "OS::Neutron::Port": + continue + + valid_fixed_ip = True + for k2, v2 in v["properties"].items(): + if k2 != "fixed_ips": + continue + for v3 in v2: + if "ip_address" not in v3: + continue + if "get_param" not in v3["ip_address"]: + valid_fixed_ip = False + + if not valid_fixed_ip: + invalid_fixed_ips.append(k) + + assert not set(invalid_fixed_ips) diff --git a/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py b/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py new file mode 100644 index 0000000..bcb4486 --- /dev/null +++ b/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py @@ -0,0 +1,62 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.ports import get_invalid_ip_addresses + + +def test_fixed_ips_include_vm_type_network_role(heat_template): + ''' + Check that all fixed_ips ip addresses include the {vm_type} of the + nova server it is associated to and also contains the {network_role} + of the network it is associated with + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_ip_addresses = get_invalid_ip_addresses(yml['resources'], + "fixed_ips") + + assert not set(invalid_ip_addresses) diff --git a/ice_validator/tests/test_get_file_only_reference_local_files.py b/ice_validator/tests/test_get_file_only_reference_local_files.py new file mode 100644 index 0000000..5282ee0 --- /dev/null +++ b/ice_validator/tests/test_get_file_only_reference_local_files.py @@ -0,0 +1,73 @@ +# -*- 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. +# + +from os import sep +import pytest +import re +import yaml +from .utils.nested_iterables import find_all_get_file_in_yml + + +def test_get_file_only_reference_local_files(yaml_file): + ''' + Make sure that all references to get_file only try to access local files + and only assume a flat directory structure + ''' + is_url = re.compile(r'(?:http|https|file|ftp|ftps)://.+') + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + get_files = find_all_get_file_in_yml(yml["resources"]) + + invalid_files = [] + for get_file in get_files: + if is_url.match(get_file): + invalid_files.append(get_file) + continue + if sep in get_file: + invalid_files.append(get_file) + continue + + assert not set(invalid_files) diff --git a/ice_validator/tests/test_heat_numeric_parameters.py b/ice_validator/tests/test_heat_numeric_parameters.py new file mode 100644 index 0000000..e439015 --- /dev/null +++ b/ice_validator/tests/test_heat_numeric_parameters.py @@ -0,0 +1,75 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_numeric_parameter(yaml_file): + ''' + Make sure all numeric parameters has either `range` or `allowed_values` + specified + ''' + key_values = ["range", "allowed_values"] + missing_constraints = [] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + for k1, v1 in yml["parameters"].items(): + if not isinstance(v1, dict): + continue + if 'number' not in v1.values(): + continue + + for k2, v2 in v1.items(): + if k2 == "type" and v2 == "number": + if "constraints" not in v1: + missing_constraints.append(k1) + continue + for v3 in v1["constraints"]: + if not set(v3) & set(key_values): + missing_constraints.append(k1) + + assert not set(missing_constraints) diff --git a/ice_validator/tests/test_heat_pairs_provided.py b/ice_validator/tests/test_heat_pairs_provided.py new file mode 100644 index 0000000..2f4b74a --- /dev/null +++ b/ice_validator/tests/test_heat_pairs_provided.py @@ -0,0 +1,62 @@ +# -*- 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. +# + +from os import path + + +def test_heat_pairs_provided(heat_templates, env_files, volume_templates): + ''' + Check that every yaml file is submitted with + an associated env file, and every env has an + associated yaml file. + ''' + + for filename in env_files: + basename = path.splitext(filename)[0] + assert basename + '.yaml' in heat_templates or \ + basename + '.yml' in heat_templates or \ + basename + '.yml' in volume_templates or \ + basename + '.yaml' in volume_templates + for filename in heat_templates: + basename = path.splitext(filename)[0] + assert basename + '.env' in env_files + for filename in volume_templates: + basename = path.splitext(filename)[0] + assert basename + '.env' in env_files diff --git a/ice_validator/tests/test_heat_parameter_section.py b/ice_validator/tests/test_heat_parameter_section.py new file mode 100644 index 0000000..7559ee6 --- /dev/null +++ b/ice_validator/tests/test_heat_parameter_section.py @@ -0,0 +1,89 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_parameter_valid_keys(yaml_file): + ''' + Make sure each parameter is a dict and only contain + valid keys + ''' + key_values = ["type", "label", "description", + "hidden", "constraints", "immutable"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + invalid_params = [] + for v1 in yml["parameters"].values(): + if not isinstance(v1, dict): + continue + detected_keys = set(v1) & set(key_values) + if set(v1) != set(detected_keys): + invalid_params.append(v1) + + assert not set(invalid_params) + + +def test_default_values(yaml_file): + ''' + Make sure no default values are set for any parameter. + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + invalid_params = [] + for v1 in yml["parameters"].values(): + if not isinstance(v1, dict): + continue + if any(k == 'default' for k in v1): + invalid_params.append(v1) + + assert not set(invalid_params) diff --git a/ice_validator/tests/test_heat_template_and_env_file_extension.py b/ice_validator/tests/test_heat_template_and_env_file_extension.py new file mode 100644 index 0000000..8174c20 --- /dev/null +++ b/ice_validator/tests/test_heat_template_and_env_file_extension.py @@ -0,0 +1,82 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_heat_template_file_extension(yaml_file): + ''' + Check that all heat templates are in fact heat + templates + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + invalid_params = [] + for k, v in yml["parameters"].items(): + if not isinstance(v, dict): + invalid_params.append(k) + + assert not set(invalid_params) + + +def test_environment_file_extension(env_file): + ''' + Check that all environments files are in fact environment + files + ''' + with open(env_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the environment file") + + invalid_params = [] + for k, v in yml["parameters"].items(): + if isinstance(v, dict): + invalid_params.append(k) + + assert not set(invalid_params) diff --git a/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py new file mode 100644 index 0000000..1cfc4ce --- /dev/null +++ b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py @@ -0,0 +1,66 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_heat_template_parameters_contain_required_fields(yaml_file): + ''' + Check that all parameters in the environment + file have the required fields + ''' + required_keys = ["type", "description"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + invalid_parameters = [] + for k1, v1 in yml["parameters"].items(): + if not isinstance(v1, dict): + continue + if not all(map(lambda v: v in v1, required_keys)): + invalid_parameters.append(k1) + + assert not set(invalid_parameters) diff --git a/ice_validator/tests/test_heat_template_structure.py b/ice_validator/tests/test_heat_template_structure.py new file mode 100644 index 0000000..3bbca31 --- /dev/null +++ b/ice_validator/tests/test_heat_template_structure.py @@ -0,0 +1,97 @@ +# -*- 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. +# + +import yaml + + +def test_heat_template_structure(yaml_file): + ''' + Check that all heat templates only have the allowed sections + ''' + key_values = ["heat_template_version", "description", + "parameter_groups", "parameters", "resources", + "outputs", "conditions"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + assert any(map(lambda v: v in yml, key_values)) + + +def test_heat_template_structure_contains_required_sections(yaml_file): + ''' + Check that all heat templates have the required sections + ''' + required_key_values = ["heat_template_version", "description", + "parameters", "resources"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + assert any(map(lambda v: v in yml, required_key_values)) + + +def test_heat_template_structure_sections_have_the_right_format(yaml_file): + ''' + Check that all heat templates have sections of the right format. + Do note that it only tests for dicts or not dicts currently. + ''' + key_values = ["heat_template_version", "description", + "parameter_groups", "parameters", "resources", + "outputs", "conditions"] + key_values_not_dicts = ["heat_template_version", "description"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + is_dict = 0 + should_be_dict = 0 + is_not_dict = 0 + should_not_be_dict = 0 + for key_value in key_values: + if key_value in yml: + if isinstance(yml[key_value], dict): + is_dict += 1 + if key_value not in key_values_not_dicts: + should_be_dict += 1 + elif not isinstance(yml[key_value], list): + is_not_dict += 1 + if key_value in key_values_not_dicts: + should_not_be_dict += 1 + assert (is_dict == should_be_dict and + is_not_dict == should_not_be_dict) diff --git a/ice_validator/tests/test_heat_templates_provided.py b/ice_validator/tests/test_heat_templates_provided.py new file mode 100644 index 0000000..187397f --- /dev/null +++ b/ice_validator/tests/test_heat_templates_provided.py @@ -0,0 +1,46 @@ +# -*- 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. +# + + +def test_heat_templates_provided(heat_templates): + ''' + Make sure heat templates have been provided + ''' + assert len(heat_templates) > 0 diff --git a/ice_validator/tests/test_nested_templates.py b/ice_validator/tests/test_nested_templates.py new file mode 100644 index 0000000..ce8785b --- /dev/null +++ b/ice_validator/tests/test_nested_templates.py @@ -0,0 +1,67 @@ +# -*- 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. +# + +import yaml +from os import path +from .utils.nested_files import get_list_of_nested_files + + +def test_all_nested_templates_provided(yaml_files): + ''' + Check that all templates marked as volume templates are + in fact volume templates + ''' + nested_yaml_files = [] + + for yaml_file in yaml_files: + with open(yaml_file) as fh: + yml = yaml.load(fh) + if "resources" not in yml: + continue + nested_yaml_files.extend(get_list_of_nested_files( + yml["resources"], path.dirname(yaml_file))) + + # detect all provided nested files + provided_nested_yaml_files = [f1 + for f1 in nested_yaml_files + for f2 in yaml_files + if f1 in f2] + + assert set(provided_nested_yaml_files) == set(nested_yaml_files) diff --git a/ice_validator/tests/test_nested_templates_invalid_nesting.py b/ice_validator/tests/test_nested_templates_invalid_nesting.py new file mode 100644 index 0000000..00d6d25 --- /dev/null +++ b/ice_validator/tests/test_nested_templates_invalid_nesting.py @@ -0,0 +1,63 @@ +# -*- 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. +# + +import yaml +from os import path +from .utils.nested_files import check_for_invalid_nesting + + +def test_valid_nesting(yaml_files): + ''' + Check that the nesting is following the proper format and + that all nested files exists and are parsable + ''' + invalid_nesting = [] + + for yaml_file in yaml_files: + with open(yaml_file) as fh: + yml = yaml.load(fh) + if "resources" not in yml: + continue + invalid_nesting.extend(check_for_invalid_nesting( + yml["resources"], + yaml_file, + path.dirname(yaml_file))) + + assert not set(invalid_nesting) diff --git a/ice_validator/tests/test_network_format.py b/ice_validator/tests/test_network_format.py new file mode 100644 index 0000000..28144d3 --- /dev/null +++ b/ice_validator/tests/test_network_format.py @@ -0,0 +1,69 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.network_roles import get_network_role_from_port + + +def test_network_format(heat_template): + ''' + Make sure all network properties use the allowed naming + conventions + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_ports = [] + for k, v in yml["resources"].items(): + if not isinstance(v, dict): + continue + if "properties" not in v: + continue + if v.get("type") != "OS::Neutron::Port": + continue + if not get_network_role_from_port(v): + invalid_ports.append(k) + + assert not set(invalid_ports) diff --git a/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py new file mode 100644 index 0000000..e30b344 --- /dev/null +++ b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py @@ -0,0 +1,80 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_network_format_use_get_param_or_get_resource(heat_template): + ''' + Make sure all network properties only use get_param + or get_resource of an internal network + ''' + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_ports = [] + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + + valid_network = True + for k2, v2 in v1["properties"].items(): + if k2 != "network": + continue + if "get_resource" in v2: + if not v2["get_resource"].startswith('int_'): + valid_network = False + elif "get_param" not in v2: + valid_network = False + + if not valid_network: + invalid_ports.append(k1) + + assert not set(invalid_ports) 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 new file mode 100644 index 0000000..03bae8f --- /dev/null +++ b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py @@ -0,0 +1,47 @@ +# -*- 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. +# + + +def test_no_unused_parameters_between_env_and_templates(environment_pair): + ''' + Check all defined parameters are used in the appropiate Heat template. + ''' + assert (set(environment_pair["eyml"]['parameters']) == + set(environment_pair["yyml"]['parameters'])) diff --git a/ice_validator/tests/test_nova_servergroup_policies.py b/ice_validator/tests/test_nova_servergroup_policies.py new file mode 100644 index 0000000..a3bdf5a --- /dev/null +++ b/ice_validator/tests/test_nova_servergroup_policies.py @@ -0,0 +1,80 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_nova_servergroup_policies(yaml_file): + ''' + Check that nova servergroup resources using either anti-affinity or + affinity rules in policies + ''' + req_rules = ['affinity', 'anti-affinity'] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + has_req_rules = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Nova::ServerGroup": + continue + if "policies" not in v1["properties"].keys(): + continue + + try: + all_rules = v1["properties"]["policies"] + detected_rules = set(all_rules) & set(req_rules) + has_req_rules.append(len(detected_rules) > 0) + except (ValueError): + continue + + if not has_req_rules: + pytest.skip("No policies Nova::ServerGroup instances were detected") + + assert all(has_req_rules) diff --git a/ice_validator/tests/test_nova_servers_correct_parameter_types.py b/ice_validator/tests/test_nova_servers_correct_parameter_types.py new file mode 100644 index 0000000..7b67682 --- /dev/null +++ b/ice_validator/tests/test_nova_servers_correct_parameter_types.py @@ -0,0 +1,111 @@ +# -*- 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. +# + +import pytest +import yaml +import re + + +def test_nova_servers_correct_parameter_types(heat_template): + ''' + Make sure all nova servers have properly assigned types for the parameters + used for their name, image and flavor + ''' + key_values = ["name", "flavor", "image"] + key_value_formats = [ + ["name", "string", + re.compile(r'(.+?)_name_\d+')], + ["name", "comma_delimited_list", + re.compile(r'(.+?)_names')], + ["flavor", "string", + re.compile(r'(.+?)_flavor_name')], + ["image", "string", + re.compile(r'(.+?)_image_name')], + ] + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + parameters = yml["parameters"] + + invalid_nova_servers = [] + + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Nova::Server": + continue + + valid_nova_server = True + for k2, v2 in v1["properties"].items(): + if k2 not in key_values: + continue + formats = [v for v in key_value_formats if v[0] == k2] + for v3 in formats: + if "get_param" not in v2: + continue + + param = v2["get_param"] + if isinstance(param, list): + param = param[0] + + m = v3[2].match(param) + if m and m.group(1): + if parameters[param]: + param_spec = parameters[param] + if not param_spec["type"]: + valid_nova_server = False + elif param_spec["type"] != v3[1]: + valid_nova_server = False + + if not valid_nova_server: + invalid_nova_servers.append(k1) + + assert not set(invalid_nova_servers) diff --git a/ice_validator/tests/test_nova_servers_resource_ids.py b/ice_validator/tests/test_nova_servers_resource_ids.py new file mode 100644 index 0000000..6cd4363 --- /dev/null +++ b/ice_validator/tests/test_nova_servers_resource_ids.py @@ -0,0 +1,75 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.vm_types import get_vm_type_for_nova_server + + +def test_nova_servers_valid_resource_ids(heat_template): + ''' + Make sure all nova servers have valid resource ids + ''' + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_nova_servers = [] + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Nova::Server": + continue + + vm_type = get_vm_type_for_nova_server(v1) + if not vm_type: + continue + vm_type = vm_type.lower() + + if vm_type+"_" not in k1.lower(): + invalid_nova_servers.append(k1) + + assert not set(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 new file mode 100644 index 0000000..1b61c27 --- /dev/null +++ b/ice_validator/tests/test_nova_servers_vm_types.py @@ -0,0 +1,71 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.vm_types import get_vm_types_for_resource + + +def test_vm_type_consistent_on_nova_servers(heat_template): + ''' + Make sure all nova servers have properly formatted properties + for their name, image and flavor + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_nova_servers = [] + for k, v in yml["resources"].items(): + if not isinstance(v, dict): + continue + if v.get('type') != 'OS::Nova::Server': + continue + if 'properties' not in v: + continue + + vm_types = get_vm_types_for_resource(v) + if len(vm_types) != 1: + invalid_nova_servers.append(k) + + assert not set(invalid_nova_servers) diff --git a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py new file mode 100644 index 0000000..2be7e6f --- /dev/null +++ b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py @@ -0,0 +1,76 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template): + ''' + Make sure all nova servers only use get_param for their properties + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + key_values = ["name", "flavor", "image"] + invalid_nova_servers = [] + + for k, v in yml["resources"].items(): + if not isinstance(v, dict): + continue + if "properties" not in v: + continue + if "type" not in v: + continue + if v["type"] != "OS::Nova::Server": + continue + + for k2, v2 in v["properties"].items(): + if k2 in key_values: + if not isinstance(v2, dict): + invalid_nova_servers.append(k) + elif "get_param" not in v2: + invalid_nova_servers.append(k) + + assert not set(invalid_nova_servers) diff --git a/ice_validator/tests/test_parse_yaml.py b/ice_validator/tests/test_parse_yaml.py new file mode 100644 index 0000000..74bda27 --- /dev/null +++ b/ice_validator/tests/test_parse_yaml.py @@ -0,0 +1,60 @@ +# -*- 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. +# + +from os import path +import pytest +import yaml + + +def test_parse_yaml(filename): + ''' + Read in each .yaml or .env file. If it is successfully parsed as yaml, save + contents, else add filename to list of bad yaml files. Log the result of + parse attempt. + ''' + if path.splitext(filename)[-1] in [".yml", ".yaml", ".env"]: + try: + yaml.load(open(filename, 'r')) + assert True + except Exception: + assert False + else: + pytest.skip("The file does not have any of the extensions .yml,\ + .yaml, or .env") diff --git a/ice_validator/tests/test_port_resource_ids.py b/ice_validator/tests/test_port_resource_ids.py new file mode 100644 index 0000000..78a6751 --- /dev/null +++ b/ice_validator/tests/test_port_resource_ids.py @@ -0,0 +1,140 @@ +# -*- 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. +# + +import re +import pytest +import yaml +from .utils.vm_types import get_vm_type_for_nova_server +from .utils.network_roles import get_network_role_from_port,\ + get_network_type_from_port + + +def test_port_resource_ids(heat_template): + ''' + Check that all resource ids for ports follow the right + naming convention to include the {vm_type} of the + nova server it is associated to and also contains the + {network_role} of the network it is associated with + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + port_patterns = { + 'internal': re.compile(r'(.+?)_\d+_int_(.+?)_\d+_port'), + 'external': re.compile(r'(.+?)_\d+_(.+?)_\d+_port'), + } + resources = yml['resources'] + + invalid_ports = [] + for k, v in resources.items(): + if not isinstance(v, dict): + continue + if 'type' not in v: + continue + if v['type'] not in 'OS::Nova::Server': + continue + if 'properties' not in v: + continue + if 'networks' not in v['properties']: + continue + + has_vm_type = False + has_network_role = True + port_resource = None + + vm_type = get_vm_type_for_nova_server(v) + if not vm_type: + continue + vm_type = vm_type.lower() + + # get all ports associated with the nova server + properties = v['properties'] + for v2 in properties['networks']: + for k3, v3 in v2.items(): + if k3 != 'port': + continue + if not isinstance(v3, dict): + continue + + if 'get_param' in v3: + continue + elif 'get_resource' in v3: + port_id = v3['get_resource'] + if not resources[port_id]: + continue + port_resource = resources[port_id] + port_id = port_id.lower() + else: + continue + + has_vm_type = vm_type+"_" in port_id + + if port_resource: + network_role = get_network_role_from_port(port_resource) + if not network_role: + continue + network_role = network_role.lower() + + network_type = get_network_type_from_port(port_resource) + if not network_type: + continue + + prepend = "" + if network_type == 'internal': + prepend = "int_" + has_network_role = prepend+network_role+"_" in port_id + else: + # match the assumed naming convention for ports + # if the specified port is provided via get_param + network_type = 'external' + if "int_" in port_id: + network_type = 'internal' + if port_patterns[network_type].match(port_id): + has_network_role = True + + if has_vm_type and has_network_role: + continue + invalid_ports.append(port_id) + + assert not set(invalid_ports) diff --git a/ice_validator/tests/test_referenced_and_defined_parameters_match.py b/ice_validator/tests/test_referenced_and_defined_parameters_match.py new file mode 100644 index 0000000..7622ba1 --- /dev/null +++ b/ice_validator/tests/test_referenced_and_defined_parameters_match.py @@ -0,0 +1,53 @@ +# -*- 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. +# + +import yaml +from .utils.nested_iterables import find_all_get_param_in_yml + + +def test_referenced_and_defined_parameters_match(yaml_file): + ''' + Check that all referenced parameters are actually defined + as parameters + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + resource_params = find_all_get_param_in_yml(yml) + assert set(yml['parameters'].keys()) == set(resource_params) diff --git a/ice_validator/tests/test_required_parameters_no_constraints.py b/ice_validator/tests/test_required_parameters_no_constraints.py new file mode 100644 index 0000000..a63f41b --- /dev/null +++ b/ice_validator/tests/test_required_parameters_no_constraints.py @@ -0,0 +1,64 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_required_parameters_no_constraints(yaml_file): + ''' + Make sure all required parameters are specified without any + constraints in the heat template. + ''' + required_parameters = ["vnf_id", "vf_module_id", "vnf_name"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + invalid_params = [] + for k1, v1 in yml["parameters"].items(): + if k1 in required_parameters and "constraints" in v1: + invalid_params.append(k1) + + assert not set(invalid_params) diff --git a/ice_validator/tests/test_required_parameters_specified_in_env_files.py b/ice_validator/tests/test_required_parameters_specified_in_env_files.py new file mode 100644 index 0000000..f60f8d7 --- /dev/null +++ b/ice_validator/tests/test_required_parameters_specified_in_env_files.py @@ -0,0 +1,74 @@ +# -*- 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. +# + +import pytest + + +def test_required_parameters_provided_in_env_file(environment_pair): + ''' + Make sure all required parameters are specified properly + in the environment file if a server is defined in the + corresponding heat template + ''' + required_parameters = ["vnf_id", "vf_module_id", "vnf_name"] + + if "resources" not in environment_pair["yyml"]: + pytest.skip("No resources specified in the heat template") + + if "parameters" not in environment_pair["eyml"]: + pytest.skip("No parameters specified in the environment file") + + server_count = 0 + for v in environment_pair["yyml"]['resources'].values(): + if "type" not in v: + continue + if v["type"] == "OS::Nova::Server": + server_count += 1 + + if server_count == 0: + pytest.skip("No Nova Server resources specified in " + + "the heat template") + + provided_parameters = [] + for k in environment_pair["eyml"]['parameters']: + if k in required_parameters: + provided_parameters.append(k) + + assert set(required_parameters) == set(provided_parameters) diff --git a/ice_validator/tests/test_required_parameters_specified_in_heat_templates.py b/ice_validator/tests/test_required_parameters_specified_in_heat_templates.py new file mode 100644 index 0000000..d86a22b --- /dev/null +++ b/ice_validator/tests/test_required_parameters_specified_in_heat_templates.py @@ -0,0 +1,77 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_required_parameters_provided_in_heat_template(heat_template): + ''' + Make sure all required parameters are specified properly + in the heat template if a server resource is defined + ''' + required_parameters = ["vnf_id", "vf_module_id", "vnf_name"] + provided_parameters = [] + + with open(heat_template) as fh: + yml = yaml.load(fh) + + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + server_count = 0 + for v in yml["resources"].values(): + if "type" not in v: + continue + if v["type"] == "OS::Nova::Server": + server_count += 1 + + if server_count == 0: + pytest.skip("No Nova Server resources specified in " + + "the heat template") + + if "parameters" not in yml: + pytest.fail("No parameters specified in the heat template") + + for k in yml["parameters"]: + if k in required_parameters: + provided_parameters.append(k) + + assert set(required_parameters) == set(provided_parameters) diff --git a/ice_validator/tests/test_resource_ids_alphanumeric_only.py b/ice_validator/tests/test_resource_ids_alphanumeric_only.py new file mode 100644 index 0000000..dc508ba --- /dev/null +++ b/ice_validator/tests/test_resource_ids_alphanumeric_only.py @@ -0,0 +1,62 @@ +# -*- 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. +# + +import yaml +import pytest +import re + + +def test_alphanumeric_resource_ids_only(yaml_file): + ''' + Check that all instance names are only using alphanumerics + ''' + valid_format = re.compile(r'^[\w-]+$') + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + if 'resources' not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_resource_ids = [k + for k in yml['resources'].keys() + if not valid_format.match(k)] + + assert not set(invalid_resource_ids) diff --git a/ice_validator/tests/test_servers_have_optional_metadata.py b/ice_validator/tests/test_servers_have_optional_metadata.py new file mode 100644 index 0000000..0e72e6c --- /dev/null +++ b/ice_validator/tests/test_servers_have_optional_metadata.py @@ -0,0 +1,93 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_servers_have_optional_metadata(yaml_file): + ''' + Check that if optional metadata is included in the metadata + for nova servers, they are specified in parameters + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if parameters are not defined + if "parameters" not in yml: + pytest.skip("No parameters specified in the heat template") + + # Check if the param vm_role is defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + optional_metadata = ["vf_module_name", "vf_module_index"] + specified_optional_metadata = [k + for k in yml["parameters"].keys() + if k in optional_metadata] + + need_optional_metadata = [] + for v in yml["resources"].values(): + keys = [] + if v.get("type") == "OS::Nova::Server": + if 'properties' not in v: + continue + if 'metadata' not in v['properties']: + continue + + keys = v["properties"]["metadata"].keys() + elif v.get("type") == "OS::Heat::ResourceGroup": + if 'resource_def' not in v: + continue + if 'properties' not in v['resource_def']: + continue + + keys = v["resource_def"]["properties"].keys() + + for key in keys: + if key in optional_metadata: + need_optional_metadata.append(key) + + if not need_optional_metadata: + pytest.skip("No optional metadata is specified in the heat template") + + # Check that if optional metadata is included in the metadata + # for nova servers, they are specified in parameters + assert set(specified_optional_metadata) == set(need_optional_metadata) diff --git a/ice_validator/tests/test_servers_have_required_metadata.py b/ice_validator/tests/test_servers_have_required_metadata.py new file mode 100644 index 0000000..82c85e5 --- /dev/null +++ b/ice_validator/tests/test_servers_have_required_metadata.py @@ -0,0 +1,73 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_servers_have_required_metadata(yaml_file): + ''' + Check all defined nova server instances have the required metadata: + vnf_id and vf_module_id + ''' + 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") + + required_metadata = ["vnf_id", "vf_module_id", "vnf_name"] + + invalid_nova_servers = [] + for k, v in yml["resources"].items(): + if v.get("type") != "OS::Nova::Server": + continue + if 'properties' not in v: + continue + if 'metadata' not in v['properties']: + continue + + # do not add the server if it has the required metadata + if set(required_metadata) <= set(v["properties"]["metadata"].keys()): + continue + invalid_nova_servers.append(k) + + assert not set(invalid_nova_servers) diff --git a/ice_validator/tests/test_servers_metadata_use_get_param.py b/ice_validator/tests/test_servers_metadata_use_get_param.py new file mode 100644 index 0000000..a535544 --- /dev/null +++ b/ice_validator/tests/test_servers_metadata_use_get_param.py @@ -0,0 +1,74 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_servers_metadata_use_get_param(yaml_file): + ''' + Check all defined nova server instances include + metadata via the get_param function + ''' + required_metadata = ["vnf_id", "vf_module_id"] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_nova_servers = [] + + for k1, v1 in yml["resources"].items(): + if "type" not in v1: + continue + if v1["type"] == "OS::Nova::Server": + try: + for k2, v2 in v1["properties"]["metadata"].items(): + if (k2 in required_metadata and not + v2["get_param"] in required_metadata): + invalid_nova_servers.append(k1) + except Exception as e: + print(e) + invalid_nova_servers.append(k1) + + assert not set(invalid_nova_servers) diff --git a/ice_validator/tests/test_subnet_format.py b/ice_validator/tests/test_subnet_format.py new file mode 100644 index 0000000..f1bab44 --- /dev/null +++ b/ice_validator/tests/test_subnet_format.py @@ -0,0 +1,123 @@ +# -*- 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. +# + +import pytest +import yaml +from .utils.network_roles import get_network_role_from_port +import re + + +def test_subnet_format(heat_template): + ''' + Make sure all subnet properties follow the allowed naming + conventions + ''' + formats = [ + ["subnet_id", "string", "internal", + re.compile(r'int_(.+?)_subnet_id')], + ["subnet_id", "string", "internal", + re.compile(r'int_(.+?)_v6_subnet_id')], + ["subnet_id", "string", "external", + re.compile(r'(.+?)_subnet_id')], + ["subnet_id", "string", "external", + re.compile(r'(.+?)_v6_subnet_id')], + ] + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_subnets = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + network_role = get_network_role_from_port(v1) + + # get the network param to define the network_type + try: + network_param = v1["properties"]["network"]["get_param"] + except KeyError: + continue + + # define the network_type + network_type = 'external' + if network_param.startswith('int_'): + network_type = 'internal' + + for k2, v2 in v1["properties"].items(): + if k2 != "fixed_ips": + continue + + for v3 in v2: + if "subnet_id" not in v3: + continue + + subnet_id = v3["subnet_id"] + for v4 in formats: + if v4[2] != network_type: + continue + + # get the param or resource + if network_type == "external": + param_or_res = subnet_id["get_param"] + elif network_type == "internal": + if subnet_id.get("get_param"): + param_or_res = subnet_id["get_param"] + elif subnet_id.get("get_resource"): + param_or_res = subnet_id["get_resource"] + else: + continue + else: + continue + + m = v4[3].match(param_or_res) + if m and m.group(1): + snr = m.group(1) + if snr.replace("_v6", "") != network_role: + invalid_subnets.append(param_or_res) + + assert not set(invalid_subnets) diff --git a/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py b/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py new file mode 100644 index 0000000..597dd22 --- /dev/null +++ b/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py @@ -0,0 +1,99 @@ +# -*- 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. +# + +import pytest +import yaml + + +def test_subnet_format_use_get_param_or_get_resource(heat_template): + ''' + Make sure all subnet properties only use get_parm + or get_resource of an internal network + ''' + + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_subnets = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + + # get the network param to define the network_type + try: + network_param = v1["properties"]["network"]["get_param"] + except KeyError: + continue + + # define the network_type + network_type = 'external' + if network_param.startswith('int_'): + network_type = 'internal' + + for k2, v2 in v1["properties"].items(): + if k2 != "fixed_ips": + continue + + for v3 in v2: + if "subnet_id" not in v3: + continue + + subnet_id = v3["subnet_id"] + + # get the param or resource + if network_type == "external" and\ + subnet_id.get("get_param"): + continue + elif network_type == "internal" and\ + (subnet_id.get("get_param") or + subnet_id.get("get_resource")): + continue + else: + invalid_subnets.append(subnet_id) + + assert not set(invalid_subnets) diff --git a/ice_validator/tests/test_unique_name_resources.py b/ice_validator/tests/test_unique_name_resources.py new file mode 100644 index 0000000..c154c28 --- /dev/null +++ b/ice_validator/tests/test_unique_name_resources.py @@ -0,0 +1,107 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_unique_name_resources(yaml_files): + ''' + Check that all resource names are unique across all yaml files. + The specifics of str_replace naming is carried out in a + different test + ''' + resource_names = [] + + params_using_index = {} + + for yaml_file in yaml_files: + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + continue + + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + + try: + v2 = v1["properties"]["name"] + except (TypeError, KeyError): + continue + + try: + param = v2["get_param"] + except (TypeError, KeyError): + param = None + + if param: + if isinstance(param, list): + name = param[0] + index = param[1] + + if (isinstance(index, dict) and + 'get_param' in index): + get_param = index['get_param'] + + if name not in params_using_index: + params_using_index[name] = get_param + param = name + get_param + else: + continue + else: + param = name + str(index) + + resource_names.append(param) + else: + try: + template = v2["str_replace"]["yaml_file"] + resource_names.append(template) + except (TypeError, KeyError): + continue + + if not resource_names: + pytest.skip("No resource names could be detected") + + assert len(resource_names) == len(set(resource_names)) diff --git a/ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py b/ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py new file mode 100644 index 0000000..80397b1 --- /dev/null +++ b/ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py @@ -0,0 +1,79 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_unique_name_str_replace_use_req_params_in_tmpl(yaml_file): + ''' + Check that all occurences of str_replace uses either vnf_name or + vnf_module_id to construct the name + ''' + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + in_template = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1["type"] in ["OS::Nova::Server", "OS::Neutron::Port", + "OS::Heat::ResourceGroup"]: + continue + + try: + v2 = v1["properties"]["name"] + str_replace = v2["str_replace"] + params = str_replace["params"] + template = str_replace["template"] + in_template.append(all(k3 in template for k3 in params)) + except (TypeError, KeyError): + continue + + if not in_template: + pytest.skip("No str_replace instances were detected") + + assert all(c for c in in_template) diff --git a/ice_validator/tests/test_unique_name_str_replace_use_req_params.py b/ice_validator/tests/test_unique_name_str_replace_use_req_params.py new file mode 100644 index 0000000..d89d8d9 --- /dev/null +++ b/ice_validator/tests/test_unique_name_str_replace_use_req_params.py @@ -0,0 +1,83 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_unique_name_str_replace_use_req_params(yaml_file): + ''' + Check that all occurences of str_replace uses either vnf_name or + vf_module_id to construct the name + ''' + req_params = ['vnf_name', 'vf_module_id'] + + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + has_req_params = [] + for v1 in yml["resources"].values(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1["type"] in ["OS::Nova::Server", "OS::Neutron::Port", + "OS::Heat::ResourceGroup"]: + continue + + try: + v2 = v1["properties"]["name"] + str_replace = v2["str_replace"] + + all_params = [] + for v3 in str_replace["params"].values(): + all_params.append(v3["get_param"]) + detected_params = set(all_params) & set(req_params) + has_req_params.append(len(detected_params) > 0) + except (TypeError, KeyError): + continue + + if not has_req_params: + pytest.skip("No str_replace instances were detected") + assert all(c for c in has_req_params) diff --git a/ice_validator/tests/test_unique_resources_across_all_templates.py b/ice_validator/tests/test_unique_resources_across_all_templates.py new file mode 100644 index 0000000..13b4121 --- /dev/null +++ b/ice_validator/tests/test_unique_resources_across_all_templates.py @@ -0,0 +1,57 @@ +# -*- 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. +# + +import yaml + + +def test_unique_resources_across_all_yaml_files(yaml_files): + ''' + Check that all instance names are unique + across all yaml files. + ''' + resources_ids = [] + for yaml_file in yaml_files: + with open(yaml_file) as fh: + yml = yaml.load(fh) + if 'resources' not in yml: + continue + resources_ids.extend(yml['resources'].keys()) + + assert len(resources_ids) == len(set(resources_ids)) diff --git a/ice_validator/tests/test_unique_resources_across_template.py b/ice_validator/tests/test_unique_resources_across_template.py new file mode 100644 index 0000000..9ed8927 --- /dev/null +++ b/ice_validator/tests/test_unique_resources_across_template.py @@ -0,0 +1,68 @@ +# -*- 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. +# + +import yaml +import pytest +from .utils import yaml_custom_utils +from yaml.constructor import ConstructorError + + +def test_unique_resources_across_yaml_file(yaml_file): + ''' + Check that all instance names are unique within + a yaml file. + ''' + yaml.add_constructor( + yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, + yaml_custom_utils.raise_duplicates_keys) + + try: + with open(yaml_file) as fh: + yml = yaml.load(fh) + + # Assert yaml file dont have resources + assert len(yml["resources"]) != 0 + + except ConstructorError as ce: + print(ce) + pytest.fail("Unique resources across a yaml file - failed") + except Exception as e: + print(e) + pytest.skip("This yaml file cannot be tested in this test") diff --git a/ice_validator/tests/test_volume_format_outputs.py b/ice_validator/tests/test_volume_format_outputs.py new file mode 100644 index 0000000..00c6871 --- /dev/null +++ b/ice_validator/tests/test_volume_format_outputs.py @@ -0,0 +1,69 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_volume_format_outputs(volume_template): + ''' + Check that the values are properly provided to the outputs section + in a volume template + ''' + with open(volume_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "outputs" not in yml: + pytest.skip("No outputs specified in the volume template") + + # Retrieve the volume category parameters usage + invalid_outputs = [] + for k, v in yml['outputs'].items(): + if not isinstance(v, dict): + continue + + if ('value' in v and + ('get_resource' in v['value'] or + 'get_attr' in v['value'])): + continue + invalid_outputs.append(k) + + assert not set(invalid_outputs) diff --git a/ice_validator/tests/test_volume_outputs_consumed.py b/ice_validator/tests/test_volume_outputs_consumed.py new file mode 100644 index 0000000..771cfd6 --- /dev/null +++ b/ice_validator/tests/test_volume_outputs_consumed.py @@ -0,0 +1,49 @@ +# -*- 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. +# + + +def test_volume_outputs_consumed(heat_volume_pair): + ''' + Check that all outputs in a volume template is consumed + by the corresponding heat template + ''' + outputs = heat_volume_pair["vyml"]["outputs"].keys() + parameters = heat_volume_pair["yyml"]["parameters"].keys() + assert set(outputs) <= set(parameters) diff --git a/ice_validator/tests/test_volume_resource_ids.py b/ice_validator/tests/test_volume_resource_ids.py new file mode 100644 index 0000000..3f0acda --- /dev/null +++ b/ice_validator/tests/test_volume_resource_ids.py @@ -0,0 +1,164 @@ +# -*- 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. +# + +import re +import pytest +import yaml +from .utils.vm_types import get_vm_type_for_nova_server + + +def test_volume_resource_ids(heat_template): + ''' + Check that all resource ids for cinder volumes follow the right + naming convention to include the {vm_type} of the + nova server it is associated to + ''' + with open(heat_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + volume_pattern = re.compile(r'(.+?)_volume_id_\d+') + resources = yml['resources'] + + invalid_volumes = [] + for k, v in resources.items(): + if not isinstance(v, dict): + continue + if 'type' not in v: + continue + if v['type'] not in ['OS::Nova::Server', + 'OS::Cinder::VolumeAttachment']: + continue + + if v['type'] == 'OS::Nova::Server': + # check block_device_mapping and make sure the right + # {vm_type} is used + if 'properties' not in v: + continue + if 'block_device_mapping' not in v['properties']: + continue + + vm_type = get_vm_type_for_nova_server(v) + if not vm_type: + continue + vm_type = vm_type.lower() + + # get the volume_id from the block_device_mapping + properties = v['properties'] + for v2 in properties['block_device_mapping']: + for k3, v3 in v2.items(): + if k3 != 'volume_id': + continue + if not isinstance(v3, dict): + continue + + volume_id = ( + v3.get('get_param') or + v3.get('get_resource')) + if not volume_id: + continue + volume_id = volume_id.lower() + + if vm_type+"_" not in volume_id: + invalid_volumes.append(volume_id) + + elif v['type'] == 'OS::Cinder::VolumeAttachment': + # check the volume attachment and the {vm_type} + # of the corresponding nova server + if 'properties' not in v: + continue + if 'volume_id' not in v['properties']: + continue + if 'instance_uuid' not in v['properties']: + continue + + properties = v['properties'] + + # get the instance_uuid and when applicable + # the nova server instance + instance_uuid = None + nova_server = None + + if 'get_param' in properties['instance_uuid']: + continue + elif 'get_resource' in properties['instance_uuid']: + instance_uuid = properties['instance_uuid']['get_resource'] + if not resources[instance_uuid]: + continue + nova_server = resources[instance_uuid] + instance_uuid = instance_uuid.lower() + else: + continue + + # get the volume_id + volume_id = None + volume_id = ( + properties['volume_id'].get('get_param') or + properties['volume_id'].get('get_resource')) + if not volume_id: + continue + volume_id = volume_id.lower() + + # do not test the case when the instance_uuid and + # volume_id are not defined + if not instance_uuid and not volume_id: + continue + + if nova_server: + vm_type = get_vm_type_for_nova_server(nova_server) + if not vm_type: + continue + vm_type = vm_type.lower() + if vm_type+"_" not in volume_id: + invalid_volumes.append(volume_id) + else: + # extract the assumed {vm_type} from volume_id + m = volume_pattern.match(volume_id) + if m: + vm_type = m.group(1).lower() + if vm_type+"_" not in instance_uuid: + invalid_volumes.append(volume_id) + else: + continue + + assert not set(invalid_volumes) diff --git a/ice_validator/tests/test_volume_templates.py b/ice_validator/tests/test_volume_templates.py new file mode 100644 index 0000000..d30ee19 --- /dev/null +++ b/ice_validator/tests/test_volume_templates.py @@ -0,0 +1,67 @@ +# -*- 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. +# + +import yaml +import pytest + + +def test_volume_templates_only_contains_cinder(volume_template): + ''' + Check that all templates marked as volume templates are + in fact volume templates + ''' + with open(volume_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + non_volumes = [] + for k, v in yml["resources"].items(): + if not isinstance(v, dict): + continue + if "type" not in v: + continue + if v["type"] not in ["OS::Cinder::Volume", + "OS::Heat::ResourceGroup"]: + non_volumes.append(k) + + assert not set(non_volumes) diff --git a/ice_validator/tests/test_volume_templates_outputs.py b/ice_validator/tests/test_volume_templates_outputs.py new file mode 100644 index 0000000..975afb7 --- /dev/null +++ b/ice_validator/tests/test_volume_templates_outputs.py @@ -0,0 +1,50 @@ +# -*- 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. +# + +import yaml + + +def test_volume_templates_contains_outputs(volume_template): + ''' + Check that all volume templates include outputs + ''' + with open(volume_template) as fh: + yml = yaml.load(fh) + assert "outputs" in yml diff --git a/ice_validator/tests/test_volume_templates_outputs_resources.py b/ice_validator/tests/test_volume_templates_outputs_resources.py new file mode 100644 index 0000000..85a9d02 --- /dev/null +++ b/ice_validator/tests/test_volume_templates_outputs_resources.py @@ -0,0 +1,80 @@ +# -*- 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. +# + +import yaml +import pytest +from .utils.nested_iterables import find_all_get_resource_in_yml + + +def test_volume_templates_outputs_match_resources(volume_template): + ''' + Check that all referenced resources in the outputs of a volume + template actually exists + ''' + with open(volume_template) as fh: + yml = yaml.load(fh) + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the volume template") + + # skip if outputs are not defined + if "outputs" not in yml: + pytest.skip("No outputs specified in the volume template") + + referenced_resources = find_all_get_resource_in_yml(yml['outputs']) + + invalid_get_attr = [] + for k, v in yml['outputs'].items(): + if 'value' not in v: + continue + if 'get_attr' not in v['value']: + continue + if not isinstance(v['value']['get_attr'], list): + continue + + for v1 in v['value']['get_attr']: + if v1 in yml['resources']: + break + else: + invalid_get_attr.append(k) + + assert (set(referenced_resources) <= set(yml["resources"]) and + not invalid_get_attr) diff --git a/ice_validator/tests/utils/__init__.py b/ice_validator/tests/utils/__init__.py new file mode 100644 index 0000000..e8f24cd --- /dev/null +++ b/ice_validator/tests/utils/__init__.py @@ -0,0 +1,39 @@ +# -*- 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. +# diff --git a/ice_validator/tests/utils/nested_files.py b/ice_validator/tests/utils/nested_files.py new file mode 100644 index 0000000..cc506d0 --- /dev/null +++ b/ice_validator/tests/utils/nested_files.py @@ -0,0 +1,142 @@ +# -*- 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. +# + +import yaml +import re +from os import path + + +def get_list_of_nested_files(yml, dirpath): + ''' + return a list of all nested files + ''' + + if not hasattr(yml, 'items'): + return [] + + nested_files = [] + + for k, v in yml.items(): + if isinstance(v, dict) and "type" in v: + t = v["type"] + if t.endswith(".yml") or t.endswith(".yaml"): + filepath = path.join(dirpath, t) + with open(filepath) as fh: + t_yml = yaml.load(fh) + nested_files.append(filepath) + nested_files.extend(get_list_of_nested_files(t_yml, dirpath)) + elif t == "OS::Heat::ResourceGroup": + rdt = v["properties"]["resource_def"]["type"] + if rdt.endswith(".yml") or rdt.endswith(".yaml"): + filepath = path.join(dirpath, rdt) + with open(filepath) as fh: + rdt_yml = yaml.load(fh) + nested_files.append(filepath) + nested_files.extend( + get_list_of_nested_files(rdt_yml, dirpath)) + if isinstance(v, dict): + nested_files.extend( + get_list_of_nested_files(v, dirpath)) + elif isinstance(v, list): + for d in v: + nested_files.extend( + get_list_of_nested_files(d, dirpath)) + return nested_files + + +def check_for_invalid_nesting(yml, yaml_file, dirpath): + ''' + return a list of all nested files + ''' + + if not hasattr(yml, 'items'): + return [] + + invalid_nesting = [] + p = re.compile('^[A-z]*::[A-z]*::[A-z]*$') + + for k, v in yml.items(): + if isinstance(v, dict) and "type" in v: + t = v["type"] + + if t.endswith(".yml") or t.endswith(".yaml"): + filepath = path.join(dirpath, t) + try: + with open(filepath) as fh: + t_yml = yaml.load(fh) + except Exception as e: + invalid_nesting.append(filepath) + print(e) + invalid_nesting.extend( + check_for_invalid_nesting(t_yml, + filepath, + dirpath)) + elif t == "OS::Heat::ResourceGroup": + rd = v["properties"]["resource_def"] + if not isinstance(rd, dict): + invalid_nesting.append(yaml_file) + elif "type" not in rd: + invalid_nesting.append(yaml_file) + elif not p.match(rd["type"]) and not \ + (rd["type"].endswith(".yml") + or rd["type"].endswith(".yaml")): + filepath = path.join(dirpath, rd["type"]) + try: + with open(filepath) as fh: + rdt_yml = yaml.load(fh) + except Exception as e: + invalid_nesting.append(filepath) + print(e) + invalid_nesting.extend( + check_for_invalid_nesting(rdt_yml, + filepath, + dirpath)) + if isinstance(v, dict): + invalid_nesting.extend( + check_for_invalid_nesting(v, + yaml_file, + dirpath)) + elif isinstance(v, list): + for d in v: + invalid_nesting.extend( + check_for_invalid_nesting(d, + yaml_file, + dirpath)) + return invalid_nesting diff --git a/ice_validator/tests/utils/nested_iterables.py b/ice_validator/tests/utils/nested_iterables.py new file mode 100644 index 0000000..47b0609 --- /dev/null +++ b/ice_validator/tests/utils/nested_iterables.py @@ -0,0 +1,207 @@ +# -*- 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. +# + + +def parse_nested_dict(d, key=""): + ''' + parse the nested dictionary and return values of + given key of function parameter only + ''' + nested_elements = [] + for k, v in d.items(): + if isinstance(v, dict): + sub_dict = parse_nested_dict(v, key) + nested_elements.extend(sub_dict) + else: + if key: + if k == key: + nested_elements.append(v) + else: + nested_elements.append(v) + + return nested_elements + + +def find_all_get_param_in_yml(yml): + ''' + Recursively find all referenced parameters in a parsed yaml body + and return a list of parameters + ''' + os_pseudo_parameters = ['OS::stack_name', + 'OS::stack_id', + 'OS::project_id'] + + if not hasattr(yml, 'items'): + return [] + params = [] + for k, v in yml.items(): + if k == 'get_param' and v not in os_pseudo_parameters: + for item in (v if isinstance(v, list) else [v]): + if isinstance(item, dict): + params.extend(find_all_get_param_in_yml(item)) + elif isinstance(item, str): + params.append(item) + continue + if isinstance(v, dict): + params.extend(find_all_get_param_in_yml(v)) + elif isinstance(v, list): + for d in v: + params.extend(find_all_get_param_in_yml(d)) + return params + + +def find_all_get_resource_in_yml(yml): + ''' + Recursively find all referenced resources + in a parsed yaml body and return a list of resource ids + ''' + if not hasattr(yml, 'items'): + return [] + resources = [] + for k, v in yml.items(): + if k == 'get_resource': + if isinstance(v, list): + resources.append(v[0]) + else: + resources.append(v) + continue + if isinstance(v, dict): + resources.extend(find_all_get_resource_in_yml(v)) + elif isinstance(v, list): + for d in v: + resources.extend(find_all_get_resource_in_yml(d)) + return resources + + +def find_all_get_file_in_yml(yml): + ''' + Recursively find all get_file in a parsed yaml body + and return the list of referenced files/urls + ''' + if not hasattr(yml, 'items'): + return [] + resources = [] + for k, v in yml.items(): + if k == 'get_file': + if isinstance(v, list): + resources.append(v[0]) + else: + resources.append(v) + continue + if isinstance(v, dict): + resources.extend(find_all_get_file_in_yml(v)) + elif isinstance(v, list): + for d in v: + resources.extend(find_all_get_file_in_yml(d)) + return resources + + +def find_all_get_resource_in_resource(resource): + ''' + Recursively find all referenced resources + in a heat resource and return a list of resource ids + ''' + if not hasattr(resource, 'items'): + return [] + + resources = [] + for k, v in resource.items(): + if k == 'get_resource': + if isinstance(v, list): + resources.append(v[0]) + else: + resources.append(v) + continue + if isinstance(v, dict): + resources.extend( + find_all_get_resource_in_resource(v)) + elif isinstance(v, list): + for d in v: + resources.extend( + find_all_get_resource_in_resource(d)) + return resources + + +def get_associated_resources_per_resource(resources): + ''' + Recursively find all referenced resources for each resource + in a list of resource ids + ''' + if not hasattr(resources, 'items'): + return None + + resources_dict = {} + resources_dict["resources"] = {} + ref_resources = [] + + for res_key, res_value in resources.items(): + get_resources = [] + + for k, v in res_value: + if k == 'get_resource' and\ + isinstance(v, dict): + get_resources = find_all_get_resource_in_resource(v) + + # if resources found, add to dict + if get_resources: + ref_resources.extend(get_resources) + resources_dict["resources"][res_key] = { + "res_value": res_value, + "get_resources": get_resources, + } + + resources_dict["ref_resources"] = set(ref_resources) + + return resources_dict + + +def flatten(items): + ''' + flatten items from any nested iterable + ''' + + merged_list = [] + for item in items: + if isinstance(item, list): + sub_list = flatten(item) + merged_list.extend(sub_list) + else: + merged_list.append(item) + return merged_list diff --git a/ice_validator/tests/utils/network_roles.py b/ice_validator/tests/utils/network_roles.py new file mode 100644 index 0000000..5a551ab --- /dev/null +++ b/ice_validator/tests/utils/network_roles.py @@ -0,0 +1,163 @@ +# -*- 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. +# + +import re +import socket + + +def get_network_role_from_port(resource): + ''' + get the network role from a neutron port resource + ''' + if not isinstance(resource, dict): + return None + if 'type' not in resource: + return None + if resource['type'] != 'OS::Neutron::Port': + return None + if 'properties' not in resource: + return None + + formats = [ + ["network", "string", "internal", + re.compile(r'int_(.+?)_net_id')], + ["network", "string", "internal", + re.compile(r'int_(.+?)_net_name')], + ["network", "string", "external", + re.compile(r'(.+?)_net_id')], + ["network", "string", "external", + re.compile(r'(.+?)_net_name')], + ] + + for k1, v1 in resource["properties"].items(): + if k1 != 'network': + continue + + # get the network id or name + network = ( + v1.get('get_param') or + v1.get('get_resource')) + if not network: + continue + + for v2 in formats: + m = v2[3].match(network) + if m and m.group(1): + return m.group(1) + + return None + + +def get_network_type_from_port(resource): + ''' + get the network type from a neutron port resource + ''' + if not isinstance(resource, dict): + return None + if 'type' not in resource: + return None + if resource['type'] != 'OS::Neutron::Port': + return None + if 'properties' not in resource: + return None + + formats = [ + ["network", "string", "internal", + re.compile(r'int_(.+?)_net_id')], + ["network", "string", "internal", + re.compile(r'int_(.+?)_net_name')], + ["network", "string", "external", + re.compile(r'(.+?)_net_id')], + ["network", "string", "external", + re.compile(r'(.+?)_net_name')], + ] + + for k1, v1 in resource["properties"].items(): + if k1 != 'network': + continue + if "get_param" not in v1: + continue + for v2 in formats: + m = v2[3].match(v1["get_param"]) + if m and m.group(1): + return v2[2] + + return None + + +def is_valid_ip_address(ip_address, ip_type='ipv4'): + ''' + check if an ip address is valid + ''' + if ip_type == 'ipv4': + return is_valid_ipv4_address(ip_address) + elif ip_type == 'ipv6': + return is_valid_ipv6_address(ip_address) + return False + + +def is_valid_ipv4_address(ip_address): + ''' + check if an ip address of the type ipv4 + is valid + ''' + try: + socket.inet_pton(socket.AF_INET, ip_address) + except AttributeError: + try: + socket.inet_aton(ip_address) + except (OSError, socket.error): + return False + return ip_address.count('.') == 3 + except (OSError, socket.error): + return False + return True + + +def is_valid_ipv6_address(ip_address): + ''' + check if an ip address of the type ipv6 + is valid + ''' + try: + socket.inet_pton(socket.AF_INET6, ip_address) + except (OSError, socket.error): + return False + return True diff --git a/ice_validator/tests/utils/ports.py b/ice_validator/tests/utils/ports.py new file mode 100644 index 0000000..51e920a --- /dev/null +++ b/ice_validator/tests/utils/ports.py @@ -0,0 +1,179 @@ +# -*- 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. +# + +from .network_roles import get_network_role_from_port +from .vm_types import get_vm_type_for_nova_server +import re + + +def is_valid_ip_address(ip_address, vm_type, network_role, port_property): + ''' + Check the ip_address to make sure it is properly formatted and + also contains {vm_type} and {network_role} + ''' + + allowed_formats = [ + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_v6_ip')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_ip')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_floating_v6_ip')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_floating_ip')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ip_\d+')], + ["allowed_address_pairs", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_ip_\d+')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_v6_ip_\d+')], + ["allowed_address_pairs", "string", "external", + re.compile(r'(.+?)_ip_\d+')], + ["allowed_address_pairs", "comma_delimited_list", + "internal", re.compile(r'(.+?)_int_(.+?)_v6_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "internal", re.compile(r'(.+?)_int_(.+?)_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "external", re.compile(r'(.+?)_v6_ips')], + ["allowed_address_pairs", "comma_delimited_list", + "external", re.compile(r'(.+?)_ips')], + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ip_\d+')], + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_ip_\d+')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_v6_ip_\d+')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_ip_\d+')], + ["fixed_ips", "comma_delimited_list", "internal", + re.compile(r'(.+?)_int_(.+?)_v6_ips')], + ["fixed_ips", "comma_delimited_list", "internal", + re.compile(r'(.+?)_int_(.+?)_ips')], + ["fixed_ips", "comma_delimited_list", "external", + re.compile(r'(.+?)_v6_ips')], + ["fixed_ips", "comma_delimited_list", "external", + re.compile(r'(.+?)_ips')], + ] + + for v3 in allowed_formats: + if v3[0] != port_property: + continue + # check if pattern matches + m = v3[3].match(ip_address) + if m: + if (v3[2] == "internal" and + len(m.groups()) > 1): + return m.group(1) == vm_type and\ + m.group(2) == network_role + elif (v3[2] == "external" and + len(m.groups()) > 0): + return m.group(1) == vm_type + "_" + network_role + + return False + + +def get_invalid_ip_addresses(resources, port_property): + ''' + Get a list of valid ip addresses for a heat resources section + ''' + invalid_ip_addresses = [] + + for k, v in resources.items(): + if not isinstance(v, dict): + continue + if 'type' not in v: + continue + if v['type'] not in 'OS::Nova::Server': + continue + if 'properties' not in v: + continue + if 'networks' not in v['properties']: + continue + + port_resource = None + + vm_type = get_vm_type_for_nova_server(v) + if not vm_type: + continue + + # get all ports associated with the nova server + properties = v['properties'] + for network in properties['networks']: + for k3, v3 in network.items(): + if k3 != 'port': + continue + if not isinstance(v3, dict): + continue + + if 'get_resource' in v3: + port_id = v3['get_resource'] + if not resources[port_id]: + continue + port_resource = resources[port_id] + else: + continue + + network_role = get_network_role_from_port(port_resource) + if not network_role: + continue + + for k1, v1 in port_resource["properties"].items(): + if k1 != port_property: + continue + for v2 in v1: + if "ip_address" not in v2: + continue + if "get_param" not in v2["ip_address"]: + continue + + ip_address = v2["ip_address"]["get_param"] + + if isinstance(ip_address, list): + ip_address = ip_address[0] + + valid_ip_address = is_valid_ip_address(ip_address, + vm_type, + network_role, + port_property) + + if not valid_ip_address: + invalid_ip_addresses.append(ip_address) + + return invalid_ip_addresses diff --git a/ice_validator/tests/utils/vm_types.py b/ice_validator/tests/utils/vm_types.py new file mode 100644 index 0000000..5bd447b --- /dev/null +++ b/ice_validator/tests/utils/vm_types.py @@ -0,0 +1,117 @@ +# -*- 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. +# + +import re + + +def get_vm_types_for_resource(resource): + ''' + Get all unique vm_types for a resource + Notes: + - Returns set([]) if the resource is not formatted + properly, the passed resource is not a nova server + - If more than one vm_type is detected all vm_types will + be returned + ''' + if not isinstance(resource, dict): + return set() + if 'type' not in resource: + return set() + if resource['type'] != 'OS::Nova::Server': + return set() + if 'properties' not in resource: + return set() + + key_values = ["name", "flavor", "image"] + key_value_formats = [ + ["name", "string", + re.compile(r'(.+?)_name_\d+')], + ["name", "comma_delimited_list", + re.compile(r'(.+?)_names')], + ["flavor", "string", + re.compile(r'(.+?)_flavor_name')], + ["image", "string", + re.compile(r'(.+?)_image_name')], + ] + + vm_types = [] + for k2, v2 in resource['properties'].items(): + if k2 not in key_values: + continue + if "get_param" not in v2: + continue + formats = [v for v in key_value_formats if v[0] == k2] + for v3 in formats: + param = v2["get_param"] + if isinstance(param, list): + param = param[0] + m = v3[2].match(param) + if m and m.group(1): + vm_types.append(m.group(1)) + + return set(vm_types) + + +def get_vm_type_for_nova_server(resource): + ''' + Get the vm_type for a resource + Note: Returns None if not exactly one vm_type + is detected, if the resource is not formatted properly, or + the passed resource is not a nova server + ''' + vm_types = get_vm_types_for_resource(resource) + + # if more than one vm_type was identified, return None + if len(vm_types) > 1: + return None + + return vm_types.pop() + + +def get_vm_types(resources): + ''' + Get all vm_types for a list of heat resources, do note that + some of the values retrieved may be invalid + ''' + vm_types = [] + for v in resources.values(): + vm_types.extend(list(get_vm_types_for_resource(v))) + + return set(vm_types) diff --git a/ice_validator/tests/utils/volumes.py b/ice_validator/tests/utils/volumes.py new file mode 100644 index 0000000..03ac611 --- /dev/null +++ b/ice_validator/tests/utils/volumes.py @@ -0,0 +1,72 @@ +# -*- 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. +# + +import yaml +from os import path + + +def get_volume_resources(heat_template): + ''' + get the resources from the volume template + Note: Returns an empty dict if there is no + volume template or for any other error + ''' + basename = path.splitext(heat_template)[0] + + for ext in ['.yaml', '.yml']: + volume_template = basename + '_volume' + ext + if path.isfile(volume_template): + break + else: + return {} + + try: + with open(volume_template) as fh: + yml = yaml.load(fh) + except Exception as e: + print(e) + return {} + + if 'outputs' not in yml: + return {} + if 'resources' not in yml: + return {} + + return yml['resources'] diff --git a/ice_validator/tests/utils/yaml_custom_utils.py b/ice_validator/tests/utils/yaml_custom_utils.py new file mode 100644 index 0000000..0d292fe --- /dev/null +++ b/ice_validator/tests/utils/yaml_custom_utils.py @@ -0,0 +1,57 @@ +# -*- 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. +# + +from yaml.constructor import ConstructorError + + +def raise_duplicates_keys(loader, node, deep=False): + """Raise error when duplicate keys found in yaml file.""" + + mapping = {} + for key_node, value_node in node.value: + key = loader.construct_object(key_node, deep=deep) + value = loader.construct_object(value_node, deep=deep) + if key in mapping: + raise ConstructorError( + "while constructing a mapping", node.start_mark, + "found duplicate key (%s)" % key, key_node.start_mark) + mapping[key] = value + + return loader.construct_mapping(node, deep) |