From: gcalvino Date: Wed, 27 Jun 2018 09:02:43 +0000 (+0200) Subject: Adding validations to upgrade and validate scripts(VDU-ID and OM-MGT) X-Git-Tag: v5.0.0~130 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F6420%2F1;p=osm%2Fdevops.git Adding validations to upgrade and validate scripts(VDU-ID and OM-MGT) Signed-off-by: gcalvino --- diff --git a/descriptor-packages/tools/upgrade_descriptor_version.py b/descriptor-packages/tools/upgrade_descriptor_version.py index 66bdbb18..7db1ec6f 100755 --- a/descriptor-packages/tools/upgrade_descriptor_version.py +++ b/descriptor-packages/tools/upgrade_descriptor_version.py @@ -135,8 +135,23 @@ if __name__=="__main__": 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 'VIRTIO' instead") + interface_list = vdu.pop("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 'VIRTIO' 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() diff --git a/descriptor-packages/tools/validate_descriptor.py b/descriptor-packages/tools/validate_descriptor.py index d2888c30..010ba16f 100755 --- a/descriptor-packages/tools/validate_descriptor.py +++ b/descriptor-packages/tools/validate_descriptor.py @@ -119,8 +119,23 @@ if __name__=="__main__": 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 'VIRTIO' instead") + interface_list = vdu.pop("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 'VIRTIO' 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()