X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fvalidation.py;h=761ee2089fe2e81a9c35753ec4c7a1d60706a858;hb=3a144c99f5ef2f73a3995081ea18d776300356e1;hp=b6ef64c1d8aca6e81e83d43c019fbb44c48f2b02;hpb=1f029d84b9597d3986a33dcd847b0d97d2bad077;p=osm%2FNBI.git diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index b6ef64c..761ee20 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -349,6 +349,8 @@ ns_scale = { # TODO for the moment it is only VDU-scaling schema_version = {"type": "string", "enum": ["1.0"]} schema_type = {"type": "string"} +vim_type = {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]} + vim_account_edit_schema = { "title": "vim_account edit input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -356,14 +358,14 @@ vim_account_edit_schema = { "properties": { "name": name_schema, "description": description_schema, - "type": shortname_schema, "vim": name_schema, "datacenter": name_schema, + "vim_type": vim_type, "vim_url": description_schema, - "vim_url_admin": description_schema, - "vim_tenant": name_schema, + # "vim_url_admin": description_schema, + # "vim_tenant": name_schema, "vim_tenant_name": name_schema, - "vim_username": shortname_schema, + "vim_user": shortname_schema, "vim_password": passwd_schema, "config": {"type": "object"} }, @@ -381,7 +383,7 @@ vim_account_new_schema = { "description": description_schema, "vim": name_schema, "datacenter": name_schema, - "vim_type": {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]}, + "vim_type": vim_type, "vim_url": description_schema, # "vim_url_admin": description_schema, # "vim_tenant": name_schema, @@ -394,6 +396,8 @@ vim_account_new_schema = { "additionalProperties": False } +wim_type = {"enum": ["tapi", "onos", "odl", "dynpac", "fake"]} + wim_account_edit_schema = { "title": "wim_account edit input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -401,8 +405,8 @@ wim_account_edit_schema = { "properties": { "name": name_schema, "description": description_schema, - "type": shortname_schema, "wim": name_schema, + "wim_type": wim_type, "wim_url": description_schema, "user": shortname_schema, "password": passwd_schema, @@ -421,7 +425,7 @@ wim_account_new_schema = { "name": name_schema, "description": description_schema, "wim": name_schema, - "wim_type": {"enum": ["tapi", "onos", "odl", "dynpac", "fake"]}, + "wim_type": wim_type, "wim_url": description_schema, "user": shortname_schema, "password": passwd_schema, @@ -631,6 +635,7 @@ user_edit_schema = { } # PROJECTS +topics_with_quota = ["vnfds", "nsds", "nsts", "pdus", "nsrs", "nsis", "vim_accounts", "wim_accounts", "sdns"] project_new_schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "New project schema for administrators", @@ -638,6 +643,11 @@ project_new_schema = { "properties": { "name": shortname_schema, "admin": bool_schema, + "quotas": { + "type": "object", + "properties": {topic: integer0_schema for topic in topics_with_quota}, + "additionalProperties": False + }, }, "required": ["name"], "additionalProperties": False @@ -649,6 +659,11 @@ project_edit_schema = { "properties": { "admin": bool_schema, "name": shortname_schema, # To allow Project Name modification + "quotas": { + "type": "object", + "properties": {topic: {"oneOf": [integer0_schema, null_schema]} for topic in topics_with_quota}, + "additionalProperties": False + }, }, "additionalProperties": False, "minProperties": 1 @@ -807,5 +822,5 @@ def is_valid_uuid(x): try: if UUID(x): return True - except (TypeError, ValueError): + except (TypeError, ValueError, AttributeError): return False