diff options
Diffstat (limited to 'src')
3 files changed, 543 insertions, 345 deletions
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java b/src/main/java/org/onap/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java index 924011901..3d32ff661 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java @@ -61,7 +61,7 @@ public class ToscaMetadataExecutor { String[] processParameters = (processInfo + "/ ").split("/"); logger.info("Executing the Tosca clamp process " + processParameters[0] + " with parameters " + processParameters[1].trim()); - mapOfProcesses.get(processParameters[0]).executeProcess(processParameters[1].trim(), childObject, serviceModel); + mapOfProcesses.get(processParameters[0].trim()).executeProcess(processParameters[1].trim(), childObject, serviceModel); } /** diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file index 49f409ae3..14ae7acd8 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file @@ -1,162 +1,360 @@ tosca_definitions_version: tosca_simple_yaml_1_1_0 policy_types: - onap.policies.controlloop.operational.common.Apex: - derived_from: onap.policies.controlloop.operational.Common - type_version: 1.0.0 - version: 1.0.0 - description: Operational policies for Apex PDP + onap.policies.controlloop.operational.Common: properties: - engineServiceParameters: - type: string - description: The engine parameters like name, instanceCount, policy implementation, parameters etc. + abatement: + name: abatement + type: boolean + typeVersion: 0.0.0 + description: Whether an abatement event message will be expected for + the control loop from DCAE. + default: 'false' required: true - eventInputParameters: - type: string - description: The event input parameters. + constraints: [ + ] + metadata: { + } + operations: + name: operations + type: list + typeVersion: 0.0.0 + description: List of operations to be performed when Control Loop + is triggered. required: true - eventOutputParameters: + constraints: [ + ] + entry_schema: + type: onap.datatype.controlloop.Operation + typeVersion: 0.0.0 + constraints: [ + ] + metadata: { + } + trigger: + name: trigger type: string - description: The event output parameters. + typeVersion: 0.0.0 + description: Initial operation to execute upon receiving an Onset + event message for the Control Loop. required: true - javaProperties: + constraints: [ + ] + metadata: { + } + timeout: + name: timeout + type: integer + typeVersion: 0.0.0 + description: | + Overall timeout for executing all the operations. This timeout should equal or exceed the total + timeout for each operation listed. + required: true + constraints: [ + ] + metadata: { + } + id: + name: id type: string - description: Name/value pairs of properties to be set for APEX if needed. - required: false - onap.policies.controlloop.operational.Common: - derived_from: tosca.policies.Root + typeVersion: 0.0.0 + description: The unique control loop id. + required: true + constraints: [ + ] + metadata: { + } + name: onap.policies.controlloop.operational.Common version: 1.0.0 + derived_from: tosca.policies.Root + metadata: { + } description: | Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant Policy Types. This does NOT support the legacy Policy YAML policy type. + onap.policies.controlloop.operational.common.Apex: properties: - id: + engineServiceParameters: + name: engineServiceParameters type: string - description: The unique control loop id. + typeVersion: 0.0.0 + description: The engine parameters like name, instanceCount, policy + implementation, parameters etc. required: true - timeout: - type: integer - description: | - Overall timeout for executing all the operations. This timeout should equal or exceed the total - timeout for each operation listed. - required: true - abatement: - type: boolean - description: Whether an abatement event message will be expected for the control loop from DCAE. - required: true - default: false - trigger: + constraints: [ + ] + metadata: { + } + eventOutputParameters: + name: eventOutputParameters type: string - description: Initial operation to execute upon receiving an Onset event message for the Control Loop. + typeVersion: 0.0.0 + description: The event output parameters. required: true - operations: - type: list - description: List of operations to be performed when Control Loop is triggered. + constraints: [ + ] + metadata: { + } + javaProperties: + name: javaProperties + type: string + typeVersion: 0.0.0 + description: Name/value pairs of properties to be set for APEX if + needed. + required: false + constraints: [ + ] + metadata: { + } + eventInputParameters: + name: eventInputParameters + type: string + typeVersion: 0.0.0 + description: The event input parameters. required: true - entry_schema: - type: onap.datatype.controlloop.Operation + constraints: [ + ] + metadata: { + } + name: onap.policies.controlloop.operational.common.Apex + version: 1.0.0 + derived_from: onap.policies.controlloop.operational.Common + metadata: { + } + description: Operational policies for Apex PDP data_types: - onap.datatype.controlloop.Target: - derived_from: tosca.datatypes.Root - description: Definition for a entity in A&AI to perform a control loop operation on + onap.datatype.controlloop.Actor: + constraints: [ + ] properties: - targetType: - type: string - description: Category for the target type - required: true - constraints: - - valid_values: [VNF, VM, VFMODULE, PNF] - entityIds: + payload: + name: payload type: map - description: | - Map of values that identify the resource. If none are provided, it is assumed that the - entity that generated the ONSET event will be the target. + typeVersion: 0.0.0 + description: Name/value pairs of payload information passed by Policy + to the actor required: false - metadata: - clamp_possible_values: ClampExecution:CSAR_RESOURCES + constraints: [ + ] entry_schema: type: string - - onap.datatype.controlloop.Actor: - derived_from: tosca.datatypes.Root - description: An actor/operation/target definition - properties: + typeVersion: 0.0.0 + constraints: [ + ] + metadata: + clamp_possible_values: ClampExecution:CDS/payload + target: + name: target + type: onap.datatype.controlloop.Target + typeVersion: 0.0.0 + description: The resource the operation should be performed on. + required: true + constraints: [ + ] + metadata: { + } actor: + name: actor type: string + typeVersion: 0.0.0 description: The actor performing the operation. required: true + constraints: [ + ] metadata: clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor operation: + name: operation type: string + typeVersion: 0.0.0 description: The operation the actor is performing. required: true + constraints: [ + ] metadata: - clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation - target: - type: onap.datatype.controlloop.Target - description: The resource the operation should be performed on. - required: true - payload: - type: map - description: Name/value pairs of payload information passed by Policy to the actor - required: false - metadata: - clamp_possible_values: ClampExecution:CDS/payload - entry_schema: - type: string - - onap.datatype.controlloop.Operation: + clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation + name: onap.datatype.controlloop.Actor + version: 0.0.0 derived_from: tosca.datatypes.Root - description: An operation supported by an actor + metadata: { + } + description: An actor/operation/target definition + onap.datatype.controlloop.Operation: + constraints: [ + ] properties: + failure_retries: + name: failure_retries + type: string + typeVersion: 0.0.0 + description: Points to the operation to invoke when the current operation + has exceeded its max retries. + default: final_failure_retries + required: false + constraints: [ + ] + metadata: { + } id: + name: id type: string + typeVersion: 0.0.0 description: Unique identifier for the operation required: true - description: + constraints: [ + ] + metadata: { + } + failure_timeout: + name: failure_timeout type: string - description: A user-friendly description of the intent for the operation + typeVersion: 0.0.0 + description: Points to the operation to invoke when the time out for + the operation occurs. + default: final_failure_timeout + required: false + constraints: [ + ] + metadata: { + } + failure: + name: failure + type: string + typeVersion: 0.0.0 + description: Points to the operation to invoke on Actor operation + failure. + default: final_failure required: false + constraints: [ + ] + metadata: { + } operation: + name: operation type: onap.datatype.controlloop.Actor + typeVersion: 0.0.0 description: The definition of the operation to be performed. required: true - timeout: + constraints: [ + ] + metadata: { + } + failure_guard: + name: failure_guard + type: string + typeVersion: 0.0.0 + description: Points to the operation to invoke when the current operation + is blocked due to guard policy enforcement. + default: final_failure_guard + required: false + constraints: [ + ] + metadata: { + } + retries: + name: retries type: integer - description: The amount of time for the actor to perform the operation. + typeVersion: 0.0.0 + description: The number of retries the actor should attempt to perform + the operation. + default: '0' required: true - retries: + constraints: [ + ] + metadata: { + } + timeout: + name: timeout type: integer - description: The number of retries the actor should attempt to perform the operation. + typeVersion: 0.0.0 + description: The amount of time for the actor to perform the operation. required: true - default: 0 - success: - type: string - description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation. - required: false - default: final_success - failure: + constraints: [ + ] + metadata: { + } + failure_exception: + name: failure_exception type: string - description: Points to the operation to invoke on Actor operation failure. + typeVersion: 0.0.0 + description: Points to the operation to invoke when the current operation + causes an exception. + default: final_failure_exception required: false - default: final_failure - failure_timeout: + constraints: [ + ] + metadata: { + } + description: + name: description type: string - description: Points to the operation to invoke when the time out for the operation occurs. + typeVersion: 0.0.0 + description: A user-friendly description of the intent for the operation required: false - default: final_failure_timeout - failure_retries: + constraints: [ + ] + metadata: { + } + success: + name: success type: string - description: Points to the operation to invoke when the current operation has exceeded its max retries. + typeVersion: 0.0.0 + description: Points to the operation to invoke on success. A value + of "final_success" indicates and end to the operation. + default: final_success required: false - default: final_failure_retries - failure_exception: - type: string - description: Points to the operation to invoke when the current operation causes an exception. + constraints: [ + ] + metadata: { + } + name: onap.datatype.controlloop.Operation + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: { + } + description: An operation supported by an actor + onap.datatype.controlloop.Target: + constraints: [ + ] + properties: + entityIds: + name: entityIds + type: map + typeVersion: 0.0.0 + description: | + Map of values that identify the resource. If none are provided, it is assumed that the + entity that generated the ONSET event will be the target. required: false - default: final_failure_exception - failure_guard: + constraints: [ + ] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [ + ] + metadata: + clamp_possible_values: ClampExecution:CSAR_RESOURCES + targetType: + name: targetType type: string - description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement. - required: false - default: final_failure_guard
\ No newline at end of file + typeVersion: 0.0.0 + description: Category for the target type + required: true + constraints: + - valid_values: + - VNF + - VM + - VFMODULE + - PNF + metadata: { + } + name: onap.datatype.controlloop.Target + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: { + } + description: Definition for a entity in A&AI to perform a control loop operation + on +name: ToscaServiceTemplateSimple +version: 1.0.0 +metadata: { + } diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json index 3fda11116..687e9b237 100644 --- a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json +++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json @@ -3,32 +3,20 @@ "type": "object", "description": "Operational policies for Apex PDP", "required": [ - "id", - "timeout", "abatement", - "trigger", "operations", + "trigger", + "timeout", + "id", "engineServiceParameters", - "eventInputParameters", - "eventOutputParameters" + "eventOutputParameters", + "eventInputParameters" ], "properties": { - "id": { - "type": "string", - "description": "The unique control loop id." - }, - "timeout": { - "type": "integer", - "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n" - }, "abatement": { "type": "boolean", "description": "Whether an abatement event message will be expected for the control loop from DCAE.", - "default": false - }, - "trigger": { - "type": "string", - "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop." + "default": "false" }, "operations": { "type": "array", @@ -40,88 +28,158 @@ "required": [ "id", "operation", - "timeout", - "retries" + "retries", + "timeout" ], "properties": { + "failure_retries": { + "type": "string", + "description": "Points to the operation to invoke when the current operation has exceeded its max retries.", + "default": "final_failure_retries" + }, "id": { "type": "string", "description": "Unique identifier for the operation" }, - "description": { + "failure_timeout": { "type": "string", - "description": "A user-friendly description of the intent for the operation" + "description": "Points to the operation to invoke when the time out for the operation occurs.", + "default": "final_failure_timeout" + }, + "failure": { + "type": "string", + "description": "Points to the operation to invoke on Actor operation failure.", + "default": "final_failure" }, "operation": { "title": "onap.datatype.controlloop.Actor", "type": "object", "description": "An actor/operation/target definition", "required": [ + "target", "actor", - "operation", - "target" + "operation" ], "properties": { - "actor": { - "type": "string", - "description": "The actor performing the operation.", - "enum": [ - "SDNR", - "SDNC", - "VFC", - "SO", - "APPC", - "CDS" - ], - "options": { - "enum_titles": [ - "SDNR", - "SDNC", - "VFC", - "SO", - "APPC" - ] - } - }, - "operation": { - "type": "string", - "description": "The operation the actor is performing.", + "payload": { + "type": "object", + "description": "Name/value pairs of payload information passed by Policy to the actor", "enum": [ - "BandwidthOnDemand", - "VF Module Delete", - "Reroute", - "VF Module Create", - "ModifyConfig", - "Rebuild", - "Restart", - "Migrate", - "Health-Check", - "resource-assignment", - "activate", - "activate-restconf", - "activate-cli", - "assign-activate", - "imperative-test-wf" - ], - "options": { - "enum_titles": [ - "BandwidthOnDemand (SDNC operation)", - "VF Module Delete (SO operation)", - "Reroute (SDNC operation)", - "VF Module Create (SO operation)", - "ModifyConfig (APPC/VFC operation)", - "Rebuild (APPC operation)", - "Restart (APPC operation)", - "Migrate (APPC operation)", - "Health-Check (APPC operation)", - "resource-assignment (CDS operation)", - "activate (CDS operation)", - "activate-restconf (CDS operation)", - "activate-cli (CDS operation)", - "assign-activate (CDS operation)", - "imperative-test-wf (CDS operation)" - ] - } + { + "title": "resource-assignment", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + }, + { + "title": "activate", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + }, + { + "title": "activate-restconf", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + }, + { + "title": "activate-cli", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + }, + { + "title": "assign-activate", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + }, + { + "title": "imperative-test-wf", + "properties": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "", + "service-instance-id": "", + "vnf-id": "", + "action-name": "", + "scope-type": "", + "hostname": "", + "vnf_name": "" + } + } + } + } + ] }, "target": { "title": "onap.datatype.controlloop.Target", @@ -131,16 +189,6 @@ "targetType" ], "properties": { - "targetType": { - "type": "string", - "description": "Category for the target type", - "enum": [ - "VNF", - "VM", - "VFMODULE", - "PNF" - ] - }, "entityIds": { "type": "object", "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n", @@ -321,180 +369,128 @@ } } ] + }, + "targetType": { + "type": "string", + "description": "Category for the target type", + "enum": [ + "VNF", + "VM", + "VFMODULE", + "PNF" + ] } } }, - "payload": { - "type": "object", - "description": "Name/value pairs of payload information passed by Policy to the actor", + "actor": { + "type": "string", + "description": "The actor performing the operation.", "enum": [ - { - "title": "resource-assignment", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - }, - { - "title": "activate", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - }, - { - "title": "activate-restconf", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - }, - { - "title": "activate-cli", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - }, - { - "title": "assign-activate", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - }, - { - "title": "imperative-test-wf", - "properties": { - "artifact_name": "baseconfiguration", - "artifact_version": "1.0.0", - "mode": "async", - "data": { - "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" - } - } - } - } - ] + "SDNR", + "SDNC", + "VFC", + "SO", + "APPC", + "CDS" + ], + "options": { + "enum_titles": [ + "SDNR", + "SDNC", + "VFC", + "SO", + "APPC" + ] + } + }, + "operation": { + "type": "string", + "description": "The operation the actor is performing.", + "enum": [ + "BandwidthOnDemand", + "VF Module Delete", + "Reroute", + "VF Module Create", + "ModifyConfig", + "Rebuild", + "Restart", + "Migrate", + "Health-Check", + "resource-assignment", + "activate", + "activate-restconf", + "activate-cli", + "assign-activate", + "imperative-test-wf" + ], + "options": { + "enum_titles": [ + "BandwidthOnDemand (SDNC operation)", + "VF Module Delete (SO operation)", + "Reroute (SDNC operation)", + "VF Module Create (SO operation)", + "ModifyConfig (APPC/VFC operation)", + "Rebuild (APPC operation)", + "Restart (APPC operation)", + "Migrate (APPC operation)", + "Health-Check (APPC operation)", + "resource-assignment (CDS operation)", + "activate (CDS operation)", + "activate-restconf (CDS operation)", + "activate-cli (CDS operation)", + "assign-activate (CDS operation)", + "imperative-test-wf (CDS operation)" + ] + } } } }, - "timeout": { - "type": "integer", - "description": "The amount of time for the actor to perform the operation." + "failure_guard": { + "type": "string", + "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.", + "default": "final_failure_guard" }, "retries": { "type": "integer", "description": "The number of retries the actor should attempt to perform the operation.", - "default": 0 + "default": "0" }, - "success": { - "type": "string", - "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.", - "default": "final_success" - }, - "failure": { - "type": "string", - "description": "Points to the operation to invoke on Actor operation failure.", - "default": "final_failure" - }, - "failure_timeout": { - "type": "string", - "description": "Points to the operation to invoke when the time out for the operation occurs.", - "default": "final_failure_timeout" - }, - "failure_retries": { - "type": "string", - "description": "Points to the operation to invoke when the current operation has exceeded its max retries.", - "default": "final_failure_retries" + "timeout": { + "type": "integer", + "description": "The amount of time for the actor to perform the operation." }, "failure_exception": { "type": "string", "description": "Points to the operation to invoke when the current operation causes an exception.", "default": "final_failure_exception" }, - "failure_guard": { + "description": { "type": "string", - "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.", - "default": "final_failure_guard" + "description": "A user-friendly description of the intent for the operation" + }, + "success": { + "type": "string", + "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.", + "default": "final_success" } } } }, - "engineServiceParameters": { + "trigger": { "type": "string", - "description": "The engine parameters like name, instanceCount, policy implementation, parameters etc." + "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop." }, - "eventInputParameters": { + "timeout": { + "type": "integer", + "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n" + }, + "id": { "type": "string", - "description": "The event input parameters." + "description": "The unique control loop id." + }, + "engineServiceParameters": { + "type": "string", + "description": "The engine parameters like name, instanceCount, policy implementation, parameters etc." }, "eventOutputParameters": { "type": "string", @@ -503,6 +499,10 @@ "javaProperties": { "type": "string", "description": "Name/value pairs of properties to be set for APEX if needed." + }, + "eventInputParameters": { + "type": "string", + "description": "The event input parameters." } } }
\ No newline at end of file |