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")
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:
vnfd_list = vnfd_descriptor["vnfd"]
mgmt_iface = False
for vnfd in vnfd_list:
+ vdu_list = vnfd["vdu"]
+ for vdu in vdu_list:
+ interface_list = []
+ external_interface_list = vdu.pop("external-interface", ())
+ for external_interface in external_interface_list:
+ if external_interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'PARAVIRT' instead")
+ interface_list = vdu.get("interface", ())
+ for interface in interface_list:
+ if interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'PARAVIRT' instead")
if vnfd.get("mgmt-interface"):
mgmt_iface = True
+ if vnfd["mgmt-interface"].get("vdu-id"):
+ raise KeyError("'mgmt-iface': Deprecated 'vdu-id' field. Please, use 'cp' field instead")
if not mgmt_iface:
raise KeyError("'mgmt-iface' is a mandatory field and it is not defined")
myvnfd = vnfd_catalog.vnfd()
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")