X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fvalidation.py;h=54d8eedc8a39a55b85460875903cf826a618bc9f;hp=060a3ebbf4bd377b0401b4c9f8a27d7612fa9d68;hb=70eeb18e4fcbb8bc3c81c88f270b59966ae4d463;hpb=14e6be87a296db26c6e6d97d0ba4d308681e9033 diff --git a/NG-RO/osm_ng_ro/validation.py b/NG-RO/osm_ng_ro/validation.py index 060a3ebb..54d8eedc 100644 --- a/NG-RO/osm_ng_ro/validation.py +++ b/NG-RO/osm_ng_ro/validation.py @@ -31,26 +31,50 @@ ssh_key_schema = {"type": "string", "minLength": 1} id_schema = {"type": "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"} bool_schema = {"type": "boolean"} null_schema = {"type": "null"} +object_schema = {"type": "object"} -image_schema = { - "title": "image input validation", +deploy_item_schema = { + "title": "deploy item validation. Each vld, vdu, flavor, image, ...", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - # TODO + "properties": { + "id": string_schema, + "vim_info": object_schema, + "common_id": string_schema, + }, + "additionalProperties": True } -flavor_schema = { - "title": "image input validation", +deploy_item_list = { + "type": "array", + "items": deploy_item_schema, +} + +deploy_vnf_schema = { + "title": "deploy.vnf.item validation", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - # TODO + "properties": { + "_id": id_schema, + "vdur": deploy_item_list, + "vld": deploy_item_list, + }, + "additionalProperties": True, + "required": ["_id"], } -ns_schema = { - "title": "image input validation", +deploy_action_schema = { + "title": "deploy.action validation", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - # TODO + "properties": { + "action": {"enum": ["inject_ssh_key"]}, + "key": ssh_key_schema, + "user": string_schema, + "password": string_schema, + }, + "additionalProperties": False, + "required": ["action"], } deploy_schema = { @@ -59,34 +83,22 @@ deploy_schema = { "type": "object", "properties": { "action_id": string_schema, - "name": name_schema, - "action": {"enum" ["inject_ssh_key"]}, - "key": ssh_key_schema, - "user": name_schema, - "password": string_schema, + "cloud_init_content": object_schema, + "name": string_schema, + "action": deploy_action_schema, "vnf": { - "type": "object", - "properties": { - "_id": id_schema, - # TODO - }, - "required": ["_id"], - "additionalProperties": True, - }, - "image": { "type": "array", - "minItems": 1, - "items": image_schema + "items": deploy_vnf_schema, }, - "flavor": { - "type": "array", - "minItems": 1, - "items": flavor_schema + "image": deploy_item_list, + "flavor": deploy_item_list, + "ns": { + "type": "object", + "properties": { + "vld": deploy_item_list, + } }, - "ns": ns_schema, }, - - "required": ["name"], "additionalProperties": False }