X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fvalidation.py;h=5c755221e6b897c4ca0c3934c9e8e292e1e879d5;hp=6a6eeee093f1d19662c43b2fe451080e7da23722;hb=eab1507cb7a80d8881fcee6ba95ee318b6b035d3;hpb=98de2986a4a7d8091c5b629910a756e207d35015 diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index 6a6eeee..5c75522 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -94,6 +94,10 @@ ip_schema = { "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", } +ipv6_schema = { + "type": "string", + "pattern": "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))", +} ip_prefix_schema = { "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}" @@ -153,7 +157,7 @@ ns_instantiate_vdu = { "type": "object", "properties": { "name": name_schema, - "ip-address": ip_schema, + "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, "mac-address": mac_schema, "floating-ip-required": bool_schema, }, @@ -172,7 +176,7 @@ ip_profile_dns_schema = { "items": { "type": "object", "properties": { - "address": ip_schema, + "address": {"oneOf": [ip_schema, ipv6_schema]}, }, "required": ["address"], "additionalProperties": False, @@ -242,7 +246,7 @@ provider_network_schema = { } ns_instantiate_internal_vld = { - "title": "ns action instantiate input schema for vdu", + "title": "ns action instantiate input schema for vld", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { @@ -312,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, @@ -387,7 +404,7 @@ ns_instantiate = { "properties": { "member-vnf-index-ref": name_schema, "vnfd-connection-point-ref": name_schema, - "ip-address": ip_schema, + "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, # "mac-address": mac_schema, }, "required": [ @@ -423,6 +440,39 @@ 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"] + }, + "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"], + }, + }, + "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#", @@ -499,6 +549,7 @@ vim_account_edit_schema = { "vim_password": passwd_schema, "vca": id_schema, "config": {"type": "object"}, + "prometheus-config": {"type": "object"}, }, "additionalProperties": False, } @@ -523,6 +574,7 @@ vim_account_new_schema = { "vim_password": passwd_schema, "vca": id_schema, "config": {"type": "object"}, + "prometheus-config": {"type": "object"}, }, "required": [ "name", @@ -801,7 +853,7 @@ pdu_interface = { "name": shortname_schema, "mgmt": bool_schema, "type": {"enum": ["overlay", "underlay"]}, - "ip-address": ip_schema, + "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, # TODO, add user, password, ssh-key "mac-address": mac_schema, "vim-network-name": shortname_schema, # interface is connected to one vim network, or switch port @@ -920,6 +972,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, @@ -1028,6 +1081,7 @@ nbi_new_input_schemas = { "ns_instantiate": ns_instantiate, "ns_action": ns_action, "ns_scale": ns_scale, + "ns_update": ns_update, "pdus": pdu_new_schema, }