1 # Copyright 2020 Whitestack LLC
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 from osm_im
.validation
import Validation
20 TESTS_EXAMPLES_FOLDER
= 'tests/examples/'
23 'alternative_image_sol006.yaml',
24 'cirros_vnfd_sol006.yaml',
26 'etsi_complex_vnfd_sol006.yaml',
27 'hackfest_charmed_vnfd_sol006.yaml',
28 'magma_knf_sol006.yaml',
31 'vnfd_sol006_k8s_scale.yaml',
35 'cirros_nsd_sol006.yaml',
36 'etsi_nsd_sol006.yaml',
37 'hackfest_charmed_nsd_sol006.yaml',
38 'vepc_nsd_sol006.yaml'
41 class ValidationTest(unittest
.TestCase
):
43 def test_descriptor_validation_of_etsi_nfv_vnfd(self
):
44 for file in VNFD_FILES
:
45 file_path
= TESTS_EXAMPLES_FOLDER
+ file
46 with
open(file_path
, 'r') as vnfd_file
:
47 vnfd_file_content
= vnfd_file
.read()
48 Validation().descriptor_validation(vnfd_file_content
)
50 def test_descriptor_validation_of_etsi_nfv_nsd(self
):
51 for file in NSD_FILES
:
52 file_path
= TESTS_EXAMPLES_FOLDER
+ file
53 with
open(file_path
, 'r') as nsd_file
:
54 nsd_file_content
= nsd_file
.read()
55 Validation().descriptor_validation(nsd_file_content
)