Add validation to Network Slice descriptor in validate_descriptor.py 88/6988/2
authorgcalvino <guillermo.calvinosanchez@altran.com>
Wed, 28 Nov 2018 15:27:20 +0000 (16:27 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 30 Nov 2018 13:44:09 +0000 (15:44 +0200)
Change-Id: I1e0e09e8caba1dd0f8a8c95b7ba454eaae0333eb
Signed-off-by: gcalvino <guillermo.calvinosanchez@altran.com>
descriptor-packages/tools/validate_descriptor.py

index 40fcb23..6ae9836 100755 (executable)
@@ -38,8 +38,8 @@ class ArgumentParserError(Exception):
 
 def usage():
     print("Usage: {} [options] FILE".format(sys.argv[0]))
-    print(" EXPERIMENTAL: Validates vnfd, nsd descriptors format")
-    print(" FILE: a yaml or json vnfd-catalog or nsd-catalog descriptor")
+    print(" Validates vnfd, nsd and nst descriptors format")
+    print(" FILE: a yaml or json vnfd-catalog, nsd-catalog or nst descriptor")
     print(" OPTIONS:")
     print("      -v|--version: prints current version")
     print("      -h|--help: shows this help")
@@ -109,6 +109,7 @@ if __name__=="__main__":
 
         import osm_im.vnfd as vnfd_catalog
         import osm_im.nsd as nsd_catalog
+        import osm_im.nst as nst_catalog
         from pyangbind.lib.serialise import pybindJSONDecoder
 
         if "vnfd:vnfd-catalog" in data or "vnfd-catalog" in data:
@@ -144,6 +145,10 @@ if __name__=="__main__":
             descriptor = "NS"
             mynsd = nsd_catalog.nsd()
             pybindJSONDecoder.load_ietf_json(data, None, None, obj=mynsd)
+        elif "nst:nst" in data or "nst" in data:
+            descriptor = "NST"
+            mynst = nst_catalog.nst()
+            pybindJSONDecoder.load_ietf_json(data, None, None, obj=mynst)
         else:
             descriptor = None
             raise KeyError("This is not neither nsd-catalog nor vnfd-catalog descriptor")