+array_edition_schema = {
+ "type": "object",
+ "patternProperties": {
+ "^\\$": {}
+ },
+ "additionalProperties": False,
+ "minProperties": 1,
+}
+nameshort_list_schema = {
+ "type": "array",
+ "minItems": 1,
+ "items": shortname_schema,
+}
+
+
+ns_instantiate_vdu = {
+ "title": "ns action instantiate input schema for vdu",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "id": name_schema,
+ "volume": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": name_schema,
+ "vim-volume-id": name_schema,
+ },
+ "required": ["name", "vim-volume-id"],
+ "additionalProperties": False
+ }
+ },
+ "interface": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": name_schema,
+ "ip-address": ip_schema,
+ "mac-address": mac_schema,
+ "floating-ip-required": bool_schema,
+ },
+ "required": ["name"],
+ "additionalProperties": False
+ }
+ }
+ },
+ "required": ["id"],
+ "additionalProperties": False
+}
+
+ip_profile_dns_schema = {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "address": ip_schema,
+ },
+ "required": ["address"],
+ "additionalProperties": False
+ }
+}
+
+ip_profile_dhcp_schema = {
+ "type": "object",
+ "properties": {
+ "enabled": {"type": "boolean"},
+ "count": integer1_schema,
+ "start-address": ip_schema
+ },
+ "additionalProperties": False,
+}
+
+ip_profile_schema = {
+ "title": "ip profile validation schame",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "ip-version": {"enum": ["ipv4", "ipv6"]},
+ "subnet-address": ip_prefix_schema,
+ "gateway-address": ip_schema,
+ "dns-server": ip_profile_dns_schema,
+ "dhcp-params": ip_profile_dhcp_schema,
+ }
+}
+
+ip_profile_update_schema = {
+ "title": "ip profile validation schame",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "ip-version": {"enum": ["ipv4", "ipv6"]},
+ "subnet-address": {"oneOf": [null_schema, ip_prefix_schema]},
+ "gateway-address": {"oneOf": [null_schema, ip_schema]},
+ "dns-server": {"oneOf": [null_schema, ip_profile_dns_schema]},
+
+ "dhcp-params": {"oneOf": [null_schema, ip_profile_dhcp_schema]},
+ },
+ "additionalProperties": False
+}
+
+ns_instantiate_internal_vld = {
+ "title": "ns action instantiate input schema for vdu",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": name_schema,
+ "vim-network-name": name_schema,
+ "vim-network-id": name_schema,
+ "ip-profile": ip_profile_update_schema,
+ "internal-connection-point": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "id-ref": name_schema,
+ "ip-address": ip_schema,
+ # "mac-address": mac_schema,
+ },
+ "required": ["id-ref"],
+ "minProperties": 2,
+ "additionalProperties": False
+ },
+ }
+ },
+ "required": ["name"],
+ "minProperties": 2,
+ "additionalProperties": False
+}
+
+additional_params_for_vnf = {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "member-vnf-index": name_schema,
+ "additionalParams": object_schema,
+ },
+ "required": ["member-vnf-index", "additionalParams"],
+ "additionalProperties": False
+ }
+
+}
+
+ns_instantiate = {
+ "title": "ns action instantiate input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "lcmOperationType": string_schema,
+ "nsInstanceId": id_schema,
+ "netsliceInstanceId": id_schema,
+ "nsName": name_schema,
+ "nsDescription": {"oneOf": [description_schema, null_schema]},
+ "nsdId": id_schema,
+ "vimAccountId": id_schema,
+ "wimAccountId": {"OneOf": [id_schema, bool_schema, null_schema]},
+ "additionalParamsForNs": object_schema,
+ "additionalParamsForVnf": additional_params_for_vnf,
+ "ssh_keys": {"type": "array", "items": {"type": "string"}},
+ "nsr_id": id_schema,
+ "vduImage": name_schema,
+ "vnf": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "member-vnf-index": name_schema,
+ "vimAccountId": id_schema,
+ "vdu": {
+ "type": "array",
+ "minItems": 1,
+ "items": ns_instantiate_vdu,
+ },
+ "internal-vld": {
+ "type": "array",
+ "minItems": 1,
+ "items": ns_instantiate_internal_vld
+ }
+ },
+ "required": ["member-vnf-index"],
+ "minProperties": 2,
+ "additionalProperties": False
+ }
+ },
+ "vld": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": string_schema,
+ "vim-network-name": {"OneOf": [string_schema, object_schema]},
+ "vim-network-id": {"OneOf": [string_schema, object_schema]},
+ "wimAccountId": {"OneOf": [id_schema, bool_schema, null_schema]},
+ "ip-profile": object_schema,
+ "vnfd-connection-point-ref": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "member-vnf-index-ref": name_schema,
+ "vnfd-connection-point-ref": name_schema,
+ "ip-address": ip_schema,
+ # "mac-address": mac_schema,
+ },
+ "required": ["member-vnf-index-ref", "vnfd-connection-point-ref"],
+ "minProperties": 3,
+ "additionalProperties": False
+ },
+ }
+ },
+ "required": ["name"],
+ "additionalProperties": False
+ }
+ },
+ },
+ "required": ["nsName", "nsdId", "vimAccountId"],
+ "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#",
+ "type": "object",
+ "properties": {
+ "lcmOperationType": string_schema,
+ "nsInstanceId": id_schema,
+ "member_vnf_index": name_schema,
+ "vnf_member_index": name_schema, # TODO for backward compatibility. To remove in future
+ "vdu_id": name_schema,
+ "vdu_count_index": integer0_schema,
+ "primitive": name_schema,
+ "primitive_params": {"type": "object"},
+ },
+ "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#",
+ "type": "object",
+ "properties": {
+ "lcmOperationType": string_schema,
+ "nsInstanceId": id_schema,
+ "scaleType": {"enum": ["SCALE_VNF"]},
+ "scaleVnfData": {
+ "type": "object",
+ "properties": {
+ "vnfInstanceId": name_schema,
+ "scaleVnfType": {"enum": ["SCALE_OUT", 'SCALE_IN']},
+ "scaleByStepData": {
+ "type": "object",
+ "properties": {
+ "scaling-group-descriptor": name_schema,
+ "member-vnf-index": name_schema,
+ "scaling-policy": name_schema,
+ },
+ "required": ["scaling-group-descriptor", "member-vnf-index"],
+ "additionalProperties": False
+ },
+ },
+ "required": ["scaleVnfType", "scaleByStepData"], # vnfInstanceId
+ "additionalProperties": False
+ },
+ "scaleTime": time_schema,
+ },
+ "required": ["scaleType", "scaleVnfData"],
+ "additionalProperties": False
+}
+