blob: d763b3eadeeb5b5d230a60cb7a31695f28ae0765 [file] [log] [blame]
garciaale74ed2e52020-10-23 15:28:33 -03001# Copyright 2020 Whitestack LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from osm_im.validation import Validation
17import unittest
18
19TESTS_EXAMPLES_FOLDER = 'tests/examples/'
20
21VNFD_FILES = [
22 'alternative_image_sol006.yaml',
23 'cirros_vnfd_sol006.yaml',
garciaale06c54902020-10-27 15:06:50 -030024 'epa_sol006.yaml',
garciaale74ed2e52020-10-23 15:28:33 -030025 'etsi_complex_vnfd_sol006.yaml',
garciaale06c54902020-10-27 15:06:50 -030026 'hackfest_charmed_vnfd_sol006.yaml',
garciaale74ed2e52020-10-23 15:28:33 -030027 'magma_knf_sol006.yaml',
28 'vepc_sol006.yaml',
29 'vnfd_sol006.yaml'
30]
31
32NSD_FILES = [
33 'cirros_nsd_sol006.yaml',
34 'etsi_nsd_sol006.yaml',
garciaale06c54902020-10-27 15:06:50 -030035 'hackfest_charmed_nsd_sol006.yaml',
garciaale74ed2e52020-10-23 15:28:33 -030036 'vepc_nsd_sol006.yaml'
37]
38
39class ValidationTest(unittest.TestCase):
40
41 def test_descriptor_validation_of_etsi_nfv_vnfd(self):
42 for file in VNFD_FILES:
43 file_path = TESTS_EXAMPLES_FOLDER + file
44 with open(file_path, 'r') as vnfd_file:
45 vnfd_file_content = vnfd_file.read()
46 Validation().descriptor_validation(vnfd_file_content)
47
48 def test_descriptor_validation_of_etsi_nfv_nsd(self):
49 for file in NSD_FILES:
50 file_path = TESTS_EXAMPLES_FOLDER + file
51 with open(file_path, 'r') as nsd_file:
52 nsd_file_content = nsd_file.read()
53 Validation().descriptor_validation(nsd_file_content)