X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FIM.git;a=blobdiff_plain;f=tests%2Ftest_validation.py;fp=tests%2Ftest_validation.py;h=a9dc8a486619524a91b967aa79c8fdef537899c7;hp=0000000000000000000000000000000000000000;hb=76f6a62b4cc15bc77cf1270d2b1630524fb2879f;hpb=10ba9c39b590538a68bdbafce02fee7e0c33954d diff --git a/tests/test_validation.py b/tests/test_validation.py new file mode 100644 index 0000000..a9dc8a4 --- /dev/null +++ b/tests/test_validation.py @@ -0,0 +1,54 @@ +# Copyright 2020 Whitestack LLC +# +# 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. +# + +from osm_im.validation import Validation +import unittest + +TESTS_EXAMPLES_FOLDER = 'tests/examples/' + +VNFD_FILES = [ + 'alternative_image_sol006.yaml', + 'cirros_vnfd_sol006.yaml', + 'epa_sol006.yaml', + 'etsi_complex_vnfd_sol006.yaml', + 'hackfest_charmed_vnfd_sol006.yaml', + 'magma_knf_sol006.yaml', + 'vepc_sol006.yaml', + 'vnfd_sol006.yaml' +] + +NSD_FILES = [ + 'cirros_nsd_sol006.yaml', + 'etsi_nsd_sol006.yaml', + 'hackfest_charmed_nsd_sol006.yaml', + 'vepc_nsd_sol006.yaml' +] + +class ValidationTest(unittest.TestCase): + + def test_descriptor_validation_of_etsi_nfv_vnfd(self): + for file in VNFD_FILES: + file_path = TESTS_EXAMPLES_FOLDER + file + with open(file_path, 'r') as vnfd_file: + vnfd_file_content = vnfd_file.read() + Validation().descriptor_validation(vnfd_file_content) + + def test_descriptor_validation_of_etsi_nfv_nsd(self): + for file in NSD_FILES: + file_path = TESTS_EXAMPLES_FOLDER + file + with open(file_path, 'r') as nsd_file: + nsd_file_content = nsd_file.read() + Validation().descriptor_validation(nsd_file_content)