From a15a4bc165307623ca0870983cee746e5f761db8 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Thu, 23 Aug 2018 11:31:35 +0800 Subject: pkgtools: remove aria validation backend Based on the community feedback, drop the aria validation backend because it has been retired. Now we use opnfv-toscaparser as the validation backend because it's used by various projects in ONAP and is recommended by ONAP modeling sub-committee. Issue-ID: VNFSDK-292 Change-Id: Iab65185b3303cad78a01ac930ce9e2760c5d4eb4 Signed-off-by: Lianhao Lu --- requirements.txt | 3 +- setup.py | 3 -- tests/validator/test_aria_validator.py | 26 --------------- tox.ini | 1 - vnfsdk_pkgtools/validator/aria_validator.py | 49 ----------------------------- 5 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 tests/validator/test_aria_validator.py delete mode 100644 vnfsdk_pkgtools/validator/aria_validator.py diff --git a/requirements.txt b/requirements.txt index e8df081..dbc2a26 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ ruamel.yaml<0.15 requests>=2.3.0 -#apache-ariatosca==0.1.1 -stevedore >= 1.9.0 +stevedore>=1.9.0 udatetime<1.0,>=0.0.16 nfv-toscaparser<2.0,>=1.0.1 diff --git a/setup.py b/setup.py index 3e0f38f..21cad65 100644 --- a/setup.py +++ b/setup.py @@ -47,8 +47,6 @@ with open(os.path.join(root_dir, 'requirements.txt')) as requirements: else: install_requires.append(requirement) -extras_require['aria'] = 'apache-ariatosca==0.1.1' - version = { } with open(os.path.join(root_dir, 'vnfsdk_pkgtools/version.py')) as fp: exec(fp.read(), version) @@ -86,7 +84,6 @@ setup( 'console_scripts': [ 'vnfsdk = vnfsdk_pkgtools.cli.__main__:main'], 'vnfsdk.pkgtools.validator': [ - 'aria = vnfsdk_pkgtools.validator.aria_validator:AriaValidator [aria]', 'toscaparser = vnfsdk_pkgtools.validator.toscaparser_validator:ToscaparserValidator', ] }, diff --git a/tests/validator/test_aria_validator.py b/tests/validator/test_aria_validator.py deleted file mode 100644 index 6570e12..0000000 --- a/tests/validator/test_aria_validator.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2018 Intel Corp. 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. -# - -import os - -from vnfsdk_pkgtools.packager import csar -from vnfsdk_pkgtools.validator import aria_validator - -CSAR_PATH = 'tests/resources/test_import.csar' - -def test_validate(tmpdir): - reader = csar._CSARReader(CSAR_PATH, str(tmpdir.mkdir('validate'))) - validator = aria_validator.AriaValidator() - validator.validate(reader) diff --git a/tox.ini b/tox.ini index efdc361..b4e2212 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,6 @@ basepython = [testenv:py27] commands = - pip install 'apache-ariatosca==0.1.1' coverage run --module pytest --junitxml xunit-results.xml tests/ coverage xml --omit=".tox/py27/*","tests/*" coverage report --omit=".tox/py27/*","tests/*" diff --git a/vnfsdk_pkgtools/validator/aria_validator.py b/vnfsdk_pkgtools/validator/aria_validator.py deleted file mode 100644 index e84d017..0000000 --- a/vnfsdk_pkgtools/validator/aria_validator.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2017 Intel Corp. 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. -# - -import os - -from aria import install_aria_extensions -from aria.parser.loading import UriLocation -from aria.parser.consumption import ( - ConsumptionContext, - ConsumerChain, - Read, - Validate, - ServiceTemplate, - ServiceInstance -) - -from vnfsdk_pkgtools import validator - - -class AriaValidator(validator.ValidatorBase): - def __init__(self): - super(AriaValidator, self).__init__() - install_aria_extensions() - - def validate(self, reader): - context = ConsumptionContext() - service_template_path = os.path.join(reader.destination, - reader.entry_definitions) - context.presentation.location = UriLocation(service_template_path) - print(reader.entry_definitions_yaml) - chain = ConsumerChain(context, (Read, Validate, ServiceTemplate, ServiceInstance)) - chain.consume() - if context.validation.dump_issues(): - raise RuntimeError('Validation failed') - dumper = chain.consumers[-1] - dumper.dump() - -- cgit 1.2.3-korg