+# NETSLICE SCHEMAS
+nsi_subnet_instantiate = deepcopy(ns_instantiate)
+nsi_subnet_instantiate["title"] = "netslice subnet instantiation params input schema"
+nsi_subnet_instantiate["properties"]["id"] = name_schema
+del nsi_subnet_instantiate["required"]
+
+nsi_vld_instantiate = {
+ "title": "netslice vld instantiation params input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": string_schema,
+ "vim-network-name": {"oneOf": [string_schema, object_schema]},
+ "vim-network-id": {"oneOf": [string_schema, object_schema]},
+ "ip-profile": object_schema,
+ },
+ "required": ["name"],
+ "additionalProperties": False,
+}
+
+nsi_instantiate = {
+ "title": "netslice action instantiate input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "lcmOperationType": string_schema,
+ "netsliceInstanceId": id_schema,
+ "nsiName": name_schema,
+ "nsiDescription": {"oneOf": [description_schema, null_schema]},
+ "nstId": string_schema,
+ "vimAccountId": id_schema,
+ "timeout_nsi_deploy": integer1_schema,
+ "ssh_keys": {"type": "array", "items": {"type": "string"}},
+ "nsi_id": id_schema,
+ "additionalParamsForNsi": object_schema,
+ "netslice-subnet": {
+ "type": "array",
+ "minItems": 1,
+ "items": nsi_subnet_instantiate,
+ },
+ "netslice-vld": {"type": "array", "minItems": 1, "items": nsi_vld_instantiate},
+ },
+ "required": ["nsiName", "nstId", "vimAccountId"],
+ "additionalProperties": False,
+}
+
+nsi_action = {}
+
+nsi_terminate = {}
+
+nsinstancesubscriptionfilter_schema = {
+ "title": "instance identifier schema",
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "nsdIds": {"type": "array"},
+ "vnfdIds": {"type": "array"},
+ "pnfdIds": {"type": "array"},
+ "nsInstanceIds": {"type": "array"},
+ "nsInstanceNames": {"type": "array"},
+ },
+}
+
+nslcmsub_schema = {
+ "title": "nslcmsubscription input schema",
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "nsInstanceSubscriptionFilter": nsinstancesubscriptionfilter_schema,
+ "notificationTypes": {
+ "type": "array",
+ "items": {
+ "enum": [
+ "NsLcmOperationOccurrenceNotification",
+ "NsChangeNotification",
+ "NsIdentifierCreationNotification",
+ "NsIdentifierDeletionNotification",
+ ]
+ },
+ },
+ "operationTypes": {
+ "type": "array",
+ "items": {"enum": ["INSTANTIATE", "SCALE", "TERMINATE", "UPDATE", "HEAL"]},
+ },
+ "operationStates": {
+ "type": "array",
+ "items": {
+ "enum": [
+ "PROCESSING",
+ "COMPLETED",
+ "PARTIALLY_COMPLETED",
+ "FAILED",
+ "FAILED_TEMP",
+ "ROLLING_BACK",
+ "ROLLED_BACK",
+ ]
+ },
+ },
+ "nsComponentTypes": {"type": "array", "items": {"enum": ["VNF", "NS", "PNF"]}},
+ "lcmOpNameImpactingNsComponent": {
+ "type": "array",
+ "items": {
+ "enum": [
+ "VNF_INSTANTIATE",
+ "VNF_SCALE",
+ "VNF_SCALE_TO_LEVEL",
+ "VNF_CHANGE_FLAVOUR",
+ "VNF_TERMINATE",
+ "VNF_HEAL",
+ "VNF_OPERATE",
+ "VNF_CHANGE_EXT_CONN",
+ "VNF_MODIFY_INFO",
+ "NS_INSTANTIATE",
+ "NS_SCALE",
+ "NS_UPDATE",
+ "NS_TERMINATE",
+ "NS_HEAL",
+ ]
+ },
+ },
+ "lcmOpOccStatusImpactingNsComponent": {
+ "type": "array",
+ "items": {
+ "enum": [
+ "START",
+ "COMPLETED",
+ "PARTIALLY_COMPLETED",
+ "FAILED",
+ "ROLLED_BACK",
+ ]
+ },
+ },
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "notificationTypes": {
+ "contains": {"const": "NsLcmOperationOccurrenceNotification"}
+ }
+ },
+ },
+ "then": {
+ "anyOf": [
+ {"required": ["operationTypes"]},
+ {"required": ["operationStates"]},
+ ]
+ },
+ },
+ {
+ "if": {
+ "properties": {
+ "notificationTypes": {"contains": {"const": "NsChangeNotification"}}
+ },
+ },
+ "then": {
+ "anyOf": [
+ {"required": ["nsComponentTypes"]},
+ {"required": ["lcmOpNameImpactingNsComponent"]},
+ {"required": ["lcmOpOccStatusImpactingNsComponent"]},
+ ]
+ },
+ },
+ ],
+}
+
+authentication_schema = {
+ "title": "authentication schema for subscription",
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "authType": {"enum": ["basic"]},
+ "paramsBasic": {
+ "type": "object",
+ "properties": {
+ "userName": string_schema,
+ "password": passwd_schema,
+ },
+ },
+ },
+}
+
+subscription = {
+ "title": "subscription input schema",
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "filter": nslcmsub_schema,
+ "CallbackUri": description_schema,
+ "authentication": authentication_schema,
+ },
+ "required": ["CallbackUri"],
+}
+