Adds augments to Makefile and tests for descriptors validation
[osm/IM.git] / tests / test_validation.py
1 # 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 from osm_im.validation import Validation
17 import unittest
18
19 TESTS_EXAMPLES_FOLDER = 'tests/examples/'
20
21 VNFD_FILES = [
22 'alternative_image_sol006.yaml',
23 'cirros_vnfd_sol006.yaml',
24 'etsi_complex_vnfd_sol006.yaml',
25 'magma_knf_sol006.yaml',
26 'vepc_sol006.yaml',
27 'vnfd_sol006.yaml'
28 ]
29
30 NSD_FILES = [
31 'cirros_nsd_sol006.yaml',
32 'etsi_nsd_sol006.yaml',
33 'vepc_nsd_sol006.yaml'
34 ]
35
36 class ValidationTest(unittest.TestCase):
37
38 def test_descriptor_validation_of_etsi_nfv_vnfd(self):
39 for file in VNFD_FILES:
40 file_path = TESTS_EXAMPLES_FOLDER + file
41 with open(file_path, 'r') as vnfd_file:
42 vnfd_file_content = vnfd_file.read()
43 Validation().descriptor_validation(vnfd_file_content)
44
45 def test_descriptor_validation_of_etsi_nfv_nsd(self):
46 for file in NSD_FILES:
47 file_path = TESTS_EXAMPLES_FOLDER + file
48 with open(file_path, 'r') as nsd_file:
49 nsd_file_content = nsd_file.read()
50 Validation().descriptor_validation(nsd_file_content)