blob: a9dc8a486619524a91b967aa79c8fdef537899c7 [file] [log] [blame]
garciaale76f6a622020-11-19 17:57:42 -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#
16
17from osm_im.validation import Validation
18import unittest
19
20TESTS_EXAMPLES_FOLDER = 'tests/examples/'
21
22VNFD_FILES = [
23 'alternative_image_sol006.yaml',
24 'cirros_vnfd_sol006.yaml',
25 'epa_sol006.yaml',
26 'etsi_complex_vnfd_sol006.yaml',
27 'hackfest_charmed_vnfd_sol006.yaml',
28 'magma_knf_sol006.yaml',
29 'vepc_sol006.yaml',
30 'vnfd_sol006.yaml'
31]
32
33NSD_FILES = [
34 'cirros_nsd_sol006.yaml',
35 'etsi_nsd_sol006.yaml',
36 'hackfest_charmed_nsd_sol006.yaml',
37 'vepc_nsd_sol006.yaml'
38]
39
40class ValidationTest(unittest.TestCase):
41
42 def test_descriptor_validation_of_etsi_nfv_vnfd(self):
43 for file in VNFD_FILES:
44 file_path = TESTS_EXAMPLES_FOLDER + file
45 with open(file_path, 'r') as vnfd_file:
46 vnfd_file_content = vnfd_file.read()
47 Validation().descriptor_validation(vnfd_file_content)
48
49 def test_descriptor_validation_of_etsi_nfv_nsd(self):
50 for file in NSD_FILES:
51 file_path = TESTS_EXAMPLES_FOLDER + file
52 with open(file_path, 'r') as nsd_file:
53 nsd_file_content = nsd_file.read()
54 Validation().descriptor_validation(nsd_file_content)