From: garciadeblas Date: Fri, 8 Nov 2019 13:23:04 +0000 (+0100) Subject: validation.py: fix class definition, vnfd and nsd first fields, improved message... X-Git-Tag: v7.0.0rc1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F8131%2F1;p=osm%2FIM.git validation.py: fix class definition, vnfd and nsd first fields, improved message in Exceptions Change-Id: I0bd8094a20898cbf33df26696f24784663e2c791 Signed-off-by: garciadeblas --- diff --git a/osm_im/validation.py b/osm_im/validation.py index 0863434..7334fbb 100644 --- a/osm_im/validation.py +++ b/osm_im/validation.py @@ -25,7 +25,7 @@ import pyangbind.lib.pybindJSON as pybindJSON class ValidationException(Exception): pass -class Validation(): +class Validation: def pyangbind_validation(self, item, data, force=False): ''' @@ -55,15 +55,15 @@ class Validation(): try: data = yaml.safe_load(descriptor) except Exception as e: - raise ValidationException("Error in YAML validation. Not a proper YAML file") - if 'vnfd:vnfd-catalog' in data: + raise ValidationException("Error in YAML validation. Not a proper YAML file: {}".format(e)) + if 'vnfd:vnfd-catalog' in data or 'vnfd-catalog' in data: item = "vnfd" - elif 'nsd:nsd-catalog' in data: + elif 'nsd:nsd-catalog' in data or 'nsd-catalog' in data: item = "nsd" elif 'nst' in data: item = "nst" else: - raise ValidationException("Error in YAML validation. Not possible to determine the type of descriptor in the first line. Expected values: vnfd:vnfd-catalog, nsd:nsd-catalog, nst") + raise ValidationException("Error in YAML validation. Not possible to determine the type of descriptor in the first line. Expected values: vnfd:vnfd-catalog, vnfd-catalog, nsd:nsd-catalog, nsd-catalog, nst") return item, data