X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fvalidation.py;h=a17e2410e82b7e32e28ccc76eb11f4e9c4951eee;hp=d1cfc1df1d0cf7cec1242521f4b6c7cf817f82b0;hb=69964ec5291654ac3895e394148124b8021f13b7;hpb=9fb3271fa1d2568ef693d6f71d25884d7e6ea45e diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index d1cfc1d..a17e241 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -316,6 +316,19 @@ additional_params_for_vnf = { "additionalProperties": False, }, }, + "affinity-or-anti-affinity-group": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": name_schema, + "vim-affinity-group-id": name_schema, + }, + "required": ["id"], + "minProperties": 2, + "additionalProperties": False, + }, + }, }, "required": ["member-vnf-index"], "minProperties": 2, @@ -427,6 +440,57 @@ ns_terminate = { "additionalProperties": False, } +ns_update = { + "title": "ns update input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lcmOperationType": string_schema, + "nsInstanceId": id_schema, + "timeout_ns_update": integer1_schema, + "updateType": { + "enum": ["CHANGE_VNFPKG", "REMOVE_VNF", "MODIFY_VNF_INFORMATION", "OPERATE_VNF"] + }, + "modifyVnfInfoData": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "vnfdId": id_schema, + }, + "required": ["vnfInstanceId", "vnfdId"], + }, + "removeVnfInstanceId": id_schema, + "changeVnfPackageData": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "vnfdId": id_schema, + }, + "required": ["vnfInstanceId", "vnfdId"], + }, + "operateVnfData": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "changeStateTo": name_schema, + "additionalParam": { + "type": "object", + "properties": { + "run-day1": bool_schema, + "vdu_id": name_schema, + "count-index": integer0_schema, + }, + "required": ["vdu_id", "count-index"], + "additionalProperties": False, + } + }, + "required": ["vnfInstanceId", "changeStateTo"], + } + }, + "required": ["updateType"], + "additionalProperties": False, +} + ns_action = { # TODO for the moment it is only contemplated the vnfd primitive execution "title": "ns action input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -446,6 +510,7 @@ ns_action = { # TODO for the moment it is only contemplated the vnfd primitive "required": ["primitive", "primitive_params"], # TODO add member_vnf_index "additionalProperties": False, } + ns_scale = { # TODO for the moment it is only VDU-scaling "title": "ns scale input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -480,6 +545,104 @@ ns_scale = { # TODO for the moment it is only VDU-scaling "additionalProperties": False, } +ns_migrate = { + "title": "ns migrate input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lcmOperationType": string_schema, + "nsInstanceId": id_schema, + "vnfInstanceId": id_schema, + "migrateToHost": string_schema, + "vdu": { + "type": "object", + "properties": { + "vduId": name_schema, + "vduCountIndex": integer0_schema, + }, + "required": ["vduId"], + "additionalProperties": False, + }, + }, + "required": ["vnfInstanceId"], + "additionalProperties": False +} + +ns_heal = { + "title": "ns heal input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lcmOperationType": string_schema, + "nsInstanceId": id_schema, + "timeout_ns_heal": integer1_schema, + "healVnfData": { + "type": "array", + "items": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "cause": description_schema, + "additionalParams": { + "type": "object", + "properties": { + "run-day1": bool_schema, + "vdu": { + "type": "array", + "items": { + "type": "object", + "properties": { + "run-day1": bool_schema, + "vdu-id": name_schema, + "count-index": integer0_schema, + }, + "required": ["vdu-id"], + "additionalProperties": False, + }, + }, + }, + "additionalProperties": False, + }, + }, + "required": ["vnfInstanceId"], + "additionalProperties": False, + }, + }, + }, + "required": ["healVnfData"], + "additionalProperties": False, +} + +ns_verticalscale = { + "title": "vertial scale input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lcmOperationType": string_schema, + "verticalScale": string_schema, + "nsInstanceId": id_schema, + "changeVnfFlavorData": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "additionalParams": { + "type": "object", + "properties": { + "vduid": string_schema, + "vduCountIndex": integer0_schema, + "virtualMemory": integer1_schema, + "sizeOfStorage": integer0_schema, + "numVirtualCpu": integer1_schema, + }, + } + }, + "required": ["vnfInstanceId", "additionalParams"], + "additionalProperties": False, + } + }, + "required": ["lcmOperationType", "verticalScale", "nsInstanceId"], + "additionalProperties": False, +} schema_version = {"type": "string", "enum": ["1.0"]} schema_type = {"type": "string"} @@ -503,6 +666,7 @@ vim_account_edit_schema = { "vim_password": passwd_schema, "vca": id_schema, "config": {"type": "object"}, + "prometheus-config": {"type": "object"}, }, "additionalProperties": False, } @@ -527,6 +691,7 @@ vim_account_new_schema = { "vim_password": passwd_schema, "vca": id_schema, "config": {"type": "object"}, + "prometheus-config": {"type": "object"}, }, "required": [ "name", @@ -648,6 +813,18 @@ sdn_external_port_schema = { } # K8s Clusters +k8scluster_deploy_method_schema = { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Deployment methods for K8s cluster", + "type": "object", + "properties": { + "helm-chart": {"type": "boolean"}, + "juju-bundle": {"type": "boolean"}, + "helm-chart-v3": {"type": "boolean"}, + }, + "additionalProperties": False, + "minProperties": 3, +} k8scluster_nets_schema = { "title": "k8scluster nets input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -670,6 +847,7 @@ k8scluster_new_schema = { "vca_id": id_schema, "k8s_version": string_schema, "nets": k8scluster_nets_schema, + "deployment_methods": k8scluster_deploy_method_schema, "namespace": name_schema, "cni": nameshort_list_schema, }, @@ -924,6 +1102,7 @@ user_edit_schema = { "type": "object", "properties": { "password": passwd_schema, + "old_password": passwd_schema, "username": string_schema, # To allow User Name modification "projects": {"oneOf": [nameshort_list_schema, array_edition_schema]}, "project_role_mappings": project_role_mappings, @@ -1032,6 +1211,8 @@ nbi_new_input_schemas = { "ns_instantiate": ns_instantiate, "ns_action": ns_action, "ns_scale": ns_scale, + "ns_update": ns_update, + "ns_heal": ns_heal, "pdus": pdu_new_schema, } @@ -1237,6 +1418,63 @@ subscription = { "required": ["CallbackUri"], } +vnflcmsub_schema = { + "title": "vnflcmsubscription input schema", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "VnfInstanceSubscriptionFilter": { + "type": "object", + "properties": { + "vnfdIds": {"type": "array"}, + "vnfInstanceIds": {"type": "array"}, + }, + }, + "notificationTypes": { + "type": "array", + "items": { + "enum": [ + "VnfIdentifierCreationNotification", + "VnfLcmOperationOccurrenceNotification", + "VnfIdentifierDeletionNotification" + ] + } + }, + "operationTypes": { + "type": "array", + "items": { + "enum": [ + "INSTANTIATE", "SCALE", "SCALE_TO_LEVEL", "CHANGE_FLAVOUR", "TERMINATE", + "HEAL", "OPERATE", "CHANGE_EXT_CONN", "MODIFY_INFO", "CREATE_SNAPSHOT", + "REVERT_TO_SNAPSHOT", "CHANGE_VNFPKG" + ] + } + }, + "operationStates": { + "type": "array", + "items": { + "enum": [ + "STARTING", "PROCESSING", "COMPLETED", "FAILED_TEMP", "FAILED", + "ROLLING_BACK", "ROLLED_BACK" + ] + } + } + }, + "required": ["VnfInstanceSubscriptionFilter", "notificationTypes"] + } + +vnf_subscription = { + "title": "vnf subscription input schema", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "filter": vnflcmsub_schema, + "CallbackUri": description_schema, + "authentication": authentication_schema + }, + "required": ["filter", "CallbackUri"] +} + class ValidationError(Exception): def __init__(self, message, http_code=HTTPStatus.UNPROCESSABLE_ENTITY):