X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fvalidation.py;h=43fd84dbe43b5c9168fd176847d23db3d83b79a7;hp=5b6cce19b75b652ea940914960050372dc1605a5;hb=ecb413205816b971f4ed54499f431846965d0c48;hpb=4ca5152329fcba2f575085df9c0921f6d1135020 diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index 5b6cce1..43fd84d 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -34,6 +34,7 @@ name_schema = {"type": "string", "minLength": 1, "maxLength": 255, "pattern": "^ string_schema = {"type": "string", "minLength": 1, "maxLength": 255} xml_text_schema = {"type": "string", "minLength": 1, "maxLength": 1000, "pattern": "^[^']+$"} description_schema = {"type": ["string", "null"], "maxLength": 255, "pattern": "^[^'\"]+$"} +long_description_schema = {"type": ["string", "null"], "maxLength": 3000, "pattern": "^[^'\"]+$"} id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36} bool_schema = {"type": "boolean"} null_schema = {"type": "null"} @@ -81,6 +82,11 @@ nameshort_list_schema = { "items": shortname_schema, } +description_list_schema = { + "type": "array", + "minItems": 1, + "items": description_schema, +} ns_instantiate_vdu = { "title": "ns action instantiate input schema for vdu", @@ -285,6 +291,7 @@ ns_instantiate = { "nsName": name_schema, "nsDescription": {"oneOf": [description_schema, null_schema]}, "nsdId": id_schema, + "vcaId": id_schema, "vimAccountId": id_schema, "wimAccountId": {"oneOf": [id_schema, bool_schema, null_schema]}, "placement-engine": string_schema, @@ -305,6 +312,7 @@ ns_instantiate = { "properties": { "member-vnf-index": name_schema, "vimAccountId": id_schema, + "vcaId": id_schema, "vdu": { "type": "array", "minItems": 1, @@ -449,6 +457,7 @@ vim_account_edit_schema = { "vim_tenant_name": name_schema, "vim_user": shortname_schema, "vim_password": passwd_schema, + "vca": id_schema, "config": {"type": "object"} }, "additionalProperties": False @@ -472,6 +481,7 @@ vim_account_new_schema = { "vim_tenant_name": name_schema, "vim_user": shortname_schema, "vim_password": passwd_schema, + "vca": id_schema, "config": {"type": "object"} }, "required": ["name", "vim_url", "vim_type", "vim_user", "vim_password", "vim_tenant_name"], @@ -608,6 +618,7 @@ k8scluster_new_schema = { "description": description_schema, "credentials": object_schema, "vim_account": id_schema, + "vca_id": id_schema, "k8s_version": string_schema, "nets": k8scluster_nets_schema, "namespace": name_schema, @@ -625,6 +636,7 @@ k8scluster_edit_schema = { "description": description_schema, "credentials": object_schema, "vim_account": id_schema, + "vca_id": id_schema, "k8s_version": string_schema, "nets": k8scluster_nets_schema, "namespace": name_schema, @@ -633,6 +645,60 @@ k8scluster_edit_schema = { "additionalProperties": False } +# VCA +vca_new_schema = { + "title": "vca creation input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "schema_version": schema_version, + "schema_type": schema_type, + "name": name_schema, + "description": description_schema, + "endpoints": description_list_schema, + "user": shortname_schema, + "secret": passwd_schema, + "cacert": long_description_schema, + "lxd-cloud": shortname_schema, + "lxd-credentials": shortname_schema, + "k8s-cloud": shortname_schema, + "k8s-credentials": shortname_schema, + "model-config": object_schema, + }, + "required": [ + "name", + "endpoints", + "user", + "secret", + "cacert", + "lxd-cloud", + "lxd-credentials", + "k8s-cloud", + "k8s-credentials", + ], + "additionalProperties": False, +} +vca_edit_schema = { + "title": "vca creation input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "name": name_schema, + "description": description_schema, + "endpoints": description_list_schema, + "port": integer1_schema, + "user": shortname_schema, + "secret": passwd_schema, + "cacert": long_description_schema, + "lxd-cloud": shortname_schema, + "lxd-credentials": shortname_schema, + "k8s-cloud": shortname_schema, + "k8s-credentials": shortname_schema, + "model-config": object_schema, + }, + "additionalProperties": False, +} + # K8s Repos k8srepo_types = {"enum": ["helm-chart", "juju-bundle"]} k8srepo_properties = { @@ -832,7 +898,7 @@ user_edit_schema = { # PROJECTS topics_with_quota = ["vnfds", "nsds", "slice_templates", "pduds", "ns_instances", "slice_instances", "vim_accounts", - "wim_accounts", "sdn_controllers", "k8sclusters", "k8srepos", "osmrepos", "ns_subscriptions"] + "wim_accounts", "sdn_controllers", "k8sclusters", "vca", "k8srepos", "osmrepos", "ns_subscriptions"] project_new_schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "New project schema for administrators",