From c4dcf1aac48980494d95a5640a7ab7a3c2d345d5 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Sat, 10 Nov 2018 11:54:05 -0500 Subject: Controller Design Studio Upgrade Spring Boot and Kotlin versions. Change-Id: If0d7d0f476d8cfd23916013ff1ab554b26bc6b7a Issue-ID: CCSDK-658 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../vFW/Definitions/vFW_spinup.json | 3613 ++++++++++++++++++++ .../vFW/TOSCA-Metadata/TOSCA.meta | 6 + .../vFW/Templates/base_template.vtl | 56 + .../vFW/Templates/vFW_vNF_Artifact.vtl | 203 ++ .../service-blueprint/vFW/Templates/vfw.vtl | 315 ++ .../service-blueprint/vFW/Templates/vpg.vtl | 315 ++ .../service-blueprint/vFW/Templates/vsn.vtl | 311 ++ .../Definitions/activation-blueprint.json | 388 +++ .../Mappings/baseconfig-mapping.json | 3 + .../baseconfiguration/Plans/ActivateProcess.bpmn | 66 + .../Scripts/SamplePythonComponentNode.py | 8 + .../baseconfiguration/Scripts/__init__.py | 0 .../baseconfiguration/TOSCA-Metadata/TOSCA.meta | 8 + .../Templates/baseconfig-template.vtl | 1 + .../artifact_type/artifact-bpmn-camunda.json | 8 + .../artifact_type/artifact-directed-graph.json | 9 + .../artifact_type/artifact-mapping-resource.json | 8 + .../artifact_type/artifact-script-python.json | 8 + .../artifact_type/artifact-template-velocity.json | 8 + .../tosca.artifacts.Implementation.json | 5 + .../starter-type/data_type/datatype-property.json | 27 + .../data_type/datatype-resource-assignment.json | 46 + .../starter-type/data_type/dt-license-key.json | 11 + .../starter-type/data_type/dt-v4-aggregate.json | 15 + .../data_type/tosca.datatypes.Credential.json | 31 + .../node_type/artifact-config-template.json | 37 + .../node_type/component-config-generator.json | 72 + .../node_type/component-netconf-executor.json | 79 + .../node_type/component-resource-assignment.json | 68 + .../node_type/dg-activate-netconf.json | 52 + .../node_type/dg-config-generator.json | 51 + .../node_type/dg-resource-assign-activate.json | 56 + .../node_type/dg-resource-assignment.json | 51 + .../starter-type/node_type/source-db.json | 44 + .../starter-type/node_type/source-default.json | 18 + .../starter-type/node_type/source-input.json | 18 + .../starter-type/node_type/source-rest.json | 61 + .../node_type/tosca.nodes.Artifact.json | 5 + .../node_type/tosca.nodes.Component.json | 5 + .../starter-type/node_type/tosca.nodes.DG.json | 5 + .../node_type/tosca.nodes.ResourceSource.json | 5 + .../starter-type/node_type/tosca.nodes.Vnf.json | 5 + .../node_type/tosca.nodes.component.Python.json | 5 + .../starter-type/node_type/vnf-netconf-device.json | 42 + .../starter-dictionary/address.json | 14 + .../starter-dictionary/aic-cloud-region.json | 15 + .../starter-dictionary/aic_clli.json | 15 + .../starter-dictionary/availability_zone_0.json | 15 + .../starter-dictionary/db-source.json | 24 + .../starter-dictionary/default-source.json | 16 + .../starter-dictionary/image_name.json | 33 + .../starter-dictionary/input-source.json | 16 + .../starter-dictionary/key_name.json | 33 + .../starter-dictionary/mdsal-source.json | 34 + .../starter-dictionary/name_0.json | 15 + .../starter-dictionary/nexus_artifact_repo.json | 16 + .../starter-dictionary/nf-role.json | 25 + .../starter-dictionary/nfc-naming-code.json | 25 + .../starter-dictionary/onap_private_net_cidr.json | 21 + .../starter-dictionary/onap_private_net_id.json | 33 + .../starter-dictionary/onap_private_subnet_id.json | 33 + .../starter-dictionary/private-prefix-id.json | 21 + .../starter-dictionary/protected-prefix-id.json | 21 + .../protected_private_net_cidr.json | 21 + .../protected_private_subnet_id.json | 16 + .../starter-dictionary/pub_key.json | 34 + .../starter-dictionary/public_net_id.json | 14 + .../starter-dictionary/sample-db-source.json | 24 + .../starter-dictionary/sample-default-source.json | 16 + .../starter-dictionary/sample-input-source.json | 17 + .../starter-dictionary/sample-licenses.json | 29 + .../starter-dictionary/sample-mdsal-source.json | 25 + .../starter-dictionary/sample-v4-ip-type.json | 17 + .../starter-dictionary/sec_group.json | 16 + .../starter-dictionary/service-instance-id.json | 15 + .../starter-dictionary/status.json | 16 + .../starter-dictionary/unprotected-prefix-id.json | 21 + .../unprotected_private_net_cidr.json | 21 + .../unprotected_private_subnet_id.json | 16 + .../starter-dictionary/vf-module-id.json | 15 + .../starter-dictionary/vf-module-label.json | 25 + .../vf-module-model-customization-uuid.json | 15 + .../starter-dictionary/vf-module-type.json | 25 + .../starter-dictionary/vf-naming-policy.json | 25 + .../starter-dictionary/vf-nf-code.json | 25 + .../starter-dictionary/vf_module_name.json | 15 + .../starter-dictionary/vfccustomizationuuid.json | 25 + .../starter-dictionary/vfw_name_0.json | 15 + .../starter-dictionary/vfw_private_ip_0.json | 33 + .../starter-dictionary/vfw_private_ip_1.json | 33 + .../starter-dictionary/vfw_private_ip_2.json | 14 + .../starter-dictionary/vm-type.json | 25 + .../starter-dictionary/vnf-id.json | 15 + .../vnf-model-customization-uuid.json | 15 + .../starter-dictionary/vnf-name.json | 28 + .../starter-dictionary/vnf_name.json | 27 + .../vnfc-model-invariant-uuid.json | 25 + .../starter-dictionary/vnfc-model-version.json | 25 + .../starter-dictionary/volume-name.json | 15 + .../starter-dictionary/volume_group_name.json | 16 + .../starter-dictionary/vpg_name_0.json | 15 + .../starter-dictionary/vpg_private_ip_0.json | 33 + .../starter-dictionary/vpg_private_ip_1.json | 16 + .../starter-dictionary/vsn_name_0.json | 15 + .../starter-dictionary/vsn_private_ip_0.json | 33 + .../starter-dictionary/vsn_private_ip_1.json | 14 + 106 files changed, 7473 insertions(+) create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/TOSCA-Metadata/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl create mode 100644 components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/__init__.py create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-bpmn-camunda.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-directed-graph.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-template-velocity.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/tosca.artifacts.Implementation.json create mode 100644 components/model-catalog/definition-type/starter-type/data_type/datatype-property.json create mode 100644 components/model-catalog/definition-type/starter-type/data_type/datatype-resource-assignment.json create mode 100644 components/model-catalog/definition-type/starter-type/data_type/dt-license-key.json create mode 100644 components/model-catalog/definition-type/starter-type/data_type/dt-v4-aggregate.json create mode 100644 components/model-catalog/definition-type/starter-type/data_type/tosca.datatypes.Credential.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-db.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-default.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-input.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-rest.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Artifact.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Component.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.ResourceSource.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Vnf.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/address.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/aic-cloud-region.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/aic_clli.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/availability_zone_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/db-source.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/default-source.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/image_name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/input-source.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/key_name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/name_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/nexus_artifact_repo.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/protected_private_subnet_id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/public_net_id.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-default-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-input-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-v4-ip-type.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/sec_group.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/status.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_subnet_id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-module-model-customization-uuid.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vf_module_name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vfw_name_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_2.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnf-model-customization-uuid.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/volume-name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/volume_group_name.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vpg_name_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_1.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vsn_name_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_1.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json new file mode 100644 index 000000000..d5416c0ea --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json @@ -0,0 +1,3613 @@ +{ + "metadata": { + "template_author": "aa0419", + "template_name": "vFW_spinup", + "template_version": "1.0.0", + "service-type": "vFW", + "template_tags": "vFW, ONAP", + "release": "1810", + "vnf-type": "VFW" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + }, + "resource-assignment-request": { + "description": "This is Dynamic Data type for the receipe resource-assignment-action.", + "required": false, + "type": "dt-resource-assignment-request" + } + }, + "node_templates": { + "resource-assignment-ra-component": { + "type": "component-resource-assignment", + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": "{ \"get_input\" : \"action-name\" }", + "service-template-name": "{ \"get_attribute\" : \"service-template-name\" }", + "template-names": [ + "vFW_vNF_Artifact", + "base_template", + "vfw", + "vsn", + "vpg" + ], + "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }", + "resource-type": "vnf-type", + "request-id": "{ \"get_input\" : \"request-id\" }", + "resource-id": "{ \"get_input\" : \"hostname\" }" + }, + "outputs": { + "resource-assignment-params": "Success", + "status": "status" + } + } + } + } + }, + "capabilities": { + "component-node": { + + } + } + }, + "resource-assignment-action": { + "type": "dg-resource-assignment", + "properties": { + "mode": "sync", + "version": "LATEST", + "is-start-flow": false + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": [ + + ] + } + } + } + } + }, + "capabilities": { + "dg-node": { + + }, + "content": { + "properties": { + "type": "json" + } + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "resource-assignment-ra-component", + "relationship": "tosca.relationships.DependsOn" + } + } + }, + "vFW_vNF_Artifact": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "vFW_vNF_Artifact" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "service-instance-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "onap_private_net_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "onap_private_subnet_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_subnet_id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "key_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "key_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "image_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "Ubuntu 14.04 LTS Generic" + }, + "input-param": false, + "dictionary-name": "image_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "pub_key", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh" + }, + "input-param": false, + "dictionary-name": "pub_key", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.Config_MS_ONAP_VFW_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "nf-role", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "nf-role", + "dictionary-source": "db", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vfw_private_ip_1", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_private_ip_1", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfw_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_private_ip_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vpg_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vpg_private_ip_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vsn_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vsn_private_ip_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "protected-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "protected-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "unprotected-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "unprotected-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-nf-code", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-nf-code", + "dictionary-source": "db", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + } + ] + } + } + } + }, + "vfw": { + "type": "artifact-config-template", + "capabilities": { + "content": { + "properties": { + "content": "vfw" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "service-instance-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-name", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vnf-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-type", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-type", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vf-module-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfccustomizationuuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfccustomizationuuid", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vm-type", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vm-type", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnfc-model-invariant-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-invariant-uuid", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "vnfc-model-version", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-version", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "nf-role", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "vFW" + }, + "input-param": false, + "dictionary-name": "nf-role", + "dictionary-source": "default", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "nfc-naming-code", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "nfc-naming-code", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "public_net_id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "public_net_id" + }, + "input-param": false, + "dictionary-name": "public_net_id", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "image_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "image_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "key_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "key_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "pub_key", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "pub_key", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_net_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_subnet_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_subnet_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "unprotected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "unprotected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "protected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "protected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "nexus_artifact_repo", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "nexus_artifact_repo" + }, + "input-param": false, + "dictionary-name": "nexus_artifact_repo", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "sec_group", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "onap_sg_PUhf" + }, + "input-param": false, + "dictionary-name": "sec_group", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "onap_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfw_name_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_name_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.Config_MS_ONAP_VFW_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf_module_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf_module_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-label", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-label", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "private-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "private-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfw_private_ip_2", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_private_ip_2", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + } + ] + } + } + } + }, + "vpg": { + "type": "artifact-config-template", + "capabilities": { + "content": { + "properties": { + "content": "vpg" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "service-instance-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-name", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vnf-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-type", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-type", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vf-module-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfccustomizationuuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfccustomizationuuid", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vm-type", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vm-type", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnfc-model-invariant-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-invariant-uuid", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "vnfc-model-version", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-version", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "nf-role", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "vPG" + }, + "input-param": false, + "dictionary-name": "nf-role", + "dictionary-source": "default", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "nfc-naming-code", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "nfc-naming-code", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "public_net_id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "public_net_id" + }, + "input-param": false, + "dictionary-name": "public_net_id", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "image_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "image_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "key_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "key_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "pub_key", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "pub_key", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_net_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_subnet_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_subnet_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "unprotected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "unprotected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "onap_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfw_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_private_ip_0", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vsn_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vsn_private_ip_0", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "nexus_artifact_repo", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "nexus_artifact_repo" + }, + "input-param": false, + "dictionary-name": "nexus_artifact_repo", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "sec_group", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "onap_sg_PUhf" + }, + "input-param": false, + "dictionary-name": "sec_group", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vpg_private_ip_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vpg_private_ip_0", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vpg_name_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vpg_name_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.Config_MS_ONAP_VPG_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf_module_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf_module_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-label", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-label", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "private-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "private-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vpg_private_ip_1", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vpg_private_ip_1", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + } + ] + } + } + } + }, + "vsn": { + "type": "artifact-config-template", + "capabilities": { + "content": { + "properties": { + "content": "vsn" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "service-instance-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-name", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vnf-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-type", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-type", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vf-module-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfccustomizationuuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfccustomizationuuid", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vm-type", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vm-type", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnfc-model-invariant-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-invariant-uuid", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "vnfc-model-version", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnfc-model-version", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "nf-role", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "vSN" + }, + "input-param": false, + "dictionary-name": "nf-role", + "dictionary-source": "default", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "nfc-naming-code", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "nfc-naming-code", + "dictionary-source": "db", + "dependencies": [ + "vfccustomizationuuid" + ], + "version": 0 + }, + { + "name": "image_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "image_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "public_net_id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "value": "public_net_id", + "default": "public_net_id" + }, + "input-param": false, + "dictionary-name": "public_net_id", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "key_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "key_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "pub_key", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "pub_key", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_net_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "onap_private_subnet_id", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_subnet_id", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "unprotected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "unprotected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "protected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "protected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "onap_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "onap_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "nexus_artifact_repo", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "value": "nexus_artifact_repo", + "default": "nexus_artifact_repo" + }, + "input-param": false, + "dictionary-name": "nexus_artifact_repo", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "sec_group", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "onap_sg_PUhf" + }, + "input-param": false, + "dictionary-name": "sec_group", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vfw_private_ip_1", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vfw_private_ip_1", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "vsn_name_0", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vsn_name_0", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-naming-policy", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + }, + "default": "SDNC_Policy.Config_MS_ONAP_VSN_NAMING_TIMESTAMP" + }, + "input-param": false, + "dictionary-name": "vf-naming-policy", + "dictionary-source": "default", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf_module_name", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf_module_name", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-label", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-label", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "private-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "private-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vsn_private_ip_1", + "property": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vsn_private_ip_1", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "protected-prefix-id", + "property": { + "description": "", + "required": false, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "protected-prefix-id", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + } + ] + } + } + } + }, + "base_template": { + "type": "artifact-config-template", + "capabilities": { + "content": { + "properties": { + "content": "base_template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "service-instance-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-type", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-type", + "dictionary-source": "db", + "dependencies": [ + "vf-module-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vf-module-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vf-module-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vf-module-id", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "vnf-model-customization-uuid", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-model-customization-uuid", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "aic-cloud-region", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "aic-cloud-region", + "dictionary-source": "input", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "nf-role", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "nf-role", + "dictionary-source": "db", + "dependencies": [ + "vnf-model-customization-uuid" + ], + "version": 0 + }, + { + "name": "vnf-name", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "vnf-name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ], + "version": 0 + }, + { + "name": "unprotected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "unprotected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + }, + { + "name": "protected_private_net_cidr", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "protected_private_net_cidr", + "dictionary-source": "db", + "dependencies": [ + + ], + "version": 0 + } + ] + } + } + } + } + } + }, + "node_types": { + "tosca.nodes.Component": { + "description": "This is default Component Node", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.Artifact": { + "description": "This is Deprecated Artifact Node Type.", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Action Name of the process", + "required": true, + "type": "string" + }, + "service-template-name": { + "description": "Service Template Name.", + "required": true, + "type": "string" + }, + "service-template-version": { + "description": "Service Template Version.", + "required": true, + "type": "string" + }, + "resource-type": { + "description": "Request type.", + "required": true, + "type": "string" + }, + "template-names": { + "description": "Name of the artifact Node Templates, to get the template Content.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id, Unique Id for the request.", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Resource Id.", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "dg-resource-assignment": { + "description": "This is Resource Assignment Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": "false" + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + }, + "content": { + "type": "tosca.capabilities.Content", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "json" + }, + "content": { + "required": false, + "type": "string" + } + } + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "artifact-config-template": { + "description": "This is Configuration Velocity Template", + "version": "1.0.0", + "properties": { + "action-names": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "capabilities": { + "content": { + "type": "tosca.capabilities.Content", + "properties": { + "content": { + "required": true, + "type": "string" + } + } + }, + "mapping": { + "type": "tosca.capabilities.Mapping", + "properties": { + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + } + } + }, + "derived_from": "tosca.nodes.Artifact" + } + }, + "data_types": { + "datatype-property": { + "version": "1.0.0", + "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs", + "properties": { + "type": { + "required": true, + "type": "string" + }, + "description": { + "required": false, + "type": "string" + }, + "required": { + "required": false, + "type": "boolean" + }, + "default": { + "required": false, + "type": "string" + }, + "entry_schema": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "datatype-resource-assignment": { + "version": "1.0.0", + "description": "This is Resource Assignment Data Type", + "properties": { + "property": { + "required": true, + "type": "datatype-property" + }, + "input-param": { + "required": true, + "type": "boolean" + }, + "dictionary-name": { + "required": false, + "type": "string" + }, + "dictionary-source": { + "required": false, + "type": "string" + }, + "dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "status": { + "required": false, + "type": "string" + }, + "message": { + "required": false, + "type": "string" + }, + "updated-date": { + "required": false, + "type": "string" + }, + "updated-by": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "dt-resource-assignment-request": { + "version": "1.0.0", + "description": "This is Dynamic Data type definition generated from resource mapping for the config template name activate-template.", + "properties": { + "password-user-ftap-nsm": { + "required": true, + "type": "string", + "default": "password-user-ftap" + }, + "reservation-id": { + "required": true, + "type": "string", + "value": "123" + }, + "security-manager-resource-key": { + "required": true, + "type": "string", + "value": "sdnc" + }, + "password-user-ftap": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "entry_schema": { + "type": "" + } + } + }, + "derived_from": "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/service-blueprint/vFW/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..7918c1159 --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,6 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: ONAP +Entry-Definitions: Definitions/vFW_spinup.json +Template-Tags: ONAP, vFW +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl new file mode 100644 index 000000000..1f8298c5f --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl @@ -0,0 +1,56 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "vnf_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vnf_name", + "param-value": "${vnf-name}" + }, + { + "param-name": "vnf_model_customization_uuid", + "param-value": "${vnf-model-customization-uuid}" + }, + { + "param-name": "vf_module_id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "vf_module_type", + "param-value": "${vf-module-type}" + }, + { + "param-name": "unprotected_private_net_id", + "param-value": "${vnf-name}_unprotected" + }, + { + "param-name": "unprotected_private_subnet_id", + "param-value": "${vnf-name}_unprotected_sub" + }, + { + "param-name": "unprotected_private_net_cidr", + "param-value": "${unprotected_private_net_cidr}" + }, + { + "param-name": "protected_private_net_id", + "param-value": "${vnf-name}_protected" + }, + { + "param-name": "protected_private_subnet_id", + "param-value": "${vnf-name}_protected_sub" + }, + { + "param-name": "protected_private_net_cidr", + "param-value": "${protected_private_net_cidr}" + }, + { + "param-name": "vf_module_name", + "param-value": "${vnf-name}_base" + } + ] +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl new file mode 100644 index 000000000..ca09046aa --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl @@ -0,0 +1,203 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "vnf_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vnf-model-customization-uuid", + "param-value": "${vnf-model-customization-uuid}" + }, + { + "param-name": "aic-cloud-region", + "param-value": "${aic-cloud-region}" + }, + { + "param-name": "onap_private_net_id", + "param-value": "${onap_private_net_id}" + }, + { + "param-name": "pub_key", + "param-value": "${pub_key}" + }, + { + "param-name": "image_name", + "param-value": "${image_name}" + }, + { + "param-name": "onap_private_subnet_id", + "param-value": "${onap_private_net_id}_sub" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vnf_name" + }, + { + "param-name": "resource-value", + "param-value": "${vnf_name}" + }, + { + "param-name": "external-key", + "param-value": "${vnf-id}_vnf_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VNF" + }, + { + "param-name": "AIC_CLOUD_REGION", + "param-value": "${aic-cloud-region}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vnf_name", + "resource-value": "${vnf_name}" + } + ] + } + ] + }, + { + "capability-name": "netbox-ip-assign", + "key-mapping": [ + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${protected-prefix-id}" + }, + { + "param-name": "vnf-id", + "param-value": "${vnf-id}" + }, + { + "param-name": "external_key", + "param-value": "${vnf-id}-vfw_private_ip_1" + } + ], + "output-key-mapping": [ + { + "resource-name": "vfw_private_ip_1", + "resource-value": "${vfw_private_ip_1}" + } + ] + }, + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${unprotected-prefix-id}" + }, + { + "param-name": "vnf-id", + "param-value": "${vnf-id}" + }, + { + "param-name": "external_key", + "param-value": "${vnf-id}-vfw_private_ip_0" + } + ], + "output-key-mapping": [ + { + "resource-name": "vfw_private_ip_0", + "resource-value": "${vfw_private_ip_0}" + } + ] + }, + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${unprotected-prefix-id}" + }, + { + "param-name": "vnf-id", + "param-value": "${vnf-id}" + }, + { + "param-name": "external_key", + "param-value": "${vnf-id}-vpg_private_ip_0" + } + ], + "output-key-mapping": [ + { + "resource-name": "vpg_private_ip_0", + "resource-value": "${vpg_private_ip_0}" + } + ] + }, + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${protected-prefix-id}" + }, + { + "param-name": "vnf-id", + "param-value": "${vnf-id}" + }, + { + "param-name": "external_key", + "param-value": "${vnf-id}-vsn_private_ip_0" + } + ], + "output-key-mapping": [ + { + "resource-name": "vsn_private_ip_0", + "resource-value": "${vsn_private_ip_0}" + } + ] + } + ] + }, + { + "capability-name": "unresolved-composite-data", + "key-mapping": [ + { + "output-key-mapping": [ + { + "resource-name": "key_name", + "resource-value": "${vnf_name}_key" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl new file mode 100644 index 000000000..06a91d3a1 --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl @@ -0,0 +1,315 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "vnf_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vnf_name", + "param-value": "${vnf-name}" + }, + { + "param-name": "vnf_model_customization_uuid", + "param-value": "${vnf-model-customization-uuid}" + }, + { + "param-name": "vf_module_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vf_module_type", + "param-value": "${vf-module-type}" + }, + { + "param-name": "vf_module_customization_uuid", + "param-value": "${vf-module-model-customization-uuid}" + }, + { + "param-name": "vfc_customization_uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "aic-cloud-region", + "param-value": "${aic-cloud-region}" + }, + { + "param-name": "vm-type", + "param-value": "${vm-type}" + }, + { + "param-name": "vnfc-model-customization-uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "vnfc-model-invariant-uuid", + "param-value": "${vnfc-model-invariant-uuid}" + }, + { + "param-name": "vnfc-model-version", + "param-value": "${vnfc-model-version}" + }, + { + "param-name": "nfc-function", + "param-value": "${nf-role}" + }, + { + "param-name": "nfc-naming-code", + "param-value": "${nfc-naming-code}" + }, + { + "param-name": "cloud_env", + "param-value": "openstack" + }, + { + "param-name": "repo_url_artifacts", + "param-value": "https://nexus.onap.org/content/groups/staging" + }, + { + "param-name": "repo_url_blob", + "param-value": "https://nexus.onap.org/content/repositories/raw" + }, + { + "param-name": "dcae_collector_port", + "param-value": "8080" + }, + { + "param-name": "image_name", + "param-value": "${image_name}" + }, + { + "param-name": "flavor_name", + "param-value": "m1.medium" + }, + { + "param-name": "install_script_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "demo_artifacts_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "dcae_collector_ip", + "param-value": "10.0.4.1" + }, + { + "param-name": "key_name", + "param-value": "${key_name}" + }, + { + "param-name": "pub_key", + "param-value": "${pub_key}" + }, + { + "param-name": "public_net_id", + "param-value": "${public_net_id}" + }, + { + "param-name": "unprotected_private_net_id", + "param-value": "${vnf-name}_unprotected" + }, + { + "param-name": "protected_private_net_id", + "param-value": "${vnf-name}_protected" + }, + { + "param-name": "onap_private_net_id", + "param-value": "${onap_private_net_id}" + }, + { + "param-name": "onap_private_subnet_id", + "param-value": "${onap_private_subnet_id}" + }, + { + "param-name": "unprotected_private_net_cidr", + "param-value": "${unprotected_private_net_cidr}" + }, + { + "param-name": "protected_private_net_cidr", + "param-value": "${protected_private_net_cidr}" + }, + { + "param-name": "unprotected_private_subnet_id", + "param-value": "${vnf-name}_unprotected_sub" + }, + { + "param-name": "unprotected_private_net_cidr", + "param-value": "${unprotected_private_net_cidr}" + }, + { + "param-name": "protected_private_subnet_id", + "param-value": "${vnf-name}_protected_sub" + }, + { + "param-name": "nexus_artifact_repo", + "param-value": "${nexus_artifact_repo}" + }, + { + "param-name": "sec_group", + "param-value": "${sec_group}" + }, + { + "param-name": "onap_private_net_cidr", + "param-value": "${onap_private_net_cidr}" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vfw_name_0" + }, + { + "param-name": "resource-value", + "param-value": "${vfw_name_0}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vfw_name_0" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VNFC" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "NFC_NAMING_CODE", + "param-value": "${nfc-naming-code}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vfw_name_0", + "resource-value": "${vfw_name_0}" + } + ] + }, + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vf_module_name" + }, + { + "param-name": "resource-value", + "param-value": "${vf_module_name}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vf_module_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VF-MODULE" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "VF_MODULE_LABEL", + "param-value": "${vf-module-label}" + }, + { + "param-name": "VF_MODULE_TYPE", + "param-value": "${vf-module-type}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vf_module_name", + "resource-value": "${vf_module_name}" + } + ] + } + ] + }, + { + "capability-name": "netbox-ip-assign", + "key-mapping": [ + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${private-prefix-id}" + }, + { + "param-name": "vf-module-id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "external_key", + "param-value": "${vf-module-id}-vfw_private_ip_2" + } + ], + "output-key-mapping": [ + { + "resource-name": "vfw_private_ip_2", + "resource-value": "${vfw_private_ip_2}" + } + ] + } + ] + }, + { + "capability-name": "unresolved-composite-data", + "key-mapping": [ + { + "output-key-mapping": [ + { + "resource-name": "KEY", + "resource-value": "${vnf_name}" + }, + { + "resource-name": "vf-module-name", + "resource-value": "${vf_module_name}" + }, + { + "resource-name": "vnfc-name", + "resource-value": "${vfw_name_0}" + }, + { + "resource-name": "ipv4-oam-address", + "resource-value": "${vfw_private_ip_2}" + }, + { + "resource-name": "ipv4-oam-address-prefix", + "resource-value": "${onap_private_net_cidr}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl new file mode 100644 index 000000000..f7e3780a3 --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl @@ -0,0 +1,315 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "vnf_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vnf_name", + "param-value": "${vnf-name}" + }, + { + "param-name": "vnf_model_customization_uuid", + "param-value": "${vnf-model-customization-uuid}" + }, + { + "param-name": "vf_module_id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "vf_module_type", + "param-value": "${vf-module-type}" + }, + { + "param-name": "vf_module_customization_uuid", + "param-value": "${vf-module-model-customization-uuid}" + }, + { + "param-name": "vfc_customization_uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "aic-cloud-region", + "param-value": "${aic-cloud-region}" + }, + { + "param-name": "vm-type", + "param-value": "${vm-type}" + }, + { + "param-name": "vnfc-model-customization-uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "vnfc-model-invariant-uuid", + "param-value": "${vnfc-model-invariant-uuid}" + }, + { + "param-name": "vnfc-model-version", + "param-value": "${vnfc-model-version}" + }, + { + "param-name": "nfc-function", + "param-value": "${nf-role}" + }, + { + "param-name": "nfc-naming-code", + "param-value": "${nfc-naming-code}" + }, + { + "param-name": "cloud_env", + "param-value": "openstack" + }, + { + "param-name": "repo_url_artifacts", + "param-value": "https://nexus.onap.org/content/groups/staging" + }, + { + "param-name": "repo_url_blob", + "param-value": "https://nexus.onap.org/content/repositories/raw" + }, + { + "param-name": "dcae_collector_port", + "param-value": "8080" + }, + { + "param-name": "image_name", + "param-value": "${image_name}" + }, + { + "param-name": "flavor_name", + "param-value": "m1.medium" + }, + { + "param-name": "key_name", + "param-value": "${key_name}" + }, + { + "param-name": "pub_key", + "param-value": "${pub_key}" + }, + { + "param-name": "install_script_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "demo_artifacts_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "dcae_collector_ip", + "param-value": "10.0.4.1" + }, + { + "param-name": "public_net_id", + "param-value": "${public_net_id}" + }, + { + "param-name": "protected_private_net_id", + "param-value": "zdfw1fwl01_protected" + }, + { + "param-name": "onap_private_net_id", + "param-value": "${onap_private_net_id}" + }, + { + "param-name": "onap_private_subnet_id", + "param-value": "${onap_private_subnet_id}" + }, + { + "param-name": "unprotected_private_net_id", + "param-value": "${vnf-name}_unprotected" + }, + { + "param-name": "unprotected_private_subnet_id", + "param-value": "${vnf-name}_unprotected_sub" + }, + { + "param-name": "unprotected_private_net_cidr", + "param-value": "${unprotected_private_net_cidr}" + }, + { + "param-name": "protected_private_subnet_id", + "param-value": "${vnf-name}_protected_sub" + }, + { + "param-name": "protected_private_net_id", + "param-value": "${vnf-name}_protected" + }, + { + "param-name": "onap_private_net_cidr", + "param-value": "${onap_private_net_cidr}" + }, + { + "param-name": "vfw_private_ip_0", + "param-value": "${vfw_private_ip_0}" + }, + { + "param-name": "vsn_private_ip_0", + "param-value": "${vsn_private_ip_0}" + }, + { + "param-name": "nexus_artifact_repo", + "param-value": "${nexus_artifact_repo}" + }, + { + "param-name": "sec_group", + "param-value": "${sec_group}" + }, + { + "param-name": "vpg_private_ip_0", + "param-value": "${vpg_private_ip_0}" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vpg_name_0" + }, + { + "param-name": "resource-value", + "param-value": "${vpg_name_0}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vpg_name_0" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VNFC" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "NFC_NAMING_CODE", + "param-value": "${nfc-naming-code}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vpg_name_0", + "resource-value": "${vpg_name_0}" + } + ] + }, + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vf_module_name" + }, + { + "param-name": "resource-value", + "param-value": "${vf_module_name}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vf_module_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VF-MODULE" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "VF_MODULE_LABEL", + "param-value": "${vf-module-label}" + }, + { + "param-name": "VF_MODULE_TYPE", + "param-value": "${vf-module-type}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vf_module_name", + "resource-value": "${vf_module_name}" + } + ] + } + ] + }, + { + "capability-name": "netbox-ip-assign", + "key-mapping": [ + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${private-prefix-id}" + }, + { + "param-name": "vf-module-id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "external_key", + "param-value": "${vf-module-id}-vpg_private_ip_1" + } + ], + "output-key-mapping": [ + { + "resource-name": "vpg_private_ip_1", + "resource-value": "${vpg_private_ip_1}" + } + ] + } + ] + }, + { + "capability-name": "unresolved-composite-data", + "key-mapping": [ + { + "output-key-mapping": [ + { + "resource-name": "vf-module-name", + "resource-value": "${vf_module_name}" + }, + { + "resource-name": "vnfc-name", + "resource-value": "${vpg_name_0}" + }, + { + "resource-name": "ipv4-oam-address-prefix", + "resource-value": "${onap_private_net_cidr}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl new file mode 100644 index 000000000..727427a63 --- /dev/null +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl @@ -0,0 +1,311 @@ +{ + "resource-accumulator-resolved-data": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "vnf_id", + "param-value": "${vnf-id}" + }, + { + "param-name": "vnf_name", + "param-value": "${vnf-name}" + }, + { + "param-name": "vnf_model_customization_uuid", + "param-value": "${vnf-model-customization-uuid}" + }, + { + "param-name": "vf_module_id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "vf_module_type", + "param-value": "${vf-module-type}" + }, + { + "param-name": "vf_module_customization_uuid", + "param-value": "${vf-module-model-customization-uuid}" + }, + { + "param-name": "vfc_customization_uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "aic-cloud-region", + "param-value": "${aic-cloud-region}" + }, + { + "param-name": "vm-type", + "param-value": "${vm-type}" + }, + { + "param-name": "vnfc-model-customization-uuid", + "param-value": "${vfccustomizationuuid}" + }, + { + "param-name": "vnfc-model-invariant-uuid", + "param-value": "${vnfc-model-invariant-uuid}" + }, + { + "param-name": "vnfc-model-version", + "param-value": "${vnfc-model-version}" + }, + { + "param-name": "nfc-function", + "param-value": "${nf-role}" + }, + { + "param-name": "nfc-naming-code", + "param-value": "${nfc-naming-code}" + }, + { + "param-name": "cloud_env", + "param-value": "openstack" + }, + { + "param-name": "repo_url_artifacts", + "param-value": "https://nexus.onap.org/content/groups/staging" + }, + { + "param-name": "repo_url_blob", + "param-value": "https://nexus.onap.org/content/repositories/raw" + }, + { + "param-name": "dcae_collector_port", + "param-value": "8080" + }, + { + "param-name": "image_name", + "param-value": "${image_name}" + }, + { + "param-name": "flavor_name", + "param-value": "m1.medium" + }, + { + "param-name": "install_script_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "key_name", + "param-value": "${key_name}" + }, + { + "param-name": "pub_key", + "param-value": "${pub_key}" + }, + { + "param-name": "demo_artifacts_version", + "param-value": "1.2.1-SNAPSHOT" + }, + { + "param-name": "dcae_collector_ip", + "param-value": "10.0.4.1" + }, + { + "param-name": "public_net_id", + "param-value": "${public_net_id}" + }, + { + "param-name": "unprotected_private_net_id", + "param-value": "${vnf-name}_unprotected" + }, + { + "param-name": "protected_private_subnet_id", + "param-value": "${vnf-name}_protected_sub" + }, + { + "param-name": "protected_private_net_id", + "param-value": "${vnf-name}_protected" + }, + { + "param-name": "onap_private_net_id", + "param-value": "${onap_private_net_id}" + }, + { + "param-name": "onap_private_subnet_id", + "param-value": "${onap_private_subnet_id}" + }, + { + "param-name": "unprotected_private_net_cidr", + "param-value": "${unprotected_private_net_cidr}" + }, + { + "param-name": "protected_private_net_cidr", + "param-value": "${protected_private_net_cidr}" + }, + { + "param-name": "onap_private_net_cidr", + "param-value": "${onap_private_net_cidr}" + }, + { + "param-name": "nexus_artifact_repo", + "param-value": "${nexus_artifact_repo}" + }, + { + "param-name": "sec_group", + "param-value": "${sec_group}" + }, + { + "param-name": "vfw_private_ip_1", + "param-value": "${vfw_private_ip_1}" + } + ], + "capability-data": [ + { + "capability-name": "generate-name", + "key-mapping": [ + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vsn_name_0" + }, + { + "param-name": "resource-value", + "param-value": "${vsn_name_0}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vsn_name_0" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VNFC" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "NFC_NAMING_CODE", + "param-value": "${nfc-naming-code}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vsn_name_0", + "resource-value": "${vsn_name_0}" + } + ] + }, + { + "payload": [ + { + "param-name": "resource-name", + "param-value": "vf_module_name" + }, + { + "param-name": "resource-value", + "param-value": "${vf_module_name}" + }, + { + "param-name": "external-key", + "param-value": "${vf-module-id}_vf_module_name" + }, + { + "param-name": "policy-instance-name", + "param-value": "${vf-naming-policy}" + }, + { + "param-name": "nf-role", + "param-value": "${nf-role}" + }, + { + "param-name": "naming-type", + "param-value": "VF-MODULE" + }, + { + "param-name": "VNF_NAME", + "param-value": "${vnf-name}" + }, + { + "param-name": "VF_MODULE_LABEL", + "param-value": "${vf-module-label}" + }, + { + "param-name": "VF_MODULE_TYPE", + "param-value": "${vf-module-type}" + } + ], + "output-key-mapping": [ + { + "resource-name": "vf_module_name", + "resource-value": "${vf_module_name}" + } + ] + } + ] + }, + { + "capability-name": "netbox-ip-assign", + "key-mapping": [ + { + "payload": [ + { + "param-name": "service-instance-id", + "param-value": "${service-instance-id}" + }, + { + "param-name": "prefix-id", + "param-value": "${private-prefix-id}" + }, + { + "param-name": "vf-module-id", + "param-value": "${vf-module-id}" + }, + { + "param-name": "external_key", + "param-value": "${vf-module-id}-vsn_private_ip_1" + } + ], + "output-key-mapping": [ + { + "resource-name": "vsn_private_ip_1", + "resource-value": "${vsn_private_ip_1}" + } + ] + } + ] + }, + { + "capability-name": "unresolved-composite-data", + "key-mapping": [ + { + "output-key-mapping": [ + { + "resource-name": "volume-group-name", + "resource-value": "${volume_group_name}" + }, + { + "resource-name": "vf-module-name", + "resource-value": "${vf_module_name}" + }, + { + "resource-name": "vnfc-name", + "resource-value": "${vsn_name_0}" + }, + { + "resource-name": "ipv4-oam-address", + "resource-value": "${vsn_private_ip_1}" + }, + { + "resource-name": "ipv4-oam-address-prefix", + "resource-value": "${onap_private_net_cidr}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json new file mode 100644 index 000000000..4c1ca4a52 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -0,0 +1,388 @@ +{ + "metadata": { + "template_author": "Brinda Santh Muthuramalingam", + "author-email": "brindasanth@gmail.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "baseconfiguration", + "template_version": "1.0.0", + "template_tags": "brinda, tosca" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "activate-process": { + "type": "bpmn-activate", + "properties": { + "process-name": { + "get_input": "action-name" + }, + "version": { + "get_property": [ + "SELF", + "process-name" + ] + }, + "content": { + "get_artifact": [ + "SELF", + "activate-process" + ] + } + }, + "artifacts": { + "activate-process": { + "type": "artifact-bpmn-camunda", + "file": "Plans/ActivateProcess.bpmn" + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "properties": { + "request-id": "1234" + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "get_input": "action-name" + }, + "resource-type": "vnf-type", + "request-id": { + "get_input": "request-id" + }, + "resource-id": { + "get_input": "hostname" + }, + "template-content": { + "get_artifact": [ + "SELF", + "baseconfig-template" + ] + }, + "mapping-content": { + "get_artifact": [ + "SELF", + "baseconfig-mapping" + ] + } + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "baseconfig-template": { + "type": "artifact-template-velocity", + "file": "Templates/baseconfig-template.vtl" + }, + "baseconfig-mapping": { + "type": "artifact-mapping-resource", + "file": "Mappings/baseconfig-mapping.json" + } + } + }, + "resource-assignment-py": { + "type": "component-resource-assignment", + "properties": { + "request-id": "1234" + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "action-name": { + "get_input": "action-name" + } + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-python", + "file": "Scripts/baseconfig-template.vtl" + } + } + } + }, + "workflows": { + "activate-process": { + "steps": { + "call-resource-assignment": { + "description": "Invoke Resource Assignment Component", + "target": "resource-assignment", + "activities": [ + { + "call_operation": "ResourceAssignmentNode.process" + } + ], + "on_success": [ + "download-baseconfig" + ] + }, + "download-baseconfig": { + "description": "Call Download Base Config Component", + "target": "activate-netconf", + "activities": [ + { + "call_operation": "NetconfTransactionNode.process" + } + ], + "on_success": [ + "download-licence" + ] + }, + "download-licence": { + "description": "Call Download Licence Component", + "target": "activate-netconf", + "activities": [ + { + "call_operation": "NetconfTransactionNode.process" + } + ] + } + } + } + } + }, + "artifact_types": { + "artifact-template-velocity": { + "description": " Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": " Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-kotlin": { + "description": " Kotlin Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "kt" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-python": { + "description": " Kotlin Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-bpmn-camunda": { + "description": " Camunda BPM File", + "version": "1.0.0", + "file_ext": [ + "bpmn" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + }, + "node_types": { + "bpmn-activate": { + "description": "This is BPMN Activate node type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.component.Python": { + "description": "This is Resource Assignment Python Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "template-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "mapping-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-resource-assignment-python": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Python" + } + }, + "data_types": { + "sample-property": { + "description": "This is sample data type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json new file mode 100644 index 000000000..caee773bb --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json @@ -0,0 +1,3 @@ +{ + "assignments": "Sample Assignments" +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn new file mode 100644 index 000000000..89ae342f8 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_0l0dq58 + + + SequenceFlow_1ay0k6p + + + + + + + + + + SequenceFlow_0l0dq58 + SequenceFlow_1ay0k6p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py new file mode 100644 index 000000000..fc5151338 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py @@ -0,0 +1,8 @@ +from com.brvith.orchestrator.core.interfaces import ComponentNode + +class SamplePythonComponentNode(ComponentNode): + def prepare(self, context, componentContext): + return None + + def prepare(self, context, componentContext): + return None \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/__init__.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..9066e4845 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,8 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh M +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: Brinda Santh, activation-blueprint + +Name: Plans/ActivateProcess.bpmn +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl new file mode 100644 index 000000000..026c59176 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl @@ -0,0 +1 @@ +This is Sample Velocity Template \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-bpmn-camunda.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-bpmn-camunda.json new file mode 100644 index 000000000..ac76b4f4f --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-bpmn-camunda.json @@ -0,0 +1,8 @@ +{ + "description": " Camunda BPM File", + "version": "1.0.0", + "file_ext": [ + "bpmn" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-directed-graph.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-directed-graph.json new file mode 100644 index 000000000..7ab3a5434 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-directed-graph.json @@ -0,0 +1,9 @@ +{ + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json new file mode 100644 index 000000000..0a3261b09 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json @@ -0,0 +1,8 @@ +{ + "description": " Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json new file mode 100644 index 000000000..b48d2b628 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json @@ -0,0 +1,8 @@ +{ + "description": " Kotlin Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-template-velocity.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-template-velocity.json new file mode 100644 index 000000000..9395d3970 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-template-velocity.json @@ -0,0 +1,8 @@ +{ + "description": " Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/tosca.artifacts.Implementation.json b/components/model-catalog/definition-type/starter-type/artifact_type/tosca.artifacts.Implementation.json new file mode 100644 index 000000000..5a7c95684 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/tosca.artifacts.Implementation.json @@ -0,0 +1,5 @@ +{ + "description": "TOSCA base type for implementation artifacts", + "version": "1.0.0", + "derived_from": "tosca.artifacts.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/datatype-property.json b/components/model-catalog/definition-type/starter-type/data_type/datatype-property.json new file mode 100644 index 000000000..5584b10ea --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/datatype-property.json @@ -0,0 +1,27 @@ +{ + "version": "1.0.0", + "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs", + "properties": { + "type": { + "required": true, + "type": "string" + }, + "description": { + "required": false, + "type": "string" + }, + "required": { + "required": false, + "type": "boolean" + }, + "default": { + "required": false, + "type": "string" + }, + "entry_schema": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/datatype-resource-assignment.json b/components/model-catalog/definition-type/starter-type/data_type/datatype-resource-assignment.json new file mode 100644 index 000000000..cc9816ebb --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/datatype-resource-assignment.json @@ -0,0 +1,46 @@ +{ + "version": "1.0.0", + "description": "This is Resource Assignment Data Type", + "properties": { + "property": { + "required": true, + "type": "datatype-property" + }, + "input-param": { + "required": true, + "type": "boolean" + }, + "dictionary-name": { + "required": false, + "type": "string" + }, + "dictionary-source": { + "required": false, + "type": "string" + }, + "dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "status": { + "required": false, + "type": "string" + }, + "message": { + "required": false, + "type": "string" + }, + "updated-date": { + "required": false, + "type": "string" + }, + "updated-by": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/dt-license-key.json b/components/model-catalog/definition-type/starter-type/data_type/dt-license-key.json new file mode 100644 index 000000000..e9c312b79 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/dt-license-key.json @@ -0,0 +1,11 @@ +{ + "version": "1.0.0", + "description": "This is dt-plicense-key Data Type", + "properties": { + "license-key": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/dt-v4-aggregate.json b/components/model-catalog/definition-type/starter-type/data_type/dt-v4-aggregate.json new file mode 100644 index 000000000..842a7f805 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/dt-v4-aggregate.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0", + "description": "This is dt-v4-aggregate Data Type", + "properties": { + "ipv4-address": { + "required": true, + "type": "string" + }, + "ipv4-plen": { + "required": false, + "type": "integer" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/tosca.datatypes.Credential.json b/components/model-catalog/definition-type/starter-type/data_type/tosca.datatypes.Credential.json new file mode 100644 index 000000000..820a55168 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/tosca.datatypes.Credential.json @@ -0,0 +1,31 @@ +{ + "version": "1.0.0", + "description": "Credential", + "properties": { + "protocol": { + "required": false, + "type": "string" + }, + "token_type": { + "required": true, + "type": "string", + "default" : "password" + }, + "token": { + "required": false, + "type": "string" + }, + "keys": { + "required": false, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "user": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json b/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json new file mode 100644 index 000000000..af99d75b8 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/artifact-config-template.json @@ -0,0 +1,37 @@ +{ + "description": "This is Configuration Velocity Template", + "version": "1.0.0", + "properties": { + "action-names": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "capabilities": { + "content": { + "type": "tosca.capabilities.Content", + "properties": { + "content": { + "required": true, + "type": "string" + } + } + }, + "mapping": { + "type": "tosca.capabilities.Mapping", + "properties": { + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + } + } + }, + "derived_from": "tosca.nodes.Artifact" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json new file mode 100644 index 000000000..764f9e890 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json @@ -0,0 +1,72 @@ +{ + "description": "This is Generate Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": { + "operations": { + "process": { + "inputs": { + "template-data": { + "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "template-content": { + "description": "Conditional : Dynamic Template used to generate Configuration.", + "required": false, + "type": "string" + }, + "resource-type": { + "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "action-name": { + "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "template-name": { + "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.", + "required": true, + "type": "string" + } + }, + "outputs": { + "generated-config": { + "description": "Generated Configuration for the Template adn Resource Data", + "required": true, + "type": "string" + }, + "mask-info": { + "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.apps.controllerblueprints.core.data.custom.MaskInfo ", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json new file mode 100644 index 000000000..240caf3fc --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -0,0 +1,79 @@ +{ + "description": "This is Netconf Transaction Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "vnf-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": { + "operations": { + "process": { + "inputs": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "template-name": { + "description": "Service Template Name", + "required": true, + "type": "string" + }, + "template-version": { + "description": "Service Template Version", + "required": true, + "type": "string" + }, + "action-name": { + "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-id": { + "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "reservation-id": { + "description": "Reservation Id used to send to NPM", + "required": false, + "type": "string" + }, + "execution-script": { + "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.", + "required": true, + "type": "string" + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json new file mode 100644 index 000000000..d424a8e43 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json @@ -0,0 +1,68 @@ +{ + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "template-name": { + "description": "Service Template Name.", + "required": true, + "type": "string" + }, + "template-version": { + "description": "Service Template Version.", + "required": true, + "type": "string" + }, + "resource-type": { + "description": "Request type.", + "required": true, + "type": "string" + }, + "template-names": { + "description": "Name of the artifact Node Templates, to get the template Content.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id, Unique Id for the request.", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Resource Id.", + "required": true, + "type": "string" + }, + "action-name": { + "description": "Action Name of the process", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json b/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json new file mode 100644 index 000000000..57667de98 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json @@ -0,0 +1,52 @@ +{ + "description": "This is Download Netconf Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": false + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-netconf-executor", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ActivateNetconf": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + + "derived_from": "tosca.nodes.DG" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json new file mode 100644 index 000000000..e59c34b6e --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json @@ -0,0 +1,51 @@ +{ + "description": "This is Activate DG for Config Generator Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": false + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-config-generator", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "GenerateConfiguration": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json new file mode 100644 index 000000000..ca703a793 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json @@ -0,0 +1,56 @@ +{ + "description": "This is Resource Assign and Activate Netconf Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": false + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "ra-component": { + "capability": "component-node", + "node": "component-resource-assignment", + "relationship": "tosca.relationships.DependsOn" + }, + "netconf-component": { + "capability": "component-node", + "node": "component-netconf-executor", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignAndActivate": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json new file mode 100644 index 000000000..9cce82a9e --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json @@ -0,0 +1,51 @@ +{ + "description": "This is Resource Assignment Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": false + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-db.json new file mode 100644 index 000000000..661a9503b --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-db.json @@ -0,0 +1,44 @@ +{ + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-default.json b/components/model-catalog/definition-type/starter-type/node_type/source-default.json new file mode 100644 index 000000000..13e234e1b --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-default.json @@ -0,0 +1,18 @@ +{ + "description": "This is Default Resource Source Node Type", + "version": "1.0.0", + "properties": { + "key": { + "required": false, + "type": "string" + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-input.json b/components/model-catalog/definition-type/starter-type/node_type/source-input.json new file mode 100644 index 000000000..126ea30bd --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-input.json @@ -0,0 +1,18 @@ +{ + "description": "This is Input Resource Source Node Type", + "version": "1.0.0", + "properties": { + "key": { + "required": false, + "type": "string" + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json new file mode 100644 index 000000000..f8dd8b6fc --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json @@ -0,0 +1,61 @@ +{ + "description": "This is Rest Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "JSON", + "constraints": [ + { + "valid_values": [ + "JSON" + ] + } + ] + }, + "url-path": { + "required": true, + "type": "string" + }, + "path": { + "required": true, + "type": "string" + }, + "expression-type": { + "required": false, + "type": "string", + "default": "JSON_PATH", + "constraints": [ + { + "valid_values": [ + "JSON_PATH", + "JSON_POINTER" + ] + } + ] + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Artifact.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 000000000..814105277 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Artifact.json @@ -0,0 +1,5 @@ +{ + "description": "This is Deprecated Artifact Node Type.", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Component.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Component.json new file mode 100644 index 000000000..bc4827b8b --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Component.json @@ -0,0 +1,5 @@ +{ + "description": "This is default Component Node", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json new file mode 100644 index 000000000..86728cf2f --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.DG.json @@ -0,0 +1,5 @@ +{ + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.ResourceSource.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.ResourceSource.json new file mode 100644 index 000000000..2ef553e24 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.ResourceSource.json @@ -0,0 +1,5 @@ +{ + "description": "TOSCA base type for Resource Sources", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Vnf.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Vnf.json new file mode 100644 index 000000000..acb1f2f31 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.Vnf.json @@ -0,0 +1,5 @@ +{ + "description": "This is VNF Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json new file mode 100644 index 000000000..7b67c8cb2 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Python.json @@ -0,0 +1,5 @@ +{ + "description": "This is Python Component", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json new file mode 100644 index 000000000..246f17706 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json @@ -0,0 +1,42 @@ +{ + "description": "This is VNF Device with Netconf Capability", + "version": "1.0.0", + "capabilities": { + "netconf": { + "type": "tosca.capabilities.Netconf", + "properties": { + "login-key": { + "required": true, + "type": "string", + "default": "sdnc" + }, + "login-account": { + "required": true, + "type": "string", + "default": "sdnc-tacacs" + }, + "source": { + "required": true, + "type": "string", + "default": "npm" + }, + "target-ip-address": { + "required": true, + "type": "string" + }, + "port-number": { + "required": true, + "type": "integer", + "default": 830 + }, + "connection-time-out": { + "required": false, + "type": "integer", + "default": 30 + } + } + } + }, + "derived_from": "tosca.nodes.Vnf" + +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/address.json b/components/model-catalog/resource-dictionary/starter-dictionary/address.json new file mode 100755 index 000000000..11f92d76e --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/address.json @@ -0,0 +1,14 @@ +{ + "name": "address", + "tags": "address", + "updated-by" : "Singal, Kapil ", + "property": { + "description" : "address", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input" + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/aic-cloud-region.json b/components/model-catalog/resource-dictionary/starter-dictionary/aic-cloud-region.json new file mode 100755 index 000000000..1501a9a63 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/aic-cloud-region.json @@ -0,0 +1,15 @@ +{ + "name" : "aic-cloud-region", + "tags" : "aic-cloud-region", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "aic-cloud-region", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/aic_clli.json b/components/model-catalog/resource-dictionary/starter-dictionary/aic_clli.json new file mode 100755 index 000000000..ccbbe9d43 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/aic_clli.json @@ -0,0 +1,15 @@ +{ + "name" : "aic_clli", + "tags" : "aic_clli", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "aic_clli", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/availability_zone_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/availability_zone_0.json new file mode 100755 index 000000000..b9e07a9fa --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/availability_zone_0.json @@ -0,0 +1,15 @@ +{ + "name" : "availability_zone_0", + "tags" : "availability_zone_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "availability_zone_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json new file mode 100755 index 000000000..de46524ce --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json @@ -0,0 +1,24 @@ +{ + "name": "db-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "bundle-id, brindasanth@onap.com", + "sources": { + "db": { + "type": "source-db", + "properties": { + "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", + "input-key-mapping": { + "profile_name": "profile_name" + }, + "output-key-mapping": { + "db-country": "country", + "db-state": "state" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/default-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/default-source.json new file mode 100755 index 000000000..42059ad8e --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/default-source.json @@ -0,0 +1,16 @@ +{ + "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com", + "name": "default-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "sources": { + "default": { + "type": "source-default", + "properties": { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json new file mode 100755 index 000000000..37ef5ae19 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json @@ -0,0 +1,33 @@ +{ + "name": "image_name", + "tags": "image_name", + "updated-by": "Singal, Kapil ", + "property": { + "type": "string", + "description": "image_name" + }, + "sources": { + "input": { + "type": "source-input" + }, + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/image_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "image_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/input-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/input-source.json new file mode 100755 index 000000000..6c693848e --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/input-source.json @@ -0,0 +1,16 @@ +{ + "name": "input-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "input-source", + "sources": { + "input": { + "type": "source-input", + "properties": { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json new file mode 100755 index 000000000..1f1b3e65c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json @@ -0,0 +1,33 @@ +{ + "name": "key_name", + "tags": "key_name", + "updated-by": "Singal, Kapil ", + "property": { + "type": "string", + "description": "key_name" + }, + "sources": { + "input": { + "type": "source-input" + }, + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/key_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "key_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json new file mode 100755 index 000000000..300a71f1f --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json @@ -0,0 +1,34 @@ +{ + "tags": "oam-local-ipv4-address", + "name": "mdsal-source", + "property" :{ + "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "sources": { + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type", + "path": "/v4-assigned-ip-list/0/v4-ip-prefix", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "network-role": "network-role", + "v4-ip-type": "v4-ip-type", + "vm-type": "vm-type" + }, + "output-key-mapping": { + "oam-local-ipv4-address": "v4-ip-prefix" + }, + "key-dependencies": [ + "service-instance-id", + "network-role", + "v4-ip-type", + "vm-type" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/name_0.json new file mode 100755 index 000000000..433a3b724 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/name_0.json @@ -0,0 +1,15 @@ +{ + "name" : "name_0", + "tags" : "name_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "name_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nexus_artifact_repo.json b/components/model-catalog/resource-dictionary/starter-dictionary/nexus_artifact_repo.json new file mode 100755 index 000000000..6b0a79e03 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/nexus_artifact_repo.json @@ -0,0 +1,16 @@ +{ + "name" : "nexus_artifact_repo", + "tags" : "nexus_artifact_repo", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "nexus_artifact_repo", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json b/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json new file mode 100755 index 000000000..819c7e602 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json @@ -0,0 +1,25 @@ +{ + "name" : "nf-role", + "tags" : "nf-role", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnf/nf-role", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid", + "input-key-mapping" : { + "vnfmodelcustomizationuuid" : "vnf-model-customization-uuid" + }, + "output-key-mapping" : { + "nf-role" : "vf_model_role" + }, + "key-dependencies" : [ "vnf-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json b/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json new file mode 100755 index 000000000..b82791877 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json @@ -0,0 +1,25 @@ +{ + "name" : "nfc-naming-code", + "tags" : "nfc-naming-code", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "nfc-naming-code", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid", + "input-key-mapping" : { + "vfccustomizationuuid" : "vfccustomizationuuid" + }, + "output-key-mapping" : { + "nfc-naming-code" : "nfc_naming_code" + }, + "key-dependencies" : [ "vfccustomizationuuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json new file mode 100755 index 000000000..cee060153 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json @@ -0,0 +1,21 @@ +{ + "name" : "onap_private_net_cidr", + "tags" : "onap_private_net_cidr", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "onap_private_net_cidr", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private\"", + "output-key-mapping" : { + "onap_private_net_cidr" : "prefix" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json new file mode 100755 index 000000000..bb70fe3c4 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json @@ -0,0 +1,33 @@ +{ + "name": "onap_private_net_id", + "tags": "onap_private_net_id", + "updated-by": "Singal, Kapil ", + "property": { + "type": "string", + "description": "onap_private_net_id" + }, + "sources": { + "input": { + "type": "source-input" + }, + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/onap_private_net_id", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "onap_private_net_id": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json new file mode 100755 index 000000000..d38ceb49c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json @@ -0,0 +1,33 @@ +{ + "name": "onap_private_subnet_id", + "tags": "onap_private_subnet_id", + "updated-by": "Singal, Kapil ", + "property": { + "type": "string", + "description": "onap_private_subnet_id" + }, + "sources": { + "input": { + "type": "source-input" + }, + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/onap_private_subnet_id", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "onap_private_subnet_id": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json new file mode 100755 index 000000000..5dea3e316 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json @@ -0,0 +1,21 @@ +{ + "name" : "private-prefix-id", + "tags" : "private-prefix-id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "private-prefix-id", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"", + "output-key-mapping" : { + "private-prefix-id" : "prefix_id" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json new file mode 100755 index 000000000..fb572741c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json @@ -0,0 +1,21 @@ +{ + "name" : "protected-prefix-id", + "tags" : "protected-prefix-id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "protected-prefix-id", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"protected\"", + "output-key-mapping" : { + "protected-prefix-id" : "prefix_id" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json new file mode 100755 index 000000000..261920feb --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json @@ -0,0 +1,21 @@ +{ + "name" : "protected_private_net_cidr", + "tags" : "protected_private_net_cidr", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "protected_private_net_cidr", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"protected\"", + "output-key-mapping" : { + "protected_private_net_cidr" : "prefix" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_subnet_id.json new file mode 100755 index 000000000..b3daadc49 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_subnet_id.json @@ -0,0 +1,16 @@ +{ + "name" : "protected_private_subnet_id", + "tags" : "protected_private_subnet_id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "protected_private_subnet_id", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json new file mode 100755 index 000000000..ce6c2f2a3 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json @@ -0,0 +1,34 @@ +{ + "name": "pub_key", + "tags": "pub_key", + "updated-by": "Singal, Kapil ", + "property": { + "type": "string", + "description": "pub_key" + }, + "sources": { + "input": { + "type": "source-input" + }, + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/pub_key", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "pub_key": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } +} + diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/public_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/public_net_id.json new file mode 100755 index 000000000..6cc9c2e38 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/public_net_id.json @@ -0,0 +1,14 @@ +{ + "name": "public_net_id", + "tags": "public_net_id", + "updated-by" : "Singal, Kapil ", + "property": { + "type": "string", + "description" : "public_net_id" + }, + "sources": { + "input": { + "type": "source-input" + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json new file mode 100644 index 000000000..90775aee0 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json @@ -0,0 +1,24 @@ +{ + "name": "sample-db-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "db-source, brindasanth@onap.com", + "sources": { + "db": { + "type": "source-db", + "properties": { + "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", + "input-key-mapping": { + "profile_name": "profile_name" + }, + "output-key-mapping": { + "db-country": "country", + "db-state": "state" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-default-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-default-source.json new file mode 100644 index 000000000..395b0ddd1 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-default-source.json @@ -0,0 +1,16 @@ +{ + "tags": "sample-default-source", + "name": "sample-default-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "sources": { + "default": { + "type": "source-default", + "properties": { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-input-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-input-source.json new file mode 100644 index 000000000..73c0d4089 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-input-source.json @@ -0,0 +1,17 @@ +{ + "name": "sample-input-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "sample-input-source", + "sources": { + "input": { + "type": "source-input", + "properties": { + "key": "input-source" + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json new file mode 100644 index 000000000..5834dd49b --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json @@ -0,0 +1,29 @@ +{ + "tags": "sample-licenses", + "name": "sample-licenses", + "property": { + "description" : " Sample Data for licences", + "required": true, + "type": "list", + "entry_schema": { + "type": "dt-license-key" + } + }, + "updated-by": "brindasanth@onap.com", + "sources": { + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/L3VNF-API:services/service-list/", + "path": "/licenses", + "input-key-mapping": { + }, + "output-key-mapping": { + "licenses": "licenses" + }, + "key-dependencies": [] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json new file mode 100644 index 000000000..25464d3fe --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json @@ -0,0 +1,25 @@ +{ + "tags": "sample-mdsal-source", + "name": "sample-mdsal-source", + "property": { + "description": "Sample sample-mdsal-source", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "sources": { + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type", + "path": "/v4-assigned-ip-list/0/v4-ip-prefix", + "input-key-mapping": { + }, + "output-key-mapping": { + "mdsal-source": "v4-ip-prefix" + }, + "key-dependencies": [] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-v4-ip-type.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-v4-ip-type.json new file mode 100644 index 000000000..055279c1e --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-v4-ip-type.json @@ -0,0 +1,17 @@ +{ + "name": "sample-v4-ip-type", + "property": { + "description": "sample-v4-ip-type", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "sample-v4-ip-type", + "sources": { + "input": { + "type": "source-input", + "properties": { + "key": "sample-v4-ip-type" + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sec_group.json b/components/model-catalog/resource-dictionary/starter-dictionary/sec_group.json new file mode 100755 index 000000000..017ba984d --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sec_group.json @@ -0,0 +1,16 @@ +{ + "name" : "sec_group", + "tags" : "sec_group", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "sec_group", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json new file mode 100755 index 000000000..37b98687c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json @@ -0,0 +1,15 @@ +{ + "name" : "service-instance-id", + "tags" : "service-instance-id, tosca.datatypes.Root, data_type", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "To be provided", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/status.json b/components/model-catalog/resource-dictionary/starter-dictionary/status.json new file mode 100755 index 000000000..47a19d096 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/status.json @@ -0,0 +1,16 @@ +{ + "name" : "status", + "tags" : "status", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "status", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json new file mode 100755 index 000000000..3cb732056 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json @@ -0,0 +1,21 @@ +{ + "name" : "unprotected-prefix-id", + "tags" : "unprotected-prefix-id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "unprotected-prefix-id", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"unprotected\"", + "output-key-mapping" : { + "unprotected-prefix-id" : "prefix_id" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json new file mode 100755 index 000000000..d2a339e7c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json @@ -0,0 +1,21 @@ +{ + "name" : "unprotected_private_net_cidr", + "tags" : "unprotected_private_net_cidr", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "unprotected_private_net_cidr", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"unprotected\"", + "output-key-mapping" : { + "unprotected_private_net_cidr" : "prefix" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_subnet_id.json new file mode 100755 index 000000000..760d611ae --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_subnet_id.json @@ -0,0 +1,16 @@ +{ + "name" : "unprotected_private_subnet_id", + "tags" : "unprotected_private_subnet_id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "unprotected_private_subnet_id", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json new file mode 100755 index 000000000..74f9310e3 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-id.json @@ -0,0 +1,15 @@ +{ + "name" : "vf-module-id", + "tags" : "vf-module-id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-module-id", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json new file mode 100755 index 000000000..ac5e21a6a --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json @@ -0,0 +1,25 @@ +{ + "name" : "vf-module-label", + "tags" : "vf-module-label", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-module-label", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping" : { + "customizationid" : "vf-module-model-customization-uuid" + }, + "output-key-mapping" : { + "vf-module-label" : "vf_module_label" + }, + "key-dependencies" : [ "vf-module-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-model-customization-uuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-model-customization-uuid.json new file mode 100755 index 000000000..6736e4feb --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-model-customization-uuid.json @@ -0,0 +1,15 @@ +{ + "name" : "vf-module-model-customization-uuid", + "tags" : "vf-module-model-customization-uuid", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-module-model-customization-uuid", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json new file mode 100755 index 000000000..147425c33 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json @@ -0,0 +1,25 @@ +{ + "name" : "vf-module-type", + "tags" : "vf-module-type", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-module-type", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid", + "input-key-mapping" : { + "customizationid" : "vf-module-model-customization-uuid" + }, + "output-key-mapping" : { + "vf-module-type" : "vf_module_type" + }, + "key-dependencies" : [ "vf-module-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json new file mode 100755 index 000000000..f68cc3746 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json @@ -0,0 +1,25 @@ +{ + "name" : "vf-naming-policy", + "tags" : "vf-naming-policy", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-naming-policy", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", + "input-key-mapping" : { + "vnf_model_customization_uuid" : "vnf-model-customization-uuid" + }, + "output-key-mapping" : { + "vf-naming-policy" : "vf_naming_policy" + }, + "key-dependencies" : [ "vnf-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json new file mode 100755 index 000000000..1865d47ff --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json @@ -0,0 +1,25 @@ +{ + "name" : "vf-nf-code", + "tags" : "vf-nf-code", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf-nf-code", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid", + "input-key-mapping" : { + "customizationid" : "vnf-model-customization-uuid" + }, + "output-key-mapping" : { + "vf-nf-code" : "vf_nf_code" + }, + "key-dependencies" : [ "vnf-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf_module_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf_module_name.json new file mode 100755 index 000000000..20ce458b8 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf_module_name.json @@ -0,0 +1,15 @@ +{ + "name" : "vf_module_name", + "tags" : "vf_module_name", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vf_module_name", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json new file mode 100755 index 000000000..463f8480b --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json @@ -0,0 +1,25 @@ +{ + "name" : "vfccustomizationuuid", + "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vfccustomizationuuid", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid", + "input-key-mapping" : { + "vfmodulecustomizationuuid" : "vf-module-model-customization-uuid" + }, + "output-key-mapping" : { + "vfccustomizationuuid" : "vnf_customid" + }, + "key-dependencies" : [ "vf-module-model-customization-uuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_name_0.json new file mode 100755 index 000000000..96a975859 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_name_0.json @@ -0,0 +1,15 @@ +{ + "name" : "vfw_name_0", + "tags" : "vfw_name_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vfw_name_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json new file mode 100755 index 000000000..71a4df2c4 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json @@ -0,0 +1,33 @@ +{ + "name" : "vfw_private_ip_0", + "tags" : "vfw_private_ip_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vfw_private_ip_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + }, + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vfw_private_ip_0", + "path" : "/param/0/value", + "expression-type" : "JSON_POINTER", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vfw_private_ip_0" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json new file mode 100755 index 000000000..481edae8c --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json @@ -0,0 +1,33 @@ +{ + "name" : "vfw_private_ip_1", + "tags" : "vfw_private_ip_1", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vfw_private_ip_1", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + }, + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vfw_private_ip_1", + "path" : "/param/0/value", + "expression-type" : "JSON_POINTER", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vfw_private_ip_1" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_2.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_2.json new file mode 100755 index 000000000..f8adf741a --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_2.json @@ -0,0 +1,14 @@ +{ + "name": "vfw_private_ip_2", + "tags": "vfw_private_ip_2", + "updated-by" : "Singal, Kapil ", + "property": { + "type": "string", + "description" : "vfw_private_ip_2" + }, + "sources": { + "input": { + "type": "source-input" + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json b/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json new file mode 100755 index 000000000..0204c64bb --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json @@ -0,0 +1,25 @@ +{ + "name" : "vm-type", + "tags" : "vm-type", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vm-type", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid", + "input-key-mapping" : { + "vfccustomizationuuid" : "vfccustomizationuuid" + }, + "output-key-mapping" : { + "vm-type" : "vm_type" + }, + "key-dependencies" : [ "vfccustomizationuuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json new file mode 100755 index 000000000..7f3a18ffc --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json @@ -0,0 +1,15 @@ +{ + "name" : "vnf-id", + "tags" : "vnf-id", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnf-id", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-model-customization-uuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-model-customization-uuid.json new file mode 100755 index 000000000..2aa08c40f --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-model-customization-uuid.json @@ -0,0 +1,15 @@ +{ + "name" : "vnf-model-customization-uuid", + "tags" : "vnf-model-customization-uuid", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnf-model-customization-uuid", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json new file mode 100755 index 000000000..89b3dc1c0 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json @@ -0,0 +1,28 @@ +{ + "name" : "vnf-name", + "tags" : "vnf-name, tosca.datatypes.Root, data_type", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnf-name", + "type" : "string" + }, + "sources" : { + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path" : "/param/0/value", + "expression-type" : "JSON_POINTER", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vnf-name" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json new file mode 100755 index 000000000..c55f1c18a --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json @@ -0,0 +1,27 @@ +{ + "name" : "vnf_name", + "tags" : "vnf_name", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnf_name", + "type" : "string" + }, + "sources" : { + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path" : "/param/0/value", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vnf_name" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json new file mode 100755 index 000000000..c894fb531 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json @@ -0,0 +1,25 @@ +{ + "name" : "vnfc-model-invariant-uuid", + "tags" : "vnfc-model-invariant-uuid", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnfc-model-invariant-uuid for SRIOV VPE template", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid", + "input-key-mapping" : { + "vfccustomizationuuid" : "vfccustomizationuuid" + }, + "output-key-mapping" : { + "vnfc-model-invariant-uuid" : "vfc_invariant_uuid" + }, + "key-dependencies" : [ "vfccustomizationuuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json new file mode 100755 index 000000000..45eb07f79 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json @@ -0,0 +1,25 @@ +{ + "name" : "vnfc-model-version", + "tags" : "vnfc-model-version", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vnfc-model-version for SRIOV VPE template", + "type" : "string" + }, + "sources" : { + "db" : { + "type" : "source-db", + "properties" : { + "type" : "SQL", + "query" : "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid", + "input-key-mapping" : { + "vfccustomizationuuid" : "vfccustomizationuuid" + }, + "output-key-mapping" : { + "vnfc-model-version" : "vnfc_model_version" + }, + "key-dependencies" : [ "vfccustomizationuuid" ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/volume-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/volume-name.json new file mode 100755 index 000000000..3fe5ab30f --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/volume-name.json @@ -0,0 +1,15 @@ +{ + "name" : "volume-name", + "tags" : "volume-name", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "volume-name", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/volume_group_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/volume_group_name.json new file mode 100755 index 000000000..90b360964 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/volume_group_name.json @@ -0,0 +1,16 @@ +{ + "name" : "volume_group_name", + "tags" : "volume_group_name", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "volume_group_name", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_name_0.json new file mode 100755 index 000000000..f158d53c5 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_name_0.json @@ -0,0 +1,15 @@ +{ + "name" : "vpg_name_0", + "tags" : "vpg_name_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vpg_name_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json new file mode 100755 index 000000000..13d89993b --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json @@ -0,0 +1,33 @@ +{ + "name" : "vpg_private_ip_0", + "tags" : "vpg_private_ip_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vpg_private_ip_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + }, + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vpg_private_ip_0", + "path" : "/param/0/value", + "expression-type" : "JSON_POINTER", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vpg_private_ip_0" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_1.json new file mode 100755 index 000000000..ff58f8afb --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_1.json @@ -0,0 +1,16 @@ +{ + "name" : "vpg_private_ip_1", + "tags" : "vpg_private_ip_1", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vpg_private_ip_1", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_name_0.json new file mode 100755 index 000000000..7b7ba4574 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_name_0.json @@ -0,0 +1,15 @@ +{ + "name" : "vsn_name_0", + "tags" : "vsn_name_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vsn_name_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json new file mode 100755 index 000000000..fcd6d8d55 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json @@ -0,0 +1,33 @@ +{ + "name" : "vsn_private_ip_0", + "tags" : "vsn_private_ip_0", + "updated-by" : "Singal, Kapil ", + "property" : { + "description" : "vsn_private_ip_0", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { + } + }, + "mdsal" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vsn_private_ip_0", + "path" : "/param/0/value", + "expression-type" : "JSON_POINTER", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "vsn_private_ip_0" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } +} diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_1.json new file mode 100755 index 000000000..52de69c62 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_1.json @@ -0,0 +1,14 @@ +{ + "name": "vsn_private_ip_1", + "tags": "vsn_private_ip_1", + "updated-by" : "Singal, Kapil ", + "property": { + "type": "string", + "description" : "vsn_private_ip_1" + }, + "sources": { + "input": { + "type": "source-input" + } + } +} -- cgit 1.2.3-korg From 2c505b980ea8942ba84fb99278dd1c34a5b5873c Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 12 Nov 2018 12:32:25 -0500 Subject: Controller Blueprints Component Core Modify test case blueprint data pointing to model catalog location. Change-Id: I601eddf899516b01ae8624c96aa13c5e236c8e5b Issue-ID: CCSDK-678 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/factory/BluePrintParserFactory.kt | 51 ---------------------- .../core/service/PropertyAssignmentService.kt | 4 +- .../core/service/BluePrintContextTest.kt | 35 ++++----------- .../core/service/BluePrintParserFactoryTest.kt | 42 ------------------ .../core/service/BluePrintRuntimeServiceTest.kt | 44 ++++++++----------- .../BluePrintValidatorDefaultServiceTest.kt | 18 ++++---- .../core/utils/BluePrintMetadataUtilsTest.kt | 2 +- .../core/utils/JacksonReactorUtilsTest.kt | 4 +- .../core/utils/JacksonUtilsTest.kt | 21 ++------- .../Definitions/activation-blueprint.json | 9 +++- 10 files changed, 52 insertions(+), 178 deletions(-) delete mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt delete mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt deleted file mode 100644 index 83233abc1..000000000 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core.factory - -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintParserDefaultService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintParserService -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager - -/** - * - * BluePrintParserFactory - * @author Brinda Santh - */ - -object BluePrintParserFactory { - private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - - var bluePrintParserServices: MutableMap = HashMap() - - init { - log.info("Initialised default BluePrintParser Service ") - bluePrintParserServices.put(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT, BluePrintParserDefaultService()) - } - - fun register(key:String, bluePrintParserService: BluePrintParserService){ - bluePrintParserServices.put(key, bluePrintParserService) - } - - /** - * Called by clients to get a Blueprint Parser for the Blueprint parser type - */ - fun instance(key : String) : BluePrintParserService? { - return bluePrintParserServices.get(key) - } -} - diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt index 5b511f158..947eb41e0 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt @@ -197,8 +197,8 @@ If Property Assignment is Expression. } fun artifactContent(artifactDefinition: ArtifactDefinition): String { - val bluePrintBasePath: String = bluePrintRuntimeService.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH) as? String - ?: throw BluePrintException(format("failed to get property (%s) from context", BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)) + val bluePrintBasePath: String = bluePrintRuntimeService.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)?.asText() + ?: throw BluePrintException("failed to get property (${BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH}) from getStore") if (artifactDefinition.repository != null) { TODO() diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt index 7a74ca476..6cfed3246 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt @@ -17,17 +17,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service -import org.apache.commons.io.FileUtils -import org.junit.Before -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager -import java.io.File -import java.nio.charset.Charset +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import kotlin.test.assertNotNull + /** * * @@ -37,30 +33,17 @@ class BluePrintContextTest { private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - lateinit var bluePrintContext: BluePrintContext - - @Before - fun setUp() { - - val basepath = "load/blueprints" - - bluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! - .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) - assertNotNull(bluePrintContext, "Failed to populate Blueprint context") - } + val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration") @Test - fun testBluePrintContextFromContent() { - val fileName = "load/blueprints/baseconfiguration/Definitions/activation-blueprint.json" - val content : String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) - val bpContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! - .readBlueprint(content) - assertNotNull(bpContext, "Failed to get blueprint content") - assertNotNull(bpContext.serviceTemplate, "Failed to get blueprint content's service template") + fun testBluePrintContextCreation() { + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) + assertNotNull(bluePrintContext, "Failed to populate Blueprint context") } @Test fun testChainedProperty() { + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) val nodeType = bluePrintContext.nodeTypeChained("component-resource-assignment") assertNotNull(nodeType, "Failed to get chained node type") log.trace("Properties {}", JacksonUtils.getJson(nodeType, true)) diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt deleted file mode 100644 index 5a5557d75..000000000 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core.service - -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import kotlin.test.assertNotNull - -/** - * - * - * @author Brinda Santh - */ -class BluePrintParserFactoryTest { - private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - - @Test - fun testBluePrintJson() { - val basepath = "load/blueprints" - - val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT)!! - .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) - assertNotNull(bluePrintContext, "Failed to populate Blueprint context") - log.trace("Blue Print {}",bluePrintContext.blueprintJson(true)) - } -} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 68031d292..19c6c2f9d 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -20,6 +20,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.NullNode import org.junit.Test import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive @@ -49,11 +50,11 @@ class BluePrintRuntimeServiceTest { val inputNode: JsonNode = jsonNodeFromFile(inputDataPath) bluePrintRuntimeService.assignInputs(inputNode) - val propContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateProperties("resource-assignment-action") + val propContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process") assertNotNull(propContext, "Failed to populate interface property values") - assertEquals(propContext.get("mode"), "sync".asJsonPrimitive(), "Failed to populate parameter process-name") - assertEquals(propContext.get("version"), "1.0.0".asJsonPrimitive(), "Failed to populate parameter version") + assertEquals(propContext["process-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name") + assertEquals(propContext["version"], jsonNodeFromObject("sample-action"), "Failed to populate parameter version") } @Test @@ -67,14 +68,13 @@ class BluePrintRuntimeServiceTest { BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(), "data/default-context.json", executionContext) - val inContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component", - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process") - - log.info("In Context {}", inContext) + val inContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment", + "DefaultComponentNode", "process") assertNotNull(inContext, "Failed to populate interface input property values") - assertEquals(inContext.get("action-name"), "sample-action".asJsonPrimitive(), "Failed to populate parameter action-name") - assertEquals(inContext.get("request-id"), "12345".asJsonPrimitive(), "Failed to populate parameter action-name") + assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") + assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name") + assertEquals(inContext["template-content"], jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name") } @Test @@ -83,24 +83,18 @@ class BluePrintRuntimeServiceTest { val bluePrintRuntimeService = getBluePrintRuntimeService() - val successValue: JsonNode = jsonNodeFromObject("Success") - val paramValue: JsonNode = jsonNodeFromObject("param-content") - - bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "params", paramValue) - - bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component", - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process") - - val resourceAssignmentParamsNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment-ra-component", - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", "resource-assignment-params") - - val statusNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment-ra-component", - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", "status") + bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance()) - assertEquals(paramValue, resourceAssignmentParamsNode, "Failed to get operation property resource-assignment-params") + bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment", + "DefaultComponentNode", "process") - assertEquals(successValue, statusNode, "Failed to get operation property status") + val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", + "DefaultComponentNode", "process", "status") + assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status") + val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", + "DefaultComponentNode", "process", "resource-assignment-params") + assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params") } @@ -123,7 +117,7 @@ class BluePrintRuntimeServiceTest { } private fun getBluePrintRuntimeService(): BluePrintRuntimeService> { - val blueprintBasePath: String = ("load/blueprints/baseconfiguration") + val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration") val blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath) val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH) diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt index b05fcb61b..09c58170f 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt @@ -16,12 +16,11 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service -import org.junit.Before -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager +import org.junit.Before +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils /** * @@ -30,7 +29,6 @@ import com.att.eelf.configuration.EELFManager */ class BluePrintValidatorDefaultServiceTest { private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - val basepath = "load/blueprints" @Before fun setUp(): Unit { @@ -39,11 +37,13 @@ class BluePrintValidatorDefaultServiceTest { @Test fun testValidateBluePrint() { - val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! - .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) - val properties : MutableMap = hashMapOf() + + val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration") + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) + val properties: MutableMap = hashMapOf() + val validatorService = BluePrintValidatorDefaultService() - validatorService.validateBlueprint(bluePrintContext.serviceTemplate,properties) + validatorService.validateBlueprint(bluePrintContext.serviceTemplate, properties) log.info("Validation Message {}", properties) } } \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt index ddb39a2d6..d5b184f6e 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt @@ -26,7 +26,7 @@ class BluePrintMetadataUtilsTest { @Test fun testToscaMetaData(){ - val basePath : String = "load/blueprints/baseconfiguration" + val basePath : String = "./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration" val toscaMetaData : ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(basePath) assertNotNull(toscaMetaData, "Missing Tosca Definition Object") diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt index c5f451ea6..be76593d8 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt @@ -29,7 +29,7 @@ class JacksonReactorUtilsTest { @Test fun testReadValues() { - val serviceTemplate = JacksonReactorUtils.readValueFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json", + val serviceTemplate = JacksonReactorUtils.readValueFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json", ServiceTemplate::class.java).block() assertNotNull(serviceTemplate, "Failed to simple transform Service Template") @@ -38,7 +38,7 @@ class JacksonReactorUtilsTest { val jsonContent = JacksonReactorUtils.getJson(serviceTemplate, true).block() assertNotNull(jsonContent, "Failed to get json content") - val jsonNode = JacksonReactorUtils.jsonNodeFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json") + val jsonNode = JacksonReactorUtils.jsonNodeFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json") .block() assertNotNull(jsonContent, "Failed to get json Node") } diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt index c3718b27a..b5edab0fa 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt @@ -17,12 +17,10 @@ package org.onap.ccsdk.apps.controllerblueprints.core.utils -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager -import kotlin.test.assertEquals +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -35,19 +33,6 @@ class JacksonUtilsTest { private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - val basePath = "load/blueprints" - - @Test - fun testReadValues() { - val content = ResourceResolverUtils.getFileContent("baseconfiguration/Definitions/activation-blueprint.json", basePath) - val serviceTemplate = JacksonUtils.readValue(content, ServiceTemplate::class.java) - assertNotNull(serviceTemplate, "Failed to simple transform Service Template") - assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance") - - val jsonContent = JacksonUtils.getJson(serviceTemplate, true) - assertNotNull(jsonContent, "Failed to get json content") - } - @Test fun testJsonNodeFromClassPathFile() { val filePath = "data/default-context.json" @@ -56,7 +41,7 @@ class JacksonUtilsTest { @Test fun testJsonNodeFromFile() { - val filePath = basePath + "/baseconfiguration/Definitions/activation-blueprint.json" + val filePath = "src/test/resources/data/default-context.json" JacksonUtils.jsonNodeFromFile(filePath) } diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 4c1ca4a52..0137cd2bd 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -87,8 +87,13 @@ } }, "outputs": { - "resource-assignment-params": "", - "status": "" + "resource-assignment-params": { + "get_attribute": [ + "SELF", + "assignment-params" + ] + }, + "status": "success" } } } -- cgit 1.2.3-korg From f4fb7a6f016fbe0bd06525b05eb26a365be7c6ba Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 12 Nov 2018 15:08:40 -0500 Subject: Controller Blueprints Microservice Add blueprint multiple import file capability. Change-Id: If57aecb08447252b0e84a7e55b081e682d6a0bbd Issue-ID: CCSDK-681 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/service/BluePrintImportService.kt | 94 +++++++ .../core/service/BluePrintValidatorService.kt | 10 +- .../core/utils/BluePrintMetadataUtils.kt | 9 +- .../core/utils/ServiceTemplateUtils.kt | 66 +++++ .../Definitions/activation-blueprint.json | 273 +++------------------ .../baseconfiguration/Definitions/types.json | 210 ++++++++++++++++ 6 files changed, 419 insertions(+), 243 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt new file mode 100644 index 000000000..fce06f3f5 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt @@ -0,0 +1,94 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.service + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.data.ImportDefinition +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.utils.ServiceTemplateUtils +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import java.io.File +import java.net.URL +import java.net.URLDecoder +import java.nio.charset.Charset + +class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) { + + private val log: Logger = LoggerFactory.getLogger(this::class.toString()) + val PARENT_SERVICE_TEMPLATE: String = "parent" + + var importServiceTemplateMap: MutableMap = hashMapOf() + + + fun getImportResolvedServiceTemplate(): ServiceTemplate { + // Populate Imported Service Templates + traverseSchema(PARENT_SERVICE_TEMPLATE, parentServiceTemplate) + + importServiceTemplateMap.forEach { key, serviceTemplate -> + ServiceTemplateUtils.merge(parentServiceTemplate, serviceTemplate) + log.debug("merged service template $key") + } + return parentServiceTemplate + } + + private fun traverseSchema(key: String, serviceTemplate: ServiceTemplate) { + if (key != PARENT_SERVICE_TEMPLATE) { + importServiceTemplateMap[key] = serviceTemplate + } + val imports: List? = serviceTemplate.imports + + imports?.let { + serviceTemplate.imports?.forEach { importDefinition -> + val childServiceTemplate = resolveImportDefinition(importDefinition) + val keyName: String = importDefinition.file + traverseSchema(keyName, childServiceTemplate) + } + } + } + + private fun resolveImportDefinition(importDefinition: ImportDefinition): ServiceTemplate { + var serviceTemplate: ServiceTemplate? = null + val file: String = importDefinition.file + val decodedSystemId: String = URLDecoder.decode(file, Charset.defaultCharset().toString()) + log.trace("file ({}), decodedSystemId ({}) ", file, decodedSystemId) + try { + if (decodedSystemId.startsWith("http", true) + || decodedSystemId.startsWith("https", true)) { + val givenUrl: String = URL(decodedSystemId).toString() + val systemUrl: String = File(".").toURI().toURL().toString() + log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl) + if (givenUrl.startsWith(systemUrl)) { + + } + } else { + if (!decodedSystemId.startsWith("/")) { + importDefinition.file = StringBuilder().append(blueprintBasePath).append(File.separator).append(file).toString() + } + serviceTemplate = ServiceTemplateUtils.getServiceTemplate(importDefinition.file) + } + } catch (e: Exception) { + throw BluePrintException("failed to populate service template for ${importDefinition.file}", e) + } + if (serviceTemplate == null) { + throw BluePrintException("failed to populate service template for : ${importDefinition.file}") + } + return serviceTemplate + } + + +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt index 7ad38332a..178373704 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt @@ -17,13 +17,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode import com.google.common.base.Preconditions import org.apache.commons.lang3.StringUtils import org.onap.ccsdk.apps.controllerblueprints.core.* import org.onap.ccsdk.apps.controllerblueprints.core.data.* -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import java.io.Serializable @@ -530,7 +530,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) { val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName) - ?: throw BluePrintException(format("Failed to ArtifactType for ArtifactDefinition : {}", artifactDefinitionName)) + ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)") checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom) } @@ -538,14 +538,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class) open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) { check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) { - throw BluePrintException(format("Failed to get ArtifactType ({})'s derivedFrom({}) definition ", artifactTypeName, derivedFrom)) + throw BluePrintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition") } } @Throws(BluePrintException::class) open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BluePrintException(format("Failed to get DataType ({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) + throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt index 43d55feac..320c306c3 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt @@ -25,6 +25,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintImportService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService import java.io.File @@ -99,9 +100,9 @@ object BluePrintMetadataUtils { fun readBlueprintFile(entityDefinitions: String, basePath: String): BluePrintContext { val rootFilePath: String = basePath.plus(File.separator).plus(entityDefinitions) val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) - // TODO ("Fix for Multiple Service Template file definitions") -// val schemaImportResolverUtils = BluePrintResolverService(rootServiceTemplate, basePath) -// val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate() - return BluePrintContext(rootServiceTemplate) + // Recursively Import Template files + val schemaImportResolverUtils = BluePrintImportService(rootServiceTemplate, basePath) + val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate() + return BluePrintContext(completeServiceTemplate) } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt index 0d739357c..0249e20b1 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.utils import org.apache.commons.io.FileUtils import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate import java.io.File import java.nio.charset.Charset @@ -40,5 +41,70 @@ object ServiceTemplateUtils { return JacksonUtils.readValue(content) } + fun merge(parentServiceTemplate: ServiceTemplate, toMerge: ServiceTemplate, removeImports: Boolean? = true): ServiceTemplate { + if (removeImports!!) { + parentServiceTemplate.imports = null + toMerge.imports = null + } + + toMerge.metadata?.let { + parentServiceTemplate.metadata = parentServiceTemplate.metadata ?: hashMapOf() + parentServiceTemplate.metadata?.putAll(toMerge.metadata as MutableMap) + } + + toMerge.dslDefinitions?.let { + parentServiceTemplate.dslDefinitions = parentServiceTemplate.dslDefinitions ?: hashMapOf() + parentServiceTemplate.dslDefinitions?.putAll(toMerge.dslDefinitions as MutableMap) + } + + toMerge.dataTypes?.let { + parentServiceTemplate.dataTypes = parentServiceTemplate.dataTypes ?: hashMapOf() + parentServiceTemplate.dataTypes?.putAll(toMerge.dataTypes as MutableMap) + } + + toMerge.nodeTypes?.let { + parentServiceTemplate.nodeTypes = parentServiceTemplate.nodeTypes ?: hashMapOf() + parentServiceTemplate.nodeTypes?.putAll(toMerge.nodeTypes as MutableMap) + } + + toMerge.artifactTypes?.let { + parentServiceTemplate.artifactTypes = parentServiceTemplate.artifactTypes ?: hashMapOf() + parentServiceTemplate.artifactTypes?.putAll(toMerge.artifactTypes as MutableMap) + } + + toMerge.repositories?.let { + parentServiceTemplate.repositories = parentServiceTemplate.repositories ?: hashMapOf() + parentServiceTemplate.repositories?.putAll(toMerge.repositories as MutableMap) + } + + parentServiceTemplate.topologyTemplate = parentServiceTemplate.topologyTemplate ?: TopologyTemplate() + + toMerge.topologyTemplate?.inputs?.let { + parentServiceTemplate.topologyTemplate?.inputs = parentServiceTemplate.topologyTemplate?.inputs ?: hashMapOf() + parentServiceTemplate.topologyTemplate?.inputs?.putAll(parentServiceTemplate.topologyTemplate?.inputs as MutableMap) + } + + toMerge.topologyTemplate?.nodeTemplates?.let { + parentServiceTemplate.topologyTemplate?.nodeTemplates = parentServiceTemplate.topologyTemplate?.nodeTemplates ?: hashMapOf() + parentServiceTemplate.topologyTemplate?.nodeTemplates?.putAll(parentServiceTemplate.topologyTemplate?.nodeTemplates as MutableMap) + } + + toMerge.topologyTemplate?.relationshipTemplates?.let { + parentServiceTemplate.topologyTemplate?.relationshipTemplates = parentServiceTemplate.topologyTemplate?.relationshipTemplates ?: hashMapOf() + parentServiceTemplate.topologyTemplate?.relationshipTemplates?.putAll(parentServiceTemplate.topologyTemplate?.relationshipTemplates as MutableMap) + } + + toMerge.topologyTemplate?.policies?.let { + parentServiceTemplate.topologyTemplate?.policies = parentServiceTemplate.topologyTemplate?.policies ?: hashMapOf() + parentServiceTemplate.topologyTemplate?.policies?.putAll(parentServiceTemplate.topologyTemplate?.policies as MutableMap) + } + + toMerge.topologyTemplate?.workflows?.let { + parentServiceTemplate.topologyTemplate?.workflows = parentServiceTemplate.topologyTemplate?.workflows ?: hashMapOf() + parentServiceTemplate.topologyTemplate?.workflows?.putAll(parentServiceTemplate.topologyTemplate?.workflows as MutableMap) + } + return parentServiceTemplate + } + } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 0137cd2bd..ee02b3a77 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -1,12 +1,17 @@ { "metadata": { "template_author": "Brinda Santh Muthuramalingam", - "author-email": "brindasanth@gmail.com", + "author-email": "brindasanth@in.ibm.com", "user-groups": "ADMIN, OPERATION", "template_name": "baseconfiguration", "template_version": "1.0.0", "template_tags": "brinda, tosca" }, + "imports": [ + { + "file": "Definitions/types.json" + } + ], "topology_template": { "inputs": { "request-id": { @@ -28,7 +33,7 @@ }, "node_templates": { "activate-process": { - "type": "bpmn-activate", + "type": "dg-activate", "properties": { "process-name": { "get_input": "action-name" @@ -42,13 +47,13 @@ "content": { "get_artifact": [ "SELF", - "activate-process" + "dg-activate-process" ] } }, "artifacts": { - "activate-process": { - "type": "artifact-bpmn-camunda", + "dg-activate-process": { + "type": "artifact-directed-graph", "file": "Plans/ActivateProcess.bpmn" } } @@ -144,250 +149,50 @@ } }, "workflows": { - "activate-process": { + "resource-assignment": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, "steps": { "call-resource-assignment": { - "description": "Invoke Resource Assignment Component", + "description": "Resource Assignment Workflow", "target": "resource-assignment", "activities": [ { "call_operation": "ResourceAssignmentNode.process" } - ], - "on_success": [ - "download-baseconfig" - ] - }, - "download-baseconfig": { - "description": "Call Download Base Config Component", - "target": "activate-netconf", - "activities": [ - { - "call_operation": "NetconfTransactionNode.process" - } - ], - "on_success": [ - "download-licence" ] - }, - "download-licence": { - "description": "Call Download Licence Component", - "target": "activate-netconf", + } + } + }, + "activate": { + "steps": { + "call-resource-assignment": { + "description": "Netconf Activation Workflow", + "target": "resource-assignment", "activities": [ { - "call_operation": "NetconfTransactionNode.process" + "call_operation": "ResourceAssignmentNode.process" } ] } } } } - }, - "artifact_types": { - "artifact-template-velocity": { - "description": " Velocity Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "vtl" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-mapping-resource": { - "description": " Velocity Template Resource Mapping File used along with Configuration template", - "version": "1.0.0", - "file_ext": [ - "json" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-kotlin": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "kt" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-python": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "py" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-bpmn-camunda": { - "description": " Camunda BPM File", - "version": "1.0.0", - "file_ext": [ - "bpmn" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-component-jar": { - "description": "Component Jar", - "version": "1.0.0", - "file_ext": [ - "jar" - ], - "derived_from": "tosca.artifacts.Implementation" - } - }, - "node_types": { - "bpmn-activate": { - "description": "This is BPMN Activate node type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.nodes.DG" - }, - "tosca.nodes.Component": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.DG": { - "description": "This is Directed Graph Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.component.Python": { - "description": "This is Resource Assignment Python Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "component-resource-assignment": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "required": false, - "type": "string" - }, - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "template-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "mapping-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" - }, - "component-resource-assignment-python": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.component.Python" - } - }, - "data_types": { - "sample-property": { - "description": "This is sample data type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.datatypes.Root" - } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json new file mode 100644 index 000000000..056d5f182 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json @@ -0,0 +1,210 @@ +{ + "artifact_types": { + "artifact-template-velocity": { + "description": " Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": " Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-kotlin": { + "description": " Kotlin Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "kt" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-python": { + "description": " Kotlin Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-directed-graph": { + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + }, + "node_types": { + "dg-activate": { + "description": "This is BPMN Activate node type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.component.Python": { + "description": "This is Resource Assignment Python Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "template-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "mapping-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-resource-assignment-python": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "DefaultComponentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Python" + } + }, + "data_types": { + "sample-property": { + "description": "This is sample data type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} \ No newline at end of file -- cgit 1.2.3-korg From da8a1fdae5ceab75a37ed79edb895f9ac57b6e5d Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Tue, 16 Oct 2018 15:57:47 -0400 Subject: Add support for aai node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6c4d70f270d605dd4d49e89580849c9100ec4928 Issue-ID: SDNC-123 Signed-off-by: Alexis de Talhouët --- .../vFW/Templates/base_template.vtl | 21 ++++++++++++++++++ .../vFW/Templates/vFW_vNF_Artifact.vtl | 19 ++++++++++++++++ .../service-blueprint/vFW/Templates/vfw.vtl | 25 +++++++++++++++++++++- .../service-blueprint/vFW/Templates/vpg.vtl | 23 ++++++++++++++++++++ .../service-blueprint/vFW/Templates/vsn.vtl | 23 ++++++++++++++++++++ 5 files changed, 110 insertions(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl index 1f8298c5f..271c50738 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/base_template.vtl @@ -52,5 +52,26 @@ "param-name": "vf_module_name", "param-value": "${vnf-name}_base" } + ], + "capability-data": [ + { + "capability-name": "aai-vf-module-put", + "key-mapping": [ + { + "payload": [ + { + "param-name": "vf-module", + "param-value": "vf-module" + } + ], + "output-key-mapping": [ + { + "resource-name": "aai-vf-module-put", + "resource-value": "${status}" + } + ] + } + ] + } ] } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl index ca09046aa..0faf09ca6 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl @@ -198,6 +198,25 @@ ] } ] + }, + { + "capability-name": "aai-vnf-put", + "key-mapping": [ + { + "payload": [ + { + "param-name": "generic-vnf", + "param-value": "generic-vnf" + } + ], + "output-key-mapping": [ + { + "resource-name": "aai-vnf-put", + "resource-value": "${status}" + } + ] + } + ] } ] } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl index 06a91d3a1..6864a36fe 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vfw.vtl @@ -18,7 +18,7 @@ }, { "param-name": "vf_module_id", - "param-value": "${vnf-id}" + "param-value": "${vf-module-id}" }, { "param-name": "vf_module_type", @@ -282,6 +282,29 @@ } ] }, + { + "capability-name": "aai-vf-module-put", + "key-mapping": [ + { + "payload": [ + { + "param-name": "vf-module", + "param-value": "vf-module" + }, + { + "param-name": "vnfc", + "param-value": "vnfc" + } + ], + "output-key-mapping": [ + { + "resource-name": "aai-vf-module-put", + "resource-value": "${status}" + } + ] + } + ] + }, { "capability-name": "unresolved-composite-data", "key-mapping": [ diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl index f7e3780a3..2ff6596ee 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vpg.vtl @@ -290,6 +290,29 @@ } ] }, + { + "capability-name": "aai-vf-module-put", + "key-mapping": [ + { + "payload": [ + { + "param-name": "vf-module", + "param-value": "vf-module" + }, + { + "param-name": "vnfc", + "param-value": "vnfc" + } + ], + "output-key-mapping": [ + { + "resource-name": "aai-vf-module-put", + "resource-value": "${status}" + } + ] + } + ] + }, { "capability-name": "unresolved-composite-data", "key-mapping": [ diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl index 727427a63..11fcea9fd 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vsn.vtl @@ -278,6 +278,29 @@ } ] }, + { + "capability-name": "aai-vf-module-put", + "key-mapping": [ + { + "payload": [ + { + "param-name": "vf-module", + "param-value": "vf-module" + }, + { + "param-name": "vnfc", + "param-value": "vnfc" + } + ], + "output-key-mapping": [ + { + "resource-name": "aai-vf-module-put", + "resource-value": "${status}" + } + ] + } + ] + }, { "capability-name": "unresolved-composite-data", "key-mapping": [ -- cgit 1.2.3-korg From 1adb9b5f44376f5602959a3709565ee812f6ddb1 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 16 Nov 2018 07:58:28 -0500 Subject: Do no prepend "sub" for subnet net id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icc240f30ef9a2f7e9f99345f05897e5d7f9d4c3a Issue-ID: CCSDK-727 Signed-off-by: Alexis de Talhouët --- .../service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl index ca09046aa..ea6a7b885 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Templates/vFW_vNF_Artifact.vtl @@ -30,7 +30,7 @@ }, { "param-name": "onap_private_subnet_id", - "param-value": "${onap_private_net_id}_sub" + "param-value": "${onap_private_subnet_id}" } ], "capability-data": [ -- cgit 1.2.3-korg From 421823b343881c6d1690be8b1082a878764635f2 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 19 Nov 2018 12:48:31 -0500 Subject: Implement Base Jython Executor function. Change-Id: I3fb066a021de4a7b3aa1fce7f6c191bc3944fb51 Issue-ID: CCSDK-696 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/service/BluePrintRuntimeService.kt | 16 ++++++++++----- .../Definitions/activation-blueprint.json | 20 ++++++++++++++++++- .../Scripts/SamplePythonComponentNode.py | 14 ++++++++----- .../scripts/python/ccsdk_blueprints/__init__.py | 0 .../abstract_blueprint_function.py | 11 +++++++++++ .../python/ccsdk_blueprints/blueprint_constants.py | 23 ++++++++++++++++++++++ .../ccsdk_blueprints/blueprint_runtime_service.py | 13 ++++++++++++ .../ccsdk_blueprints/sample_blueprint_component.py | 12 +++++++++++ 8 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 components/scripts/python/ccsdk_blueprints/__init__.py create mode 100644 components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py create mode 100644 components/scripts/python/ccsdk_blueprints/blueprint_constants.py create mode 100644 components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py create mode 100644 components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index f84b2c569..9da5b0ee4 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -59,6 +59,8 @@ interface BluePrintRuntimeService { fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String + fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String, artifactName: String): ArtifactDefinition + fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) @@ -269,15 +271,19 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return propertyAssignmentValue } - override fun resolveNodeTemplateArtifact(nodeTemplateName: String, - artifactName: String): String { + override fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String { + val artifactDefinition: ArtifactDefinition = resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName) + val propertyAssignmentExpression = PropertyAssignmentService(this) + return propertyAssignmentExpression.artifactContent(artifactDefinition) + } + + override fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String, artifactName: String): ArtifactDefinition { val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName) - val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName) + return nodeTemplate.artifacts?.get(artifactName) ?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template" , artifactName)) - val propertyAssignmentExpression = PropertyAssignmentService(this) - return propertyAssignmentExpression.artifactContent(artifactDefinition) + } diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index ee02b3a77..e067a7dfd 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -143,7 +143,7 @@ "artifacts": { "component-script": { "type": "artifact-script-python", - "file": "Scripts/baseconfig-template.vtl" + "file": "Scripts/SamplePythonComponentNode.py" } } } @@ -181,6 +181,24 @@ } }, "activate": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, "steps": { "call-resource-assignment": { "description": "Netconf Activation Workflow", diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py index fc5151338..0a583dc57 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SamplePythonComponentNode.py @@ -1,8 +1,12 @@ -from com.brvith.orchestrator.core.interfaces import ComponentNode +from abstract_blueprint_function import AbstractPythonComponentFunction +from blueprint_constants import * -class SamplePythonComponentNode(ComponentNode): - def prepare(self, context, componentContext): +class SamplePythonComponentNode(AbstractPythonComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH return None - def prepare(self, context, componentContext): - return None \ No newline at end of file + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/scripts/python/ccsdk_blueprints/__init__.py b/components/scripts/python/ccsdk_blueprints/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py new file mode 100644 index 000000000..0ddab16e7 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py @@ -0,0 +1,11 @@ +from org.onap.ccsdk.apps.blueprintsprocessor.services.execution import AbstractComponentFunction + +class AbstractPythonComponentFunction(AbstractComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + return None diff --git a/components/scripts/python/ccsdk_blueprints/blueprint_constants.py b/components/scripts/python/ccsdk_blueprints/blueprint_constants.py new file mode 100644 index 000000000..2ec95f312 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/blueprint_constants.py @@ -0,0 +1,23 @@ + +PROPERTY_BLUEPRINT_PROCESS_ID= "blueprint-process-id" +PROPERTY_BLUEPRINT_BASE_PATH= "blueprint-basePath" +PROPERTY_BLUEPRINT_RUNTIME= "blueprint-runtime" +PROPERTY_BLUEPRINT_INPUTS_DATA= "blueprint-inputs-data" +PROPERTY_BLUEPRINT_CONTEXT= "blueprint-context" +PROPERTY_BLUEPRINT_NAME= "template_name" +PROPERTY_BLUEPRINT_VERSION= "template_version" + +METADATA_USER_GROUPS = "user-groups" +METADATA_TEMPLATE_NAME = "template_name" +METADATA_TEMPLATE_VERSION = "template_version" +METADATA_TEMPLATE_AUTHOR = "template_author" +METADATA_TEMPLATE_TAGS = "template_tags" +METADATA_WORKFLOW_NAME = "workflow_name" + +PAYLOAD_DATA = "payload-data" +PROPERTY_CURRENT_STEP = "current-step" +PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template" +PROPERTY_CURRENT_INTERFACE = "current-interface" +PROPERTY_CURRENT_OPERATION = "current-operation" +PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation" +PROPERTY_EXECUTION_REQUEST = "execution-request" diff --git a/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py b/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py new file mode 100644 index 000000000..022b47244 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py @@ -0,0 +1,13 @@ +class BluePrintRuntimeService: + + def __init__(self, bps): + self.bps = bps + + def resolveNodeTemplateArtifact(self, node_template_name, artifact_name): + return self.bps.resolveNodeTemplateArtifact(node_template_name, artifact_name) + + def setNodeTemplateAttributeValue(self, nodeTemplateName, attributeName, value): + return self.bps.setNodeTemplateAttributeValue(nodeTemplateName, attributeName, value) + + def setNodeTemplatePropertyValue(self, nodeTemplateName, propertyName, value): + return self.bps.setNodeTemplatePropertyValue(nodeTemplateName, propertyName, value) diff --git a/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py new file mode 100644 index 000000000..62665dc8f --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py @@ -0,0 +1,12 @@ +from abstract_blueprint_function import AbstractPythonComponentFunction +from blueprint_constants import * + +class SampleBlueprintComponent(AbstractPythonComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None -- cgit 1.2.3-korg From 7af6a923ef993bed14d0fc5f769c3766c94b88b3 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 20 Nov 2018 12:20:30 -0500 Subject: Add Jython Component model and validation logics. Change-Id: I2bdba0016a41e16198d60be68dff68d1ce7ad13a Issue-ID: CCSDK-696 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../node_type/component-resource-assignment.json | 2 +- .../core/BluePrintConstants.kt | 1 + .../controllerblueprints/core/BluePrintTypes.kt | 1 + .../core/service/BluePrintRuntimeServiceTest.kt | 8 +- .../vFW/Definitions/vFW_spinup.json | 4 +- .../Definitions/activation-blueprint.json | 42 ++++- .../Definitions/artifact-types.json | 45 +++++ .../baseconfiguration/Definitions/data-types.json | 24 +++ .../baseconfiguration/Definitions/node-types.json | 130 +++++++++++++ .../baseconfiguration/Definitions/types.json | 210 --------------------- .../artifact_type/artifact-script-jython.json | 8 + .../artifact_type/artifact-script-python.json | 2 +- .../node_type/component-config-generator.json | 2 +- .../node_type/component-jython-executor.json | 40 ++++ .../node_type/component-netconf-executor.json | 4 +- .../node_type/component-resource-assignment.json | 2 +- .../node_type/tosca.nodes.component.Jython.json | 5 + 17 files changed, 302 insertions(+), 228 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json (limited to 'components/model-catalog') diff --git a/components/core/load/model_type/node_type/component-resource-assignment.json b/components/core/load/model_type/node_type/component-resource-assignment.json index 1389bc328..2a9035619 100644 --- a/components/core/load/model_type/node_type/component-resource-assignment.json +++ b/components/core/load/model_type/node_type/component-resource-assignment.json @@ -7,7 +7,7 @@ } }, "interfaces": { - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "inputs": { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 84d2befc5..a41284187 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -93,6 +93,7 @@ object BluePrintConstants { const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle" const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script" const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python" + const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython" const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript" const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt index a971898d3..64797ed40 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt @@ -37,6 +37,7 @@ object BluePrintTypes { BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE, BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT, BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON, + BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON, BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT ) diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 19c6c2f9d..2f519802d 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -69,7 +69,7 @@ class BluePrintRuntimeServiceTest { "data/default-context.json", executionContext) val inContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment", - "DefaultComponentNode", "process") + "ResourceAssignmentComponent", "process") assertNotNull(inContext, "Failed to populate interface input property values") assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") @@ -86,14 +86,14 @@ class BluePrintRuntimeServiceTest { bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance()) bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment", - "DefaultComponentNode", "process") + "ResourceAssignmentComponent", "process") val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", - "DefaultComponentNode", "process", "status") + "ResourceAssignmentComponent", "process", "status") assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status") val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", - "DefaultComponentNode", "process", "resource-assignment-params") + "ResourceAssignmentComponent", "process", "resource-assignment-params") assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params") } diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json index d5416c0ea..1137c1d58 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json @@ -40,7 +40,7 @@ "resource-assignment-ra-component": { "type": "component-resource-assignment", "interfaces": { - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "inputs": { @@ -3337,7 +3337,7 @@ } }, "interfaces": { - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index e067a7dfd..269fd0cf0 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -9,7 +9,13 @@ }, "imports": [ { - "file": "Definitions/types.json" + "file": "Definitions/data-types.json" + }, + { + "file": "Definitions/node-types.json" + }, + { + "file": "Definitions/artifact-types.json" } ], "topology_template": { @@ -64,7 +70,7 @@ "request-id": "1234" }, "interfaces": { - "DefaultComponentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "inputs": { @@ -121,7 +127,7 @@ "request-id": "1234" }, "interfaces": { - "DefaultComponentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "implementation": { @@ -142,7 +148,31 @@ }, "artifacts": { "component-script": { - "type": "artifact-script-python", + "type": "artifact-script-jython", + "file": "Scripts/SamplePythonComponentNode.py" + } + } + }, + "activate-jython": { + "type": "component-jython-executor", + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", "file": "Scripts/SamplePythonComponentNode.py" } } @@ -174,7 +204,7 @@ "target": "resource-assignment", "activities": [ { - "call_operation": "ResourceAssignmentNode.process" + "call_operation": "ResourceAssignmentComponent.process" } ] } @@ -205,7 +235,7 @@ "target": "resource-assignment", "activities": [ { - "call_operation": "ResourceAssignmentNode.process" + "call_operation": "ResourceAssignmentComponent.process" } ] } diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json new file mode 100644 index 000000000..d741d151e --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json @@ -0,0 +1,45 @@ +{ + "artifact_types": { + "artifact-template-velocity": { + "description": "Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": "Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-jython": { + "description": "Jython Script File", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-directed-graph": { + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json new file mode 100644 index 000000000..6ca1ffde2 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json @@ -0,0 +1,24 @@ +{ + "data_types": { + "sample-property": { + "description": "This is sample data type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json new file mode 100644 index 000000000..139ebb1a3 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json @@ -0,0 +1,130 @@ +{ + "node_types": { + "dg-activate": { + "description": "This is BPMN Activate node type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.component.Jython": { + "description": "This is Resource Assignment Jython Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "template-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "mapping-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-jython-executor": { + "description": "This is Jython Execution Component.", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json deleted file mode 100644 index 056d5f182..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/types.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "artifact_types": { - "artifact-template-velocity": { - "description": " Velocity Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "vtl" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-mapping-resource": { - "description": " Velocity Template Resource Mapping File used along with Configuration template", - "version": "1.0.0", - "file_ext": [ - "json" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-kotlin": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "kt" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-python": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "py" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-directed-graph": { - "description": "Directed Graph File", - "version": "1.0.0", - "file_ext": [ - "json", - "xml" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-component-jar": { - "description": "Component Jar", - "version": "1.0.0", - "file_ext": [ - "jar" - ], - "derived_from": "tosca.artifacts.Implementation" - } - }, - "node_types": { - "dg-activate": { - "description": "This is BPMN Activate node type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.nodes.DG" - }, - "tosca.nodes.Component": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.DG": { - "description": "This is Directed Graph Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.component.Python": { - "description": "This is Resource Assignment Python Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "component-resource-assignment": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "required": false, - "type": "string" - }, - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "template-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "mapping-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" - }, - "component-resource-assignment-python": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.component.Python" - } - }, - "data_types": { - "sample-property": { - "description": "This is sample data type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.datatypes.Root" - } - } -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json new file mode 100644 index 000000000..969662ab7 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-jython.json @@ -0,0 +1,8 @@ +{ + "description": "Jython Script File", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json index b48d2b628..b42f7156a 100644 --- a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-python.json @@ -1,5 +1,5 @@ { - "description": " Kotlin Script Template used for Configuration", + "description": "Python Script file", "version": "1.0.0", "file_ext": [ "py" diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json index 764f9e890..ba142600f 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-config-generator.json @@ -7,7 +7,7 @@ } }, "interfaces": { - "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": { + "ConfigGeneratorComponent": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json new file mode 100644 index 000000000..4959a9dd1 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json @@ -0,0 +1,40 @@ +{ + "description": "This is Jython Execution Component.", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "required": true, + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 240caf3fc..7e1d81343 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -14,7 +14,7 @@ } }, "interfaces": { - "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": { + "NetconfExecutorComponent": { "operations": { "process": { "inputs": { @@ -75,5 +75,5 @@ } } }, - "derived_from": "tosca.nodes.Component" + "derived_from": "tosca.nodes.component.Jython" } \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json index d424a8e43..a29a875cb 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json @@ -7,7 +7,7 @@ } }, "interfaces": { - "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "ResourceAssignmentComponent": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json new file mode 100644 index 000000000..8e194f6dd --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Jython.json @@ -0,0 +1,5 @@ +{ + "description": "This is Jython Component", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file -- cgit 1.2.3-korg From 6af718b8552503a7dfce2e4e1f61a12eb0837921 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 20 Nov 2018 15:55:29 -0500 Subject: Add directed graph reterive and execution service. Change-Id: Ia31af4d14e38e6229166cda0f39fa090764ef1cb Issue-ID: CCSDK-672 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/service/BluePrintContext.kt | 16 ++++++++-- .../core/service/BluePrintRuntimeService.kt | 28 ++++++++++++++++-- .../Definitions/activation-blueprint.json | 6 ++-- .../Plans/CONFIG_ActivateNetconf_1.0.0.xml | 34 ++++++++++++++++++++++ 4 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt index 4764479ad..f73fb727d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt @@ -57,10 +57,15 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)") } - fun workflowStepNodeTemplate(workFlowName: String, stepName: String): NodeTemplate { - val nodeTemplateName = workflowStepByName(workFlowName, stepName).target + fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String { + return workflowStepByName(workFlowName, stepName).target ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)") - return nodeTemplateByName(nodeTemplateName) + } + + fun workflowFirstStepNodeTemplate(workFlowName: String): String { + val firstStepName = workflowByName(workFlowName).steps?.keys?.first() + ?: throw BluePrintException("could't get first step for workflow($workFlowName)") + return workflowStepNodeTemplate(workFlowName, firstStepName) } fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String { @@ -156,6 +161,11 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)") } + fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition { + return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0) + ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)") + } + fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment { return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first() ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment") diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index 9da5b0ee4..84ba10473 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -48,6 +48,14 @@ interface BluePrintRuntimeService { fun cleanRuntime() + fun getAsString(key: String): String? + + fun getAsBoolean(key: String): Boolean? + + fun getAsInt(key: String): Int? + + fun getAsDouble(key: String): Double? + /* Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing */ @@ -139,9 +147,25 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return get(key) } + override fun getAsString(key: String): String? { + return get(key).asText() + } + + override fun getAsBoolean(key: String): Boolean? { + return get(key).asBoolean() + } + + override fun getAsInt(key: String): Int? { + return get(key).asInt() + } + + override fun getAsDouble(key: String): Double? { + return get(key).asDouble() + } + /* - Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing - */ + Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing + */ override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap { log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName) val propertyAssignmentValue: MutableMap = hashMapOf() diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 269fd0cf0..9d1172fc5 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -60,7 +60,7 @@ "artifacts": { "dg-activate-process": { "type": "artifact-directed-graph", - "file": "Plans/ActivateProcess.bpmn" + "file": "Plans/CONFIG_ActivateNetconf_1.0.0.xml" } } }, @@ -230,9 +230,9 @@ } }, "steps": { - "call-resource-assignment": { + "activate-process": { "description": "Netconf Activation Workflow", - "target": "resource-assignment", + "target": "activate-process", "activities": [ { "call_operation": "ResourceAssignmentComponent.process" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml new file mode 100644 index 000000000..d256bbd23 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit 1.2.3-korg From 304b509a1c90de0bfcbc7fee36cfe373c1cc463e Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 26 Nov 2018 14:51:58 -0500 Subject: Add Resource Dictionary Artifact Type. Change-Id: I40c4cb47cb54c460b198c9d700ccd84b578da0a4 Issue-ID: CCSDK-747 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../baseconfiguration/Mappings/resources-dictionary.json | 3 +++ .../starter-type/artifact_type/artifact-dictionary-resource.json | 8 ++++++++ .../starter-type/artifact_type/artifact-mapping-resource.json | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-dictionary-resource.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json new file mode 100644 index 000000000..0e0dcd235 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-dictionary-resource.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-dictionary-resource.json new file mode 100644 index 000000000..ccc15985f --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-dictionary-resource.json @@ -0,0 +1,8 @@ +{ + "description": "Resource Dictionary File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json index 0a3261b09..ea3aa232b 100644 --- a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-mapping-resource.json @@ -1,5 +1,5 @@ { - "description": " Velocity Template Resource Mapping File used along with Configuration template", + "description": "Resource Mapping File used along with Configuration template", "version": "1.0.0", "file_ext": [ "json" -- cgit 1.2.3-korg From e1e4a87bf588ba6f4d7e1fbc1698131876bc9f70 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 3 Dec 2018 12:34:39 -0500 Subject: Add Blueprint File utils Change-Id: I9896d934684343358d1c0c7e321725511430c7e6 Issue-ID: CCSDK-783 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/BluePrintConstants.kt | 2 + .../core/utils/BluePrintFileUtils.kt | 128 ++++++++++++++++++++ .../core/utils/JacksonUtils.kt | 7 ++ .../core/utils/BluePrintFileUtilsTest.kt | 59 ++++++++++ .../Definitions/activation-blueprint.json | 8 +- .../Definitions/artifact-types.json | 45 ------- .../Definitions/artifact_types.json | 45 +++++++ .../Definitions/baseconfig-mapping.json | 3 + .../baseconfiguration/Definitions/data-types.json | 24 ---- .../baseconfiguration/Definitions/data_types.json | 24 ++++ .../baseconfiguration/Definitions/node-types.json | 130 --------------------- .../baseconfiguration/Definitions/node_types.json | 130 +++++++++++++++++++++ .../Definitions/resources_dictionaty_types.json | 3 + .../Mappings/baseconfig-mapping.json | 3 - .../Mappings/resources-dictionary.json | 3 - 15 files changed, 405 insertions(+), 209 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact_types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 2908a6325..0517e90ba 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -139,7 +139,9 @@ object BluePrintConstants { const val PROPERTY_BLUEPRINT_NAME: String = "template_name" const val PROPERTY_BLUEPRINT_VERSION: String = "template_version" + const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata" const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta" + const val TOSCA_DEFINITIONS_DIR: String = "Definitions" const val TOSCA_PLANS_DIR: String = "Plans" const val TOSCA_SCRIPTS_DIR: String = "Scripts" const val TOSCA_MAPPINGS_DIR: String = "Mappings" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt new file mode 100644 index 000000000..d9222d754 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -0,0 +1,128 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.utils + +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import kotlinx.coroutines.runBlocking +import org.apache.commons.io.FileUtils +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import java.io.File +import java.io.FileFilter +import java.nio.file.Files +import java.nio.file.StandardOpenOption + +class BluePrintFileUtils { + companion object { + + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + + fun createEmptyBluePrint(basePath: String) { + + val blueprintDir = File(basePath) + FileUtils.deleteDirectory(blueprintDir) + + Files.createDirectories(blueprintDir.toPath()) + + val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR)) + Files.createDirectories(metaDataDir.toPath()) + + val metafile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)) + Files.write(metafile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW) + + val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)) + Files.createDirectories(definitionsDir.toPath()) + + val scriptsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_SCRIPTS_DIR)) + Files.createDirectories(scriptsDir.toPath()) + + val plansDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_PLANS_DIR)) + Files.createDirectories(plansDir.toPath()) + + val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_TEMPLATES_DIR)) + Files.createDirectories(templatesDir.toPath()) + + } + + fun copyBluePrint(sourcePath: String, targetPath: String) { + val sourceFile = File(sourcePath) + val targetFile = File(targetPath) + sourceFile.copyRecursively(targetFile, true) + } + + fun deleteBluePrintTypes(basePath: String) { + val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) + log.info("deleting definition types under : $definitionPath") + + val definitionDir = File(definitionPath) + // Find the Type Definitions + val fileFilter = FileFilter { pathname -> pathname.absolutePath.endsWith("_types.json") } + // Delete the Type Files + definitionDir.listFiles(fileFilter).forEach { + Files.deleteIfExists(it.toPath()) + } + } + + fun writeBluePrintTypes(blueprintContext: BluePrintContext) { + + val basePath = blueprintContext.rootPath + val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) + val definitionDir = File(definitionPath) + + check(definitionDir.exists()) { + throw BluePrintException("couldn't get definition file under path(${definitionDir.absolutePath})") + } + + blueprintContext.dataTypes.let { + val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, blueprintContext.dataTypes!!, true) + writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) + + } + + blueprintContext.artifactTypes.let { + val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, blueprintContext.artifactTypes!!, true) + writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) + } + + blueprintContext.nodeTypes.let { + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, blueprintContext.nodeTypes!!, true) + writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent) + } + + } + + private fun writeFile(definitionPath: String, type: String, content: String) = runBlocking { + val typeFile = File(definitionPath.plus(File.separator).plus("$type.json")) + + Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW) + check(typeFile.exists()) { + throw BluePrintException("couldn't write $type.json file under path(${typeFile.absolutePath})") + } + } + + private fun getMetaDataContent(): String { + return "TOSCA-Meta-File-Version: 1.0.0" + + "\nCSAR-Version: " + + "\nCreated-By: " + + "\nEntry-Definitions: Definitions/.json" + + "\nTemplate-Tags: " + } + + } +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index cf5f9e20c..f53f86154 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -104,6 +104,13 @@ object JacksonUtils { return getJson(any, false) } + @JvmStatic + fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String { + val wrapperMap = hashMapOf() + wrapperMap[wrapper] = any + return getJson(wrapperMap, pretty) + } + @JvmStatic fun getJson(any: kotlin.Any, pretty: Boolean = false): String { val objectMapper = jacksonObjectMapper() diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt new file mode 100644 index 000000000..143c4a848 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt @@ -0,0 +1,59 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.utils + +import kotlinx.coroutines.runBlocking +import org.junit.Test +import java.io.File +import java.nio.file.Paths +import kotlin.test.assertTrue + + +class BluePrintFileUtilsTest { + + @Test + fun testNewBlueprint() = runBlocking { + val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-new-test") + BluePrintFileUtils.createEmptyBluePrint(targetPath) + + } + + @Test + fun testBlueprintCopy() = runBlocking { + val sourcePath: String = "./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration" + + val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-copy-test") + + val targetDir = File(targetPath) + targetDir.deleteOnExit() + // Copy the BP file + BluePrintFileUtils.copyBluePrint(sourcePath, targetDir.absolutePath) + + assertTrue(targetDir.exists(), "faield to copy blueprint to ${targetDir.absolutePath}") + + // Delete Type Files + BluePrintFileUtils.deleteBluePrintTypes(targetDir.absolutePath) + + // Generate the Type Files + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(sourcePath) + bluePrintContext.rootPath = targetDir.absolutePath + + BluePrintFileUtils.writeBluePrintTypes(bluePrintContext) + + + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 9d1172fc5..04e0efce8 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -9,13 +9,13 @@ }, "imports": [ { - "file": "Definitions/data-types.json" + "file": "Definitions/data_types.json" }, { - "file": "Definitions/node-types.json" + "file": "Definitions/node_types.json" }, { - "file": "Definitions/artifact-types.json" + "file": "Definitions/artifact_types.json" } ], "topology_template": { @@ -117,7 +117,7 @@ }, "baseconfig-mapping": { "type": "artifact-mapping-resource", - "file": "Mappings/baseconfig-mapping.json" + "file": "Definitions/baseconfig-mapping.json" } } }, diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json deleted file mode 100644 index d741d151e..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact-types.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "artifact_types": { - "artifact-template-velocity": { - "description": "Velocity Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "vtl" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-mapping-resource": { - "description": "Velocity Template Resource Mapping File used along with Configuration template", - "version": "1.0.0", - "file_ext": [ - "json" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-jython": { - "description": "Jython Script File", - "version": "1.0.0", - "file_ext": [ - "py" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-directed-graph": { - "description": "Directed Graph File", - "version": "1.0.0", - "file_ext": [ - "json", - "xml" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-component-jar": { - "description": "Component Jar", - "version": "1.0.0", - "file_ext": [ - "jar" - ], - "derived_from": "tosca.artifacts.Implementation" - } - } -} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact_types.json new file mode 100644 index 000000000..d741d151e --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/artifact_types.json @@ -0,0 +1,45 @@ +{ + "artifact_types": { + "artifact-template-velocity": { + "description": "Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": "Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-jython": { + "description": "Jython Script File", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-directed-graph": { + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json new file mode 100644 index 000000000..caee773bb --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -0,0 +1,3 @@ +{ + "assignments": "Sample Assignments" +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json deleted file mode 100644 index 6ca1ffde2..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data-types.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "data_types": { - "sample-property": { - "description": "This is sample data type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.datatypes.Root" - } - } -} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json new file mode 100644 index 000000000..6ca1ffde2 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -0,0 +1,24 @@ +{ + "data_types": { + "sample-property": { + "description": "This is sample data type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json deleted file mode 100644 index 139ebb1a3..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node-types.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "node_types": { - "dg-activate": { - "description": "This is BPMN Activate node type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - } - }, - "derived_from": "tosca.nodes.DG" - }, - "tosca.nodes.Component": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.DG": { - "description": "This is Directed Graph Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.component.Jython": { - "description": "This is Resource Assignment Jython Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "component-resource-assignment": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "ResourceAssignmentComponent": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "required": false, - "type": "string" - }, - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "template-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "mapping-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" - }, - "component-jython-executor": { - "description": "This is Jython Execution Component.", - "version": "1.0.0", - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" - } - }, - "interfaces": { - "JythonExecutorComponent": { - "operations": { - "process": { - "outputs": { - "response-data": { - "description": "Execution Response Data in JSON format.", - "required": false, - "type": "string" - }, - "status": { - "description": "Status of the Component Execution ( success or failure )", - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.component.Jython" - } - } -} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json new file mode 100644 index 000000000..139ebb1a3 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -0,0 +1,130 @@ +{ + "node_types": { + "dg-activate": { + "description": "This is BPMN Activate node type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.component.Jython": { + "description": "This is Resource Assignment Jython Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "properties": { + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + } + }, + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "template-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "mapping-content": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-jython-executor": { + "description": "This is Jython Execution Component.", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json new file mode 100644 index 000000000..0e0dcd235 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json deleted file mode 100644 index caee773bb..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/baseconfig-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "assignments": "Sample Assignments" -} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json deleted file mode 100644 index 0e0dcd235..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Mappings/resources-dictionary.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file -- cgit 1.2.3-korg From 6cba7f8da7640b8c6dd3c662ce424fd11acc621f Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 4 Dec 2018 10:25:44 -0500 Subject: Add Blueprint Runtime Input/Output logic Change-Id: I0355e78862096b7b4074faa882d66ce27d6e1844 Issue-ID: CCSDK-670 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/BluePrintConstants.kt | 3 + .../controllerblueprints/core/CustomFunctions.kt | 20 ++- .../core/service/BluePrintContext.kt | 2 + .../core/service/BluePrintRuntimeService.kt | 34 +++-- .../core/service/PropertyAssignmentService.kt | 3 +- .../core/utils/BluePrintArchiveUtils.kt | 148 +++++++++++++++++++++ .../Definitions/activation-blueprint.json | 109 ++++++++++----- .../baseconfiguration/Definitions/data_types.json | 69 ++++++++++ .../baseconfiguration/Definitions/node_types.json | 2 +- .../Plans/CONFIG_ActivateNetconf_1.0.0.xml | 2 +- .../Plans/CONFIG_AssignActivateNetconf_1.0.0.xml | 42 ++++++ .../Plans/CONFIG_ResourceAssignment_1.0.0.xml | 34 +++++ components/parent/pom.xml | 9 ++ 13 files changed, 424 insertions(+), 53 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 0517e90ba..167496ebc 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -29,6 +29,9 @@ object BluePrintConstants { const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion" const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion" + const val STATUS_SUCCESS: String = "success" + const val STATUS_FAILURE: String = "failure" + const val TYPE_DEFAULT: String = "default" const val DATA_TYPE_STRING: String = "string" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt index c32e15f8a..2329fc935 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt @@ -75,17 +75,17 @@ fun MutableMap.castValue(key: String, valueType: KClass) fun MutableMap.putJsonElement(key: String, value: Any) { when (value) { is JsonNode -> - this.put(key, value) + this[key] = value is String -> - this.put(key, TextNode(value)) + this[key] = TextNode(value) is Boolean -> - this.put(key, BooleanNode.valueOf(value)) + this[key] = BooleanNode.valueOf(value) is Int -> - this.put(key, IntNode.valueOf(value.toInt())) + this[key] = IntNode.valueOf(value.toInt()) is Double -> - this.put(key, DoubleNode.valueOf(value.toDouble())) + this[key] = DoubleNode.valueOf(value.toDouble()) else -> - this.put(key, JacksonUtils.jsonNodeFromObject(value)) + this[key] = JacksonUtils.jsonNodeFromObject(value) } } @@ -97,6 +97,14 @@ fun MutableMap.getAsBoolean(key: String): Boolean { return this[key]?.asBoolean() ?: throw BluePrintException("couldn't find value for key($key)") } +fun MutableMap.getAsInt(key: String): Int { + return this[key]?.asInt() ?: throw BluePrintException("couldn't find value for key($key)") +} + +fun MutableMap.getAsDouble(key: String): Double { + return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)") +} + // Checks fun checkNotEmpty(value: String?): Boolean { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt index cce6d904c..84af3f988 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt @@ -57,6 +57,8 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun workflowByName(workFlowName: String): Workflow = workflows?.get(workFlowName) ?: throw BluePrintException("could't get workflow($workFlowName)") + fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs + fun workflowStepByName(workFlowName: String, stepName: String): Step { return workflowByName(workFlowName).steps?.get(stepName) ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)") diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index 84ba10473..448a06a86 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate @@ -211,15 +210,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val propertyAssignments: MutableMap = bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap - ?: throw BluePrintException(String.format("failed to get input definitions for node template (%s), " + - "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName)) + ?: hashMapOf() val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type val nodeTypeInterfaceOperationInputs: MutableMap = bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName) - ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " + - "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName)) + ?: hashMapOf() log.info("input definition for node template ({}), values ({})", nodeTemplateName, propertyAssignments) @@ -258,15 +255,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val propertyAssignments: MutableMap = bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap - ?: throw BluePrintException(String.format("failed to get output definitions for node template (%s), " + - "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName)) + ?: hashMapOf() val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type val nodeTypeInterfaceOperationOutputs: MutableMap = bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName) - ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " + - "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName)) + ?: hashMapOf() // Iterate Node Type Properties nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty -> @@ -435,10 +430,25 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl override fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) { log.info("assign workflow {} input value ({})", workflowName, jsonNode.toString()) + val dynamicInputPropertiesName = "$workflowName-properties" + bluePrintContext.workflowByName(workflowName).inputs?.forEach { propertyName, property -> - val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName) - ?: NullNode.getInstance() - setInputValue(propertyName, property, valueNode) + if (propertyName != dynamicInputPropertiesName) { + val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName) + ?: NullNode.getInstance() + setInputValue(propertyName, property, valueNode) + } + } + + val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName) + + workflowDynamicInputs?.let { + bluePrintContext.dataTypeByName(dynamicInputPropertiesName)?.properties?.forEach { propertyName, property -> + val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName) + ?: NullNode.getInstance() + setInputValue(propertyName, property, valueNode) + + } } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt index 947eb41e0..36c141f5e 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt @@ -197,8 +197,7 @@ If Property Assignment is Expression. } fun artifactContent(artifactDefinition: ArtifactDefinition): String { - val bluePrintBasePath: String = bluePrintRuntimeService.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)?.asText() - ?: throw BluePrintException("failed to get property (${BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH}) from getStore") + val bluePrintBasePath: String = bluePrintContext.rootPath if (artifactDefinition.repository != null) { TODO() diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt new file mode 100644 index 000000000..f02524ffa --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt @@ -0,0 +1,148 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.utils + +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry +import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream +import org.apache.commons.io.IOUtils +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import java.io.* +import java.nio.charset.Charset +import java.util.zip.ZipFile + +class BluePrintArchiveUtils { + + companion object { + + + fun compress(source: String, destination: String, absolute: Boolean): Boolean { + val rootDir = File(source) + val saveFile = File(destination) + return compress(rootDir, saveFile, absolute) + } + + /** + * Create a new Zip from a root directory + * + * @param directory the base directory + * @param filename the output filename + * @param absolute store absolute filepath (from directory) or only filename + * @return True if OK + */ + fun compress(source: File, destination: File, absolute: Boolean): Boolean { + // recursive call + val zaos: ZipArchiveOutputStream + try { + zaos = ZipArchiveOutputStream(FileOutputStream(destination)) + } catch (e: FileNotFoundException) { + return false + } + + try { + recurseFiles(source, source, zaos, absolute) + } catch (e2: IOException) { + try { + zaos.close() + } catch (e: IOException) { + // ignore + } + + return false + } + + try { + zaos.finish() + } catch (e1: IOException) { + // ignore + } + + try { + zaos.flush() + } catch (e: IOException) { + // ignore + } + + try { + zaos.close() + } catch (e: IOException) { + // ignore + } + + return true + } + + /** + * Recursive traversal to add files + * + * @param root + * @param file + * @param zaos + * @param absolute + * @throws IOException + */ + @Throws(IOException::class) + private fun recurseFiles(root: File, file: File, zaos: ZipArchiveOutputStream, + absolute: Boolean) { + if (file.isDirectory) { + // recursive call + val files = file.listFiles() + for (file2 in files!!) { + recurseFiles(root, file2, zaos, absolute) + } + } else if (!file.name.endsWith(".zip") && !file.name.endsWith(".ZIP")) { + var filename: String? = null + if (absolute) { + filename = file.absolutePath.substring(root.absolutePath.length) + } else { + filename = file.name + } + val zae = ZipArchiveEntry(filename) + zae.setSize(file.length()) + zaos.putArchiveEntry(zae) + val fis = FileInputStream(file) + IOUtils.copy(fis, zaos) + zaos.closeArchiveEntry() + } + } + + + fun deCompress(zipFile: File, targetPath: String): File { + val zip = ZipFile(zipFile, Charset.defaultCharset()) + val enumeration = zip.entries() + while (enumeration.hasMoreElements()) { + val entry = enumeration.nextElement() + val destFilePath = File(targetPath, entry.name) + destFilePath.parentFile.mkdirs() + if (entry.isDirectory) + continue + val bufferedIs = BufferedInputStream(zip.getInputStream(entry)) + bufferedIs.use { + destFilePath.outputStream().buffered(1024).use { bos -> + bufferedIs.copyTo(bos) + } + } + } + + val destinationDir = File(targetPath) + check(destinationDir.isDirectory && destinationDir.exists()) { + throw BluePrintProcessorException("failed to decompress blueprint(${zipFile.absolutePath}) to ($targetPath) ") + } + return destinationDir + } + } + +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 04e0efce8..b538f50d3 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -38,6 +38,32 @@ } }, "node_templates": { + "resource-assignment-process": { + "type": "dg-activate", + "properties": { + "process-name": { + "get_input": "action-name" + }, + "version": { + "get_property": [ + "SELF", + "process-name" + ] + }, + "content": { + "get_artifact": [ + "SELF", + "dg-resource-assignment-process" + ] + } + }, + "artifacts": { + "dg-resource-assignment-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_ResourceAssignment_1.0.0.xml" + } + } + }, "activate-process": { "type": "dg-activate", "properties": { @@ -64,6 +90,32 @@ } } }, + "assign-activate-process": { + "type": "dg-activate", + "properties": { + "process-name": { + "get_input": "action-name" + }, + "version": { + "get_property": [ + "SELF", + "process-name" + ] + }, + "content": { + "get_artifact": [ + "SELF", + "dg-assign-activate-process" + ] + } + }, + "artifacts": { + "dg-assign-activate-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_AssignActivateNetconf_1.0.0.xml" + } + } + }, "resource-assignment": { "type": "component-resource-assignment", "properties": { @@ -181,30 +233,18 @@ "workflows": { "resource-assignment": { "inputs": { - "request-id": { + "resource-assignment-properties": { "required": true, - "type": "string" - }, - "action-name": { - "required": true, - "type": "string" - }, - "scope-type": { - "required": true, - "type": "string" - }, - "hostname": { - "required": true, - "type": "string" + "type": "resource-assignment-properties" } }, "steps": { "call-resource-assignment": { "description": "Resource Assignment Workflow", - "target": "resource-assignment", + "target": "resource-assignment-process", "activities": [ { - "call_operation": "ResourceAssignmentComponent.process" + "call_operation": "CONFIG.ResourceAssignment" } ] } @@ -212,21 +252,9 @@ }, "activate": { "inputs": { - "request-id": { - "required": true, - "type": "string" - }, - "action-name": { + "activate-properties": { "required": true, - "type": "string" - }, - "scope-type": { - "required": true, - "type": "string" - }, - "hostname": { - "required": true, - "type": "string" + "type": "activate-properties" } }, "steps": { @@ -235,7 +263,26 @@ "target": "activate-process", "activities": [ { - "call_operation": "ResourceAssignmentComponent.process" + "call_operation": "CONFIG.ActivateProcess" + } + ] + } + } + }, + "assign-activate": { + "inputs": { + "assign-activate-properties": { + "required": true, + "type": "assign-activate-properties" + } + }, + "steps": { + "activate-process": { + "description": "Resource Assign and Netconf Activation Workflow", + "target": "assign-activate-process", + "activities": [ + { + "call_operation": "CONFIG.AssignActivateProcess" } ] } diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json index 6ca1ffde2..569b668ac 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -19,6 +19,75 @@ } }, "derived_from": "tosca.datatypes.Root" + }, + "activate-properties": { + "description": "This is Dynamically generated data type for workflow activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "resource-assignment-properties": { + "description": "This is Dynamically generated data type for workflow activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "assign-activate-properties": { + "description": "This is Dynamically generated data type for workflow assign-activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 139ebb1a3..b83fd2a3f 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -1,7 +1,7 @@ { "node_types": { "dg-activate": { - "description": "This is BPMN Activate node type", + "description": "This is Generic Directed Graph Type", "version": "1.0.0", "properties": { "content": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml index d256bbd23..2f6d2eda8 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml @@ -19,7 +19,7 @@ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'> - + diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml new file mode 100644 index 000000000..eb41b7dfa --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml new file mode 100644 index 000000000..a197877f5 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/parent/pom.xml b/components/parent/pom.xml index 8a779c1dc..5c4620880 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -91,6 +91,11 @@ commons-io 2.6 + + org.apache.commons + commons-compress + 1.15 + org.apache.velocity velocity @@ -215,6 +220,10 @@ commons-io commons-io + + org.apache.commons + commons-compress + com.jayway.jsonpath json-path -- cgit 1.2.3-korg From 6579644f0a797ecb04d7e00505cd1263a8c5810f Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 4 Dec 2018 20:53:22 -0500 Subject: Add Netconf Executor Function module Change-Id: If264e63d4fc4305bc26dc6b249a462afefcbfe1e Issue-ID: CCSDK-790 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../baseconfiguration/Definitions/activation-blueprint.json | 6 ++++++ .../baseconfiguration/Definitions/node_types.json | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index b538f50d3..e5f0c9c02 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -214,6 +214,12 @@ "implementation": { "primary": "component-script" }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, "outputs": { "response-data": "", "status": "" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index b83fd2a3f..2723510a0 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -108,6 +108,16 @@ "JythonExecutorComponent": { "operations": { "process": { + "inputs": { + "instance-dependencies": { + "required": true, + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, "outputs": { "response-data": { "description": "Execution Response Data in JSON format.", -- cgit 1.2.3-korg From 0948a5aefe07ad80092fd2e8e8499dd5609996e1 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Fri, 7 Dec 2018 16:37:03 -0500 Subject: Add GRPC Blueprint Processing API Change-Id: Id2c31e8db2b5ede6a992d923f695ce1e0e14b450 Issue-ID: CCSDK-799 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../api-definition/proto/BluePrintManagement.proto | 56 ++++++++++++++++++++++ .../api-definition/proto/BluePrintProcessing.proto | 49 +++++++++++++++++++ components/parent/pom.xml | 24 ++++++++++ 3 files changed, 129 insertions(+) create mode 100644 components/model-catalog/api-definition/proto/BluePrintManagement.proto create mode 100644 components/model-catalog/api-definition/proto/BluePrintProcessing.proto (limited to 'components/model-catalog') diff --git a/components/model-catalog/api-definition/proto/BluePrintManagement.proto b/components/model-catalog/api-definition/proto/BluePrintManagement.proto new file mode 100644 index 000000000..55f9466e4 --- /dev/null +++ b/components/model-catalog/api-definition/proto/BluePrintManagement.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; +option java_multiple_files = true; +package org.onap.ccsdk.apps.controllerblueprints.management.api; + +message BluePrintUploadInput { + CommonHeader commonHeader = 1; + string blueprintName = 2; + string blueprintVersion = 3; + FileChunk fileChunk = 4; +} + +message FileChunk { + bytes chunk = 1; +} + +message BluePrintUploadOutput { + CommonHeader commonHeader = 1; + Status status = 3; +} + +message BluePrintRemoveInput { + CommonHeader commonHeader = 1; + string blueprintName = 2; + string blueprintVersion = 3; +} + +message BluePrintRemoveOutput { + CommonHeader commonHeader = 1; + Status status = 3; +} + +message CommonHeader { + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; +} + +message ActionIdentifiers { + string blueprintName = 1; + string blueprintVersion = 2; + string actionName = 3; + string mode = 4; +} + +message Status { + string timestamp = 1; + int32 code = 2; + string message = 3; + string errorMessage = 4; +} + +service BluePrintManagementService { + rpc uploadBlueprint (BluePrintUploadInput) returns (BluePrintUploadOutput); + rpc removeBlueprint (BluePrintRemoveInput) returns (BluePrintRemoveOutput); +} diff --git a/components/model-catalog/api-definition/proto/BluePrintProcessing.proto b/components/model-catalog/api-definition/proto/BluePrintProcessing.proto new file mode 100644 index 000000000..8fa4a13fa --- /dev/null +++ b/components/model-catalog/api-definition/proto/BluePrintProcessing.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +import "google/protobuf/struct.proto"; +option java_multiple_files = true; +package org.onap.ccsdk.apps.controllerblueprints.processing.api; + +message ExecutionServiceInput { + CommonHeader commonHeader = 1; + ActionIdentifiers actionIdentifiers = 2; + google.protobuf.Struct payload = 3; +} + +message ExecutionServiceOutput { + CommonHeader commonHeader = 1; + ActionIdentifiers actionIdentifiers = 2; + Status status = 3; + google.protobuf.Struct payload = 4; +} + +message CommonHeader { + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; + Flag flag = 5; +} + +message Flag { + bool isForce = 1; + int32 ttl = 2; +} + +message ActionIdentifiers { + string blueprintName = 1; + string blueprintVersion = 2; + string actionName = 3; + string mode = 4; +} + +message Status { + int32 code = 1; + string errorMessage = 2; + string message = 3; + string eventType = 4; + string timestamp = 5; +} + +service BluePrintProcessingService { + rpc process (ExecutionServiceInput) returns (stream ExecutionServiceOutput); +} diff --git a/components/parent/pom.xml b/components/parent/pom.xml index 5c4620880..03656ebd7 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -35,6 +35,7 @@ 1.3.10 1.0.1 1.16.1 + 3.6.1 1.0.0 26.0-jre 2.9.2 @@ -155,6 +156,11 @@ grpc-stub ${grpc.version} + + com.google.protobuf + protobuf-java-util + ${protobuff.java.utils.version} + @@ -256,6 +262,24 @@ com.fasterxml.jackson.module jackson-module-kotlin + + + io.grpc + grpc-netty + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + com.google.protobuf + protobuf-java-util + + -- cgit 1.2.3-korg From 08a5bc8044c8a11aff1797c8e8a8d52973c98605 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 10 Dec 2018 17:01:38 -0500 Subject: Implement Resource Resolution Services Change-Id: Ia1cf57c9fa16cb943836e3a78d4d2c9776f0e32f Issue-ID: CCSDK-724 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/utils/JacksonUtils.kt | 12 +++++ .../Definitions/activation-blueprint.json | 3 ++ .../Definitions/baseconfig-mapping.json | 39 ++++++++++++-- .../baseconfiguration/Definitions/node_types.json | 8 +++ .../Definitions/resources_dictionary_types.json | 62 ++++++++++++++++++++++ .../Definitions/resources_dictionaty_types.json | 3 -- .../node_type/component-resource-assignment.json | 12 ++++- .../resource/dict/ResourceAssignmentProcessor.kt | 57 -------------------- 8 files changed, 131 insertions(+), 65 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index f53f86154..40210142c 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -121,6 +121,11 @@ object JacksonUtils { return objectMapper.writeValueAsString(any) } + @JvmStatic + fun getListFromJsonNode(node: JsonNode, valueType: Class): List? { + return getListFromJson(node.toString(), valueType) + } + @JvmStatic fun getListFromJson(content: String, valueType: Class): List? { val objectMapper = jacksonObjectMapper() @@ -148,6 +153,13 @@ object JacksonUtils { return objectMapper.readValue(content, typeRef) } + @JvmStatic + fun getMapFromFile(fileName: String, valueType: Class): MutableMap? { + val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) + ?: throw BluePrintException(format("Failed to read json file : {}", fileName)) + return getMapFromJson(content, valueType) + } + @JvmStatic fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean { if (BluePrintTypes.validPrimitiveTypes().contains(type)) { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index e5f0c9c02..446932d54 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -136,6 +136,9 @@ "resource-id": { "get_input": "hostname" }, + "artifact-prefix-names": [ + "baseconfig" + ], "template-content": { "get_artifact": [ "SELF", diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json index caee773bb..c457086cf 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -1,3 +1,36 @@ -{ - "assignments": "Sample Assignments" -} \ No newline at end of file +[ + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + ] + }, + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "vnf_name", + "input-param": false, + "property": { + "type": "string" + }, + "dictionary-name": "vnf_name", + "dictionary-source": "mdsal", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + } +] diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 2723510a0..6e8d839ee 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -69,6 +69,14 @@ "required": true, "type": "string" }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } + }, "template-content": { "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", "required": true, diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json new file mode 100644 index 000000000..557f6efce --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json @@ -0,0 +1,62 @@ +{ + "service-instance-id": { + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "updated-by": "Singal, Kapil ", + "property": { + "description": "To be provided", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf-id": { + "name": "vnf-id", + "tags": "vnf-id", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf-id", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf_name": { + "name": "vnf_name", + "tags": "vnf_name", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf_name", + "type": "string" + }, + "sources": { + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json deleted file mode 100644 index 0e0dcd235..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionaty_types.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json index a29a875cb..51d70ede9 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json @@ -11,12 +11,12 @@ "operations": { "process": { "inputs": { - "template-name": { + "template-name": { "description": "Service Template Name.", "required": true, "type": "string" }, - "template-version": { + "template-version": { "description": "Service Template Version.", "required": true, "type": "string" @@ -34,6 +34,14 @@ "type": "string" } }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } + }, "request-id": { "description": "Request Id, Unique Id for the request.", "required": true, diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt deleted file mode 100644 index 327d50ac4..000000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2018 IBM. - * Modifications Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict - -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService -import org.slf4j.LoggerFactory - -abstract class ResourceAssignmentProcessor : BlueprintFunctionNode { - - private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java) - - private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null - - open fun setBlueprintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) { - this.bluePrintRuntimeService = bluePrintRuntimeService - } - - open fun getBlueprintRuntimeService(): BluePrintRuntimeService<*> { - return this.bluePrintRuntimeService!! - } - - override fun prepareRequest(resourceAssignment: ResourceAssignment): ResourceAssignment { - log.info("prepareRequest...") - return resourceAssignment - } - - override fun prepareResponse(): ResourceAssignment { - log.info("Preparing Response...") - return ResourceAssignment() - } - - override fun apply(executionServiceInput: ResourceAssignment): ResourceAssignment { - prepareRequest(executionServiceInput) - process(executionServiceInput) - return prepareResponse() - } - - override abstract fun process(executionRequest: ResourceAssignment) - - override abstract fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) -} \ No newline at end of file -- cgit 1.2.3-korg From 97fc5fa09de5e349ba1dee9a584a9d525c552d06 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 11 Dec 2018 19:40:51 -0500 Subject: Implement Enhancer Framework Interfaces Change-Id: Iff85dc50f87ab6d6f7d9ceb4a309ea6e4d55e362 Issue-ID: CCSDK-803 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../controllerblueprints/core/BluePrintError.kt | 29 +++++ .../core/BluePrintValidationError.kt | 29 ----- .../core/interfaces/BluePrintEnhancer.kt | 122 +++++++++++++++++++++ .../core/interfaces/BlueprintValidator.kt | 28 ++--- .../core/service/BluePrintRepoService.kt | 32 +++--- .../core/utils/JacksonUtils.kt | 32 +++--- .../BluePrintArtifactTypeValidatorImpl.kt | 4 +- .../BluePrintAttributeDefinitionValidatorImpl.kt | 4 +- .../validation/BluePrintDataTypeValidatorImpl.kt | 4 +- .../BluePrintNodeTemplateValidatorImpl.kt | 6 +- .../validation/BluePrintNodeTypeValidatorImpl.kt | 6 +- .../BluePrintPropertyDefinitionValidatorImpl.kt | 6 +- .../BluePrintServiceTemplateValidatorImpl.kt | 6 +- .../BluePrintTopologyTemplateValidatorImpl.kt | 6 +- .../validation/BluePrintValidatorServiceImpl.kt | 4 +- .../validation/BluePrintWorkflowValidatorImpl.kt | 6 +- .../core/service/BluePrintRepoFileServiceTest.kt | 8 +- .../baseconfiguration/Definitions/data_types.json | 6 +- .../dict/service/ResourceDefinitionRepoService.kt | 10 +- .../service/ResourceDefinitionValidationService.kt | 13 +-- .../service/ResourceDefinitionRepoServiceTest.java | 6 +- 21 files changed, 246 insertions(+), 121 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt delete mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintValidationError.kt create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt new file mode 100644 index 000000000..ea5bda42e --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt @@ -0,0 +1,29 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core + +class BluePrintError { + var errors: MutableList = arrayListOf() + + fun addError(type: String, name: String, error: String) { + this.errors.add("$type : $name : $error") + } + + fun addError(error: String) { + this.errors.add(error) + } +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintValidationError.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintValidationError.kt deleted file mode 100644 index 3ec0691f4..000000000 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintValidationError.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core - -class BluePrintValidationError { - var errors: MutableList = arrayListOf() - - fun addError(type: String, name: String, error: String) { - this.errors.add("$type : $name : $error") - } - - fun addError(error: String) { - this.errors.add(error) - } -} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt new file mode 100644 index 000000000..989617bd3 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt @@ -0,0 +1,122 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.interfaces + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.data.* +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext + +interface BluePrintEnhancer { + fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T) +} + +interface BluePrintServiceTemplateEnhancer : BluePrintEnhancer + +interface BluePrintTopologyTemplateEnhancer : BluePrintEnhancer + +interface BluePrintWorkflowEnhancer : BluePrintEnhancer + +interface BluePrintNodeTemplateEnhancer : BluePrintEnhancer + +interface BluePrintNodeTypeEnhancer : BluePrintEnhancer + +interface BluePrintPolicyTypeEnhancer : BluePrintEnhancer + +interface BluePrintPropertyDefinitionEnhancer : BluePrintEnhancer + +interface BluePrintAttributeDefinitionEnhancer : BluePrintEnhancer + + +interface BluePrintEnhancerService { + + @Throws(BluePrintException::class) + fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext + + @Throws(BluePrintException::class) + fun enhance(basePath: String): BluePrintContext + + @Throws(BluePrintException::class) + fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate +} + +interface BluePrintTypeEnhancerService { + + fun getServiceTemplateEnhancers(): List + + fun getTopologyTemplateEnhancers(): List + + fun getWorkflowEnhancers(): List + + fun getNodeTemplateEnhancers(): List + + fun getNodeTypeEnhancers(): List + + fun getPolicyTypeEnhancers(): List + + fun getPropertyDefinitionEnhancers(): List + + fun getAttributeDefinitionEnhancers(): List + + fun enhanceServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { + val enhancers = getServiceTemplateEnhancers() + doEnhancement(bluePrintContext, error, name, serviceTemplate, enhancers) + } + + fun enhanceTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { + val enhancers = getTopologyTemplateEnhancers() + doEnhancement(bluePrintContext, error, name, topologyTemplate, enhancers) + } + + fun enhanceWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) { + val enhancers = getWorkflowEnhancers() + doEnhancement(bluePrintContext, error, name, workflow, enhancers) + } + + fun enhanceNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) { + val enhancers = getNodeTemplateEnhancers() + doEnhancement(bluePrintContext, error, name, nodeTemplate, enhancers) + } + + fun enhanceNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) { + val enhancers = getNodeTypeEnhancers() + doEnhancement(bluePrintContext, error, name, nodeType, enhancers) + } + + fun enhancePolicyType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, policyType: PolicyType) { + val enhancers = getPolicyTypeEnhancers() + doEnhancement(bluePrintContext, error, name, policyType, enhancers) + } + + fun enhancePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { + val enhancers = getPropertyDefinitionEnhancers() + doEnhancement(bluePrintContext, error, name, propertyDefinition, enhancers) + } + + fun enhanceAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) { + val enhancers = getAttributeDefinitionEnhancers() + doEnhancement(bluePrintContext, error, name, attributeDefinition, enhancers) + } + + private fun doEnhancement(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, enhancers: List>) { + if (enhancers.isNotEmpty()) { + enhancers.forEach { + it.enhance(bluePrintContext, error, name, definition as T) + } + } + } +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt index 322f65741..adc94c4c2 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt @@ -1,14 +1,14 @@ package org.onap.ccsdk.apps.controllerblueprints.core.interfaces +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext interface BluePrintValidator { - fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, type: T) + fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T) } @@ -61,64 +61,64 @@ interface BluePrintTypeValidatorService { fun getAttributeDefinitionValidators(): List - fun validateServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, serviceTemplate: ServiceTemplate) { + fun validateServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { val validators = getServiceTemplateValidators() doValidation(bluePrintContext, error, name, serviceTemplate, validators) } - fun validateArtifactType(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, artifactType: ArtifactType) { + fun validateArtifactType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) { val validators = getArtifactTypeValidators() doValidation(bluePrintContext, error, name, artifactType, validators) } - fun validateDataType(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, dataType: DataType) { + fun validateDataType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) { val validators = getDataTypeValidators() doValidation(bluePrintContext, error, name, dataType, validators) } - fun validateNodeType(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, nodeType: NodeType) { + fun validateNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) { val validators = getNodeTypeValidators() doValidation(bluePrintContext, error, name, nodeType, validators) } - fun validateTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, topologyTemplate: TopologyTemplate) { + fun validateTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { val validators = getTopologyTemplateValidators() doValidation(bluePrintContext, error, name, topologyTemplate, validators) } - fun validateNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, nodeTemplate: NodeTemplate) { + fun validateNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) { val validators = getNodeTemplateValidators() doValidation(bluePrintContext, error, name, nodeTemplate, validators) } - fun validateWorkflow(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, workflow: Workflow) { + fun validateWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) { val validators = getWorkflowValidators() doValidation(bluePrintContext, error, name, workflow, validators) } - fun validatePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintValidationError, properties: MutableMap) { + fun validatePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap) { properties.forEach { propertyName, propertyDefinition -> validatePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition) } } - fun validatePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, propertyDefinition: PropertyDefinition) { + fun validatePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { val validators = getPropertyDefinitionValidators() doValidation(bluePrintContext, error, name, propertyDefinition, validators) } - fun validateAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintValidationError, attributes: MutableMap) { + fun validateAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap) { attributes.forEach { attributeName, attributeDefinition -> validateAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition) } } - fun validateAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, attributeDefinition: AttributeDefinition) { + fun validateAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) { val validators = getAttributeDefinitionValidators() doValidation(bluePrintContext, error, name, attributeDefinition, validators) } - private fun doValidation(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, definition: Any, validators: List>) { + private fun doValidation(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, validators: List>) { validators.forEach { it.validate(bluePrintContext, error, name, definition as T) } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt index dec7a50df..5ca43952d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt @@ -17,13 +17,12 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.data.* -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils -import reactor.core.publisher.Mono +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import java.io.Serializable /** @@ -35,19 +34,19 @@ import java.io.Serializable interface BluePrintRepoService : Serializable { @Throws(BluePrintException::class) - fun getNodeType(nodeTypeName: String): Mono + fun getNodeType(nodeTypeName: String): NodeType @Throws(BluePrintException::class) - fun getDataType(dataTypeName: String): Mono + fun getDataType(dataTypeName: String): DataType @Throws(BluePrintException::class) - fun getArtifactType(artifactTypeName: String): Mono + fun getArtifactType(artifactTypeName: String): ArtifactType @Throws(BluePrintException::class) - fun getRelationshipType(relationshipTypeName: String): Mono + fun getRelationshipType(relationshipTypeName: String): RelationshipType @Throws(BluePrintException::class) - fun getCapabilityDefinition(capabilityDefinitionName: String): Mono + fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition } @@ -63,36 +62,37 @@ open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoServic private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) private val extension = ".json" - override fun getDataType(dataTypeName: String): Mono { + override fun getDataType(dataTypeName: String): DataType { val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER) .plus(dataTypeName).plus(extension) return getModelType(fileName, DataType::class.java) } - override fun getNodeType(nodeTypeName: String): Mono { + override fun getNodeType(nodeTypeName: String): NodeType { val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension) return getModelType(fileName, NodeType::class.java) } - override fun getArtifactType(artifactTypeName: String): Mono { + override fun getArtifactType(artifactTypeName: String): ArtifactType { val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER) .plus(artifactTypeName).plus(extension) return getModelType(fileName, ArtifactType::class.java) } - override fun getRelationshipType(relationshipTypeName: String): Mono { + override fun getRelationshipType(relationshipTypeName: String): RelationshipType { val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER) .plus(relationshipTypeName).plus(extension) return getModelType(fileName, RelationshipType::class.java) } - override fun getCapabilityDefinition(capabilityDefinitionName: String): Mono { + override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition { val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER) .plus(capabilityDefinitionName).plus(extension) return getModelType(fileName, CapabilityDefinition::class.java) } - private fun getModelType(fileName: String, valueType: Class): Mono { - return JacksonReactorUtils.readValueFromFile(fileName, valueType) + private fun getModelType(fileName: String, valueType: Class): T { + return JacksonUtils.readValueFromFile(fileName, valueType) + ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}") } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index 40210142c..be23172a7 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -24,12 +24,12 @@ import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import org.apache.commons.io.FileUtils +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext import org.apache.commons.io.IOUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.format import java.io.File import java.nio.charset.Charset @@ -56,19 +56,26 @@ object JacksonUtils { @JvmStatic fun getContent(fileName: String): String { - return File(fileName).readText(Charsets.UTF_8) + return runBlocking { + withContext(Dispatchers.Default) { + File(fileName).readText(Charsets.UTF_8) + } + } } @JvmStatic fun getClassPathFileContent(fileName: String): String { - return IOUtils.toString(JacksonUtils::class.java.classLoader - .getResourceAsStream(fileName), Charset.defaultCharset()) + return runBlocking { + withContext(Dispatchers.Default) { + IOUtils.toString(JacksonUtils::class.java.classLoader + .getResourceAsStream(fileName), Charset.defaultCharset()) + } + } } @JvmStatic fun readValueFromFile(fileName: String, valueType: Class): T? { - val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) - ?: throw BluePrintException(format("Failed to read json file : {}", fileName)) + val content: String = getContent(fileName) return readValue(content, valueType) } @@ -89,8 +96,7 @@ object JacksonUtils { @JvmStatic fun jsonNodeFromFile(fileName: String): JsonNode { - val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) - ?: throw BluePrintException(format("Failed to read json file : {}", fileName)) + val content: String = getContent(fileName) return jsonNode(content) } @@ -135,8 +141,7 @@ object JacksonUtils { @JvmStatic fun getListFromFile(fileName: String, valueType: Class): List? { - val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) - ?: throw BluePrintException(format("Failed to read json file : {}", fileName)) + val content: String = getContent(fileName) return getListFromJson(content, valueType) } @@ -155,8 +160,7 @@ object JacksonUtils { @JvmStatic fun getMapFromFile(fileName: String, valueType: Class): MutableMap? { - val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) - ?: throw BluePrintException(format("Failed to read json file : {}", fileName)) + val content: String = getContent(fileName) return getMapFromJson(content, valueType) } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt index 9208bdac3..3fd318548 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService @@ -24,7 +24,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator { - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, artifactType: ArtifactType) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) { artifactType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, artifactType.properties!!) } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt index d0faf1c25..98abc1e26 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService @@ -24,7 +24,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator { - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, type: AttributeDefinition) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: AttributeDefinition) { //TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt index c8d8a74d5..1241aa6dc 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt @@ -18,7 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintDataTypeValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService @@ -27,7 +27,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintDataTypeValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintDataTypeValidatorImpl::class.toString()) - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, dataType: DataType) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) { log.trace("Validating DataType($name)") dataType.properties?.let { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt index 94d6251cc..26a246dd6 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt @@ -21,7 +21,7 @@ import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator @@ -36,10 +36,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, nodeTemplateName: String, nodeTemplate: NodeTemplate) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTemplateName: String, nodeTemplate: NodeTemplate) { log.trace("Validating NodeTemplate($nodeTemplateName)") this.bluePrintContext = bluePrintContext this.error = error diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt index 86bf521fa..e15724ae2 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt @@ -20,7 +20,7 @@ import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyNThrow import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator @@ -33,10 +33,10 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, nodeTypeName: String, nodeType: NodeType) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTypeName: String, nodeType: NodeType) { log.trace("Validating NodeType($nodeTypeName)") this.bluePrintContext = bluePrintContext this.error = error diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt index f4804d4c5..f7a1cbf4b 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt @@ -20,7 +20,7 @@ import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator @@ -32,9 +32,9 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, propertyDefinition: PropertyDefinition) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { this.bluePrintContext = bluePrintContext this.error = error diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt index 66c504dea..848dcc5f8 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt @@ -21,7 +21,7 @@ import com.att.eelf.configuration.EELFManager import com.google.common.base.Preconditions import org.apache.commons.lang3.StringUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService @@ -32,10 +32,10 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, serviceTemplate: ServiceTemplate) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { log.trace("Validating Service Template..") try { this.bluePrintContext = bluePrintContext diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt index 411cdb4d3..2783e14ee 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate @@ -33,9 +33,9 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, name: String, topologyTemplate: TopologyTemplate) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { log.trace("Validating Topology Template..") this.bluePrintContext = bluePrintContext this.error = error diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt index 10e8d65bc..4ddf76b2b 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext @@ -30,7 +30,7 @@ open class BluePrintValidatorServiceImpl(private val bluePrintTypeValidatorServi private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintValidatorServiceImpl::class.toString()) override fun validateBluePrints(bluePrintContext: BluePrintContext, properties: MutableMap): Boolean { - val error = BluePrintValidationError() + val error = BluePrintError() bluePrintTypeValidatorService.validateServiceTemplate(bluePrintContext, error, "default", bluePrintContext.serviceTemplate) if (error.errors.size > 0) { throw BluePrintException("failed in blueprint validation : ${error.errors.joinToString("\n")}") diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt index 8ba6f7204..f4434a54a 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintValidationError +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowValidator @@ -29,10 +29,10 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) var bluePrintContext: BluePrintContext? = null - var error: BluePrintValidationError? = null + var error: BluePrintError? = null var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintValidationError, workflowName: String, workflow: Workflow) { + override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, workflowName: String, workflow: Workflow) { log.info("Validating Workflow($workflowName)") this.bluePrintContext = bluePrintContext diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt index b8cfdd408..f7f995fbb 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt @@ -33,25 +33,25 @@ class BluePrintRepoFileServiceTest { @Test fun testGetDataType() { - val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate").block() + val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate") assertNotNull(dataType, "Failed to get DataType from repo") } @Test fun testGetNodeType() { - val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment").block() + val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment") assertNotNull(nodeType, "Failed to get NodeType from repo") } @Test fun testGetArtifactType() { - val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity").block() + val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity") assertNotNull(nodeType, "Failed to get ArtifactType from repo") } @Test(expected = FileNotFoundException::class) fun testModelNotFound() { - val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found").block() + val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found") assertNotNull(dataType, "Failed to get DataType from repo") } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json index 569b668ac..3ea494ac4 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -41,7 +41,7 @@ "type": "string" } }, - "derived_from": "tosca.datatypes.Root" + "derived_from": "tosca.datatypes.Dynamic" }, "resource-assignment-properties": { "description": "This is Dynamically generated data type for workflow activate", @@ -64,7 +64,7 @@ "type": "string" } }, - "derived_from": "tosca.datatypes.Root" + "derived_from": "tosca.datatypes.Dynamic" }, "assign-activate-properties": { "description": "This is Dynamically generated data type for workflow assign-activate", @@ -87,7 +87,7 @@ "type": "string" } }, - "derived_from": "tosca.datatypes.Root" + "derived_from": "tosca.datatypes.Dynamic" } } } \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt index 6d186b598..bcb7e7da7 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt @@ -21,9 +21,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition -import reactor.core.publisher.Mono /** * ResourceDefinitionRepoService. @@ -33,7 +32,7 @@ import reactor.core.publisher.Mono interface ResourceDefinitionRepoService : BluePrintRepoService { @Throws(BluePrintException::class) - fun getResourceDefinition(resourceDefinitionName: String): Mono + fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition } /** @@ -57,11 +56,12 @@ open class ResourceDefinitionFileRepoService : BluePrintRepoFileService, resourceDefinitionPath = basePath.plus("/resource-dictionary/starter-dictionary") } - override fun getResourceDefinition(resourceDefinitionName: String): Mono { + override fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition { val fileName = resourceDefinitionPath.plus(BluePrintConstants.PATH_DIVIDER) .plus(resourceDefinitionName).plus(extension) - return JacksonReactorUtils.readValueFromFile(fileName, ResourceDefinition::class.java) + return JacksonUtils.readValueFromFile(fileName, ResourceDefinition::class.java) + ?: throw BluePrintException("couldn't get resource definition for file($fileName)") } } diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt index 9f45d1666..9ed077323 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode import com.google.common.base.Preconditions import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException @@ -30,8 +31,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpression import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition -import com.att.eelf.configuration.EELFManager import java.io.Serializable + /** * ResourceDefinitionValidationService. * @@ -43,6 +44,7 @@ interface ResourceDefinitionValidationService : Serializable { fun validate(resourceDefinition: ResourceDefinition) } + /** * ResourceDefinitionValidationService. * @@ -59,8 +61,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS resourceDefinition.sources.forEach { (name, nodeTemplate) -> val sourceType = nodeTemplate.type - val sourceNodeType = bluePrintRepoService.getNodeType(sourceType).block() - ?: throw BluePrintException(format("Failed to get source({}) node type definition({})", name, sourceType)) + val sourceNodeType = bluePrintRepoService.getNodeType(sourceType) // Validate Property Name, expression, values and Data Type validateNodeTemplateProperties(nodeTemplate, sourceNodeType) @@ -91,7 +92,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS open fun checkPropertyValue(propertyDefinition: PropertyDefinition, propertyName: String, propertyAssignment: JsonNode) { val propertyType = propertyDefinition.type - val isValid : Boolean + val isValid: Boolean if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) { isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment) @@ -100,9 +101,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment) } else { - bluePrintRepoService.getDataType(propertyType).block() - ?: throw BluePrintException(format("property({}) defined of data type({}) is not in repository", - propertyName, propertyType)) + bluePrintRepoService.getDataType(propertyType) isValid = true } diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java index 6789c0e0e..ac8cbcb43 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java @@ -24,13 +24,13 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition public class ResourceDefinitionRepoServiceTest { @Test - public void testGetResourceDefinition() throws Exception{ + public void testGetResourceDefinition() throws Exception { ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../model-catalog"); ResourceDefinition resourceDefinition = resourceDefinitionRepoService - .getResourceDefinition("db-source").block(); + .getResourceDefinition("db-source"); Assert.assertNotNull("Failed to get Resource Definition db-source", resourceDefinition); - NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db").block(); + NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db"); Assert.assertNotNull("Failed to get Node Type source-db", resourceDefinition); } } \ No newline at end of file -- cgit 1.2.3-korg From 478a8a7a321556ed01ec757cde3c827ef10690c0 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Wed, 12 Dec 2018 16:49:04 -0500 Subject: Add multiple location repo for enhancer. Change-Id: I5333b30fad8d754caf8dc89956132e4637f28c26 Issue-ID: CCSDK-803 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/interfaces/BluePrintRepoService.kt | 47 +++++++++++ .../core/service/BluePrintRepoFileService.kt | 71 ++++++++++++++++ .../core/service/BluePrintRepoService.kt | 98 ---------------------- .../core/service/BluePrintRepoFileServiceTest.kt | 10 +-- .../core/service/BluePrintRuntimeServiceTest.kt | 2 - .../Definitions/activation-blueprint.json | 33 +------- .../baseconfiguration/Definitions/node_types.json | 13 +-- .../starter-type/node_type/dg-generic.json | 11 +++ .../dict/service/ResourceDefinitionRepoService.kt | 67 --------------- .../service/ResourceDefinitionValidationService.kt | 2 +- .../service/ResourceDefinitionRepoServiceTest.java | 36 -------- 11 files changed, 140 insertions(+), 250 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt delete mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt create mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-generic.json delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt new file mode 100644 index 000000000..efcb0c38b --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt @@ -0,0 +1,47 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.interfaces + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.data.* +import java.io.Serializable + +/** + * BluePrintRepoFileService + * @author Brinda Santh + * + */ + +interface BluePrintRepoService : Serializable { + + @Throws(BluePrintException::class) + fun getNodeType(nodeTypeName: String): NodeType + + @Throws(BluePrintException::class) + fun getDataType(dataTypeName: String): DataType + + @Throws(BluePrintException::class) + fun getArtifactType(artifactTypeName: String): ArtifactType + + @Throws(BluePrintException::class) + fun getRelationshipType(relationshipTypeName: String): RelationshipType + + @Throws(BluePrintException::class) + fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition + +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt new file mode 100644 index 000000000..de338664c --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt @@ -0,0 +1,71 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.service + +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.data.* +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils + +open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService { + + private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintRepoFileService::class.toString()) + + private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) + private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) + private val capabilityTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) + private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) + private val extension = ".json" + + override fun getDataType(dataTypeName: String): DataType { + val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(dataTypeName).plus(extension) + return getModelType(fileName, DataType::class.java) + } + + override fun getNodeType(nodeTypeName: String): NodeType { + val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension) + return getModelType(fileName, NodeType::class.java) + } + + override fun getArtifactType(artifactTypeName: String): ArtifactType { + val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(artifactTypeName).plus(extension) + return getModelType(fileName, ArtifactType::class.java) + } + + override fun getRelationshipType(relationshipTypeName: String): RelationshipType { + val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(relationshipTypeName).plus(extension) + return getModelType(fileName, RelationshipType::class.java) + } + + override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition { + val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(capabilityDefinitionName).plus(extension) + return getModelType(fileName, CapabilityDefinition::class.java) + } + + private fun getModelType(fileName: String, valueType: Class): T { + return JacksonUtils.readValueFromFile(fileName, valueType) + ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}") + } +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt deleted file mode 100644 index 5ca43952d..000000000 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core.service - -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.data.* -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import java.io.Serializable - -/** - * BluePrintRepoFileService - * @author Brinda Santh - * - */ - -interface BluePrintRepoService : Serializable { - - @Throws(BluePrintException::class) - fun getNodeType(nodeTypeName: String): NodeType - - @Throws(BluePrintException::class) - fun getDataType(dataTypeName: String): DataType - - @Throws(BluePrintException::class) - fun getArtifactType(artifactTypeName: String): ArtifactType - - @Throws(BluePrintException::class) - fun getRelationshipType(relationshipTypeName: String): RelationshipType - - @Throws(BluePrintException::class) - fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition - -} - - -open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService { - - private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintRepoFileService::class.toString()) - - private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) - private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) - private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) - private val capabilityTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) - private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) - private val extension = ".json" - - override fun getDataType(dataTypeName: String): DataType { - val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(dataTypeName).plus(extension) - return getModelType(fileName, DataType::class.java) - } - - override fun getNodeType(nodeTypeName: String): NodeType { - val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension) - return getModelType(fileName, NodeType::class.java) - } - - override fun getArtifactType(artifactTypeName: String): ArtifactType { - val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(artifactTypeName).plus(extension) - return getModelType(fileName, ArtifactType::class.java) - } - - override fun getRelationshipType(relationshipTypeName: String): RelationshipType { - val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(relationshipTypeName).plus(extension) - return getModelType(fileName, RelationshipType::class.java) - } - - override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition { - val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(capabilityDefinitionName).plus(extension) - return getModelType(fileName, CapabilityDefinition::class.java) - } - - private fun getModelType(fileName: String, valueType: Class): T { - return JacksonUtils.readValueFromFile(fileName, valueType) - ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}") - } -} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt index f7f995fbb..f7ffc3940 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt @@ -29,29 +29,29 @@ import kotlin.test.assertNotNull class BluePrintRepoFileServiceTest { private val basePath = "load/model_type" - private val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath) + private val bluePrintRepoFileService = BluePrintRepoFileService(basePath) @Test fun testGetDataType() { - val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate") + val dataType = bluePrintRepoFileService.getDataType("dt-v4-aggregate") assertNotNull(dataType, "Failed to get DataType from repo") } @Test fun testGetNodeType() { - val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment") + val nodeType = bluePrintRepoFileService.getNodeType("component-resource-assignment") assertNotNull(nodeType, "Failed to get NodeType from repo") } @Test fun testGetArtifactType() { - val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity") + val nodeType = bluePrintRepoFileService.getArtifactType("artifact-template-velocity") assertNotNull(nodeType, "Failed to get ArtifactType from repo") } @Test(expected = FileNotFoundException::class) fun testModelNotFound() { - val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found") + val dataType = bluePrintRepoFileService.getDataType("dt-not-found") assertNotNull(dataType, "Failed to get DataType from repo") } } \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 2f519802d..cbcadeb39 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -53,8 +53,6 @@ class BluePrintRuntimeServiceTest { val propContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process") assertNotNull(propContext, "Failed to populate interface property values") - assertEquals(propContext["process-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name") - assertEquals(propContext["version"], jsonNodeFromObject("sample-action"), "Failed to populate parameter version") } @Test diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 446932d54..f756ef7ed 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -39,17 +39,8 @@ }, "node_templates": { "resource-assignment-process": { - "type": "dg-activate", + "type": "dg-generic", "properties": { - "process-name": { - "get_input": "action-name" - }, - "version": { - "get_property": [ - "SELF", - "process-name" - ] - }, "content": { "get_artifact": [ "SELF", @@ -65,17 +56,8 @@ } }, "activate-process": { - "type": "dg-activate", + "type": "dg-generic", "properties": { - "process-name": { - "get_input": "action-name" - }, - "version": { - "get_property": [ - "SELF", - "process-name" - ] - }, "content": { "get_artifact": [ "SELF", @@ -91,17 +73,8 @@ } }, "assign-activate-process": { - "type": "dg-activate", + "type": "dg-generic", "properties": { - "process-name": { - "get_input": "action-name" - }, - "version": { - "get_property": [ - "SELF", - "process-name" - ] - }, "content": { "get_artifact": [ "SELF", diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 6e8d839ee..8227b82f7 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -1,21 +1,12 @@ { "node_types": { - "dg-activate": { + "dg-generic": { "description": "This is Generic Directed Graph Type", "version": "1.0.0", "properties": { "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, + "required": true, "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" } }, "derived_from": "tosca.nodes.DG" diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json new file mode 100644 index 000000000..6274445ca --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json @@ -0,0 +1,11 @@ +{ + "description": "This is Generic Directed Graph Type", + "version": "1.0.0", + "properties": { + "content": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.nodes.DG" +} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt deleted file mode 100644 index bcb7e7da7..000000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service - -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition - -/** - * ResourceDefinitionRepoService. - * - * @author Brinda Santh - */ -interface ResourceDefinitionRepoService : BluePrintRepoService { - - @Throws(BluePrintException::class) - fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition -} - -/** - * ResourceDefinitionFileRepoService. - * - * @author Brinda Santh - */ -open class ResourceDefinitionFileRepoService : BluePrintRepoFileService, - ResourceDefinitionRepoService { - - private var resourceDefinitionPath: String - private val extension = ".json" - - constructor(basePath: String) : this(basePath, - basePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(BluePrintConstants.MODEL_DIR_MODEL_TYPE) - .plus(BluePrintConstants.PATH_DIVIDER) - .plus("starter-type")) - - constructor(basePath: String, modelTypePath: String) : super(modelTypePath) { - resourceDefinitionPath = basePath.plus("/resource-dictionary/starter-dictionary") - } - - override fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition { - - val fileName = resourceDefinitionPath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(resourceDefinitionName).plus(extension) - - return JacksonUtils.readValueFromFile(fileName, ResourceDefinition::class.java) - ?: throw BluePrintException("couldn't get resource definition for file($fileName)") - } -} diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt index 9ed077323..2c66ff197 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt @@ -27,8 +27,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.format +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition import java.io.Serializable diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java deleted file mode 100644 index ac8cbcb43..000000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition; - -public class ResourceDefinitionRepoServiceTest { - - @Test - public void testGetResourceDefinition() throws Exception { - ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../model-catalog"); - ResourceDefinition resourceDefinition = resourceDefinitionRepoService - .getResourceDefinition("db-source"); - Assert.assertNotNull("Failed to get Resource Definition db-source", resourceDefinition); - - NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db"); - Assert.assertNotNull("Failed to get Node Type source-db", resourceDefinition); - } -} \ No newline at end of file -- cgit 1.2.3-korg From 2294f097df4a787eaa609cdeab24a6bc6d3b19ee Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 13 Dec 2018 11:34:49 -0500 Subject: Implement Blueprint Workflow Enhancement Change-Id: I64d6e949e9a4bc2100b49fedb3781b04c1c03f43 Issue-ID: CCSDK-722 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/BluePrintConstants.kt | 1 + .../core/interfaces/BluePrintEnhancer.kt | 51 ++++++++++------------ .../core/service/BluePrintRuntimeService.kt | 23 ++++++++-- .../core/utils/BluePrintFileUtils.kt | 32 +++++++++----- .../Definitions/activation-blueprint.json | 41 +++++++++++++---- .../baseconfiguration/Definitions/data_types.json | 27 +----------- .../baseconfiguration/Definitions/node_types.json | 8 ++++ .../Definitions/policy_types.json | 4 ++ .../starter-type/node_type/dg-generic.json | 8 ++++ 9 files changed, 121 insertions(+), 74 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 167496ebc..fd6a8db10 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -55,6 +55,7 @@ object BluePrintConstants { const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template" const val PATH_METADATA: String = "metadata" const val PATH_NODE_TYPES: String = "node_types" + const val PATH_POLICY_TYPES: String = "policy_types" const val PATH_ARTIFACT_TYPES: String = "artifact_types" const val PATH_DATA_TYPES: String = "data_types" const val PATH_INPUTS: String = "inputs" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt index cb835d736..f6659e7db 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt @@ -16,13 +16,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.interfaces -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService interface BluePrintEnhancer { - fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T) + fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T) } interface BluePrintServiceTemplateEnhancer : BluePrintEnhancer @@ -49,9 +49,6 @@ interface BluePrintEnhancerService { @Throws(BluePrintException::class) fun enhance(basePath: String): BluePrintContext - - @Throws(BluePrintException::class) - fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate } interface BluePrintTypeEnhancerService { @@ -72,63 +69,63 @@ interface BluePrintTypeEnhancerService { fun getAttributeDefinitionEnhancers(): List - fun enhanceServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { + fun enhanceServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { val enhancers = getServiceTemplateEnhancers() - doEnhancement(bluePrintContext, error, name, serviceTemplate, enhancers) + doEnhancement(bluePrintRuntimeService, name, serviceTemplate, enhancers) } - fun enhanceTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { + fun enhanceTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { val enhancers = getTopologyTemplateEnhancers() - doEnhancement(bluePrintContext, error, name, topologyTemplate, enhancers) + doEnhancement(bluePrintRuntimeService, name, topologyTemplate, enhancers) } - fun enhanceWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) { + fun enhanceWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) { val enhancers = getWorkflowEnhancers() - doEnhancement(bluePrintContext, error, name, workflow, enhancers) + doEnhancement(bluePrintRuntimeService, name, workflow, enhancers) } - fun enhanceNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) { + fun enhanceNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { val enhancers = getNodeTemplateEnhancers() - doEnhancement(bluePrintContext, error, name, nodeTemplate, enhancers) + doEnhancement(bluePrintRuntimeService, name, nodeTemplate, enhancers) } - fun enhanceNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) { + fun enhanceNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) { val enhancers = getNodeTypeEnhancers() - doEnhancement(bluePrintContext, error, name, nodeType, enhancers) + doEnhancement(bluePrintRuntimeService, name, nodeType, enhancers) } - fun enhancePolicyType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, policyType: PolicyType) { + fun enhancePolicyType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, policyType: PolicyType) { val enhancers = getPolicyTypeEnhancers() - doEnhancement(bluePrintContext, error, name, policyType, enhancers) + doEnhancement(bluePrintRuntimeService, name, policyType, enhancers) } - fun enhancePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap) { + fun enhancePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap) { properties.forEach { propertyName, propertyDefinition -> - enhancePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition) + enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition) } } - fun enhancePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { + fun enhancePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { val enhancers = getPropertyDefinitionEnhancers() - doEnhancement(bluePrintContext, error, name, propertyDefinition, enhancers) + doEnhancement(bluePrintRuntimeService, name, propertyDefinition, enhancers) } - fun enhanceAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap) { + fun enhanceAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap) { attributes.forEach { attributeName, attributeDefinition -> - enhanceAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition) + enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition) } } - fun enhanceAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) { + fun enhanceAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) { val enhancers = getAttributeDefinitionEnhancers() - doEnhancement(bluePrintContext, error, name, attributeDefinition, enhancers) + doEnhancement(bluePrintRuntimeService, name, attributeDefinition, enhancers) } @Suppress("UNCHECKED_CAST") - private fun doEnhancement(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, enhancers: List>) { + private fun doEnhancement(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, enhancers: List>) { if (enhancers.isNotEmpty()) { enhancers.forEach { - it.enhance(bluePrintContext, error, name, definition as T) + it.enhance(bluePrintRuntimeService, name, definition as T) } } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index 448a06a86..cf518bd14 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate @@ -55,6 +56,10 @@ interface BluePrintRuntimeService { fun getAsDouble(key: String): Double? + fun getBluePrintError(): BluePrintError + + fun setBluePrintError(bluePrintError: BluePrintError) + /* Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing */ @@ -113,6 +118,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl private var store: MutableMap = hashMapOf() + private var bluePrintError = BluePrintError() + override fun id(): String { return id } @@ -162,9 +169,17 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return get(key).asDouble() } + override fun getBluePrintError(): BluePrintError { + return this.bluePrintError + } + + override fun setBluePrintError(bluePrintError: BluePrintError) { + this.bluePrintError = bluePrintError + } + /* - Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing - */ + Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing + */ override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap { log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName) val propertyAssignmentValue: MutableMap = hashMapOf() @@ -439,11 +454,11 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl setInputValue(propertyName, property, valueNode) } } - + // Load Dynamic data Types val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName) workflowDynamicInputs?.let { - bluePrintContext.dataTypeByName(dynamicInputPropertiesName)?.properties?.forEach { propertyName, property -> + bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.forEach { propertyName, property -> val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName) ?: NullNode.getInstance() setInputValue(propertyName, property, valueNode) diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt index d9222d754..4cb247b5d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -89,25 +89,37 @@ class BluePrintFileUtils { throw BluePrintException("couldn't get definition file under path(${definitionDir.absolutePath})") } - blueprintContext.dataTypes.let { - val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, blueprintContext.dataTypes!!, true) - writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) + blueprintContext.serviceTemplate.dataTypes?.let { + val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it, true) + writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) + } + blueprintContext.serviceTemplate.artifactTypes?.let { + val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it, true) + writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) } - blueprintContext.artifactTypes.let { - val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, blueprintContext.artifactTypes!!, true) - writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) + blueprintContext.serviceTemplate.nodeTypes?.let { + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it, true) + writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent) } - blueprintContext.nodeTypes.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, blueprintContext.nodeTypes!!, true) - writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent) + blueprintContext.serviceTemplate.policyTypes?.let { + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it, true) + writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent) } + } + fun writeDefinitionFile(definitionFile: String, content: String) = runBlocking { + val definitionFile = File(definitionFile) + + Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE) + check(definitionFile.exists()) { + throw BluePrintException("couldn't write definition file under path(${definitionFile.absolutePath})") + } } - private fun writeFile(definitionPath: String, type: String, content: String) = runBlocking { + private fun writeTypeFile(definitionPath: String, type: String, content: String) = runBlocking { val typeFile = File(definitionPath.plus(File.separator).plus("$type.json")) Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW) diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index f756ef7ed..ec229df2d 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -11,11 +11,14 @@ { "file": "Definitions/data_types.json" }, + { + "file": "Definitions/artifact_types.json" + }, { "file": "Definitions/node_types.json" }, { - "file": "Definitions/artifact_types.json" + "file": "Definitions/policy_types.json" } ], "topology_template": { @@ -46,7 +49,10 @@ "SELF", "dg-resource-assignment-process" ] - } + }, + "dependency-node-templates": [ + "resource-assignment" + ] }, "artifacts": { "dg-resource-assignment-process": { @@ -63,7 +69,10 @@ "SELF", "dg-activate-process" ] - } + }, + "dependency-node-templates": [ + "activate-jython" + ] }, "artifacts": { "dg-activate-process": { @@ -80,7 +89,11 @@ "SELF", "dg-assign-activate-process" ] - } + }, + "dependency-node-templates": [ + "resource-assignment", + "activate-jython" + ] }, "artifacts": { "dg-assign-activate-process": { @@ -217,7 +230,7 @@ "inputs": { "resource-assignment-properties": { "required": true, - "type": "resource-assignment-properties" + "type": "dt-resource-assignment-properties" } }, "steps": { @@ -234,9 +247,21 @@ }, "activate": { "inputs": { - "activate-properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { "required": true, - "type": "activate-properties" + "type": "string" } }, "steps": { @@ -255,7 +280,7 @@ "inputs": { "assign-activate-properties": { "required": true, - "type": "assign-activate-properties" + "type": "dt-assign-activate-properties" } }, "steps": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json index 3ea494ac4..7d850f200 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -20,7 +20,7 @@ }, "derived_from": "tosca.datatypes.Root" }, - "activate-properties": { + "dt-resource-assignment-properties": { "description": "This is Dynamically generated data type for workflow activate", "version": "1.0.0", "properties": { @@ -43,30 +43,7 @@ }, "derived_from": "tosca.datatypes.Dynamic" }, - "resource-assignment-properties": { - "description": "This is Dynamically generated data type for workflow activate", - "version": "1.0.0", - "properties": { - "request-id": { - "required": true, - "type": "string" - }, - "action-name": { - "required": true, - "type": "string" - }, - "scope-type": { - "required": true, - "type": "string" - }, - "hostname": { - "required": true, - "type": "string" - } - }, - "derived_from": "tosca.datatypes.Dynamic" - }, - "assign-activate-properties": { + "dt-assign-activate-properties": { "description": "This is Dynamically generated data type for workflow assign-activate", "version": "1.0.0", "properties": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 8227b82f7..8f242efb1 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -7,6 +7,14 @@ "content": { "required": true, "type": "string" + }, + "dependency-node-templates": { + "required": true, + "description": "Dependent Step Components", + "type": "list", + "entry_schema": { + "type": "string" + } } }, "derived_from": "tosca.nodes.DG" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json new file mode 100644 index 000000000..0c9b99252 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json @@ -0,0 +1,4 @@ +{ + "policy_types": { + } +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json index 6274445ca..ec9904bf5 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json @@ -5,6 +5,14 @@ "content": { "required": true, "type": "string" + }, + "dependency-node-templates": { + "required": true, + "description": "Dependent Step Components NodeTemplate name.", + "type": "list", + "entry_schema": { + "type": "string" + } } }, "derived_from": "tosca.nodes.DG" -- cgit 1.2.3-korg From adcbf58a6c6cef14523ed1700e698769769027aa Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 13 Dec 2018 15:10:35 -0500 Subject: Add blueprint runtime service to validator Change-Id: I0e4375e422b55002f1666ee9e61a1469482f77d2 Issue-ID: CCSDK-757 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/interfaces/BlueprintValidator.kt | 59 ++++++++++++---------- .../core/utils/BluePrintFileUtils.kt | 8 +-- .../BluePrintArtifactTypeValidatorImpl.kt | 8 +-- .../BluePrintAttributeDefinitionValidatorImpl.kt | 7 ++- .../validation/BluePrintDataTypeValidatorImpl.kt | 7 ++- .../BluePrintNodeTemplateValidatorImpl.kt | 28 +++++----- .../validation/BluePrintNodeTypeValidatorImpl.kt | 20 ++++---- .../BluePrintPropertyDefinitionValidatorImpl.kt | 17 +++---- .../BluePrintServiceTemplateValidatorImpl.kt | 22 ++++---- .../BluePrintTopologyTemplateValidatorImpl.kt | 17 +++---- .../validation/BluePrintValidatorServiceImpl.kt | 22 +++++--- .../validation/BluePrintWorkflowValidatorImpl.kt | 13 +++-- .../core/service/BluePrintRuntimeServiceTest.kt | 3 +- .../BluePrintValidatorServiceImplTest.kt | 4 +- .../Definitions/activation-blueprint.json | 20 +------- .../baseconfiguration/Definitions/node_types.json | 10 ---- .../node_type/dg-activate-netconf.json | 52 ------------------- .../node_type/dg-config-generator.json | 51 ------------------- .../node_type/dg-resource-assign-activate.json | 56 -------------------- .../node_type/dg-resource-assignment.json | 51 ------------------- .../service/ResourceAssignmentValidationService.kt | 10 ++-- .../service/ResourceDefinitionValidationService.kt | 4 +- .../ResourceAssignmentValidationServiceTest.kt | 6 +-- .../ResourceDefinitionValidationServiceTest.java | 2 +- 24 files changed, 132 insertions(+), 365 deletions(-) delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt index adc94c4c2..bea790fd3 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt @@ -1,14 +1,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.interfaces -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.data.* -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService interface BluePrintValidator { - fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T) + fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T) } @@ -37,7 +36,10 @@ interface BluePrintAttributeDefinitionValidator : BluePrintValidator) : Boolean + fun validateBluePrints(basePath: String): Boolean + + @Throws(BluePrintException::class) + fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean } @@ -61,66 +63,67 @@ interface BluePrintTypeValidatorService { fun getAttributeDefinitionValidators(): List - fun validateServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { + fun validateServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { val validators = getServiceTemplateValidators() - doValidation(bluePrintContext, error, name, serviceTemplate, validators) + doValidation(bluePrintRuntimeService, name, serviceTemplate, validators) } - fun validateArtifactType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) { + fun validateArtifactType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) { val validators = getArtifactTypeValidators() - doValidation(bluePrintContext, error, name, artifactType, validators) + doValidation(bluePrintRuntimeService, name, artifactType, validators) } - fun validateDataType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) { + fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) { val validators = getDataTypeValidators() - doValidation(bluePrintContext, error, name, dataType, validators) + doValidation(bluePrintRuntimeService, name, dataType, validators) } - fun validateNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) { + fun validateNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) { val validators = getNodeTypeValidators() - doValidation(bluePrintContext, error, name, nodeType, validators) + doValidation(bluePrintRuntimeService, name, nodeType, validators) } - fun validateTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { + fun validateTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { val validators = getTopologyTemplateValidators() - doValidation(bluePrintContext, error, name, topologyTemplate, validators) + doValidation(bluePrintRuntimeService, name, topologyTemplate, validators) } - fun validateNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) { + fun validateNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { val validators = getNodeTemplateValidators() - doValidation(bluePrintContext, error, name, nodeTemplate, validators) + doValidation(bluePrintRuntimeService, name, nodeTemplate, validators) } - fun validateWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) { + fun validateWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) { val validators = getWorkflowValidators() - doValidation(bluePrintContext, error, name, workflow, validators) + doValidation(bluePrintRuntimeService, name, workflow, validators) } - fun validatePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap) { + fun validatePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap) { properties.forEach { propertyName, propertyDefinition -> - validatePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition) + validatePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition) } } - fun validatePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { + fun validatePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { val validators = getPropertyDefinitionValidators() - doValidation(bluePrintContext, error, name, propertyDefinition, validators) + doValidation(bluePrintRuntimeService, name, propertyDefinition, validators) } - fun validateAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap) { + fun validateAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap) { attributes.forEach { attributeName, attributeDefinition -> - validateAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition) + validateAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition) } } - fun validateAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) { + fun validateAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) { val validators = getAttributeDefinitionValidators() - doValidation(bluePrintContext, error, name, attributeDefinition, validators) + doValidation(bluePrintRuntimeService, name, attributeDefinition, validators) } - private fun doValidation(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, validators: List>) { + @Suppress("UNCHECKED_CAST") + private fun doValidation(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, validators: List>) { validators.forEach { - it.validate(bluePrintContext, error, name, definition as T) + it.validate(bluePrintRuntimeService, name, definition as T) } } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt index 4cb247b5d..f9ac87600 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -90,22 +90,22 @@ class BluePrintFileUtils { } blueprintContext.serviceTemplate.dataTypes?.let { - val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it, true) + val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it.toSortedMap(), true) writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) } blueprintContext.serviceTemplate.artifactTypes?.let { - val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it, true) + val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true) writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) } blueprintContext.serviceTemplate.nodeTypes?.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it, true) + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it.toSortedMap(), true) writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent) } blueprintContext.serviceTemplate.policyTypes?.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it, true) + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it.toSortedMap(), true) writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent) } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt index 3fd318548..e383588ee 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt @@ -16,17 +16,17 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator { - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) { + artifactType.properties?.let { - bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, artifactType.properties!!) + bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!) } // TODO ("Files Present ") } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt index 98abc1e26..53a27b53d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt @@ -16,15 +16,14 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService -class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator { +open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator { - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: AttributeDefinition) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: AttributeDefinition) { //TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt index 1241aa6dc..980302bf9 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt @@ -18,21 +18,20 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintDataTypeValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintDataTypeValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintDataTypeValidatorImpl::class.toString()) - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) { log.trace("Validating DataType($name)") dataType.properties?.let { - bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, dataType.properties!!) + bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!) } } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt index 26a246dd6..1449e63df 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt @@ -21,13 +21,13 @@ import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils @@ -35,14 +35,15 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintContext: BluePrintContext var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTemplateName: String, nodeTemplate: NodeTemplate) { - log.trace("Validating NodeTemplate($nodeTemplateName)") - this.bluePrintContext = bluePrintContext - this.error = error + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, nodeTemplate: NodeTemplate) { + log.info("Validating NodeTemplate($nodeTemplateName)") + + this.bluePrintRuntimeService = bluePrintRuntimeService + this.bluePrintContext = bluePrintRuntimeService.bluePrintContext() paths.add(nodeTemplateName) @@ -156,7 +157,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator throw BluePrintException("Failed to get relationship type ($relationship) for NodeTemplate($nodeTemplateName)'s requirement($requirementAssignmentName)") } - val relationShipNodeTemplate = bluePrintContext!!.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName) + val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName) ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " + "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)") @@ -212,16 +213,15 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName) ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)") - log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName, - interfaceAssignmentName, operationAssignmentName) + log.info("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation ($operationAssignmentName)") val inputs = operationAssignments.inputs val outputs = operationAssignments.outputs inputs?.forEach { propertyName, propertyAssignment -> val propertyDefinition = operationDefinition.inputs?.get(propertyName) - ?: throw BluePrintException("Failed to get NodeTemplate(nodeTemplateName) operation " + - "definition (operationAssignmentName) property definition(propertyName)") + ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " + + "definition ($operationAssignmentName) property definition($propertyName)") // Check the property values with property definition validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment) } @@ -241,7 +241,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) { - val artifactType = bluePrintContext!!.serviceTemplate.artifactTypes?.get(artifactTypeName) + val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName) ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)") checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom) @@ -282,7 +282,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator private fun checkPropertyDataType(dataTypeName: String, propertyName: String) { - val dataType = bluePrintContext!!.serviceTemplate.dataTypes?.get(dataTypeName) + val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName) ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found") checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom) diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt index e15724ae2..2e4a733a8 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt @@ -20,26 +20,26 @@ import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyNThrow import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintContext: BluePrintContext var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTypeName: String, nodeType: NodeType) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTypeName: String, nodeType: NodeType) { log.trace("Validating NodeType($nodeTypeName)") - this.bluePrintContext = bluePrintContext - this.error = error + this.bluePrintRuntimeService = bluePrintRuntimeService + this.bluePrintContext = bluePrintRuntimeService.bluePrintContext() paths.add(nodeTypeName) @@ -52,7 +52,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)") } - nodeType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, nodeType.properties!!) } + nodeType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, nodeType.properties!!) } nodeType.capabilities?.let { validateCapabilityDefinitions(nodeTypeName, nodeType) } nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) } nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) } @@ -111,7 +111,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ throw BluePrintException("failed to get relationship($relationship) for NodeType($nodeTypeName)'s requirement($requirementDefinitionName)") } - val relationShipNodeType = bluePrintContext!!.serviceTemplate.nodeTypes?.get(requirementNodeTypeName) + val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName) ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ") relationShipNodeType.capabilities?.get(capabilityName) @@ -137,11 +137,11 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ operationDefinition.implementation?.let { validateImplementation(operationDefinition.implementation!!) } operationDefinition.inputs?.let { - bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, operationDefinition.inputs!!) + bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.inputs!!) } operationDefinition.outputs?.let { - bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, operationDefinition.outputs!!) + bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.outputs!!) } paths.removeAt(paths.lastIndex) } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt index f7a1cbf4b..ca156190c 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt @@ -20,23 +20,22 @@ import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + + + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { + this.bluePrintRuntimeService = bluePrintRuntimeService - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { - this.bluePrintContext = bluePrintContext - this.error = error log.trace("Validating PropertyDefinition($name)") @@ -66,14 +65,14 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal private fun checkPropertyDataType(dataTypeName: String, propertyName: String) { - val dataType = bluePrintContext!!.serviceTemplate.dataTypes?.get(dataTypeName) + val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName) ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName)) checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom) } private fun checkDataType(key: String): Boolean { - return bluePrintContext!!.serviceTemplate.dataTypes?.containsKey(key) ?: false + return bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.containsKey(key) ?: false } open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt index 848dcc5f8..61159cf8b 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt @@ -25,21 +25,22 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.* import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var error: BluePrintError + var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { log.trace("Validating Service Template..") try { - this.bluePrintContext = bluePrintContext - this.error = error + this.bluePrintRuntimeService = bluePrintRuntimeService + this.error = bluePrintRuntimeService.getBluePrintError() serviceTemplate.metadata?.let { validateMetadata(serviceTemplate.metadata!!) } serviceTemplate.dataTypes?.let { validateDataTypes(serviceTemplate.dataTypes!!) } @@ -47,6 +48,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida serviceTemplate.nodeTypes?.let { validateNodeTypes(serviceTemplate.nodeTypes!!) } serviceTemplate.topologyTemplate?.let { validateTopologyTemplate(serviceTemplate.topologyTemplate!!) } } catch (e: Exception) { + log.error("failed in blueprint service template validation", e) error.addError(BluePrintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!) } } @@ -74,7 +76,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida paths.add(BluePrintConstants.PATH_DATA_TYPES) dataTypes.forEach { dataTypeName, dataType -> // Validate Single Data Type - bluePrintTypeValidatorService.validateDataType(bluePrintContext!!, error!!, dataTypeName, dataType) + bluePrintTypeValidatorService.validateDataType(bluePrintRuntimeService, dataTypeName, dataType) } paths.removeAt(paths.lastIndex) } @@ -83,7 +85,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida paths.add(BluePrintConstants.PATH_ARTIFACT_TYPES) artifactTypes.forEach { artifactName, artifactType -> // Validate Single Artifact Type - bluePrintTypeValidatorService.validateArtifactType(bluePrintContext!!, error!!, artifactName, artifactType) + bluePrintTypeValidatorService.validateArtifactType(bluePrintRuntimeService, artifactName, artifactType) } paths.removeAt(paths.lastIndex) } @@ -92,14 +94,14 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida paths.add(BluePrintConstants.PATH_NODE_TYPES) nodeTypes.forEach { nodeTypeName, nodeType -> // Validate Single Node Type - bluePrintTypeValidatorService.validateNodeType(bluePrintContext!!, error!!, nodeTypeName, nodeType) + bluePrintTypeValidatorService.validateNodeType(bluePrintRuntimeService, nodeTypeName, nodeType) } paths.removeAt(paths.lastIndex) } fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) { paths.add(BluePrintConstants.PATH_TOPOLOGY_TEMPLATE) - bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintContext!!, error!!, "topologyTemplate", topologyTemplate) + bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate) paths.removeAt(paths.lastIndex) } } \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt index 2783e14ee..b87666d2d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt @@ -19,26 +19,23 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { log.trace("Validating Topology Template..") - this.bluePrintContext = bluePrintContext - this.error = error + this.bluePrintRuntimeService = bluePrintRuntimeService // Validate Inputs topologyTemplate.inputs?.let { validateInputs(topologyTemplate.inputs!!) } @@ -50,7 +47,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid @Throws(BluePrintException::class) fun validateInputs(inputs: MutableMap) { - bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, inputs) + bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs) } @@ -59,7 +56,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid nodeTemplates.forEach { nodeTemplateName, nodeTemplate -> // Validate Single Node Template - bluePrintTypeValidatorService.validateNodeTemplate(bluePrintContext!!, error!!, nodeTemplateName, nodeTemplate) + bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeTemplate) } } @@ -68,7 +65,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid workflows.forEach { workflowName, workflow -> // Validate Single workflow - bluePrintTypeValidatorService.validateWorkflow(bluePrintContext!!, error!!, workflowName, workflow) + bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow) } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt index 4ddf76b2b..4f68342eb 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt @@ -19,21 +19,29 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils +import java.util.* open class BluePrintValidatorServiceImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintValidatorService { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintValidatorServiceImpl::class.toString()) - override fun validateBluePrints(bluePrintContext: BluePrintContext, properties: MutableMap): Boolean { - val error = BluePrintError() - bluePrintTypeValidatorService.validateServiceTemplate(bluePrintContext, error, "default", bluePrintContext.serviceTemplate) - if (error.errors.size > 0) { - throw BluePrintException("failed in blueprint validation : ${error.errors.joinToString("\n")}") + override fun validateBluePrints(basePath: String): Boolean { + + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath) + return validateBluePrints(bluePrintRuntimeService) + } + + override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean { + + bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template", + bluePrintRuntimeService.bluePrintContext().serviceTemplate) + if (bluePrintRuntimeService.getBluePrintError().errors.size > 0) { + throw BluePrintException("failed in blueprint validation : ${bluePrintRuntimeService.getBluePrintError().errors.joinToString("\n")}") } return true } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt index f4434a54a..1a138c3a6 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt @@ -19,24 +19,23 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowValidator -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator { private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - var bluePrintContext: BluePrintContext? = null - var error: BluePrintError? = null + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + var paths: MutableList = arrayListOf() - override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, workflowName: String, workflow: Workflow) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, workflowName: String, workflow: Workflow) { log.info("Validating Workflow($workflowName)") - this.bluePrintContext = bluePrintContext - this.error = error + this.bluePrintRuntimeService = bluePrintRuntimeService + paths.add(workflowName) paths.joinToString(BluePrintConstants.PATH_DIVIDER) diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index cbcadeb39..7ecf44b69 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -72,8 +72,7 @@ class BluePrintRuntimeServiceTest { assertNotNull(inContext, "Failed to populate interface input property values") assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name") - assertEquals(inContext["template-content"], jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name") - } + } @Test fun testResolveNodeTemplateInterfaceOperationOutputs() { diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt index ca238db53..c98f2ac3c 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt @@ -28,13 +28,13 @@ class BluePrintValidatorServiceImplTest { @Test fun testValidateOfType() { - val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) + val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath) val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService() val defaultBluePrintValidatorService = BluePrintValidatorServiceImpl(mockBluePrintTypeValidatorService) - val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintContext, hashMapOf()) + val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime) assertTrue(valid, "failed in blueprint Validation") diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index ec229df2d..7d3a17a68 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -104,9 +104,6 @@ }, "resource-assignment": { "type": "component-resource-assignment", - "properties": { - "request-id": "1234" - }, "interfaces": { "ResourceAssignmentComponent": { "operations": { @@ -124,19 +121,7 @@ }, "artifact-prefix-names": [ "baseconfig" - ], - "template-content": { - "get_artifact": [ - "SELF", - "baseconfig-template" - ] - }, - "mapping-content": { - "get_artifact": [ - "SELF", - "baseconfig-mapping" - ] - } + ] }, "outputs": { "resource-assignment-params": { @@ -164,9 +149,6 @@ }, "resource-assignment-py": { "type": "component-resource-assignment", - "properties": { - "request-id": "1234" - }, "interfaces": { "ResourceAssignmentComponent": { "operations": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 8f242efb1..7330663c4 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -75,16 +75,6 @@ "entry_schema": { "type": "string" } - }, - "template-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "mapping-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json b/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json deleted file mode 100644 index 57667de98..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "description": "This is Download Netconf Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-netconf-executor", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ActivateNetconf": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - - "derived_from": "tosca.nodes.DG" -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json deleted file mode 100644 index e59c34b6e..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "description": "This is Activate DG for Config Generator Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-config-generator", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "GenerateConfiguration": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.DG" -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json deleted file mode 100644 index ca703a793..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "description": "This is Resource Assign and Activate Netconf Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "ra-component": { - "capability": "component-node", - "node": "component-resource-assignment", - "relationship": "tosca.relationships.DependsOn" - }, - "netconf-component": { - "capability": "component-node", - "node": "component-netconf-executor", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ResourceAssignAndActivate": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.DG" -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json deleted file mode 100644 index 9cce82a9e..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "description": "This is Resource Assignment Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-resource-assignment", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ResourceAssignment": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.DG" -} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt index fc7f1092d..d71fbbf80 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt @@ -18,14 +18,14 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.text.StrBuilder import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.apps.controllerblueprints.core.format import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory import java.io.Serializable @@ -41,12 +41,12 @@ interface ResourceAssignmentValidationService : Serializable { } /** - * ResourceAssignmentValidationDefaultService. + * ResourceAssignmentValidationServiceImpl. * * @author Brinda Santh */ -open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValidationService { - private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationDefaultService::class.java) +open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService { + private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceImpl::class.java) open var resourceAssignmentMap: Map = hashMapOf() open val validationMessage = StrBuilder() diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt index 2c66ff197..9541a7b89 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt @@ -50,7 +50,7 @@ interface ResourceDefinitionValidationService : Serializable { * * @author Brinda Santh */ -open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService { +open class ResourceDefinitionValidationServiceImpl(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService { private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDefinitionValidationService::class.java) @@ -58,7 +58,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS Preconditions.checkNotNull(resourceDefinition, "Failed to get Resource Definition") log.trace("Validating Resource Dictionary Definition {}", resourceDefinition.name) - resourceDefinition.sources.forEach { (name, nodeTemplate) -> + resourceDefinition.sources.forEach { name, nodeTemplate -> val sourceType = nodeTemplate.type val sourceNodeType = bluePrintRepoService.getNodeType(sourceType) diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt index 87ebb700b..191f568f1 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt @@ -43,7 +43,7 @@ class ResourceAssignmentValidationServiceTest { fun testValidateSuccess() { log.info("**************** testValidateSuccess *****************") val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService() + val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() val result = resourceAssignmentValidator.validate(assignments!!) Assert.assertTrue("Failed to Validate", result) } @@ -52,7 +52,7 @@ class ResourceAssignmentValidationServiceTest { fun testValidateDuplicate() { log.info(" **************** testValidateDuplicate *****************") val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService() + val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() resourceAssignmentValidator.validate(assignments!!) } @@ -60,7 +60,7 @@ class ResourceAssignmentValidationServiceTest { fun testValidateCyclic() { log.info(" **************** testValidateCyclic *****************") val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService() + val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() resourceAssignmentValidator.validate(assignments!!) } } \ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java index ef305627f..2b68585fa 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java @@ -49,7 +49,7 @@ public class ResourceDefinitionValidationServiceTest { Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); ResourceDefinitionValidationService resourceDictionaryValidationService = - new ResourceDefinitionDefaultValidationService(bluePrintRepoFileService); + new ResourceDefinitionValidationServiceImpl(bluePrintRepoFileService); resourceDictionaryValidationService.validate(resourceDefinition); Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition); } -- cgit 1.2.3-korg From 61f774846a79bd63ad5e1f8999740b556ef49aa3 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 18 Dec 2018 08:16:28 -0500 Subject: Add attribute definition enhancer. Change-Id: Ie8ac60910f04dfca477d0276aa451821cfcd8510 Issue-ID: CCSDK-718 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/ConfigModelConstant.kt | 8 - .../core/data/BluePrintModel.kt | 12 +- .../core/service/BluePrintContext.kt | 4 + .../core/utils/BluePrintFileUtils.kt | 63 +++++++- .../core/utils/BluePrintMetadataUtils.kt | 165 +++++++++++---------- .../baseconfiguration/Definitions/node_types.json | 5 +- .../Definitions/resources_definition_types.json | 62 ++++++++ .../Definitions/resources_dictionary_types.json | 62 -------- .../node_type/component-resource-assignment.json | 6 + 9 files changed, 231 insertions(+), 156 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt index 8bfa2db7e..5461798de 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt @@ -26,13 +26,5 @@ object ConfigModelConstant { const val MODEL_CONTENT_TYPE_TOSCA_JSON = "TOSCA_JSON" const val MODEL_CONTENT_TYPE_TEMPLATE = "TEMPLATE" - - const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic" - - const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact" - const val CAPABILITY_PROPERTY_MAPPING = "mapping" - - const val PROPERTY_RECIPE_NAMES = "action-names" - } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt index 9b6fbbf19..19f09432d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt @@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.data import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyOrder import com.fasterxml.jackson.databind.JsonNode import io.swagger.annotations.ApiModelProperty @@ -183,12 +184,14 @@ class AttributeDefinition { @get:JsonIgnore var id: String? = null var description: String? = null + var required: Boolean? = null lateinit var type: String @JsonProperty("default") var defaultValue: JsonNode? = null var status: String? = null + var constraints: MutableList? = null @JsonProperty("entry_schema") - var entrySchema: String? = null + var entrySchema: EntrySchema? = null } /* @@ -579,7 +582,8 @@ class ConditionClause { A TOSCA Service Template (YAML) document contains element definitions of building blocks for cloud application, or complete models of cloud applications. This section describes the top-level structural elements (TOSCA keynames) along with their grammars, which are allowed to appear in a TOSCA Service Template document. */ -class ServiceTemplate { +@JsonPropertyOrder(value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "topologyTemplate"]) +class ServiceTemplate : Cloneable { @get:JsonIgnore var id: String? = null @get:JsonProperty("tosca_definitions_version") @@ -600,6 +604,10 @@ class ServiceTemplate { var policyTypes: MutableMap? = null @get:JsonProperty("topology_template") var topologyTemplate: TopologyTemplate? = null + + override public fun clone(): ServiceTemplate { + return super.clone() as ServiceTemplate + } } class ToscaMetaData { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt index 84af3f988..bc1f4b437 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt @@ -36,6 +36,10 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { * Blueprint CBA extracted file location */ var rootPath = "." + /** + * Root Definition file path + */ + var entryDefinition = "" val imports: List? = serviceTemplate.imports diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt index f9ac87600..67ae39870 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -22,6 +22,8 @@ import kotlinx.coroutines.runBlocking import org.apache.commons.io.FileUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.apps.controllerblueprints.core.data.ImportDefinition +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext import java.io.File import java.io.FileFilter @@ -79,6 +81,46 @@ class BluePrintFileUtils { } } + fun populateDefaultImports(blueprintContext: BluePrintContext) { + // Get the Default Types + val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_ARTIFACT_TYPES, + BluePrintConstants.PATH_NODE_TYPES, BluePrintConstants.PATH_POLICY_TYPES) + + // Clean Type Imports + cleanImportTypes(blueprintContext.serviceTemplate) + + val imports = mutableListOf() + types.forEach { typeName -> + val import = ImportDefinition() + import.file = BluePrintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json") + imports.add(import) + } + + blueprintContext.serviceTemplate.imports = imports + } + + fun cleanImportTypes(serviceTemplate: ServiceTemplate) { + // Clean the Type imports + val toDeleteTypes = serviceTemplate.imports?.filter { + it.file.endsWith("_types.json") + } + + if (toDeleteTypes != null && toDeleteTypes.isNotEmpty()) { + serviceTemplate.imports?.removeAll(toDeleteTypes) + } + } + + fun writeEnhancedBluePrint(blueprintContext: BluePrintContext) { + + // Write Blueprint Types + writeBluePrintTypes(blueprintContext) + // Re Populate the Imports + populateDefaultImports(blueprintContext) + // Rewrite the Entry Definition Files + writeEntryDefinitionFile(blueprintContext) + + } + fun writeBluePrintTypes(blueprintContext: BluePrintContext) { val basePath = blueprintContext.rootPath @@ -110,10 +152,29 @@ class BluePrintFileUtils { } } + fun writeEntryDefinitionFile(blueprintContext: BluePrintContext) { + + val absoluteEntryDefinitionFile = blueprintContext.rootPath.plus(File.separator).plus(blueprintContext.entryDefinition) + + val serviceTemplate = blueprintContext.serviceTemplate + + // Clone the Service Template + val writeServiceTemplate = serviceTemplate.clone() + writeServiceTemplate.dataTypes = null + writeServiceTemplate.artifactTypes = null + writeServiceTemplate.policyTypes = null + writeServiceTemplate.nodeTypes = null + + // Write the Serivice Template + writeDefinitionFile(absoluteEntryDefinitionFile, JacksonUtils.getJson(writeServiceTemplate, true)) + } + fun writeDefinitionFile(definitionFile: String, content: String) = runBlocking { val definitionFile = File(definitionFile) + // Delete the File If exists + Files.deleteIfExists(definitionFile.toPath()) - Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE) + Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW) check(definitionFile.exists()) { throw BluePrintException("couldn't write definition file under path(${definitionFile.absolutePath})") } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt index 9dbe15ef1..5b5561f64 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt @@ -31,109 +31,114 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRun import java.io.File import java.nio.charset.Charset -object BluePrintMetadataUtils { - private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) +class BluePrintMetadataUtils { + companion object { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - @JvmStatic - fun toscaMetaData(basePath: String): ToscaMetaData { - val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus("TOSCA-Metadata/TOSCA.meta") - return toscaMetaDataFromMetaFile(toscaMetaPath) - } - @JvmStatic - fun toscaMetaDataFromMetaFile(metaFilePath: String): ToscaMetaData { - val toscaMetaData = ToscaMetaData() - val lines: MutableList = FileUtils.readLines(File(metaFilePath), Charset.defaultCharset()) - lines.forEach { line -> - if (line.contains(":")) { - val keyValue = line.split(":") - if (keyValue.size == 2) { - val value: String = keyValue[1].trim() - when (keyValue[0]) { - "TOSCA-Meta-File-Version" -> toscaMetaData.toscaMetaFileVersion = value - "CSAR-Version" -> toscaMetaData.csarVersion = value - "Created-By" -> toscaMetaData.createdBy = value - "Entry-Definitions" -> toscaMetaData.entityDefinitions = value - "Template-Tags" -> toscaMetaData.templateTags = value + fun toscaMetaData(basePath: String): ToscaMetaData { + val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) + return toscaMetaDataFromMetaFile(toscaMetaPath) + } + + fun entryDefinitionFile(basePath: String): String { + val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER) + .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) + return toscaMetaDataFromMetaFile(toscaMetaPath).entityDefinitions + } + + fun toscaMetaDataFromMetaFile(metaFilePath: String): ToscaMetaData { + val toscaMetaData = ToscaMetaData() + val lines: MutableList = FileUtils.readLines(File(metaFilePath), Charset.defaultCharset()) + lines.forEach { line -> + if (line.contains(":")) { + val keyValue = line.split(":") + if (keyValue.size == 2) { + val value: String = keyValue[1].trim() + when (keyValue[0]) { + "TOSCA-Meta-File-Version" -> toscaMetaData.toscaMetaFileVersion = value + "CSAR-Version" -> toscaMetaData.csarVersion = value + "Created-By" -> toscaMetaData.createdBy = value + "Entry-Definitions" -> toscaMetaData.entityDefinitions = value + "Template-Tags" -> toscaMetaData.templateTags = value + } } } - } + } + return toscaMetaData } - return toscaMetaData - } - @JvmStatic - fun getBluePrintRuntime(id: String, blueprintBasePath: String): BluePrintRuntimeService> { + fun getBluePrintRuntime(id: String, blueprintBasePath: String): BluePrintRuntimeService> { - val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) + val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) - val context: MutableMap = hashMapOf() - context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = blueprintBasePath.asJsonPrimitive() - context[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = id.asJsonPrimitive() + val context: MutableMap = hashMapOf() + context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = blueprintBasePath.asJsonPrimitive() + context[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = id.asJsonPrimitive() - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) - bluePrintRuntimeService.setExecutionContext(context) + val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + bluePrintRuntimeService.setExecutionContext(context) - return bluePrintRuntimeService - } + return bluePrintRuntimeService + } - @JvmStatic - fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String): BluePrintRuntimeService> { + fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String): BluePrintRuntimeService> { - val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath) - val context: MutableMap = hashMapOf() - context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = blueprintBasePath.asJsonPrimitive() - context[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = id.asJsonPrimitive() + val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath) + val context: MutableMap = hashMapOf() + context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = blueprintBasePath.asJsonPrimitive() + context[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = id.asJsonPrimitive() - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) - bluePrintRuntimeService.setExecutionContext(context) + val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + bluePrintRuntimeService.setExecutionContext(context) - return bluePrintRuntimeService - } + return bluePrintRuntimeService + } - @JvmStatic - fun getBluePrintRuntime(id: String, blueprintBasePath: String, executionContext: MutableMap): BluePrintRuntimeService> { - val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) - bluePrintRuntimeService.setExecutionContext(executionContext) - return bluePrintRuntimeService - } + fun getBluePrintRuntime(id: String, blueprintBasePath: String, executionContext: MutableMap): BluePrintRuntimeService> { + val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) + val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + bluePrintRuntimeService.setExecutionContext(executionContext) + return bluePrintRuntimeService + } - @JvmStatic - fun getBluePrintContext(blueprintBasePath: String): BluePrintContext { + fun getBluePrintContext(blueprintBasePath: String): BluePrintContext { - val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) + val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) - log.info("Processing blueprint base path ($blueprintBasePath) and entry definition file (${toscaMetaData.entityDefinitions})") + log.info("Reading blueprint path($blueprintBasePath) and entry definition file (${toscaMetaData.entityDefinitions})") - return readBlueprintFile(toscaMetaData.entityDefinitions, blueprintBasePath) - } + return readBlueprintFile(toscaMetaData.entityDefinitions, blueprintBasePath) + } - fun getBaseEnhancementBluePrintContext(blueprintBasePath: String): BluePrintContext { - val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) - // Clean Type files - BluePrintFileUtils.deleteBluePrintTypes(blueprintBasePath) - val rootFilePath: String = blueprintBasePath.plus(File.separator).plus(toscaMetaData.entityDefinitions) - val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) + private fun getBaseEnhancementBluePrintContext(blueprintBasePath: String): BluePrintContext { + val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) + // Clean Type files + BluePrintFileUtils.deleteBluePrintTypes(blueprintBasePath) + val rootFilePath: String = blueprintBasePath.plus(File.separator).plus(toscaMetaData.entityDefinitions) + val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) - // Clean the Import Definitions - rootServiceTemplate.imports?.clear() + // Clean the Import Definitions + BluePrintFileUtils.cleanImportTypes(rootServiceTemplate) - val blueprintContext = BluePrintContext(rootServiceTemplate) - blueprintContext.rootPath = blueprintBasePath - return blueprintContext - } + val blueprintContext = BluePrintContext(rootServiceTemplate) + blueprintContext.rootPath = blueprintBasePath + blueprintContext.entryDefinition = toscaMetaData.entityDefinitions + return blueprintContext + } - @JvmStatic - fun readBlueprintFile(entityDefinitions: String, basePath: String): BluePrintContext { - val rootFilePath: String = basePath.plus(File.separator).plus(entityDefinitions) - val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) - // Recursively Import Template files - val schemaImportResolverUtils = BluePrintImportService(rootServiceTemplate, basePath) - val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate() - val blueprintContext = BluePrintContext(completeServiceTemplate) - blueprintContext.rootPath = basePath - return blueprintContext + private fun readBlueprintFile(entityDefinitions: String, basePath: String): BluePrintContext { + val rootFilePath: String = basePath.plus(File.separator).plus(entityDefinitions) + val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) + // Recursively Import Template files + val schemaImportResolverUtils = BluePrintImportService(rootServiceTemplate, basePath) + val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate() + val blueprintContext = BluePrintContext(completeServiceTemplate) + blueprintContext.rootPath = basePath + blueprintContext.entryDefinition = entityDefinitions + return blueprintContext + } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 7330663c4..6a156ff16 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -37,9 +37,8 @@ "component-resource-assignment": { "description": "This is Resource Assignment Component API", "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "attributes": { + "assignment-params": { "required": true, "type": "string" } diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json new file mode 100644 index 000000000..557f6efce --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -0,0 +1,62 @@ +{ + "service-instance-id": { + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "updated-by": "Singal, Kapil ", + "property": { + "description": "To be provided", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf-id": { + "name": "vnf-id", + "tags": "vnf-id", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf-id", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf_name": { + "name": "vnf_name", + "tags": "vnf_name", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf_name", + "type": "string" + }, + "sources": { + "mdsal": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json deleted file mode 100644 index 557f6efce..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_dictionary_types.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "service-instance-id": { - "name": "service-instance-id", - "tags": "service-instance-id, tosca.datatypes.Root, data_type", - "updated-by": "Singal, Kapil ", - "property": { - "description": "To be provided", - "type": "string" - }, - "sources": { - "input": { - "type": "source-input", - "properties": {} - } - } - }, - "vnf-id": { - "name": "vnf-id", - "tags": "vnf-id", - "updated-by": "Singal, Kapil ", - "property": { - "description": "vnf-id", - "type": "string" - }, - "sources": { - "input": { - "type": "source-input", - "properties": {} - } - } - }, - "vnf_name": { - "name": "vnf_name", - "tags": "vnf_name", - "updated-by": "Singal, Kapil ", - "property": { - "description": "vnf_name", - "type": "string" - }, - "sources": { - "mdsal": { - "type": "source-rest", - "properties": { - "type": "JSON", - "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", - "path": "/param/0/value", - "input-key-mapping": { - "service-instance-id": "service-instance-id", - "vnf-id": "vnf-id" - }, - "output-key-mapping": { - "vnf_name": "value" - }, - "key-dependencies": [ - "service-instance-id", - "vnf-id" - ] - } - } - } - } -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json index 51d70ede9..38fc97d70 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json @@ -1,6 +1,12 @@ { "description": "This is Resource Assignment Component API", "version": "1.0.0", + "attributes": { + "assignment-params": { + "required": true, + "type": "string" + } + }, "capabilities": { "component-node": { "type": "tosca.capabilities.Node" -- cgit 1.2.3-korg From e84581567488cad47892c156996ae4464fd33373 Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Fri, 21 Dec 2018 10:31:48 -0500 Subject: Applied comments from review: Change 74622 - Draft Change-Id: I8ec37a628af98a332f568dc254e499dfdcf886ce Issue-ID: CCSDK-418 Signed-off-by: Steve Alphonse Siani --- .../core/utils/BluePrintFileUtils.kt | 46 +++++++++++++++++++++ .../test-blueprints/CBA_Zip_Test.zip | Bin 0 -> 5382 bytes 2 files changed, 46 insertions(+) mode change 100644 => 100755 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt create mode 100755 components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt old mode 100644 new mode 100755 index 67ae39870..2be9f19ca --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -20,6 +20,7 @@ import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import kotlinx.coroutines.runBlocking import org.apache.commons.io.FileUtils +import org.apache.commons.lang3.StringUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.data.ImportDefinition @@ -28,7 +29,16 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext import java.io.File import java.io.FileFilter import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths import java.nio.file.StandardOpenOption +import java.text.MessageFormat +import java.time.Instant +import java.time.temporal.ChronoUnit +import java.time.ZoneId +import java.time.format.DateTimeFormatter + + class BluePrintFileUtils { companion object { @@ -196,6 +206,42 @@ class BluePrintFileUtils { "\nEntry-Definitions: Definitions/.json" + "\nTemplate-Tags: " } + + fun getBluePrintFile(fileName: String, targetPath: Path) : File { + val filePath = targetPath.resolve(fileName).toString() + val file = File(filePath) + check(file.exists()) { + throw BluePrintException("couldn't get definition file under path(${file.absolutePath})") + } + return file + } + + fun getCBAGeneratedFileName(fileName: String, prefix: String): String { + val DATE_FORMAT = "yyyyMMddHHmmss" + val formatter = DateTimeFormatter.ofPattern(DATE_FORMAT) + val datePrefix = Instant.now().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter) + return MessageFormat.format(prefix, datePrefix, fileName) + } + + fun getCbaStorageDirectory(path: String): Path { + check(StringUtils.isNotBlank(path)) { + throw BluePrintException("CBA Path is missing.") + } + + val fileStorageLocation = Paths.get(path).toAbsolutePath().normalize() + + if (!Files.exists(fileStorageLocation)) + Files.createDirectories(fileStorageLocation) + + return fileStorageLocation + } + + fun stripFileExtension(fileName: String): String { + val dotIndexe = fileName.lastIndexOf('.') + + // In case dot is in first position, we are dealing with a hidden file rather than an extension + return if (dotIndexe > 0) fileName.substring(0, dotIndexe) else fileName + } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip b/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip new file mode 100755 index 000000000..77882ef14 Binary files /dev/null and b/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip differ -- cgit 1.2.3-korg From 07603763ab93f4ad57587430e96a3bd82b7eab80 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 7 Jan 2019 23:15:01 -0500 Subject: Add Java Capability resource assignment processor Change-Id: I21cea850d8fbe1c9f0a01fdc72f7147a2827ae03 Issue-ID: CCSDK-665 Signed-off-by: Muthuramalingam, Brinda Santh --- .../starter-type/node_type/source-capability.json | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-capability.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json new file mode 100644 index 000000000..241b69953 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json @@ -0,0 +1,49 @@ +{ + "description": "This is Component Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "default": "JAVA-COMPONENT", + "constraints": [ + { + "valid_values": [ + "JAVA-COMPONENT", + "JYTHON-COMPONENT" + ] + } + ] + }, + "instance-name": { + "description": "Capability component instance reference name.", + "required": true, + "type": "string" + }, + "input-key-mapping": { + "description": "Context name to input parameters name mapping.", + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "description": "Context name to output parameters name mapping.", + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "description": "Resource Resolution dependency dictionary names.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file -- cgit 1.2.3-korg From 07d02ef8e38763d753dbf412a59c0fa7a6fb80e3 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 8 Jan 2019 11:17:05 -0500 Subject: Add relationships type files load structure. Change-Id: I1be3ba493956674b476058094e05d681ce358711 Issue-ID: CCSDK-746 Signed-off-by: Muthuramalingam, Brinda Santh --- .../core/service/BluePrintExpressionService.kt | 22 ++--- .../core/service/BluePrintRuntimeService.kt | 38 ++++++--- .../core/service/PropertyAssignmentService.kt | 2 +- .../core/service/BluePrintRuntimeServiceTest.kt | 14 +++- .../Definitions/activation-blueprint.json | 51 +++++++++++ .../baseconfiguration/Definitions/node_types.json | 98 ++++++++++++++++++++++ .../node_type/component-netconf-executor.json | 44 ++-------- .../starter-type/node_type/vnf-netconf-device.json | 1 - .../tosca.relationships.ConnectsTo.json | 5 ++ .../tosca.relationships.DependsOn.json | 5 ++ 10 files changed, 214 insertions(+), 66 deletions(-) create mode 100644 components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json create mode 100644 components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt index 6a50680e6..8caec75fd 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt @@ -16,15 +16,15 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ArrayNode import com.fasterxml.jackson.databind.node.ObjectNode +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.apps.controllerblueprints.core.data.* -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager /** * @@ -34,12 +34,6 @@ import com.att.eelf.configuration.EELFManager object BluePrintExpressionService { val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - @JvmStatic - fun getExpressionData(propertyAssignment: Any): ExpressionData { - val propertyAssignmentNode: JsonNode = JacksonUtils.jsonNodeFromObject(propertyAssignment) - return getExpressionData(propertyAssignmentNode) - } - @JvmStatic fun getExpressionData(propertyAssignmentNode: JsonNode): ExpressionData { log.trace("Assignment Data/Expression : {}", propertyAssignmentNode) @@ -53,19 +47,19 @@ object BluePrintExpressionService { expressionData.expressionNode = propertyAssignmentNode when (expressionData.command) { - org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT -> { + BluePrintConstants.EXPRESSION_GET_INPUT -> { expressionData.inputExpression = populateInputExpression(propertyAssignmentNode) } - org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> { + BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> { expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode) } - org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY -> { + BluePrintConstants.EXPRESSION_GET_PROPERTY -> { expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode) } - org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { + BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode) } - org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT -> { + BluePrintConstants.EXPRESSION_GET_ARTIFACT -> { expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode) } } diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index 5540047c1..bd19ae47e 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -67,6 +67,12 @@ interface BluePrintRuntimeService { */ fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap + fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capability: String): MutableMap + + fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap + fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap @@ -193,17 +199,15 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName) - val propertyAssignments: MutableMap = - nodeTemplate.properties as MutableMap + val propertyAssignments: MutableMap = nodeTemplate.properties!! // Get the Node Type Definitions - val nodeTypeProperties: MutableMap = - bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!! + val nodeTypeProperties: MutableMap = bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!! // Iterate Node Type Properties nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty -> // Get the Express or Value for the Node Template - val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName] + val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName] var resolvedValue: JsonNode = NullNode.getInstance() if (propertyAssignment != null) { @@ -223,6 +227,18 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return propertyAssignmentValue } + override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String): + MutableMap { + log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " + + "($capabilityName)") + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap { + log.info("resolveNodeTemplateRequirementProperties for node template($nodeTemplateName) requirement ($requirementName)") + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap { log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " + @@ -230,8 +246,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val propertyAssignmentValue: MutableMap = hashMapOf() - val propertyAssignments: MutableMap = - bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap + val propertyAssignments: MutableMap = + bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) ?: hashMapOf() val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type @@ -245,7 +261,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl // Iterate Node Type Properties nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty -> // Get the Express or Value for the Node Template - val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName] + val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName] var resolvedValue: JsonNode = NullNode.getInstance() if (propertyAssignment != null) { @@ -275,8 +291,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val propertyAssignmentValue: MutableMap = hashMapOf() - val propertyAssignments: MutableMap = - bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap + val propertyAssignments: MutableMap = + bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) ?: hashMapOf() val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type @@ -289,7 +305,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty -> // Get the Express or Value for the Node Template - val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName] + val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName] var resolvedValue: JsonNode = NullNode.getInstance() if (propertyAssignment != null) { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt index 36c141f5e..17380fc0f 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt @@ -47,7 +47,7 @@ If Property Assignment is Expression. */ fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String, - assignment: Any): JsonNode { + assignment: JsonNode): JsonNode { val valueNode: JsonNode log.trace("Assignment ({})", assignment) val expressionData = BluePrintExpressionService.getExpressionData(assignment) diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 7ecf44b69..1dfb89a5d 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -55,6 +55,18 @@ class BluePrintRuntimeServiceTest { assertNotNull(propContext, "Failed to populate interface property values") } + @Test + fun testResolveNodeTemplateCapabilityProperties() { + log.info("************************ testResolveNodeTemplateRequirementProperties **********************") + //TODO + } + + @Test + fun testResolveNodeTemplateRequirementProperties() { + log.info("************************ testResolveNodeTemplateRequirementProperties **********************") + //TODO + } + @Test fun testResolveNodeTemplateInterfaceOperationInputs() { log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************") @@ -72,7 +84,7 @@ class BluePrintRuntimeServiceTest { assertNotNull(inContext, "Failed to populate interface input property values") assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name") - } + } @Test fun testResolveNodeTemplateInterfaceOperationOutputs() { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 7d3a17a68..6a446355f 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -205,6 +205,57 @@ "file": "Scripts/SamplePythonComponentNode.py" } } + }, + "activate-netconf": { + "type": "component-netconf-executor", + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "sample-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/SamplePythonComponentNode.py" + } + } + }, + "sample-netconf-device": { + "type": "vnf-netconf-device", + "capabilities": { + "netconf": { + "properties": { + "login-key": "sample-key", + "login-account": "sample-account", + "target-ip-address": "localhost", + "port-number": 830, + "connection-time-out": 30 + } + } + } } }, "workflows": { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 6a156ff16..f7970bfbd 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -29,11 +29,68 @@ "version": "1.0.0", "derived_from": "tosca.nodes.Root" }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "tosca.nodes.component.Jython": { "description": "This is Resource Assignment Jython Component API", "version": "1.0.0", "derived_from": "tosca.nodes.Root" }, + "component-netconf-executor": { + "description": "This is Netconf Transaction Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "vnf-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "description": "Instance Names to Inject to Jython Script.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + }, "component-resource-assignment": { "description": "This is Resource Assignment Component API", "version": "1.0.0", @@ -131,6 +188,47 @@ } }, "derived_from": "tosca.nodes.component.Jython" + }, + "vnf-netconf-device": { + "description": "This is VNF Device with Netconf Capability", + "version": "1.0.0", + "capabilities": { + "netconf": { + "type": "tosca.capabilities.Netconf", + "properties": { + "login-key": { + "required": true, + "type": "string", + "default": "sdnc" + }, + "login-account": { + "required": true, + "type": "string", + "default": "sdnc-tacacs" + }, + "source": { + "required": true, + "type": "string", + "default": "npm" + }, + "target-ip-address": { + "required": true, + "type": "string" + }, + "port-number": { + "required": true, + "type": "integer", + "default": 830 + }, + "connection-time-out": { + "required": false, + "type": "integer", + "default": 30 + } + } + } + }, + "derived_from": "tosca.nodes.Vnf" } } } \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 7e1d81343..b8ac762e5 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -18,45 +18,13 @@ "operations": { "process": { "inputs": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "instance-dependencies": { "required": true, - "type": "string" - }, - "template-name": { - "description": "Service Template Name", - "required": true, - "type": "string" - }, - "template-version": { - "description": "Service Template Version", - "required": true, - "type": "string" - }, - "action-name": { - "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-id": { - "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "reservation-id": { - "description": "Reservation Id used to send to NPM", - "required": false, - "type": "string" - }, - "execution-script": { - "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.", - "required": true, - "type": "string" + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json index 246f17706..c6f512dfb 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json +++ b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json @@ -38,5 +38,4 @@ } }, "derived_from": "tosca.nodes.Vnf" - } diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json new file mode 100644 index 000000000..4abb94832 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json @@ -0,0 +1,5 @@ +{ + "description": "Relationship tosca.relationships.ConnectsTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json new file mode 100644 index 000000000..89987ff51 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json @@ -0,0 +1,5 @@ +{ + "description": "Relationship tosca.relationships.DependsOn", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" +} \ No newline at end of file -- cgit 1.2.3-korg From cb46b4b6df0431ad32e80ec501feecb7037cd6f5 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 8 Jan 2019 20:59:31 -0500 Subject: Add relationships type enhancement logic. Change-Id: If8f072f49ccc74502052055bce0c90dd43ebd495 Issue-ID: CCSDK-920 Signed-off-by: Muthuramalingam, Brinda Santh --- .../core/BluePrintConstants.kt | 6 +- .../core/data/BluePrintModel.kt | 2 + .../core/service/BluePrintImportService.kt | 6 +- .../core/utils/BluePrintFileUtils.kt | 103 +++++++++------------ .../Definitions/activation-blueprint.json | 3 + .../Definitions/relationship_types.json | 9 ++ .../tosca.relationships.AttachesTo.json | 5 + .../tosca.relationships.HostedOn.json | 5 + .../tosca.relationships.RoutesTo.json | 5 + 9 files changed, 80 insertions(+), 64 deletions(-) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/relationship_types.json create mode 100644 components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.AttachesTo.json create mode 100644 components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.HostedOn.json create mode 100644 components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.RoutesTo.json (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index fd6a8db10..102e2ebd3 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -45,17 +45,13 @@ object BluePrintConstants { const val USER_SYSTEM: String = "System" - const val MODEL_CONTENT_TYPE_JSON: String = "JSON" - const val MODEL_CONTENT_TYPE_YAML: String = "YAML" - const val MODEL_CONTENT_TYPE_YANG: String = "YANG" - const val MODEL_CONTENT_TYPE_SCHEMA: String = "SCHEMA" - const val PATH_DIVIDER: String = "/" const val PATH_SERVICE_TEMPLATE: String = "service_template" const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template" const val PATH_METADATA: String = "metadata" const val PATH_NODE_TYPES: String = "node_types" const val PATH_POLICY_TYPES: String = "policy_types" + const val PATH_RELATIONSHIP_TYPES: String = "relationship_types" const val PATH_ARTIFACT_TYPES: String = "artifact_types" const val PATH_DATA_TYPES: String = "data_types" const val PATH_INPUTS: String = "inputs" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt index 19f09432d..9767b2e17 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt @@ -598,6 +598,8 @@ class ServiceTemplate : Cloneable { var artifactTypes: MutableMap? = null @get:JsonProperty("data_types") var dataTypes: MutableMap? = null + @get:JsonProperty("relationship_types") + var relationshipTypes: MutableMap? = null @get:JsonProperty("node_types") var nodeTypes: MutableMap? = null @get:JsonProperty("policy_types") diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt index fce06f3f5..26eb19de1 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt @@ -28,11 +28,13 @@ import java.net.URLDecoder import java.nio.charset.Charset class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) { + companion object { + private const val PARENT_SERVICE_TEMPLATE: String = "parent" + } private val log: Logger = LoggerFactory.getLogger(this::class.toString()) - val PARENT_SERVICE_TEMPLATE: String = "parent" - var importServiceTemplateMap: MutableMap = hashMapOf() + private var importServiceTemplateMap: MutableMap = hashMapOf() fun getImportResolvedServiceTemplate(): ServiceTemplate { diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt index 18896f51d..5a10e43f4 100755 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt @@ -33,12 +33,6 @@ import java.nio.file.Files import java.nio.file.Path import java.nio.file.Paths import java.nio.file.StandardOpenOption -import java.text.MessageFormat -import java.time.Instant -import java.time.temporal.ChronoUnit -import java.time.ZoneId -import java.time.format.DateTimeFormatter - class BluePrintFileUtils { @@ -56,8 +50,9 @@ class BluePrintFileUtils { val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR)) Files.createDirectories(metaDataDir.toPath()) - val metafile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)) - Files.write(metafile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW) + val metaFile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants + .TOSCA_METADATA_ENTRY_DEFINITION_FILE)) + Files.write(metaFile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW) val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)) Files.createDirectories(definitionsDir.toPath()) @@ -92,35 +87,6 @@ class BluePrintFileUtils { } } - fun populateDefaultImports(blueprintContext: BluePrintContext) { - // Get the Default Types - val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_ARTIFACT_TYPES, - BluePrintConstants.PATH_NODE_TYPES, BluePrintConstants.PATH_POLICY_TYPES) - - // Clean Type Imports - cleanImportTypes(blueprintContext.serviceTemplate) - - val imports = mutableListOf() - types.forEach { typeName -> - val import = ImportDefinition() - import.file = BluePrintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json") - imports.add(import) - } - - blueprintContext.serviceTemplate.imports = imports - } - - fun cleanImportTypes(serviceTemplate: ServiceTemplate) { - // Clean the Type imports - val toDeleteTypes = serviceTemplate.imports?.filter { - it.file.endsWith("_types.json") - } - - if (toDeleteTypes != null && toDeleteTypes.isNotEmpty()) { - serviceTemplate.imports?.removeAll(toDeleteTypes) - } - } - fun writeEnhancedBluePrint(blueprintContext: BluePrintContext) { // Write Blueprint Types @@ -147,6 +113,11 @@ class BluePrintFileUtils { writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) } + blueprintContext.serviceTemplate.relationshipTypes?.let { + val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_RELATIONSHIP_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_RELATIONSHIP_TYPES, nodeTypesContent) + } + blueprintContext.serviceTemplate.artifactTypes?.let { val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true) writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) @@ -163,7 +134,40 @@ class BluePrintFileUtils { } } - fun writeEntryDefinitionFile(blueprintContext: BluePrintContext) { + private fun populateDefaultImports(blueprintContext: BluePrintContext) { + // Get the Default Types + val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES, + BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES, + BluePrintConstants.PATH_POLICY_TYPES) + + // Clean Type Imports + cleanImportTypes(blueprintContext.serviceTemplate) + + val imports = mutableListOf() + types.forEach { typeName -> + val import = ImportDefinition() + import.file = BluePrintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json") + imports.add(import) + } + + blueprintContext.serviceTemplate.imports = imports + } + + fun cleanImportTypes(serviceTemplate: ServiceTemplate) { + // Clean the Type imports + val toDeleteTypes = serviceTemplate.imports?.filter { + it.file.endsWith("_types.json") + } + + if (toDeleteTypes != null && toDeleteTypes.isNotEmpty()) { + serviceTemplate.imports?.removeAll(toDeleteTypes) + } + } + + /** + * Re Generate the Blueprint Service Template Definition file based on BluePrint Context. + */ + private fun writeEntryDefinitionFile(blueprintContext: BluePrintContext) { val absoluteEntryDefinitionFile = blueprintContext.rootPath.plus(File.separator).plus(blueprintContext.entryDefinition) @@ -174,14 +178,15 @@ class BluePrintFileUtils { writeServiceTemplate.dataTypes = null writeServiceTemplate.artifactTypes = null writeServiceTemplate.policyTypes = null + writeServiceTemplate.relationshipTypes = null writeServiceTemplate.nodeTypes = null - // Write the Serivice Template + // Write the Service Template writeDefinitionFile(absoluteEntryDefinitionFile, JacksonUtils.getJson(writeServiceTemplate, true)) } - fun writeDefinitionFile(definitionFile: String, content: String) = runBlocking { - val definitionFile = File(definitionFile) + fun writeDefinitionFile(definitionFileName: String, content: String) = runBlocking { + val definitionFile = File(definitionFileName) // Delete the File If exists Files.deleteIfExists(definitionFile.toPath()) @@ -207,22 +212,6 @@ class BluePrintFileUtils { "\nEntry-Definitions: Definitions/.json" + "\nTemplate-Tags: " } - - fun getBluePrintFile(fileName: String, targetPath: Path) : File { - val filePath = targetPath.resolve(fileName).toString() - val file = File(filePath) - check(file.exists()) { - throw BluePrintException("couldn't get definition file under path(${file.absolutePath})") - } - return file - } - - fun getCBAGeneratedFileName(fileName: String, prefix: String): String { - val DATE_FORMAT = "yyyyMMddHHmmss" - val formatter = DateTimeFormatter.ofPattern(DATE_FORMAT) - val datePrefix = Instant.now().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter) - return MessageFormat.format(prefix, datePrefix, fileName) - } fun getCbaStorageDirectory(path: String): Path { check(StringUtils.isNotBlank(path)) { diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 6a446355f..a3bf546d6 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -11,6 +11,9 @@ { "file": "Definitions/data_types.json" }, + { + "file": "Definitions/relationship_types.json" + }, { "file": "Definitions/artifact_types.json" }, diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/relationship_types.json new file mode 100644 index 000000000..87d2dc586 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/relationship_types.json @@ -0,0 +1,9 @@ +{ + "relationship_types": { + "tosca.relationships.ConnectsTo": { + "description": "Relationship tosca.relationships.ConnectsTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.AttachesTo.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.AttachesTo.json new file mode 100644 index 000000000..bcfb65eee --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.AttachesTo.json @@ -0,0 +1,5 @@ +{ + "description": "Relationship tosca.relationships.AttachesTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.HostedOn.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.HostedOn.json new file mode 100644 index 000000000..a8337cd15 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.HostedOn.json @@ -0,0 +1,5 @@ +{ + "description": "Relationship tosca.relationships.HostedOn", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.RoutesTo.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.RoutesTo.json new file mode 100644 index 000000000..1da73cdea --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.RoutesTo.json @@ -0,0 +1,5 @@ +{ + "description": "Relationship tosca.relationships.RoutesTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" +} \ No newline at end of file -- cgit 1.2.3-korg From bf19a3a88eac9220051453180614edb4d146a134 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Thu, 10 Jan 2019 12:50:06 -0500 Subject: Resource Resoulution Service Implement Input Resource Resolution Processor Service along with Resource Resolution Utilities Change-Id: Ibb4899e415f4b79cd6cd1b190b0f4969b09c3fe4 Issue-ID: CCSDK-936 Signed-off-by: Singal, Kapil (ks220y) --- .../core/utils/JacksonUtils.kt | 364 ++++++++++----------- .../core/service/BluePrintRuntimeServiceTest.kt | 15 +- .../baseconfiguration/Definitions/data_types.json | 12 + .../resource/dict/ResourceDefinitionTest.java | 8 +- .../ResourceDefinitionValidationServiceTest.java | 2 +- .../utils/BulkResourceSequencingUtilsTest.java | 2 +- .../dict/utils/ResourceDictionaryUtilsTest.java | 2 +- 7 files changed, 193 insertions(+), 212 deletions(-) (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index 01874455a..58a820791 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.ccsdk.apps.controllerblueprints.core.utils import com.att.eelf.configuration.EELFLogger @@ -22,6 +21,9 @@ import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.ArrayNode +import com.fasterxml.jackson.databind.node.NullNode +import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import kotlinx.coroutines.Dispatchers @@ -40,241 +42,209 @@ import java.nio.charset.Charset * * @author Brinda Santh */ -object JacksonUtils { - private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - - inline fun readValue(content: String): T = - jacksonObjectMapper().readValue(content, T::class.java) +class JacksonUtils { + companion object { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + inline fun readValue(content: String): T = + jacksonObjectMapper().readValue(content, T::class.java) + + fun readValue(content: String, valueType: Class): T? { + return jacksonObjectMapper().readValue(content, valueType) + } - @JvmStatic - fun readValue(content: String, valueType: Class): T? { - return jacksonObjectMapper().readValue(content, valueType) - } + fun readValue(node: JsonNode, valueType: Class): T? { + return jacksonObjectMapper().treeToValue(node, valueType) + } - @JvmStatic - fun readValue(node: JsonNode, valueType: Class): T? { - return jacksonObjectMapper().treeToValue(node, valueType) - } + fun getContent(fileName: String): String = runBlocking { + async { + try { + File(fileName).readText(Charsets.UTF_8) + } catch (e: Exception) { + throw BluePrintException("couldn't get file ($fileName) content : ${e.message}") + } + }.await() + } - @JvmStatic - fun getContent(fileName: String): String = runBlocking { - async { - try { - File(fileName).readText(Charsets.UTF_8) - } catch (e: Exception) { - throw BluePrintException("couldn't get file ($fileName) content : ${e.message}") + fun getClassPathFileContent(fileName: String): String { + return runBlocking { + withContext(Dispatchers.Default) { + IOUtils.toString(JacksonUtils::class.java.classLoader + .getResourceAsStream(fileName), Charset.defaultCharset()) + } } - }.await() - } + } - @JvmStatic - fun getClassPathFileContent(fileName: String): String { - return runBlocking { - withContext(Dispatchers.Default) { - IOUtils.toString(JacksonUtils::class.java.classLoader - .getResourceAsStream(fileName), Charset.defaultCharset()) - } + fun readValueFromFile(fileName: String, valueType: Class): T? { + val content: String = getContent(fileName) + return readValue(content, valueType) } - } - @JvmStatic - fun readValueFromFile(fileName: String, valueType: Class): T? { - val content: String = getContent(fileName) - return readValue(content, valueType) - } + fun readValueFromClassPathFile(fileName: String, valueType: Class): T? { + val content: String = getClassPathFileContent(fileName) + return readValue(content, valueType) + } - @JvmStatic - fun readValueFromClassPathFile(fileName: String, valueType: Class): T? { - val content: String = getClassPathFileContent(fileName) - return readValue(content, valueType) - } + fun jsonNodeFromObject(from: kotlin.Any): JsonNode { + return jacksonObjectMapper().convertValue(from, JsonNode::class.java) + } - @JvmStatic - fun jsonNodeFromObject(from: kotlin.Any): JsonNode = jacksonObjectMapper().convertValue(from, JsonNode::class.java) + fun jsonNodeFromClassPathFile(fileName: String): JsonNode { + val content: String = getClassPathFileContent(fileName) + return jsonNode(content) + } - @JvmStatic - fun jsonNodeFromClassPathFile(fileName: String): JsonNode { - val content: String = getClassPathFileContent(fileName) - return jsonNode(content) - } + fun jsonNodeFromFile(fileName: String): JsonNode { + val content: String = getContent(fileName) + return jsonNode(content) + } - @JvmStatic - fun jsonNodeFromFile(fileName: String): JsonNode { - val content: String = getContent(fileName) - return jsonNode(content) - } + fun jsonNode(content: String): JsonNode { + return jacksonObjectMapper().readTree(content) + } - @JvmStatic - fun jsonNode(content: String): JsonNode { - return jacksonObjectMapper().readTree(content) - } + fun getJson(any: kotlin.Any): String { + return getJson(any, false) + } - @JvmStatic - fun getJson(any: kotlin.Any): String { - return getJson(any, false) - } + fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String { + val wrapperMap = hashMapOf() + wrapperMap[wrapper] = any + return getJson(wrapperMap, pretty) + } - @JvmStatic - fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String { - val wrapperMap = hashMapOf() - wrapperMap[wrapper] = any - return getJson(wrapperMap, pretty) - } + fun getJson(any: kotlin.Any, pretty: Boolean = false): String { + val objectMapper = jacksonObjectMapper() + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL) + if (pretty) { + objectMapper.enable(SerializationFeature.INDENT_OUTPUT) + } + return objectMapper.writeValueAsString(any) + } - @JvmStatic - fun getJson(any: kotlin.Any, pretty: Boolean = false): String { - val objectMapper = jacksonObjectMapper() - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL) - if (pretty) { - objectMapper.enable(SerializationFeature.INDENT_OUTPUT) + fun getJsonNode(any: kotlin.Any?, pretty: Boolean = false): JsonNode { + val objectMapper = jacksonObjectMapper() + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL) + if (pretty) { + objectMapper.enable(SerializationFeature.INDENT_OUTPUT) + } + return objectMapper.valueToTree(any) } - return objectMapper.writeValueAsString(any) - } - @JvmStatic - fun getListFromJsonNode(node: JsonNode, valueType: Class): List? { - return getListFromJson(node.toString(), valueType) - } + fun getListFromJsonNode(node: JsonNode, valueType: Class): List? { + return getListFromJson(node.toString(), valueType) + } - @JvmStatic - fun getListFromJson(content: String, valueType: Class): List? { - val objectMapper = jacksonObjectMapper() - val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType) - return objectMapper.readValue>(content, javaType) - } + fun getListFromJson(content: String, valueType: Class): List? { + val objectMapper = jacksonObjectMapper() + val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType) + return objectMapper.readValue>(content, javaType) + } - @JvmStatic - fun getListFromFile(fileName: String, valueType: Class): List? { - val content: String = getContent(fileName) - return getListFromJson(content, valueType) - } + fun getListFromFile(fileName: String, valueType: Class): List? { + val content: String = getContent(fileName) + return getListFromJson(content, valueType) + } - @JvmStatic - fun getListFromClassPathFile(fileName: String, valueType: Class): List? { - val content: String = getClassPathFileContent(fileName) - return getListFromJson(content, valueType) - } + fun getListFromClassPathFile(fileName: String, valueType: Class): List? { + val content: String = getClassPathFileContent(fileName) + return getListFromJson(content, valueType) + } - @JvmStatic - fun getMapFromJson(content: String, valueType: Class): MutableMap? { - val objectMapper = jacksonObjectMapper() - val typeRef = object : TypeReference>() {} - return objectMapper.readValue(content, typeRef) - } + fun getMapFromJson(content: String, valueType: Class): MutableMap? { + val objectMapper = jacksonObjectMapper() + val typeRef = object : TypeReference>() {} + return objectMapper.readValue(content, typeRef) + } - @JvmStatic - fun getMapFromFile(fileName: String, valueType: Class): MutableMap? { - val content: String = getContent(fileName) - return getMapFromJson(content, valueType) - } + fun getMapFromFile(fileName: String, valueType: Class): MutableMap? { + val content: String = getContent(fileName) + return getMapFromJson(content, valueType) + } - @JvmStatic - fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean { - if (BluePrintTypes.validPrimitiveTypes().contains(type)) { - return checkJsonNodeValueOfPrimitiveType(type, jsonNode) - } else if (BluePrintTypes.validCollectionTypes().contains(type)) { - return checkJsonNodeValueOfCollectionType(type, jsonNode) + fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean { + if (BluePrintTypes.validPrimitiveTypes().contains(type)) { + return checkJsonNodeValueOfPrimitiveType(type, jsonNode) + } else if (BluePrintTypes.validCollectionTypes().contains(type)) { + return checkJsonNodeValueOfCollectionType(type, jsonNode) + } + return false } - return false - } - @JvmStatic - fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean { - when (primitiveType) { - BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual - BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean - BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt - BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble - BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual - else -> return false + fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean { + when (primitiveType) { + BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual + BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean + BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt + BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble + BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual + else -> return false + } } - } - @JvmStatic - fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean { - when (type) { - BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray - BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode - else -> return false + fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean { + when (type) { + BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray + BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode + else -> return false + } } - } -/* - @JvmStatic - fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) { - objectNode.put(key, value as Boolean) - } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) { - objectNode.put(key, value as Int) - } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) { - objectNode.put(key, value as Float) - } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) { - objectNode.put(key, value as String) - } else { - objectNode.put(key, value as String) + fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) { + when (primitiveType) { + BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, value as Boolean) + BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, value as Int) + BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, value as Float) + BluePrintConstants.DATA_TYPE_TIMESTAMP -> objectNode.put(key, value as String) + else -> objectNode.put(key, value as String) + } } - } - @JvmStatic - fun populatePrimitiveValues(value: Any, primitiveType: String, objectNode: ArrayNode) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) { - objectNode.add(value as Boolean) - } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) { - objectNode.add(value as Int) - } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) { - objectNode.add(value as Float) - } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) { - objectNode.add(value as String) - } else { - objectNode.add(value as String) + fun populatePrimitiveValues(value: Any, primitiveType: String, arrayNode: ArrayNode) { + when (primitiveType) { + BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(value as Boolean) + BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(value as Int) + BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(value as Float) + BluePrintConstants.DATA_TYPE_TIMESTAMP -> arrayNode.add(value as String) + else -> arrayNode.add(value as String) + } } - } - @JvmStatic - fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) { - objectNode.put(key, false) - } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) { - objectNode.put(key, 0) - } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) { - objectNode.put(key, 0.0) - } else { - objectNode.put(key, "") + fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) { + when (primitiveType) { + BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, false) + BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, 0) + BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, 0.0) + else -> objectNode.put(key, "") + } } - } - @JvmStatic - fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) { - arrayNode.add(false) - } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) { - arrayNode.add(0) - } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) { - arrayNode.add(0.0) - } else { - arrayNode.add("") + fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) { + when (primitiveType) { + BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(false) + BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(0) + BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(0.0) + else -> arrayNode.add("") + } } - } - @JvmStatic - fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) { - if (nodeValue == null || nodeValue is NullNode) { - objectNode.set(key, nodeValue) - } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN == type) { - objectNode.put(key, nodeValue.asBoolean()) - } else if (BluePrintConstants.DATA_TYPE_INTEGER == type) { - objectNode.put(key, nodeValue.asInt()) - } else if (BluePrintConstants.DATA_TYPE_FLOAT == type) { - objectNode.put(key, nodeValue.floatValue()) - } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == type) { - objectNode.put(key, nodeValue.asText()) + fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) { + if (nodeValue == null || nodeValue is NullNode) { + objectNode.set(key, nodeValue) + } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) { + populatePrimitiveValues(key, nodeValue, type, objectNode) } else { - objectNode.put(key, nodeValue.asText()) + objectNode.set(key, nodeValue) + } + } + + fun convertPrimitiveResourceValue(type: String, value: String): JsonNode? { + when (type) { + BluePrintConstants.DATA_TYPE_BOOLEAN -> return JacksonUtils.getJsonNode(value as Boolean) + BluePrintConstants.DATA_TYPE_INTEGER -> return JacksonUtils.getJsonNode(value as Int) + BluePrintConstants.DATA_TYPE_FLOAT -> return JacksonUtils.getJsonNode(value as Float) + else -> return JacksonUtils.getJsonNode(value) } - } else { - objectNode.set(key, nodeValue) } } - */ } \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 1dfb89a5d..c01b14b31 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -26,8 +26,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromFile -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromObject +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -47,7 +46,7 @@ class BluePrintRuntimeServiceTest { val inputDataPath = "src/test/resources/data/default-context.json" - val inputNode: JsonNode = jsonNodeFromFile(inputDataPath) + val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath) bluePrintRuntimeService.assignInputs(inputNode) val propContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process") @@ -82,9 +81,9 @@ class BluePrintRuntimeServiceTest { "ResourceAssignmentComponent", "process") assertNotNull(inContext, "Failed to populate interface input property values") - assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") - assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name") - } + assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") + assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name") + } @Test fun testResolveNodeTemplateInterfaceOperationOutputs() { @@ -113,9 +112,9 @@ class BluePrintRuntimeServiceTest { val bluePrintRuntimeService = getBluePrintRuntimeService() bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1", - jsonNodeFromObject("context1-value")) + JacksonUtils.jsonNodeFromObject("context1-value")) bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2", - jsonNodeFromObject("context2-value")) + JacksonUtils.jsonNodeFromObject("context2-value")) val keys = listOf("context1", "context2") diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json index 7d850f200..6d771cd68 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -28,6 +28,14 @@ "required": true, "type": "string" }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "vnf-id": { + "required": true, + "type": "string" + }, "action-name": { "required": true, "type": "string" @@ -39,6 +47,10 @@ "hostname": { "required": true, "type": "string" + }, + "vnf_name": { + "required": true, + "type": "string" } }, "derived_from": "tosca.datatypes.Dynamic" diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java index fde800057..cb39200f3 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -31,7 +31,7 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionInputSource(){ String fileName = basePath + "/input-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition); } @@ -39,7 +39,7 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDefaultSource(){ String fileName = basePath + "/default-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition); } @@ -47,14 +47,14 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDBSource(){ String fileName = basePath + "/db-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition); } @Test public void testDictionaryDefinitionMDSALSource(){ String fileName = basePath + "/mdsal-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition); } } diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java index 2b68585fa..f5c3567fa 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java @@ -45,7 +45,7 @@ public class ResourceDefinitionValidationServiceTest { private void testValidate(String fileName) throws Exception { - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); ResourceDefinitionValidationService resourceDictionaryValidationService = diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java index c7444dbae..a2c2310be 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java @@ -30,7 +30,7 @@ public class BulkResourceSequencingUtilsTest { @Test public void testProcess(){ - List assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); + List assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments); BulkResourceSequencingUtils.process(assignments); } diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java index 13bf8195e..fa2413805 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java @@ -86,7 +86,7 @@ public class ResourceDictionaryUtilsTest { @Test public void testAssignInputs() { - JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json"); + JsonNode data = JacksonUtils.Companion.jsonNodeFromClassPathFile("data/resource-assignment-input.json"); Map context = new HashMap<>(); ResourceDictionaryUtils.assignInputs(data, context); String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue"); -- cgit 1.2.3-korg From 32e90cd22a5e2fb21ca369102dfa063f2db9e93f Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Fri, 11 Jan 2019 13:58:38 -0500 Subject: Resource Resolution Service : 2 Changes for Primary-DB Resource Resolution Processor Service Change-Id: Iaf6ad6277d36787d87881819ae530de1d7038a2e Issue-ID: CCSDK-942 Signed-off-by: Singal, Kapil (ks220y) --- .../core/BluePrintConstants.kt | 342 ++++++++++----------- .../resources/dictionary/dictionary_schema.json | 4 +- .../vFW/Definitions/vFW_spinup.json | 82 ++--- .../starter-dictionary/db-source.json | 24 -- .../starter-dictionary/nf-role.json | 4 +- .../starter-dictionary/nfc-naming-code.json | 4 +- .../starter-dictionary/onap_private_net_cidr.json | 4 +- .../starter-dictionary/primary-db-source.json | 24 ++ .../starter-dictionary/private-prefix-id.json | 4 +- .../starter-dictionary/protected-prefix-id.json | 4 +- .../protected_private_net_cidr.json | 4 +- .../starter-dictionary/sample-db-source.json | 24 -- .../sample-primary-db-source.json | 24 ++ .../starter-dictionary/unprotected-prefix-id.json | 4 +- .../unprotected_private_net_cidr.json | 4 +- .../starter-dictionary/vf-module-label.json | 4 +- .../starter-dictionary/vf-module-type.json | 4 +- .../starter-dictionary/vf-naming-policy.json | 4 +- .../starter-dictionary/vf-nf-code.json | 4 +- .../starter-dictionary/vfccustomizationuuid.json | 4 +- .../starter-dictionary/vm-type.json | 4 +- .../vnfc-model-invariant-uuid.json | 4 +- .../starter-dictionary/vnfc-model-version.json | 4 +- .../load/model_type/node_type/source-db.json | 44 --- .../model_type/node_type/source-primary-db.json | 44 +++ .../load/resource_dictionary/db-source.json | 24 -- .../load/resource_dictionary/nf-role.json | 4 +- .../load/resource_dictionary/nfc-naming-code.json | 4 +- .../resource_dictionary/onap_private_net_cidr.json | 4 +- .../resource_dictionary/primary-db-source.json | 24 ++ .../resource_dictionary/private-prefix-id.json | 4 +- .../resource_dictionary/protected-prefix-id.json | 4 +- .../protected_private_net_cidr.json | 4 +- .../resource_dictionary/unprotected-prefix-id.json | 4 +- .../unprotected_private_net_cidr.json | 4 +- .../load/resource_dictionary/vf-module-label.json | 4 +- .../load/resource_dictionary/vf-module-type.json | 4 +- .../load/resource_dictionary/vf-naming-policy.json | 4 +- .../load/resource_dictionary/vf-nf-code.json | 4 +- .../resource_dictionary/vfccustomizationuuid.json | 4 +- .../load/resource_dictionary/vm-type.json | 4 +- .../vnfc-model-invariant-uuid.json | 4 +- .../resource_dictionary/vnfc-model-version.json | 4 +- .../resource/dict/ResourceDictionaryConstants.kt | 2 +- .../resource/dict/utils/ResourceAssignmentUtils.kt | 156 ++++++++++ .../dict/utils/ResourceDictionaryTestUtils.kt | 30 -- .../resource/dict/ResourceDefinitionTest.java | 4 +- .../factory/ResourceSourceMappingFactoryTest.java | 6 +- .../ResourceDefinitionValidationServiceTest.java | 4 +- .../dict/utils/ResourceDictionaryTestUtils.kt | 30 ++ .../src/test/resources/validation/cyclic.json | 2 +- .../src/test/resources/validation/duplicate.json | 2 +- .../src/test/resources/validation/success.json | 2 +- 53 files changed, 591 insertions(+), 435 deletions(-) delete mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/db-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/primary-db-source.json delete mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json create mode 100644 components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json delete mode 100644 components/resource-dict/load/model_type/node_type/source-db.json create mode 100644 components/resource-dict/load/model_type/node_type/source-primary-db.json delete mode 100644 components/resource-dict/load/resource_dictionary/db-source.json create mode 100644 components/resource-dict/load/resource_dictionary/primary-db-source.json create mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt create mode 100644 components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt (limited to 'components/model-catalog') diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 102e2ebd3..4c2d6e2fc 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -1,172 +1,172 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core - -/** - * BluePrintConstants - * - * @author Brinda Santh - */ -object BluePrintConstants { - - const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID" - const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion" - const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion" - const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion" - - const val STATUS_SUCCESS: String = "success" - const val STATUS_FAILURE: String = "failure" - - const val TYPE_DEFAULT: String = "default" - - const val DATA_TYPE_STRING: String = "string" - const val DATA_TYPE_INTEGER: String = "integer" - const val DATA_TYPE_FLOAT: String = "float" - const val DATA_TYPE_BOOLEAN: String = "boolean" - const val DATA_TYPE_TIMESTAMP: String = "timestamp" - const val DATA_TYPE_NULL: String = "null" - const val DATA_TYPE_LIST: String = "list" - const val DATA_TYPE_MAP: String = "map" - - const val USER_SYSTEM: String = "System" - - const val PATH_DIVIDER: String = "/" - const val PATH_SERVICE_TEMPLATE: String = "service_template" - const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template" - const val PATH_METADATA: String = "metadata" - const val PATH_NODE_TYPES: String = "node_types" - const val PATH_POLICY_TYPES: String = "policy_types" - const val PATH_RELATIONSHIP_TYPES: String = "relationship_types" - const val PATH_ARTIFACT_TYPES: String = "artifact_types" - const val PATH_DATA_TYPES: String = "data_types" - const val PATH_INPUTS: String = "inputs" - const val PATH_NODE_WORKFLOWS: String = "workflows" - const val PATH_NODE_TEMPLATES: String = "node_templates" - const val PATH_CAPABILITIES: String = "capabilities" - const val PATH_REQUIREMENTS: String = "requirements" - const val PATH_INTERFACES: String = "interfaces" - const val PATH_OPERATIONS: String = "operations" - const val PATH_OUTPUTS: String = "outputs" - const val PATH_PROPERTIES: String = "properties" - const val PATH_ATTRIBUTES: String = "attributes" - const val PATH_ARTIFACTS: String = "artifacts" - - const val MODEL_DIR_MODEL_TYPE: String = "definition-type" - - const val MODEL_DEFINITION_TYPE_NODE_TYPE: String = "node_type" - const val MODEL_DEFINITION_TYPE_ARTIFACT_TYPE: String = "artifact_type" - const val MODEL_DEFINITION_TYPE_CAPABILITY_TYPE: String = "capability_type" - const val MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE: String = "relationship_type" - const val MODEL_DEFINITION_TYPE_DATA_TYPE: String = "data_type" - - const val MODEL_TYPE_DATATYPES_ROOT: String = "tosca.datatypes.Root" - const val MODEL_TYPE_NODES_ROOT: String = "tosca.nodes.Root" - const val MODEL_TYPE_GROUPS_ROOT: String = "tosca.groups.Root" - const val MODEL_TYPE_RELATIONSHIPS_ROOT: String = "tosca.relationships.Root" - const val MODEL_TYPE_ARTIFACTS_ROOT: String = "tosca.artifacts.Root" - const val MODEL_TYPE_CAPABILITIES_ROOT: String = "tosca.capabilities.Root" - const val MODEL_TYPE_INTERFACES_ROOT: String = "tosca.interfaces.Root" - - const val MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn" - const val MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn" - const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo" - const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo" - const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo" - - const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG" - const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component" - const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf" - @Deprecated("Artifacts will be attached to Node Template") - const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact" - const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource" - - const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java" - const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle" - const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script" - const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python" - const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython" - const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript" - - const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation" - - const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic" - - const val MODEL_TYPE_CAPABILITY_TYPE_NODE = "tosca.capabilities.Node" - const val MODEL_TYPE_CAPABILITY_TYPE_COMPUTE = "tosca.capabilities.Compute" - const val MODEL_TYPE_CAPABILITY_TYPE_NETWORK = "tosca.capabilities.Network" - const val MODEL_TYPE_CAPABILITY_TYPE_STORAGE = "tosca.capabilities.Storage" - const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT = "tosca.capabilities.Endpoint" - const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC = "tosca.capabilities.Endpoint.Public" - const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin" - const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE = "tosca.capabilities.Endpoint.Database" - const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment" - const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem" - const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable" - // Custom capabilities - const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content" - const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping" - const val MODEL_TYPE_CAPABILITY_TYPE_NETCONF = "tosca.capabilities.Netconf" - const val MODEL_TYPE_CAPABILITY_TYPE_SSH = "tosca.capabilities.Ssh" - const val MODEL_TYPE_CAPABILITY_TYPE_SFTP = "tosca.capabilities.Sftp" - - const val EXPRESSION_GET_INPUT: String = "get_input" - const val EXPRESSION_GET_ATTRIBUTE: String = "get_attribute" - const val EXPRESSION_GET_ARTIFACT: String = "get_artifact" - const val EXPRESSION_GET_PROPERTY: String = "get_property" - const val EXPRESSION_GET_OPERATION_OUTPUT: String = "get_operation_output" - const val EXPRESSION_GET_NODE_OF_TYPE: String = "get_nodes_of_type" - - const val PROPERTY_BLUEPRINT_PROCESS_ID: String = "blueprint-process-id" - const val PROPERTY_BLUEPRINT_BASE_PATH: String = "blueprint-basePath" - const val PROPERTY_BLUEPRINT_RUNTIME: String = "blueprint-runtime" - const val PROPERTY_BLUEPRINT_INPUTS_DATA: String = "blueprint-inputs-data" - const val PROPERTY_BLUEPRINT_CONTEXT: String = "blueprint-context" - const val PROPERTY_BLUEPRINT_NAME: String = "template_name" - const val PROPERTY_BLUEPRINT_VERSION: String = "template_version" - - const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata" - const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta" - const val TOSCA_DEFINITIONS_DIR: String = "Definitions" - const val TOSCA_PLANS_DIR: String = "Plans" - const val TOSCA_SCRIPTS_DIR: String = "Scripts" - const val TOSCA_MAPPINGS_DIR: String = "Mappings" - const val TOSCA_TEMPLATES_DIR: String = "Templates" - - const val METADATA_USER_GROUPS = "user-groups" - const val METADATA_TEMPLATE_NAME = "template_name" - const val METADATA_TEMPLATE_VERSION = "template_version" - const val METADATA_TEMPLATE_AUTHOR = "template_author" - const val METADATA_TEMPLATE_TAGS = "template_tags" - const val METADATA_WORKFLOW_NAME = "workflow_name" - - const val PAYLOAD_DATA = "payload-data" - const val PROPERTY_CURRENT_STEP = "current-step" - const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template" - const val PROPERTY_CURRENT_INTERFACE = "current-interface" - const val PROPERTY_CURRENT_OPERATION = "current-operation" - const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation" - const val PROPERTY_EXECUTION_REQUEST = "execution-request" - - const val OPERATION_PROCESS = "process" - const val OPERATION_PREPARE = "prepare" - - const val BLUEPRINT_RETRIEVE_TYPE_DB = "db" - const val BLUEPRINT_RETRIEVE_TYPE_FILE = "file" - const val BLUEPRINT_RETRIEVE_TYPE_REPO = "repo" - +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core + +/** + * BluePrintConstants + * + * @author Brinda Santh + */ +object BluePrintConstants { + + const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID" + const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion" + const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion" + const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion" + + const val STATUS_SUCCESS: String = "success" + const val STATUS_FAILURE: String = "failure" + + const val TYPE_DEFAULT: String = "default" + + const val DATA_TYPE_STRING: String = "string" + const val DATA_TYPE_INTEGER: String = "integer" + const val DATA_TYPE_FLOAT: String = "float" + const val DATA_TYPE_BOOLEAN: String = "boolean" + const val DATA_TYPE_TIMESTAMP: String = "timestamp" + const val DATA_TYPE_NULL: String = "null" + const val DATA_TYPE_LIST: String = "list" + const val DATA_TYPE_MAP: String = "map" + + const val USER_SYSTEM: String = "System" + + const val PATH_DIVIDER: String = "/" + const val PATH_SERVICE_TEMPLATE: String = "service_template" + const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template" + const val PATH_METADATA: String = "metadata" + const val PATH_NODE_TYPES: String = "node_types" + const val PATH_POLICY_TYPES: String = "policy_types" + const val PATH_RELATIONSHIP_TYPES: String = "relationship_types" + const val PATH_ARTIFACT_TYPES: String = "artifact_types" + const val PATH_DATA_TYPES: String = "data_types" + const val PATH_INPUTS: String = "inputs" + const val PATH_NODE_WORKFLOWS: String = "workflows" + const val PATH_NODE_TEMPLATES: String = "node_templates" + const val PATH_CAPABILITIES: String = "capabilities" + const val PATH_REQUIREMENTS: String = "requirements" + const val PATH_INTERFACES: String = "interfaces" + const val PATH_OPERATIONS: String = "operations" + const val PATH_OUTPUTS: String = "outputs" + const val PATH_PROPERTIES: String = "properties" + const val PATH_ATTRIBUTES: String = "attributes" + const val PATH_ARTIFACTS: String = "artifacts" + + const val MODEL_DIR_MODEL_TYPE: String = "definition-type" + + const val MODEL_DEFINITION_TYPE_NODE_TYPE: String = "node_type" + const val MODEL_DEFINITION_TYPE_ARTIFACT_TYPE: String = "artifact_type" + const val MODEL_DEFINITION_TYPE_CAPABILITY_TYPE: String = "capability_type" + const val MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE: String = "relationship_type" + const val MODEL_DEFINITION_TYPE_DATA_TYPE: String = "data_type" + + const val MODEL_TYPE_DATATYPES_ROOT: String = "tosca.datatypes.Root" + const val MODEL_TYPE_NODES_ROOT: String = "tosca.nodes.Root" + const val MODEL_TYPE_GROUPS_ROOT: String = "tosca.groups.Root" + const val MODEL_TYPE_RELATIONSHIPS_ROOT: String = "tosca.relationships.Root" + const val MODEL_TYPE_ARTIFACTS_ROOT: String = "tosca.artifacts.Root" + const val MODEL_TYPE_CAPABILITIES_ROOT: String = "tosca.capabilities.Root" + const val MODEL_TYPE_INTERFACES_ROOT: String = "tosca.interfaces.Root" + + const val MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn" + const val MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn" + const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo" + const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo" + const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo" + + const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG" + const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component" + const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf" + @Deprecated("Artifacts will be attached to Node Template") + const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact" + const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource" + + const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java" + const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle" + const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script" + const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python" + const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython" + const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript" + + const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation" + + const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic" + + const val MODEL_TYPE_CAPABILITY_TYPE_NODE = "tosca.capabilities.Node" + const val MODEL_TYPE_CAPABILITY_TYPE_COMPUTE = "tosca.capabilities.Compute" + const val MODEL_TYPE_CAPABILITY_TYPE_NETWORK = "tosca.capabilities.Network" + const val MODEL_TYPE_CAPABILITY_TYPE_STORAGE = "tosca.capabilities.Storage" + const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT = "tosca.capabilities.Endpoint" + const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC = "tosca.capabilities.Endpoint.Public" + const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin" + const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE = "tosca.capabilities.Endpoint.Database" + const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment" + const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem" + const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable" + // Custom capabilities + const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content" + const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping" + const val MODEL_TYPE_CAPABILITY_TYPE_NETCONF = "tosca.capabilities.Netconf" + const val MODEL_TYPE_CAPABILITY_TYPE_SSH = "tosca.capabilities.Ssh" + const val MODEL_TYPE_CAPABILITY_TYPE_SFTP = "tosca.capabilities.Sftp" + + const val EXPRESSION_GET_INPUT: String = "get_input" + const val EXPRESSION_GET_ATTRIBUTE: String = "get_attribute" + const val EXPRESSION_GET_ARTIFACT: String = "get_artifact" + const val EXPRESSION_GET_PROPERTY: String = "get_property" + const val EXPRESSION_GET_OPERATION_OUTPUT: String = "get_operation_output" + const val EXPRESSION_GET_NODE_OF_TYPE: String = "get_nodes_of_type" + + const val PROPERTY_BLUEPRINT_PROCESS_ID: String = "blueprint-process-id" + const val PROPERTY_BLUEPRINT_BASE_PATH: String = "blueprint-basePath" + const val PROPERTY_BLUEPRINT_RUNTIME: String = "blueprint-runtime" + const val PROPERTY_BLUEPRINT_INPUTS_DATA: String = "blueprint-inputs-data" + const val PROPERTY_BLUEPRINT_CONTEXT: String = "blueprint-context" + const val PROPERTY_BLUEPRINT_NAME: String = "template_name" + const val PROPERTY_BLUEPRINT_VERSION: String = "template_version" + + const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata" + const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta" + const val TOSCA_DEFINITIONS_DIR: String = "Definitions" + const val TOSCA_PLANS_DIR: String = "Plans" + const val TOSCA_SCRIPTS_DIR: String = "Scripts" + const val TOSCA_MAPPINGS_DIR: String = "Mappings" + const val TOSCA_TEMPLATES_DIR: String = "Templates" + + const val METADATA_USER_GROUPS = "user-groups" + const val METADATA_TEMPLATE_NAME = "template_name" + const val METADATA_TEMPLATE_VERSION = "template_version" + const val METADATA_TEMPLATE_AUTHOR = "template_author" + const val METADATA_TEMPLATE_TAGS = "template_tags" + const val METADATA_WORKFLOW_NAME = "workflow_name" + + const val PAYLOAD_DATA = "payload-data" + const val PROPERTY_CURRENT_STEP = "current-step" + const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template" + const val PROPERTY_CURRENT_INTERFACE = "current-interface" + const val PROPERTY_CURRENT_OPERATION = "current-operation" + const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation" + const val PROPERTY_EXECUTION_REQUEST = "execution-request" + + const val OPERATION_PROCESS = "process" + const val OPERATION_PREPARE = "prepare" + + const val BLUEPRINT_RETRIEVE_TYPE_DB = "db" + const val BLUEPRINT_RETRIEVE_TYPE_FILE = "file" + const val BLUEPRINT_RETRIEVE_TYPE_REPO = "repo" + } \ No newline at end of file diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json index d03170050..f9ef9eeed 100644 --- a/components/core/src/test/resources/dictionary/dictionary_schema.json +++ b/components/core/src/test/resources/dictionary/dictionary_schema.json @@ -104,7 +104,7 @@ } } }, - "db": { + "primary-db": { "type": "object", "properties": { "query": { @@ -210,7 +210,7 @@ } } }, - "db": { + "primary-db": { "type": "object", "properties": { "names": { diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json index 1137c1d58..13847bbb4 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json @@ -411,7 +411,7 @@ }, "input-param": false, "dictionary-name": "nf-role", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vnf-model-customization-uuid" ], @@ -531,7 +531,7 @@ }, "input-param": false, "dictionary-name": "protected-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -555,7 +555,7 @@ }, "input-param": false, "dictionary-name": "unprotected-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -579,7 +579,7 @@ }, "input-param": false, "dictionary-name": "vf-nf-code", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vnf-model-customization-uuid" ], @@ -740,7 +740,7 @@ }, "input-param": false, "dictionary-name": "vf-module-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -788,7 +788,7 @@ }, "input-param": false, "dictionary-name": "vfccustomizationuuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -836,7 +836,7 @@ }, "input-param": false, "dictionary-name": "vm-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -860,7 +860,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-invariant-uuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -884,7 +884,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-version", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -933,7 +933,7 @@ }, "input-param": false, "dictionary-name": "nfc-naming-code", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -1107,7 +1107,7 @@ }, "input-param": false, "dictionary-name": "unprotected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1131,7 +1131,7 @@ }, "input-param": false, "dictionary-name": "protected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1205,7 +1205,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1302,7 +1302,7 @@ }, "input-param": false, "dictionary-name": "vf-module-label", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -1326,7 +1326,7 @@ }, "input-param": false, "dictionary-name": "private-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1535,7 +1535,7 @@ }, "input-param": false, "dictionary-name": "vf-module-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -1583,7 +1583,7 @@ }, "input-param": false, "dictionary-name": "vfccustomizationuuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -1631,7 +1631,7 @@ }, "input-param": false, "dictionary-name": "vm-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1655,7 +1655,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-invariant-uuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -1679,7 +1679,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-version", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -1728,7 +1728,7 @@ }, "input-param": false, "dictionary-name": "nfc-naming-code", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -1902,7 +1902,7 @@ }, "input-param": false, "dictionary-name": "unprotected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -1926,7 +1926,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2148,7 +2148,7 @@ }, "input-param": false, "dictionary-name": "vf-module-label", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -2172,7 +2172,7 @@ }, "input-param": false, "dictionary-name": "private-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2357,7 +2357,7 @@ }, "input-param": false, "dictionary-name": "vf-module-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -2405,7 +2405,7 @@ }, "input-param": false, "dictionary-name": "vfccustomizationuuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -2453,7 +2453,7 @@ }, "input-param": false, "dictionary-name": "vm-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2477,7 +2477,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-invariant-uuid", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -2501,7 +2501,7 @@ }, "input-param": false, "dictionary-name": "vnfc-model-version", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -2550,7 +2550,7 @@ }, "input-param": false, "dictionary-name": "nfc-naming-code", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vfccustomizationuuid" ], @@ -2725,7 +2725,7 @@ }, "input-param": false, "dictionary-name": "unprotected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2749,7 +2749,7 @@ }, "input-param": false, "dictionary-name": "protected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2773,7 +2773,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -2946,7 +2946,7 @@ }, "input-param": false, "dictionary-name": "vf-module-label", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -2970,7 +2970,7 @@ }, "input-param": false, "dictionary-name": "private-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -3018,7 +3018,7 @@ }, "input-param": false, "dictionary-name": "protected-prefix-id", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -3082,7 +3082,7 @@ }, "input-param": false, "dictionary-name": "vf-module-type", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vf-module-model-customization-uuid" ], @@ -3226,7 +3226,7 @@ }, "input-param": false, "dictionary-name": "nf-role", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "vnf-model-customization-uuid" ], @@ -3275,7 +3275,7 @@ }, "input-param": false, "dictionary-name": "unprotected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], @@ -3299,7 +3299,7 @@ }, "input-param": false, "dictionary-name": "protected_private_net_cidr", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ ], diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json deleted file mode 100755 index de46524ce..000000000 --- a/components/model-catalog/resource-dictionary/starter-dictionary/db-source.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": "bundle-id, brindasanth@onap.com", - "sources": { - "db": { - "type": "source-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json b/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json index 819c7e602..6da5ea22f 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json b/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json index b82791877..4e1ba2b0a 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json index cee060153..42765ee94 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/primary-db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/primary-db-source.json new file mode 100644 index 000000000..26e62e85d --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/primary-db-source.json @@ -0,0 +1,24 @@ +{ + "name": "primary-db-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "bundle-id, brindasanth@onap.com", + "sources": { + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", + "input-key-mapping": { + "profile_name": "profile_name" + }, + "output-key-mapping": { + "db-country": "country", + "db-state": "state" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json index 5dea3e316..0685401d3 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json index fb572741c..f6120f3fd 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"protected\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json index 261920feb..bb477dcb6 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"protected\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json deleted file mode 100644 index 90775aee0..000000000 --- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "sample-db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": "db-source, brindasanth@onap.com", - "sources": { - "db": { - "type": "source-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json new file mode 100644 index 000000000..656841f2e --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json @@ -0,0 +1,24 @@ +{ + "name": "sample-db-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "primary-db-source, brindasanth@onap.com", + "sources": { + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", + "input-key-mapping": { + "profile_name": "profile_name" + }, + "output-key-mapping": { + "db-country": "country", + "db-state": "state" + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json index 3cb732056..c1fc541bd 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"unprotected\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json index d2a339e7c..604875500 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"unprotected\"", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json index ac5e21a6a..faa7ea49e 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json index 147425c33..dbd51bbd9 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json index f68cc3746..70792f86f 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json index 1865d47ff..a21982c0c 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json index 463f8480b..9f3e7cf17 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json b/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json index 0204c64bb..9744316c0 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json index c894fb531..3d89d9dd2 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json index 45eb07f79..d7fb50169 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/resource-dict/load/model_type/node_type/source-db.json b/components/resource-dict/load/model_type/node_type/source-db.json deleted file mode 100644 index 661a9503b..000000000 --- a/components/resource-dict/load/model_type/node_type/source-db.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "description": "This is Database Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": true, - "type": "string", - "constraints": [ - { - "valid_values": [ - "SQL", - "PLSQL" - ] - } - ] - }, - "query": { - "required": true, - "type": "string" - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/source-primary-db.json b/components/resource-dict/load/model_type/node_type/source-primary-db.json new file mode 100644 index 000000000..661a9503b --- /dev/null +++ b/components/resource-dict/load/model_type/node_type/source-primary-db.json @@ -0,0 +1,44 @@ +{ + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/db-source.json b/components/resource-dict/load/resource_dictionary/db-source.json deleted file mode 100644 index b96dc63f7..000000000 --- a/components/resource-dict/load/resource_dictionary/db-source.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": "bundle-id, brindasanth@onap.com", - "sources": { - "db": { - "type": "source-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/nf-role.json b/components/resource-dict/load/resource_dictionary/nf-role.json index 0e108c5cb..df6b5df4d 100644 --- a/components/resource-dict/load/resource_dictionary/nf-role.json +++ b/components/resource-dict/load/resource_dictionary/nf-role.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid", diff --git a/components/resource-dict/load/resource_dictionary/nfc-naming-code.json b/components/resource-dict/load/resource_dictionary/nfc-naming-code.json index f0f2b7f0f..7c521a7c0 100644 --- a/components/resource-dict/load/resource_dictionary/nfc-naming-code.json +++ b/components/resource-dict/load/resource_dictionary/nfc-naming-code.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json index 07c5cbc18..f2067a19c 100644 --- a/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json +++ b/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private", diff --git a/components/resource-dict/load/resource_dictionary/primary-db-source.json b/components/resource-dict/load/resource_dictionary/primary-db-source.json new file mode 100644 index 000000000..dfac66aee --- /dev/null +++ b/components/resource-dict/load/resource_dictionary/primary-db-source.json @@ -0,0 +1,24 @@ +{ + "name": "primary-db-source", + "property" :{ + "description": "name of the ", + "type": "string" + }, + "updated-by": "brindasanth@onap.com", + "tags": "bundle-id, brindasanth@onap.com", + "sources": { + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", + "input-key-mapping": { + "profile_name": "profile_name" + }, + "output-key-mapping": { + "db-country": "country", + "db-state": "state" + } + } + } + } +} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/private-prefix-id.json b/components/resource-dict/load/resource_dictionary/private-prefix-id.json index a95bae308..309647d79 100644 --- a/components/resource-dict/load/resource_dictionary/private-prefix-id.json +++ b/components/resource-dict/load/resource_dictionary/private-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private", diff --git a/components/resource-dict/load/resource_dictionary/protected-prefix-id.json b/components/resource-dict/load/resource_dictionary/protected-prefix-id.json index 56b0d6d21..816405b4e 100644 --- a/components/resource-dict/load/resource_dictionary/protected-prefix-id.json +++ b/components/resource-dict/load/resource_dictionary/protected-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected", diff --git a/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json index db0a43dc5..bf46fb3a6 100644 --- a/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json +++ b/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected", diff --git a/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json b/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json index a0d966a2c..8a09b1498 100644 --- a/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json +++ b/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected", diff --git a/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json index 8f9385d87..241147c3f 100644 --- a/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json +++ b/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected", diff --git a/components/resource-dict/load/resource_dictionary/vf-module-label.json b/components/resource-dict/load/resource_dictionary/vf-module-label.json index a9543722c..01355c201 100644 --- a/components/resource-dict/load/resource_dictionary/vf-module-label.json +++ b/components/resource-dict/load/resource_dictionary/vf-module-label.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", diff --git a/components/resource-dict/load/resource_dictionary/vf-module-type.json b/components/resource-dict/load/resource_dictionary/vf-module-type.json index 805d834b5..ead69d46a 100644 --- a/components/resource-dict/load/resource_dictionary/vf-module-type.json +++ b/components/resource-dict/load/resource_dictionary/vf-module-type.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid", diff --git a/components/resource-dict/load/resource_dictionary/vf-naming-policy.json b/components/resource-dict/load/resource_dictionary/vf-naming-policy.json index ceed3186c..cde861f8a 100644 --- a/components/resource-dict/load/resource_dictionary/vf-naming-policy.json +++ b/components/resource-dict/load/resource_dictionary/vf-naming-policy.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", diff --git a/components/resource-dict/load/resource_dictionary/vf-nf-code.json b/components/resource-dict/load/resource_dictionary/vf-nf-code.json index 0d25d0e94..adbd22af8 100644 --- a/components/resource-dict/load/resource_dictionary/vf-nf-code.json +++ b/components/resource-dict/load/resource_dictionary/vf-nf-code.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid", diff --git a/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json b/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json index a34a9a783..b3485791a 100644 --- a/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json +++ b/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid", diff --git a/components/resource-dict/load/resource_dictionary/vm-type.json b/components/resource-dict/load/resource_dictionary/vm-type.json index 7bb5ef1cc..e559f9b55 100644 --- a/components/resource-dict/load/resource_dictionary/vm-type.json +++ b/components/resource-dict/load/resource_dictionary/vm-type.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json b/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json index b2ccd45da..9eb94cffc 100644 --- a/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json +++ b/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/resource-dict/load/resource_dictionary/vnfc-model-version.json b/components/resource-dict/load/resource_dictionary/vnfc-model-version.json index fb59eea7f..e4e662291 100644 --- a/components/resource-dict/load/resource_dictionary/vnfc-model-version.json +++ b/components/resource-dict/load/resource_dictionary/vnfc-model-version.json @@ -7,8 +7,8 @@ "type" : "string" }, "sources" : { - "db" : { - "type" : "source-db", + "primary-db" : { + "type" : "source-primary-db", "properties" : { "type" : "SQL", "query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid", diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt index a39139edc..e4219c139 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt @@ -23,7 +23,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict object ResourceDictionaryConstants { const val SOURCE_INPUT = "input" const val SOURCE_DEFAULT = "default" - const val SOURCE_DB = "db" + const val SOURCE_DB = "primary-db" const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary" diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt new file mode 100644 index 000000000..a234a89ee --- /dev/null +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt @@ -0,0 +1,156 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils + +import java.util.Date +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.node.NullNode +import com.fasterxml.jackson.databind.node.ObjectNode +import org.onap.ccsdk.apps.controllerblueprints.core.* +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment + +class ResourceAssignmentUtils { + companion object { + + private val logger: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils::class.toString()) + + @Synchronized + @Throws(BluePrintProcessorException::class) + fun setResourceDataValue(resourceAssignment: ResourceAssignment, value: Any?) { + + val resourceProp = checkNotNull(resourceAssignment.property) { "Failed in setting resource value for resource mapping $resourceAssignment" } + checkNotEmptyNThrow(resourceAssignment.name, "Failed in setting resource value for resource mapping $resourceAssignment") + + if (checkNotEmpty(resourceAssignment.dictionaryName)) { + resourceAssignment.dictionaryName = resourceAssignment.name + logger.warn("Missing dictionary key, setting with template key (${resourceAssignment.name}) as dictionary key (${resourceAssignment.dictionaryName})") + } + + try { + if (checkNotEmpty(resourceProp.type)) { + val convertedValue = convertResourceValue(resourceProp.type, value) + logger.info("Setting Resource Value ($convertedValue) for Resource Name (${resourceAssignment.dictionaryName}) of type (${resourceProp.type})") + resourceProp.value = convertedValue + resourceAssignment.updatedDate = Date() + resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM + resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS + } + } catch (e: Exception) { + throw BluePrintProcessorException("Failed in setting value for template key (%s) and " + + "dictionary key (${resourceAssignment.name}) of type (${resourceProp.type}) with error message (${e.message})", e) + } + } + + private fun convertResourceValue(type: String, value: Any?): JsonNode? { + var convertedValue: JsonNode? + + if (value == null || value is NullNode) { + logger.info("Returning {} value from convertResourceValue", value) + return null + } else if (BluePrintTypes.validPrimitiveTypes().contains(type) && value is String) { + convertedValue = JacksonUtils.convertPrimitiveResourceValue(type, value) + } else { + // Case where Resource is non-primitive type + if (value is String) { + convertedValue = JacksonUtils.jsonNode(value) + } else { + convertedValue = JacksonUtils.getJsonNode(value) + } + } + return convertedValue + } + + @Synchronized + fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) { + if (checkNotEmpty(resourceAssignment.name)) { + resourceAssignment.updatedDate = Date() + resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM + resourceAssignment.status = BluePrintConstants.STATUS_FAILURE + resourceAssignment.message = message + } + } + + @Synchronized + @Throws(BluePrintProcessorException::class) + fun assertTemplateKeyValueNotNull(resourceAssignment: ResourceAssignment) { + val resourceProp = checkNotNull(resourceAssignment.property) { "Failed to populate mandatory resource resource mapping $resourceAssignment" } + if (resourceProp.required != null && resourceProp.required!! && (resourceProp.value == null || resourceProp.value !is NullNode)) { + logger.error("failed to populate mandatory resource mapping ($resourceAssignment)") + throw BluePrintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)") + } + } + + @Synchronized + @Throws(BluePrintProcessorException::class) + fun generateResourceDataForAssignments(assignments: List): String { + var result = "{}" + try { + val mapper = ObjectMapper() + val root = mapper.readTree(result) + + assignments.forEach { + if (checkNotEmpty(it.name) && it.property != null) { + + val type = it.property?.type + val value = it.property?.value + logger.info("Generating Resource name ({}), type ({}), value ({})", it.name, type, + value) + if (value == null) { + (root as ObjectNode).set(it.name, null) + } else if (value is JsonNode) { + (root as ObjectNode).put(it.name, value as JsonNode) + } else if (BluePrintConstants.DATA_TYPE_STRING.equals(type, ignoreCase = true)) { + (root as ObjectNode).put(it.name, value as String) + } else if (BluePrintConstants.DATA_TYPE_BOOLEAN.equals(type, ignoreCase = true)) { + (root as ObjectNode).put(it.name, value as Boolean) + } else if (BluePrintConstants.DATA_TYPE_INTEGER.equals(type, ignoreCase = true)) { + (root as ObjectNode).put(it.name, value as Int) + } else if (BluePrintConstants.DATA_TYPE_FLOAT.equals(type, ignoreCase = true)) { + (root as ObjectNode).put(it.name, value as Float) + } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP.equals(type, ignoreCase = true)) { + (root as ObjectNode).put(it.name, value as String) + } else { + val jsonNode = JacksonUtils.getJsonNode(value) + if (jsonNode != null) { + (root as ObjectNode).put(it.name, jsonNode) + } else { + (root as ObjectNode).set(it.name, null) + } + } + } + } + result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root) + logger.info("Generated Resource Param Data ({})", result) + } catch (e: Exception) { + throw BluePrintProcessorException("kapil is failing with $e.message", e) + } + + return result + } + + fun transformResourceSource(properties: MutableMap, classType: Class): T { + val content = JacksonUtils.getJson(properties) + return JacksonUtils.readValue(content, classType) + ?: throw BluePrintProcessorException("failed to transform content($content) to type($classType)") + } + + } +} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt deleted file mode 100644 index bebe27d8c..000000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils - -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory - -object ResourceDictionaryTestUtils { - - @JvmStatic - fun setUpResourceSourceMapping() { - ResourceSourceMappingFactory.registerSourceMapping("db", "source-db") - ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") - ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") - ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest") - } -} \ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java index cb39200f3..1ed306e21 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -46,9 +46,9 @@ public class ResourceDefinitionTest { @Test public void testDictionaryDefinitionDBSource(){ - String fileName = basePath + "/db-source.json"; + String fileName = basePath + "/primary-db-source.json"; ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition); + Assert.assertNotNull("Failed to populate dictionaryDefinition for primary-db type", resourceDefinition); } @Test diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java index b67aa7998..3f5aef43d 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java @@ -25,13 +25,13 @@ public class ResourceSourceMappingFactoryTest { @Test public void testRegisterResourceMapping() { - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db"); + ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest"); - String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("db"); - Assert.notNull(nodeTypeName, "Failed to get db mapping"); + String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db"); + Assert.notNull(nodeTypeName, "Failed to get primary-db mapping"); ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping(); Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping"); diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java index f5c3567fa..7f040b2e2 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java @@ -30,10 +30,10 @@ public class ResourceDefinitionValidationServiceTest { @Test public void testValidateSource() throws Exception { - String inputFileName = dictionaryPath + "/db-source.json"; + String inputFileName = dictionaryPath + "/input-source.json"; testValidate(inputFileName); - String dbFileName = dictionaryPath + "/db-source.json"; + String dbFileName = dictionaryPath + "/primary-db-source.json"; testValidate(dbFileName); String defaultFileName = dictionaryPath + "/default-source.json"; diff --git a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt new file mode 100644 index 000000000..50e5c3290 --- /dev/null +++ b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt @@ -0,0 +1,30 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils + +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory + +object ResourceDictionaryTestUtils { + + @JvmStatic + fun setUpResourceSourceMapping() { + ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db") + ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") + ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") + ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest") + } +} \ No newline at end of file diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json index d837dc5d8..7e6472f5a 100644 --- a/components/resource-dict/src/test/resources/validation/cyclic.json +++ b/components/resource-dict/src/test/resources/validation/cyclic.json @@ -102,7 +102,7 @@ "type": "string" }, "dictionary-name": "loopback-ip", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "bundle-mac", "managed-ip1" diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json index 330324cda..28ab71fca 100644 --- a/components/resource-dict/src/test/resources/validation/duplicate.json +++ b/components/resource-dict/src/test/resources/validation/duplicate.json @@ -102,7 +102,7 @@ "type": "string" }, "dictionary-name": "loopback-ip", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "bundle-mac" ] diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json index 3215d06d7..5d0e89805 100644 --- a/components/resource-dict/src/test/resources/validation/success.json +++ b/components/resource-dict/src/test/resources/validation/success.json @@ -102,7 +102,7 @@ "type": "string" }, "dictionary-name": "loopback-ip", - "dictionary-source": "db", + "dictionary-source": "primary-db", "dependencies": [ "bundle-mac" ] -- cgit 1.2.3-korg From a3450eb629c88e8fe7f2a0a2d9b241004fd45442 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 11 Jan 2019 11:30:40 -0500 Subject: Add blueprint Kotlin script support. Change-Id: I92b8e9850ea07c7f671e7aada9770713854534c3 Issue-ID: CCSDK-941 Signed-off-by: Muthuramalingam, Brinda Santh --- components/core/pom.xml | 5 ++ .../core/script/BluePrintScriptConfiguration.kt | 86 ++++++++++++++++++++ .../core/script/BluePrintScriptService.kt | 78 ++++++++++++++++++ .../core/script/BlueprintScriptingHost.kt | 93 ++++++++++++++++++++++ .../services/javax.script.ScriptEngineFactory | 17 ++++ .../core/script/BluePrintScriptServiceTest.kt | 49 ++++++++++++ .../core/utils/JacksonReactorUtilsTest.kt | 52 ------------ .../scripts/SampleBlueprintFunctionNode.kts | 44 ++++++++++ .../artifact_type/artifact-script-kotlin.json | 8 ++ .../starter-type/node_type/source-capability.json | 3 +- .../node_type/tosca.nodes.component.Kotlin.json | 5 ++ components/parent/pom.xml | 45 +++++++++-- 12 files changed, 427 insertions(+), 58 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt create mode 100644 components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt delete mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt create mode 100644 components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts create mode 100644 components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json (limited to 'components/model-catalog') diff --git a/components/core/pom.xml b/components/core/pom.xml index 84063fd57..f33146b6a 100644 --- a/components/core/pom.xml +++ b/components/core/pom.xml @@ -63,6 +63,11 @@ mockk test + + org.jetbrains.kotlinx + kotlinx-coroutines-test + test + diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt new file mode 100644 index 000000000..f7bfb857c --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt @@ -0,0 +1,86 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.script + +import org.jetbrains.kotlin.script.util.LocalFilesResolver +import java.io.File +import kotlin.script.dependencies.ScriptContents +import kotlin.script.dependencies.ScriptDependenciesResolver +import kotlin.script.experimental.annotations.KotlinScript +import kotlin.script.experimental.api.* +import kotlin.script.experimental.jvm.JvmDependency +import kotlin.script.experimental.jvm.dependenciesFromCurrentContext +import kotlin.script.experimental.jvm.jvm + + +@KotlinScript(fileExtension = "kts", + compilationConfiguration = ComponentScriptConfiguration::class) +abstract class ComponentScript { + +} + +object ComponentScriptConfiguration : ScriptCompilationConfiguration( + { + // defaultImports(DependsOn::class, Repository::class) + jvm { + dependenciesFromCurrentContext( + wholeClasspath = true + ) + } +// refineConfiguration { +// onAnnotations(DependsOn::class, Repository::class, handler = ::configureLocalFileDepsOnAnnotations) +// } + } +) + + +private val resolver = LocalFilesResolver() + +fun configureLocalFileDepsOnAnnotations(context: ScriptConfigurationRefinementContext): + ResultWithDiagnostics { + + val annotations = context.collectedData?.get(ScriptCollectedData.foundAnnotations)?.takeIf { it.isNotEmpty() } + ?: return context.compilationConfiguration.asSuccess() + + val scriptContents = object : ScriptContents { + override val annotations: Iterable = annotations + override val file: File? = null + override val text: CharSequence? = null + } + + val diagnostics = arrayListOf() + + fun report(severity: ScriptDependenciesResolver.ReportSeverity, message: String, position: ScriptContents.Position?) { + //TODO + } + + return try { + val newDepsFromResolver = resolver.resolve(scriptContents, emptyMap(), ::report, null).get() + ?: return context.compilationConfiguration.asSuccess(diagnostics) + + val resolvedClasspath = newDepsFromResolver.classpath.toList().takeIf { it.isNotEmpty() } + ?: return context.compilationConfiguration.asSuccess(diagnostics) + + ScriptCompilationConfiguration(context.compilationConfiguration) { + dependencies.append(JvmDependency(resolvedClasspath)) + + }.asSuccess(diagnostics) + + } catch (e: Throwable) { + ResultWithDiagnostics.Failure(*diagnostics.toTypedArray(), e.asDiagnostics()) + } +} \ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt new file mode 100644 index 000000000..8ae091511 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt @@ -0,0 +1,78 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.script + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import java.io.File +import java.io.InputStream +import java.io.Reader +import javax.script.ScriptEngineManager +import kotlin.script.experimental.api.ResultValue +import kotlin.script.experimental.api.ResultWithDiagnostics +import kotlin.script.experimental.api.resultOrNull +import kotlin.script.experimental.host.toScriptSource +import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate + + +open class BluePrintScriptService(classLoader: ClassLoader? = Thread.currentThread().contextClassLoader) { + + /** + * Get the Script Class instance + */ + inline fun scriptClassNewInstance(scriptFile: File, scriptClassName: String): T { + + val compilationConfiguration = createJvmCompilationConfigurationFromTemplate() + + val scriptEvaluator = BluePrintScriptEvaluator(scriptClassName) + + val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptFile.toScriptSource(), compilationConfiguration, + null) + + when (evalResponse) { + is ResultWithDiagnostics.Success -> { + val returnValue = evalResponse.resultOrNull()?.returnValue as ResultValue.Value + return returnValue.value.castOrError() + } + is ResultWithDiagnostics.Failure -> { + throw BluePrintProcessorException(evalResponse.reports.joinToString("\n")) + } + else -> { + throw BluePrintProcessorException("Failed to process script ${scriptFile.absolutePath}") + } + } + + } + + val engine = ScriptEngineManager(classLoader).getEngineByExtension("kts") + + inline fun safeEval(evaluation: () -> R?) = try { + evaluation() + } catch (e: Exception) { + throw BluePrintProcessorException("Cannot load script", e) + } + + inline fun Any?.castOrError() = takeIf { it is T }?.let { it as T } + ?: throw IllegalArgumentException("Cannot cast $this to expected type ${T::class}") + + inline fun load(script: String): T = safeEval { engine.eval(script) }.castOrError() + + inline fun load(reader: Reader): T = safeEval { engine.eval(reader) }.castOrError() + + inline fun load(inputStream: InputStream): T = load(inputStream.reader()) + + inline fun loadAll(vararg inputStream: InputStream): List = inputStream.map(::load) +} diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt new file mode 100644 index 000000000..bda20a444 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt @@ -0,0 +1,93 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.script + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.slf4j.LoggerFactory +import kotlin.script.experimental.api.* +import kotlin.script.experimental.host.BasicScriptingHost +import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration +import kotlin.script.experimental.jvmhost.JvmScriptCompiler + +val defaultBlueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration) + +open class BlueprintScriptingHost(evaluator: ScriptEvaluator +) : BasicScriptingHost(defaultBlueprintScriptCompiler, evaluator) { + + override fun eval( + script: SourceCode, + scriptCompilationConfiguration: ScriptCompilationConfiguration, + configuration: ScriptEvaluationConfiguration? + ): ResultWithDiagnostics = + + runInCoroutineContext { + + compiler(script, scriptCompilationConfiguration) + .onSuccess { + evaluator(it, configuration) + } + } +} + + +open class BluePrintScriptEvaluator(private val scriptClassName: String) : ScriptEvaluator { + + val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!! + + override suspend operator fun invoke( + compiledScript: CompiledScript<*>, + scriptEvaluationConfiguration: ScriptEvaluationConfiguration? + ): ResultWithDiagnostics = + try { + val res = compiledScript.getClass(scriptEvaluationConfiguration) + when (res) { + is ResultWithDiagnostics.Failure -> res + is ResultWithDiagnostics.Success -> { + val scriptClass = res.value + val args = ArrayList() + scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach { + args.add(it.value) + } + scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let { + args.addAll(it) + } + scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let { + args.addAll(it) + } + + val completeScriptClass = "Script\$$scriptClassName" + log.info("Searching for class type($completeScriptClass)") + /** + * Search for Class Name + */ + val instanceClass = scriptClass.java.classes + .single { it.name == completeScriptClass } + //.single { it.name == "Script\$SampleBlueprintsFunctionNode" } + + + val instance = instanceClass.newInstance() + ?: throw BluePrintProcessorException("failed to create instance from the script") + + ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(completeScriptClass, + instance, instance.javaClass.typeName), + scriptEvaluationConfiguration)) + } + } + } catch (e: Throwable) { + ResultWithDiagnostics.Failure(e.asDiagnostics("Error evaluating script")) + } +} \ No newline at end of file diff --git a/components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory new file mode 100644 index 000000000..89838f44f --- /dev/null +++ b/components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory @@ -0,0 +1,17 @@ +# +# Copyright © 2017-2018 AT&T Intellectual Property. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt new file mode 100644 index 000000000..5c5ad3ba1 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt @@ -0,0 +1,49 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.script + +import org.junit.Ignore +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode +import java.io.File +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +class BluePrintScriptServiceTest { + + @Test + fun `invoke script`() { + val scriptContent = "11 + 11" + val value = BluePrintScriptService() + .load(scriptContent) + assertEquals(22, value, "failed to execute command") + } + + @Test + @Ignore + fun `invoke script component node`() { + + //println(classpathFromClasspathProperty()?.joinToString("\n")) + + val scriptFile = File("src/test/resources/scripts/SampleBlueprintFunctionNode.kts") + + val functionNode = BluePrintScriptService() + .scriptClassNewInstance>(scriptFile, + "SampleBlueprintFunctionNode") + assertNotNull(functionNode, "failed to get instance from script") + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt deleted file mode 100644 index ad55c7761..000000000 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.core.utils - -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate -import kotlin.test.assertEquals -import kotlin.test.assertNotNull - -@Deprecated("Reactor will be replacecd by coroutines by default.") -class JacksonReactorUtilsTest { - private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) - @Test - fun testReadValues() { - - val serviceTemplate = JacksonReactorUtils.readValueFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json", - ServiceTemplate::class.java).block() - - assertNotNull(serviceTemplate, "Failed to simple transform Service Template") - assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance") - - val jsonContent = JacksonReactorUtils.getJson(serviceTemplate, true).block() - assertNotNull(jsonContent, "Failed to get json content") - - val jsonNode = JacksonReactorUtils.jsonNodeFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json") - .block() - assertNotNull(jsonContent, "Failed to get json Node") - } - - @Test(expected = BluePrintException::class) - fun testReadValuesFailure() { - JacksonReactorUtils.jsonNodeFromFile("load/blueprints/not-found.json") - .block() - } -} \ No newline at end of file diff --git a/components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts b/components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts new file mode 100644 index 000000000..44cc957d2 --- /dev/null +++ b/components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts @@ -0,0 +1,44 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode + +open class SampleBlueprintFunctionNode : BlueprintFunctionNode{ + + override fun getName(): String { + return "Kotlin-Script-Function-Node" + } + + override fun prepareRequest(executionRequest: String): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun process(executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun recover(runtimeException: RuntimeException, executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun prepareResponse(): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun apply(t: String): String { + return "$t-status" + } +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json new file mode 100644 index 000000000..cf19ac615 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json @@ -0,0 +1,8 @@ +{ + "description": "Kotlin Script file", + "version": "1.0.0", + "file_ext": [ + "kts" + ], + "derived_from": "tosca.artifacts.Implementation" +} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json index 241b69953..e4eb90e7b 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json @@ -5,10 +5,11 @@ "type": { "required": true, "type": "string", - "default": "JAVA-COMPONENT", + "default": "KOTLIN-COMPONENT", "constraints": [ { "valid_values": [ + "KOTLIN-COMPONENT", "JAVA-COMPONENT", "JYTHON-COMPONENT" ] diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json new file mode 100644 index 000000000..381ed59e2 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json @@ -0,0 +1,5 @@ +{ + "description": "This is Kotlin Component", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/components/parent/pom.xml b/components/parent/pom.xml index c9da403ca..8ecb2c1a2 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -31,13 +31,13 @@ 2.1.1.RELEASE 5.1.3.RELEASE - 1.3.10 - 1.3.10 - 1.0.1 - 1.16.1 + 1.3.11 + 1.3.11 + 1.1.0 + 1.17.1 3.6.1 1.0.0 - 26.0-jre + 27.0.1-jre 2.9.2 1.4.197 1.2.2 @@ -77,6 +77,7 @@ ${springfox.swagger2.version} + org.apache.commons commons-lang3 @@ -114,6 +115,26 @@ kotlin-stdlib ${kotlin.version} + + org.jetbrains.kotlin + kotlin-scripting-jvm-host + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-compiler-embeddable + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-script-util + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + org.jetbrains.kotlinx kotlinx-coroutines-core @@ -201,6 +222,12 @@ ${kotlin.version} test + + org.jetbrains.kotlinx + kotlinx-coroutines-test + ${kotlin.couroutines.version} + test + io.grpc grpc-testing @@ -255,6 +282,10 @@ org.jetbrains.kotlin kotlin-stdlib + + org.jetbrains.kotlin + kotlin-script-util + org.jetbrains.kotlin kotlin-stdlib-jdk8 @@ -271,6 +302,10 @@ com.fasterxml.jackson.module jackson-module-kotlin + + org.jetbrains.kotlin + kotlin-scripting-jvm-host + io.grpc -- cgit 1.2.3-korg From afa5c2df6c53dfce43c72c05457ec5a108ae0ed7 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Sun, 13 Jan 2019 16:49:32 -0500 Subject: Implement BluePrintManagementServiceGrpc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I66a6a3c23b5a3c24ce8d61178f00f053cb8bbbdc Issue-ID: CCSDK-909 Signed-off-by: Alexis de Talhouët --- .../api-definition/proto/BluePrintManagement.proto | 58 ++++++++-------------- 1 file changed, 20 insertions(+), 38 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/api-definition/proto/BluePrintManagement.proto b/components/model-catalog/api-definition/proto/BluePrintManagement.proto index 55f9466e4..dc0680d57 100644 --- a/components/model-catalog/api-definition/proto/BluePrintManagement.proto +++ b/components/model-catalog/api-definition/proto/BluePrintManagement.proto @@ -2,55 +2,37 @@ syntax = "proto3"; option java_multiple_files = true; package org.onap.ccsdk.apps.controllerblueprints.management.api; -message BluePrintUploadInput { - CommonHeader commonHeader = 1; - string blueprintName = 2; - string blueprintVersion = 3; - FileChunk fileChunk = 4; +message BluePrintManagementInput { + CommonHeader commonHeader = 1; + string blueprintName = 2; + string blueprintVersion = 3; + FileChunk fileChunk = 4; } -message FileChunk { - bytes chunk = 1; -} - -message BluePrintUploadOutput { - CommonHeader commonHeader = 1; - Status status = 3; -} - -message BluePrintRemoveInput { - CommonHeader commonHeader = 1; - string blueprintName = 2; - string blueprintVersion = 3; +message BluePrintManagementOutput { + CommonHeader commonHeader = 1; + Status status = 3; } -message BluePrintRemoveOutput { - CommonHeader commonHeader = 1; - Status status = 3; +message FileChunk { + bytes chunk = 1; } message CommonHeader { - string timestamp = 1; - string originatorId = 23; - string requestId = 3; - string subRequestId = 4; -} - -message ActionIdentifiers { - string blueprintName = 1; - string blueprintVersion = 2; - string actionName = 3; - string mode = 4; + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; } message Status { - string timestamp = 1; - int32 code = 2; - string message = 3; - string errorMessage = 4; + string timestamp = 1; + int32 code = 2; + string message = 3; + string errorMessage = 4; } service BluePrintManagementService { - rpc uploadBlueprint (BluePrintUploadInput) returns (BluePrintUploadOutput); - rpc removeBlueprint (BluePrintRemoveInput) returns (BluePrintRemoveOutput); + rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); + rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); } -- cgit 1.2.3-korg From 95553263e5ea110912e83c93e2b22b4796fe57c6 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 18 Jan 2019 14:29:38 -0500 Subject: Create module for .proto definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That way 3rd party system can depend on it to create a client Change-Id: I96e8588251eb0911a7dd7bee270954e966d9fc40 Issue-ID: CCSDK-947 Signed-off-by: Alexis de Talhouët --- .../api-definition/proto/BluePrintManagement.proto | 38 ---------- .../api-definition/proto/BluePrintProcessing.proto | 49 ------------- components/model-catalog/proto-definition/pom.xml | 81 ++++++++++++++++++++++ .../proto/BluePrintManagement.proto | 38 ++++++++++ .../proto/BluePrintProcessing.proto | 49 +++++++++++++ components/pom.xml | 4 +- 6 files changed, 171 insertions(+), 88 deletions(-) delete mode 100644 components/model-catalog/api-definition/proto/BluePrintManagement.proto delete mode 100644 components/model-catalog/api-definition/proto/BluePrintProcessing.proto create mode 100644 components/model-catalog/proto-definition/pom.xml create mode 100644 components/model-catalog/proto-definition/proto/BluePrintManagement.proto create mode 100644 components/model-catalog/proto-definition/proto/BluePrintProcessing.proto (limited to 'components/model-catalog') diff --git a/components/model-catalog/api-definition/proto/BluePrintManagement.proto b/components/model-catalog/api-definition/proto/BluePrintManagement.proto deleted file mode 100644 index dc0680d57..000000000 --- a/components/model-catalog/api-definition/proto/BluePrintManagement.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; -option java_multiple_files = true; -package org.onap.ccsdk.apps.controllerblueprints.management.api; - -message BluePrintManagementInput { - CommonHeader commonHeader = 1; - string blueprintName = 2; - string blueprintVersion = 3; - FileChunk fileChunk = 4; -} - -message BluePrintManagementOutput { - CommonHeader commonHeader = 1; - Status status = 3; -} - -message FileChunk { - bytes chunk = 1; -} - -message CommonHeader { - string timestamp = 1; - string originatorId = 23; - string requestId = 3; - string subRequestId = 4; -} - -message Status { - string timestamp = 1; - int32 code = 2; - string message = 3; - string errorMessage = 4; -} - -service BluePrintManagementService { - rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); - rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); -} diff --git a/components/model-catalog/api-definition/proto/BluePrintProcessing.proto b/components/model-catalog/api-definition/proto/BluePrintProcessing.proto deleted file mode 100644 index 8fa4a13fa..000000000 --- a/components/model-catalog/api-definition/proto/BluePrintProcessing.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/struct.proto"; -option java_multiple_files = true; -package org.onap.ccsdk.apps.controllerblueprints.processing.api; - -message ExecutionServiceInput { - CommonHeader commonHeader = 1; - ActionIdentifiers actionIdentifiers = 2; - google.protobuf.Struct payload = 3; -} - -message ExecutionServiceOutput { - CommonHeader commonHeader = 1; - ActionIdentifiers actionIdentifiers = 2; - Status status = 3; - google.protobuf.Struct payload = 4; -} - -message CommonHeader { - string timestamp = 1; - string originatorId = 23; - string requestId = 3; - string subRequestId = 4; - Flag flag = 5; -} - -message Flag { - bool isForce = 1; - int32 ttl = 2; -} - -message ActionIdentifiers { - string blueprintName = 1; - string blueprintVersion = 2; - string actionName = 3; - string mode = 4; -} - -message Status { - int32 code = 1; - string errorMessage = 2; - string message = 3; - string eventType = 4; - string timestamp = 5; -} - -service BluePrintProcessingService { - rpc process (ExecutionServiceInput) returns (stream ExecutionServiceOutput); -} diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml new file mode 100644 index 000000000..c1f77922c --- /dev/null +++ b/components/model-catalog/proto-definition/pom.xml @@ -0,0 +1,81 @@ + + + + 4.0.0 + + org.onap.ccsdk.apps.controllerblueprints + modules + 0.4.1-SNAPSHOT + + + proto-definition + jar + + Controller Blueprints Proto Definition + Controller Blueprints Proto Definition + + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + com.google.protobuf + protobuf-java-util + + + + + + + kr.motd.maven + os-maven-plugin + 1.6.1 + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.6.1 + + + com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} + + grpc-java + + io.grpc:protoc-gen-grpc-java:1.16.1:exe:${os.detected.classifier} + + proto + + + + + compile + compile-custom + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto new file mode 100644 index 000000000..dc0680d57 --- /dev/null +++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; +option java_multiple_files = true; +package org.onap.ccsdk.apps.controllerblueprints.management.api; + +message BluePrintManagementInput { + CommonHeader commonHeader = 1; + string blueprintName = 2; + string blueprintVersion = 3; + FileChunk fileChunk = 4; +} + +message BluePrintManagementOutput { + CommonHeader commonHeader = 1; + Status status = 3; +} + +message FileChunk { + bytes chunk = 1; +} + +message CommonHeader { + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; +} + +message Status { + string timestamp = 1; + int32 code = 2; + string message = 3; + string errorMessage = 4; +} + +service BluePrintManagementService { + rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); + rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); +} diff --git a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto new file mode 100644 index 000000000..8fa4a13fa --- /dev/null +++ b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +import "google/protobuf/struct.proto"; +option java_multiple_files = true; +package org.onap.ccsdk.apps.controllerblueprints.processing.api; + +message ExecutionServiceInput { + CommonHeader commonHeader = 1; + ActionIdentifiers actionIdentifiers = 2; + google.protobuf.Struct payload = 3; +} + +message ExecutionServiceOutput { + CommonHeader commonHeader = 1; + ActionIdentifiers actionIdentifiers = 2; + Status status = 3; + google.protobuf.Struct payload = 4; +} + +message CommonHeader { + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; + Flag flag = 5; +} + +message Flag { + bool isForce = 1; + int32 ttl = 2; +} + +message ActionIdentifiers { + string blueprintName = 1; + string blueprintVersion = 2; + string actionName = 3; + string mode = 4; +} + +message Status { + int32 code = 1; + string errorMessage = 2; + string message = 3; + string eventType = 4; + string timestamp = 5; +} + +service BluePrintProcessingService { + rpc process (ExecutionServiceInput) returns (stream ExecutionServiceOutput); +} diff --git a/components/pom.xml b/components/pom.xml index 5b8768cea..95ffd5c02 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -14,7 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + org.onap.ccsdk.apps ccsdk-apps @@ -37,5 +38,6 @@ parent core resource-dict + model-catalog/proto-definition -- cgit 1.2.3-korg From 148f823ff5a500aad6cc1456f0f70b1000ca6d57 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 18 Jan 2019 14:59:10 -0500 Subject: Make BluePrintProcessingService#process stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4aed859365a9c7251d8b29c0c68726d53b0f9d0f Issue-ID: CCSDK-662 Signed-off-by: Alexis de Talhouët --- .../model-catalog/proto-definition/proto/BluePrintProcessing.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto index 8fa4a13fa..d8ad571b6 100644 --- a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto +++ b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto @@ -45,5 +45,5 @@ message Status { } service BluePrintProcessingService { - rpc process (ExecutionServiceInput) returns (stream ExecutionServiceOutput); + rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput); } -- cgit 1.2.3-korg From 83b8b91a3648b585d3fd451f99aab90db5fe5fc9 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Sun, 20 Jan 2019 17:49:52 -0500 Subject: Resource Resolution Service: Source Rest Complex Data Processing for Primary-Config-Data DataSource Resource Resolution Service Change-Id: I62492b5c4e3c0b831f9027df5d42c6b80186debc Issue-ID: CCSDK-674 Signed-off-by: Singal, Kapil (ks220y) --- .../resources/dictionary/dictionary_schema.json | 4 +- .../vFW/Definitions/vFW_spinup.json | 46 +++++++++++----------- .../Definitions/baseconfig-mapping.json | 2 +- .../Definitions/resources_definition_types.json | 2 +- .../starter-dictionary/image_name.json | 2 +- .../starter-dictionary/key_name.json | 2 +- .../starter-dictionary/mdsal-source.json | 2 +- .../starter-dictionary/onap_private_net_id.json | 2 +- .../starter-dictionary/onap_private_subnet_id.json | 2 +- .../starter-dictionary/pub_key.json | 2 +- .../starter-dictionary/sample-licenses.json | 2 +- .../starter-dictionary/sample-mdsal-source.json | 2 +- .../starter-dictionary/vfw_private_ip_0.json | 2 +- .../starter-dictionary/vfw_private_ip_1.json | 2 +- .../starter-dictionary/vnf-name.json | 2 +- .../starter-dictionary/vnf_name.json | 2 +- .../starter-dictionary/vpg_private_ip_0.json | 2 +- .../starter-dictionary/vsn_private_ip_0.json | 2 +- .../load/resource_dictionary/mdsal-source.json | 2 +- .../load/resource_dictionary/vfw_private_ip_0.json | 2 +- .../load/resource_dictionary/vfw_private_ip_1.json | 2 +- .../load/resource_dictionary/vnf-name.json | 2 +- .../load/resource_dictionary/vnf_name.json | 2 +- .../load/resource_dictionary/vpg_private_ip_0.json | 2 +- .../load/resource_dictionary/vsn_private_ip_0.json | 2 +- .../resource/dict/ResourceDictionaryConstants.kt | 2 +- .../factory/ResourceSourceMappingFactoryTest.java | 2 +- .../dict/utils/ResourceDictionaryTestUtils.kt | 2 +- .../src/test/resources/validation/cyclic.json | 10 ++--- .../src/test/resources/validation/duplicate.json | 10 ++--- .../src/test/resources/validation/success.json | 10 ++--- 31 files changed, 66 insertions(+), 66 deletions(-) (limited to 'components/model-catalog') diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json index f9ef9eeed..51db5f51a 100644 --- a/components/core/src/test/resources/dictionary/dictionary_schema.json +++ b/components/core/src/test/resources/dictionary/dictionary_schema.json @@ -54,7 +54,7 @@ "aai": { "type": "any" }, - "mdsal": { + "primary-config-data": { "type": "object", "properties": { "path": { @@ -188,7 +188,7 @@ } } }, - "mdsal": { + "primary-config-data": { "type": "object", "properties": { "names": { diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json index 13847bbb4..4484d550e 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json @@ -667,7 +667,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -982,7 +982,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1007,7 +1007,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1032,7 +1032,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1057,7 +1057,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1082,7 +1082,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1462,7 +1462,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1777,7 +1777,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1802,7 +1802,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1827,7 +1827,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1852,7 +1852,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1877,7 +1877,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1950,7 +1950,7 @@ }, "input-param": false, "dictionary-name": "vfw_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1975,7 +1975,7 @@ }, "input-param": false, "dictionary-name": "vsn_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2050,7 +2050,7 @@ }, "input-param": false, "dictionary-name": "vpg_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2284,7 +2284,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2574,7 +2574,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2625,7 +2625,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2650,7 +2650,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2675,7 +2675,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2700,7 +2700,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2848,7 +2848,7 @@ }, "input-param": false, "dictionary-name": "vfw_private_ip_1", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -3250,7 +3250,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json index c457086cf..67d2a914e 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -27,7 +27,7 @@ "type": "string" }, "dictionary-name": "vnf_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json index 557f6efce..c88712146 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -38,7 +38,7 @@ "type": "string" }, "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json index 37ef5ae19..57a0ef391 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json index 1f1b3e65c..6eb8d929b 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json index 300a71f1f..67661ecd0 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json @@ -7,7 +7,7 @@ }, "updated-by": "brindasanth@onap.com", "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json index bb70fe3c4..3dd74f7d4 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json index d38ceb49c..6cb22c3d6 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json index ce6c2f2a3..fe172cafd 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json index 5834dd49b..c0f78ac55 100644 --- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json @@ -11,7 +11,7 @@ }, "updated-by": "brindasanth@onap.com", "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json index 25464d3fe..75d7ca050 100644 --- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json @@ -7,7 +7,7 @@ }, "updated-by": "brindasanth@onap.com", "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json index 71a4df2c4..4c227f91f 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json index 481edae8c..0df08c000 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json index 89b3dc1c0..4c0320aca 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json index c55f1c18a..e9d8a3b48 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json index 13d89993b..586aa0c9c 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json index fcd6d8d55..1fe479717 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json index b38986a4b..fa72e5dc2 100644 --- a/components/resource-dict/load/resource_dictionary/mdsal-source.json +++ b/components/resource-dict/load/resource_dictionary/mdsal-source.json @@ -7,7 +7,7 @@ }, "updated-by": "brindasanth@onap.com", "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json index 7c8d4f4e8..59f51516d 100644 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vfw_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json index 0553b8c37..6dda72f7c 100644 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json +++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json @@ -13,7 +13,7 @@ "key" : "vfw_private_ip_1" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vnf-name.json b/components/resource-dict/load/resource_dictionary/vnf-name.json index 47371d184..708030ee1 100644 --- a/components/resource-dict/load/resource_dictionary/vnf-name.json +++ b/components/resource-dict/load/resource_dictionary/vnf-name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vnf_name.json b/components/resource-dict/load/resource_dictionary/vnf_name.json index 4617a264e..3164367c6 100644 --- a/components/resource-dict/load/resource_dictionary/vnf_name.json +++ b/components/resource-dict/load/resource_dictionary/vnf_name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json index 912cfb9ad..9bef3c791 100644 --- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vpg_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json index bf987382c..52a4542c5 100644 --- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vsn_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt index 0004b02f5..aa06c9da0 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt @@ -24,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict object ResourceDictionaryConstants { const val SOURCE_INPUT = "input" const val SOURCE_DEFAULT = "default" - const val SOURCE_MDSAL = "mdsal" + const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data" const val SOURCE_PRIMARY_DB = "primary-db" const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary" diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java index 3f5aef43d..f11638e35 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java @@ -28,7 +28,7 @@ public class ResourceSourceMappingFactoryTest { ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest"); + ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest"); String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db"); Assert.notNull(nodeTypeName, "Failed to get primary-db mapping"); diff --git a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt index 50e5c3290..74ef6d6de 100644 --- a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt +++ b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt @@ -25,6 +25,6 @@ object ResourceDictionaryTestUtils { ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db") ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") - ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest") + ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest") } } \ No newline at end of file diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json index 7e6472f5a..98cd14446 100644 --- a/components/resource-dict/src/test/resources/validation/cyclic.json +++ b/components/resource-dict/src/test/resources/validation/cyclic.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "managed-ip", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json index 28ab71fca..7581ff64d 100644 --- a/components/resource-dict/src/test/resources/validation/duplicate.json +++ b/components/resource-dict/src/test/resources/validation/duplicate.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json index 5d0e89805..486251d60 100644 --- a/components/resource-dict/src/test/resources/validation/success.json +++ b/components/resource-dict/src/test/resources/validation/success.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "managed-ip", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "loopback-ip" ] -- cgit 1.2.3-korg From 2bb2e0fa50480e833de6eeeb6244217cb23a8f5f Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 21 Jan 2019 08:35:36 -0500 Subject: Map proto to pojo. implement blueprint processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I16b06b4700a42d4a7066eb8c0779677fa28cd94b Issue-ID: CCSDK-951 Signed-off-by: Alexis de Talhouët --- .../proto-definition/proto/BluePrintCommon.proto | 31 +++++++++++++++ .../proto/BluePrintManagement.proto | 21 ++-------- .../proto/BluePrintProcessing.proto | 45 +++++----------------- 3 files changed, 45 insertions(+), 52 deletions(-) create mode 100644 components/model-catalog/proto-definition/proto/BluePrintCommon.proto (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/proto/BluePrintCommon.proto b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto new file mode 100644 index 000000000..0f17783aa --- /dev/null +++ b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +option java_multiple_files = true; +package org.onap.ccsdk.apps.controllerblueprints.common.api; + +message CommonHeader { + string timestamp = 1; + string originatorId = 23; + string requestId = 3; + string subRequestId = 4; + Flag flag = 5; +} + +message Flag { + bool isForce = 1; + int32 ttl = 2; +} + +message ActionIdentifiers { + string blueprintName = 1; + string blueprintVersion = 2; + string actionName = 3; + string mode = 4; +} + +message Status { + int32 code = 1; + string errorMessage = 2; + string message = 3; + string eventType = 4; + string timestamp = 5; +} \ No newline at end of file diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto index dc0680d57..658cbbbdc 100644 --- a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto +++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto @@ -1,37 +1,24 @@ syntax = "proto3"; +import "BluePrintCommon.proto"; option java_multiple_files = true; package org.onap.ccsdk.apps.controllerblueprints.management.api; message BluePrintManagementInput { - CommonHeader commonHeader = 1; + org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1; string blueprintName = 2; string blueprintVersion = 3; FileChunk fileChunk = 4; } message BluePrintManagementOutput { - CommonHeader commonHeader = 1; - Status status = 3; + org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1; + org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3; } message FileChunk { bytes chunk = 1; } -message CommonHeader { - string timestamp = 1; - string originatorId = 23; - string requestId = 3; - string subRequestId = 4; -} - -message Status { - string timestamp = 1; - int32 code = 2; - string message = 3; - string errorMessage = 4; -} - service BluePrintManagementService { rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput); diff --git a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto index d8ad571b6..5b91f46b7 100644 --- a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto +++ b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto @@ -1,49 +1,24 @@ syntax = "proto3"; import "google/protobuf/struct.proto"; +import "BluePrintCommon.proto"; option java_multiple_files = true; package org.onap.ccsdk.apps.controllerblueprints.processing.api; + message ExecutionServiceInput { - CommonHeader commonHeader = 1; - ActionIdentifiers actionIdentifiers = 2; - google.protobuf.Struct payload = 3; + org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1; + org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2; + google.protobuf.Struct payload = 3; } message ExecutionServiceOutput { - CommonHeader commonHeader = 1; - ActionIdentifiers actionIdentifiers = 2; - Status status = 3; - google.protobuf.Struct payload = 4; -} - -message CommonHeader { - string timestamp = 1; - string originatorId = 23; - string requestId = 3; - string subRequestId = 4; - Flag flag = 5; -} - -message Flag { - bool isForce = 1; - int32 ttl = 2; -} - -message ActionIdentifiers { - string blueprintName = 1; - string blueprintVersion = 2; - string actionName = 3; - string mode = 4; + org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1; + org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2; + org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3; + google.protobuf.Struct payload = 4; } -message Status { - int32 code = 1; - string errorMessage = 2; - string message = 3; - string eventType = 4; - string timestamp = 5; -} service BluePrintProcessingService { - rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput); + rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput); } -- cgit 1.2.3-korg From c5da036e9c92280f0f3c722f98e7cc17c857284c Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Wed, 23 Jan 2019 11:42:13 -0500 Subject: GRPC 1.18.0 Upgrade. Change-Id: I1f7f75e14d284641d86c5ef91723b00aaab9bed7 Issue-ID: CCSDK-998 Signed-off-by: Muthuramalingam, Brinda Santh --- .../apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt | 4 ++-- components/model-catalog/proto-definition/pom.xml | 7 ++++--- components/parent/pom.xml | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'components/model-catalog') diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt index 143c4a848..59a037199 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt @@ -27,7 +27,7 @@ class BluePrintFileUtilsTest { @Test fun testNewBlueprint() = runBlocking { - val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-new-test") + val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test") BluePrintFileUtils.createEmptyBluePrint(targetPath) } @@ -36,7 +36,7 @@ class BluePrintFileUtilsTest { fun testBlueprintCopy() = runBlocking { val sourcePath: String = "./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration" - val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-copy-test") + val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-copy-test") val targetDir = File(targetPath) targetDir.deleteOnExit() diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml index c1f77922c..f76dd5f1a 100644 --- a/components/model-catalog/proto-definition/pom.xml +++ b/components/model-catalog/proto-definition/pom.xml @@ -1,7 +1,8 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml deleted file mode 100644 index eb41b7dfa..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml deleted file mode 100644 index a197877f5..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts deleted file mode 100644 index f1da61407..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.* -import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive - -open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() { - - lateinit var resourceAssignment: ResourceAssignment - - override fun getName(): String { - return "resource-assignment-processor-custom-capability" - } - - override fun process(resourceAssignment: ResourceAssignment) { - this.resourceAssignment = resourceAssignment - } - - override fun prepareResponse(): ResourceAssignment { - return resourceAssignment - } - - override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - TODO("To Implement") - } - -} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts deleted file mode 100644 index 184c49335..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode - -open class SampleKotlinComponent : BlueprintFunctionNode { - - override fun getName(): String { - return "my Name" - } - - override fun prepareRequest(executionRequest: String): String { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun process(executionRequest: String) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun recover(runtimeException: RuntimeException, executionRequest: String) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun prepareResponse(): String { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun apply(t: String): String { - return "Successfully Executed Scripts" - } -} diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py deleted file mode 100644 index 4db7c731b..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py +++ /dev/null @@ -1,50 +0,0 @@ -import netconf_constant -from netconfclient import NetconfClient -from java.lang import Exception -from abstract_blueprint_function import AbstractPythonComponentFunction -from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService -from org.onap.ccsdk.apps.controllerblueprints.core.utils import JacksonUtils -from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces import DeviceInfo -from org.onap.ccsdk.apps.controllerblueprints.core.service import BluePrintRuntimeService - - -class DefaultGetNetConfig(AbstractPythonComponentFunction): - def process(self, execution_request): - try: - log = globals()[netconf_constant.SERVICE_LOG] - print(globals()) - #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] - requestId = '1234' - - bluePrintRuntimeService = globals()['bluePrintRuntimeService'] - - capabilityProperty = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device","netconf") - - log.info("capabilityProperty {}",capabilityProperty) - netconfService = NetconfRpcService() - nc = NetconfClient(log, netconfService) - - nc.connect(netconfService.getNetconfDeviceInfo(capabilityProperty)) - runningConfigTemplate = "runningconfig-template" - - runningConfigMessageId = "get-config-" + requestId - - deviceResponse = nc.getConfig(messageId=runningConfigMessageId, - filter=runningConfigTemplate) - - log.info("Get Running Config Response {} ", deviceResponse.responseMessage) - if(deviceResponse !='null') : - status = deviceResponse.status - responseData = "{}" - if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): - errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage - - except Exception, err: - log.info("Exception in the script {}",err.getMessage()) - status = netconf_constant.STATUS_FAILURE - errorMessage = "Get Running Config Failure ::"+err.getMessage() - - def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None - diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py deleted file mode 100644 index 0a583dc57..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py +++ /dev/null @@ -1,12 +0,0 @@ -from abstract_blueprint_function import AbstractPythonComponentFunction -from blueprint_constants import * - -class SamplePythonComponentNode(AbstractPythonComponentFunction): - - def process(self, execution_request): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None - - def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/__init__.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/python/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 9066e4845..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Brinda Santh M -Entry-Definitions: Definitions/activation-blueprint.json -Template-Tags: Brinda Santh, activation-blueprint - -Name: Plans/ActivateProcess.bpmn -Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl deleted file mode 100644 index 026c59176..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Templates/baseconfig-template.vtl +++ /dev/null @@ -1 +0,0 @@ -This is Sample Velocity Template \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip b/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip new file mode 100755 index 000000000..77882ef14 Binary files /dev/null and b/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip differ diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json new file mode 100644 index 000000000..822cc68b7 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -0,0 +1,336 @@ +{ + "metadata": { + "template_author": "Brinda Santh Muthuramalingam", + "author-email": "brindasanth@in.ibm.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "baseconfiguration", + "template_version": "1.0.0", + "template_tags": "brinda, tosca" + }, + "imports": [ + { + "file": "Definitions/data_types.json" + }, + { + "file": "Definitions/relationship_types.json" + }, + { + "file": "Definitions/artifact_types.json" + }, + { + "file": "Definitions/node_types.json" + }, + { + "file": "Definitions/policy_types.json" + } + ], + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "resource-assignment-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-resource-assignment-process" + ] + }, + "dependency-node-templates": [ + "resource-assignment" + ] + }, + "artifacts": { + "dg-resource-assignment-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_ResourceAssignment_1.0.0.xml" + } + } + }, + "activate-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-activate-process" + ] + }, + "dependency-node-templates": [ + "activate-jython" + ] + }, + "artifacts": { + "dg-activate-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_ActivateNetconf_1.0.0.xml" + } + } + }, + "assign-activate-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-assign-activate-process" + ] + }, + "dependency-node-templates": [ + "resource-assignment", + "activate-jython" + ] + }, + "artifacts": { + "dg-assign-activate-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_AssignActivateNetconf_1.0.0.xml" + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "get_input": "action-name" + }, + "resource-type": "vnf-type", + "request-id": { + "get_input": "request-id" + }, + "resource-id": { + "get_input": "hostname" + }, + "artifact-prefix-names": [ + "baseconfig" + ] + }, + "outputs": { + "resource-assignment-params": { + "get_attribute": [ + "SELF", + "assignment-params" + ] + }, + "status": "success" + } + } + } + } + }, + "artifacts": { + "baseconfig-template": { + "type": "artifact-template-velocity", + "file": "Templates/baseconfig-template.vtl" + }, + "baseconfig-mapping": { + "type": "artifact-mapping-resource", + "file": "Definitions/baseconfig-mapping.json" + } + } + }, + "resource-assignment-py": { + "type": "component-resource-assignment", + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "action-name": { + "get_input": "action-name" + } + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/SamplePythonComponentNode.py" + } + } + }, + "activate-jython": { + "type": "component-jython-executor", + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/SamplePythonComponentNode.py" + } + } + }, + "activate-netconf": { + "type": "component-netconf-executor", + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "sample-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/DefaultGetNetConfig.py" + } + } + }, + "sample-netconf-device": { + "type": "vnf-netconf-device", + "capabilities": { + "netconf": { + "properties": { + "login-key": "sample-key", + "login-account": "sample-account", + "target-ip-address": "localhost", + "port-number": 830, + "connection-time-out": 30 + } + } + } + } + }, + "workflows": { + "resource-assignment": { + "inputs": { + "resource-assignment-properties": { + "required": true, + "type": "dt-resource-assignment-properties" + } + }, + "steps": { + "call-resource-assignment": { + "description": "Resource Assignment Workflow", + "target": "resource-assignment-process", + "activities": [ + { + "call_operation": "CONFIG.ResourceAssignment" + } + ] + } + } + }, + "activate": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "steps": { + "activate-process": { + "description": "Netconf Activation Workflow", + "target": "activate-process", + "activities": [ + { + "call_operation": "CONFIG.ActivateProcess" + } + ] + } + } + }, + "assign-activate": { + "inputs": { + "assign-activate-properties": { + "required": true, + "type": "dt-assign-activate-properties" + } + }, + "steps": { + "activate-process": { + "description": "Resource Assign and Netconf Activation Workflow", + "target": "assign-activate-process", + "activities": [ + { + "call_operation": "CONFIG.AssignActivateProcess" + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json new file mode 100644 index 000000000..d741d151e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json @@ -0,0 +1,45 @@ +{ + "artifact_types": { + "artifact-template-velocity": { + "description": "Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": "Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-jython": { + "description": "Jython Script File", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-directed-graph": { + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json new file mode 100644 index 000000000..67d2a914e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -0,0 +1,36 @@ +[ + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + ] + }, + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "vnf_name", + "input-param": false, + "property": { + "type": "string" + }, + "dictionary-name": "vnf_name", + "dictionary-source": "primary-config-data", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json new file mode 100644 index 000000000..6d771cd68 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json @@ -0,0 +1,82 @@ +{ + "data_types": { + "sample-property": { + "description": "This is sample data type", + "version": "1.0.0", + "properties": { + "content": { + "required": false, + "type": "string" + }, + "process-name": { + "required": false, + "type": "string" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "dt-resource-assignment-properties": { + "description": "This is Dynamically generated data type for workflow activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "vnf-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + }, + "vnf_name": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, + "dt-assign-activate-properties": { + "description": "This is Dynamically generated data type for workflow assign-activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json new file mode 100644 index 000000000..f7970bfbd --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -0,0 +1,234 @@ +{ + "node_types": { + "dg-generic": { + "description": "This is Generic Directed Graph Type", + "version": "1.0.0", + "properties": { + "content": { + "required": true, + "type": "string" + }, + "dependency-node-templates": { + "required": true, + "description": "Dependent Step Components", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.component.Jython": { + "description": "This is Resource Assignment Jython Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-netconf-executor": { + "description": "This is Netconf Transaction Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "vnf-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "description": "Instance Names to Inject to Jython Script.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "attributes": { + "assignment-params": { + "required": true, + "type": "string" + } + }, + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-jython-executor": { + "description": "This is Jython Execution Component.", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "required": true, + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + }, + "vnf-netconf-device": { + "description": "This is VNF Device with Netconf Capability", + "version": "1.0.0", + "capabilities": { + "netconf": { + "type": "tosca.capabilities.Netconf", + "properties": { + "login-key": { + "required": true, + "type": "string", + "default": "sdnc" + }, + "login-account": { + "required": true, + "type": "string", + "default": "sdnc-tacacs" + }, + "source": { + "required": true, + "type": "string", + "default": "npm" + }, + "target-ip-address": { + "required": true, + "type": "string" + }, + "port-number": { + "required": true, + "type": "integer", + "default": 830 + }, + "connection-time-out": { + "required": false, + "type": "integer", + "default": 30 + } + } + } + }, + "derived_from": "tosca.nodes.Vnf" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json new file mode 100644 index 000000000..0c9b99252 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json @@ -0,0 +1,4 @@ +{ + "policy_types": { + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json new file mode 100644 index 000000000..87d2dc586 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json @@ -0,0 +1,9 @@ +{ + "relationship_types": { + "tosca.relationships.ConnectsTo": { + "description": "Relationship tosca.relationships.ConnectsTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json new file mode 100644 index 000000000..c88712146 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -0,0 +1,62 @@ +{ + "service-instance-id": { + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "updated-by": "Singal, Kapil ", + "property": { + "description": "To be provided", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf-id": { + "name": "vnf-id", + "tags": "vnf-id", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf-id", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf_name": { + "name": "vnf_name", + "tags": "vnf_name", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf_name", + "type": "string" + }, + "sources": { + "primary-config-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn new file mode 100644 index 000000000..89ae342f8 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_0l0dq58 + + + SequenceFlow_1ay0k6p + + + + + + + + + + SequenceFlow_0l0dq58 + SequenceFlow_1ay0k6p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml new file mode 100644 index 000000000..2f6d2eda8 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml new file mode 100644 index 000000000..eb41b7dfa --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml new file mode 100644 index 000000000..a197877f5 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts new file mode 100644 index 000000000..f1da61407 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts @@ -0,0 +1,44 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.* +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive + +open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() { + + lateinit var resourceAssignment: ResourceAssignment + + override fun getName(): String { + return "resource-assignment-processor-custom-capability" + } + + override fun process(resourceAssignment: ResourceAssignment) { + this.resourceAssignment = resourceAssignment + } + + override fun prepareResponse(): ResourceAssignment { + return resourceAssignment + } + + override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + TODO("To Implement") + } + +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts new file mode 100644 index 000000000..184c49335 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts @@ -0,0 +1,46 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode + +open class SampleKotlinComponent : BlueprintFunctionNode { + + override fun getName(): String { + return "my Name" + } + + override fun prepareRequest(executionRequest: String): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun process(executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun recover(runtimeException: RuntimeException, executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun prepareResponse(): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun apply(t: String): String { + return "Successfully Executed Scripts" + } +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py new file mode 100644 index 000000000..4db7c731b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py @@ -0,0 +1,50 @@ +import netconf_constant +from netconfclient import NetconfClient +from java.lang import Exception +from abstract_blueprint_function import AbstractPythonComponentFunction +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService +from org.onap.ccsdk.apps.controllerblueprints.core.utils import JacksonUtils +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces import DeviceInfo +from org.onap.ccsdk.apps.controllerblueprints.core.service import BluePrintRuntimeService + + +class DefaultGetNetConfig(AbstractPythonComponentFunction): + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] + requestId = '1234' + + bluePrintRuntimeService = globals()['bluePrintRuntimeService'] + + capabilityProperty = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device","netconf") + + log.info("capabilityProperty {}",capabilityProperty) + netconfService = NetconfRpcService() + nc = NetconfClient(log, netconfService) + + nc.connect(netconfService.getNetconfDeviceInfo(capabilityProperty)) + runningConfigTemplate = "runningconfig-template" + + runningConfigMessageId = "get-config-" + requestId + + deviceResponse = nc.getConfig(messageId=runningConfigMessageId, + filter=runningConfigTemplate) + + log.info("Get Running Config Response {} ", deviceResponse.responseMessage) + if(deviceResponse !='null') : + status = deviceResponse.status + responseData = "{}" + if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): + errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage + + except Exception, err: + log.info("Exception in the script {}",err.getMessage()) + status = netconf_constant.STATUS_FAILURE + errorMessage = "Get Running Config Failure ::"+err.getMessage() + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py new file mode 100644 index 000000000..0a583dc57 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py @@ -0,0 +1,12 @@ +from abstract_blueprint_function import AbstractPythonComponentFunction +from blueprint_constants import * + +class SamplePythonComponentNode(AbstractPythonComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/__init__.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..9066e4845 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,8 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh M +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: Brinda Santh, activation-blueprint + +Name: Plans/ActivateProcess.bpmn +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl new file mode 100644 index 000000000..026c59176 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl @@ -0,0 +1 @@ +This is Sample Velocity Template \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip b/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip deleted file mode 100755 index 77882ef14..000000000 Binary files a/components/model-catalog/blueprint-model/test-blueprints/CBA_Zip_Test.zip and /dev/null differ -- cgit 1.2.3-korg From 7816ef331a873af0ba96f7478d45badefd135c62 Mon Sep 17 00:00:00 2001 From: "Cherukuri, Venkatanaresh (vn166g)" Date: Mon, 11 Feb 2019 10:36:36 -0500 Subject: Blueprint modeled Netconf capability components Adding Netconf Executor Function module Change-Id: I8b896fef84a465db2b9365d038b611e9fdf793ea Issue-ID: CCSDK-790 Signed-off-by: Cherukuri, Venkatanaresh (vn166g) --- .../baseconfiguration/Scripts/python/DefaultGetNetConfig.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py index 4db7c731b..e2f5655a2 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py @@ -3,9 +3,7 @@ from netconfclient import NetconfClient from java.lang import Exception from abstract_blueprint_function import AbstractPythonComponentFunction from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService -from org.onap.ccsdk.apps.controllerblueprints.core.utils import JacksonUtils -from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces import DeviceInfo -from org.onap.ccsdk.apps.controllerblueprints.core.service import BluePrintRuntimeService + class DefaultGetNetConfig(AbstractPythonComponentFunction): -- cgit 1.2.3-korg From d73ea79d225154e9edfd88901374cf5ed33947d1 Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Mon, 11 Feb 2019 23:35:16 -0500 Subject: Jython execution component and service Change-Id: I2610e73a9c7ba073b5fa9d148dcd6fb5b9ad9ae3 Issue-ID: CCSDK-696 Signed-off-by: Steve Alphonse Siani --- .../Scripts/SampleResourceAssignmentProcessorScript.py | 13 +++++++++++++ .../blueprint-model/test-blueprint/CBA_Zip_Test.zip | Bin 5382 -> 0 bytes .../Scripts/python/SampleRAProcessor.py | 13 +++++++++++++ .../python/ccsdk_blueprints/abstract_ra_processor.py | 12 ++++++++++++ .../python/ccsdk_blueprints/resource_assignment_utils.py | 14 ++++++++++++++ .../ccsdk_blueprints/sample_ra_processor_function.py | 12 ++++++++++++ 6 files changed, 64 insertions(+) create mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py delete mode 100755 components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py create mode 100644 components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py create mode 100644 components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py create mode 100644 components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py new file mode 100644 index 000000000..f9b533090 --- /dev/null +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py @@ -0,0 +1,13 @@ +from resource_assignment_processor_function import JythonComponentFunction +from blueprint_constants import * + + +class SampleJythonComponentNode(JythonComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip b/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip deleted file mode 100755 index 77882ef14..000000000 Binary files a/components/model-catalog/blueprint-model/test-blueprint/CBA_Zip_Test.zip and /dev/null differ diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py new file mode 100644 index 000000000..9729f04f2 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py @@ -0,0 +1,13 @@ +from abstract_ra_processor import AbstractRAProcessor +from blueprint_constants import * + + +class SampleRAProcessor(AbstractRAProcessor): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py new file mode 100644 index 000000000..f7d54ea88 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py @@ -0,0 +1,12 @@ +from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import ResourceAssignmentProcessor + + +class AbstractRAProcessor(ResourceAssignmentProcessor): + + def process(self, execution_request): + print "Processing calling.." + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + return None diff --git a/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py b/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py new file mode 100644 index 000000000..53cc5d708 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py @@ -0,0 +1,14 @@ +class ResourceAssignmentUtils: + + + @classmethod + def set_ressource_data_value(cls, ra, runtime_exception, value): + print "Set resource here..." + # TODO + return None + + @staticmethod + def set_ressource_value(ra, runtime_exception, value): + print "Set resource here..." + # TODO + return None \ No newline at end of file diff --git a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py new file mode 100644 index 000000000..8f68bfec0 --- /dev/null +++ b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py @@ -0,0 +1,12 @@ +from abstract_ra_processor import AbstractRAProcessor + + +class SampleRAProcessorFunction(AbstractRAProcessor): + + def process(self, execution_request): + print "Processing calling.." + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + return None -- cgit 1.2.3-korg From 50b404400a599b826511593218bf98acdf7fa55e Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Sat, 9 Feb 2019 18:33:55 -0500 Subject: Multiple fixes & enhancement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rework docker image build - Fix compress function - Fix node type name for source-primary-db Change-Id: Ide38e17036e76047d9f850b714ba0da4add5cd9d Issue-ID: CCSDK-414 Signed-off-by: Alexis de Talhouët --- .../starter-type/node_type/source-db.json | 44 ---------------------- .../starter-type/node_type/source-primary-db.json | 44 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-db.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-db.json deleted file mode 100644 index 661a9503b..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/source-db.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "description": "This is Database Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": true, - "type": "string", - "constraints": [ - { - "valid_values": [ - "SQL", - "PLSQL" - ] - } - ] - }, - "query": { - "required": true, - "type": "string" - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json new file mode 100644 index 000000000..661a9503b --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json @@ -0,0 +1,44 @@ +{ + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file -- cgit 1.2.3-korg From 4d7d6d918a724e9c83692bf8e5c7a491f073d970 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 11 Feb 2019 17:23:48 -0500 Subject: Fixes: manual integration test of CDS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - support to overwrite cba - fix map to json - finish meshing - fix python context not having the bluePrintRuntimeService injected - load all properties in the properties store Issue-ID: CCSDK-414 Change-Id: I6b65201529d0ffd9c3e18023a33e0081236b01de Signed-off-by: Alexis de Talhouët --- .../Definitions/activation-blueprint.json | 10 +-- .../baseconfiguration/Definitions/node_types.json | 6 +- .../node_type/component-jython-executor.json | 2 +- .../node_type/component-resource-assignment.json | 82 ---------------------- .../node_type/component-resource-resolution.json | 82 ++++++++++++++++++++++ 5 files changed, 91 insertions(+), 91 deletions(-) delete mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 822cc68b7..5af64caa7 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -106,9 +106,9 @@ } }, "resource-assignment": { - "type": "component-resource-assignment", + "type": "component-resource-resolution", "interfaces": { - "ResourceAssignmentComponent": { + "ResourceResolutionComponent": { "operations": { "process": { "inputs": { @@ -151,9 +151,9 @@ } }, "resource-assignment-py": { - "type": "component-resource-assignment", + "type": "component-resource-resolution", "interfaces": { - "ResourceAssignmentComponent": { + "ResourceResolutionComponent": { "operations": { "process": { "implementation": { @@ -182,7 +182,7 @@ "activate-jython": { "type": "component-jython-executor", "interfaces": { - "JythonExecutorComponent": { + "ComponentJythonExecutor": { "operations": { "process": { "implementation": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index f7970bfbd..400db435c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -91,7 +91,7 @@ }, "derived_from": "tosca.nodes.component.Jython" }, - "component-resource-assignment": { + "component-resource-resolution": { "description": "This is Resource Assignment Component API", "version": "1.0.0", "attributes": { @@ -101,7 +101,7 @@ } }, "interfaces": { - "ResourceAssignmentComponent": { + "ResourceResolutionComponent": { "operations": { "process": { "inputs": { @@ -158,7 +158,7 @@ } }, "interfaces": { - "JythonExecutorComponent": { + "ComponentJythonExecutor": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json index 4959a9dd1..af8aae12e 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json @@ -7,7 +7,7 @@ } }, "interfaces": { - "JythonExecutorComponent": { + "ComponentJythonExecutor": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json deleted file mode 100644 index 38fc97d70..000000000 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-assignment.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "attributes": { - "assignment-params": { - "required": true, - "type": "string" - } - }, - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" - } - }, - "interfaces": { - "ResourceAssignmentComponent": { - "operations": { - "process": { - "inputs": { - "template-name": { - "description": "Service Template Name.", - "required": true, - "type": "string" - }, - "template-version": { - "description": "Service Template Version.", - "required": true, - "type": "string" - }, - "resource-type": { - "description": "Request type.", - "required": true, - "type": "string" - }, - "template-names": { - "description": "Name of the artifact Node Templates, to get the template Content.", - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "artifact-prefix-names": { - "required": false, - "description": "Template , Resource Assignment Artifact Prefix names", - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "request-id": { - "description": "Request Id, Unique Id for the request.", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Resource Id.", - "required": true, - "type": "string" - }, - "action-name": { - "description": "Action Name of the process", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" -} \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json new file mode 100644 index 000000000..d01660efc --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json @@ -0,0 +1,82 @@ +{ + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "attributes": { + "assignment-params": { + "required": true, + "type": "string" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "template-name": { + "description": "Service Template Name.", + "required": true, + "type": "string" + }, + "template-version": { + "description": "Service Template Version.", + "required": true, + "type": "string" + }, + "resource-type": { + "description": "Request type.", + "required": true, + "type": "string" + }, + "template-names": { + "description": "Name of the artifact Node Templates, to get the template Content.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id, Unique Id for the request.", + "required": false, + "type": "string" + }, + "resource-id": { + "description": "Resource Id.", + "required": false, + "type": "string" + }, + "action-name": { + "description": "Action Name of the process", + "required": false, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file -- cgit 1.2.3-korg From f7c657993d50ed855a1ac359b5dd325960a6051b Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 12 Feb 2019 15:26:19 -0500 Subject: Add netconf script component function Change-Id: I094025fba5626bae0b4b13320f1cbbb76cda3bfd Issue-ID: CCSDK-790 Signed-off-by: Muthuramalingam, Brinda Santh --- .../Definitions/activation-blueprint.json | 6 ++---- .../Scripts/python/DefaultGetNetConfig.py | 19 ++++++------------- .../scripts/python/ccsdk_netconf/netconfclient.py | 10 +++++++--- 3 files changed, 15 insertions(+), 20 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 5af64caa7..637b589f6 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -190,8 +190,7 @@ }, "inputs": { "instance-dependencies": [ - "json-parser-service", - "netconf-rpc-service" + "json-parser-service" ] }, "outputs": { @@ -220,8 +219,7 @@ }, "inputs": { "instance-dependencies": [ - "json-parser-service", - "netconf-rpc-service" + "json-parser-service" ] }, "outputs": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py index e2f5655a2..c966b1a4b 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py @@ -1,28 +1,21 @@ import netconf_constant from netconfclient import NetconfClient from java.lang import Exception -from abstract_blueprint_function import AbstractPythonComponentFunction -from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfComponentFunction +class DefaultGetNetConfig(NetconfComponentFunction): - -class DefaultGetNetConfig(AbstractPythonComponentFunction): def process(self, execution_request): try: log = globals()[netconf_constant.SERVICE_LOG] print(globals()) #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] requestId = '1234' + nc = NetconfClient(log, self) - bluePrintRuntimeService = globals()['bluePrintRuntimeService'] - - capabilityProperty = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device","netconf") - - log.info("capabilityProperty {}",capabilityProperty) - netconfService = NetconfRpcService() - nc = NetconfClient(log, netconfService) + # Create RPC Serivice + nc.createRPCServiceFromRequirement("netconf-connection") - nc.connect(netconfService.getNetconfDeviceInfo(capabilityProperty)) runningConfigTemplate = "runningconfig-template" runningConfigMessageId = "get-config-" + requestId @@ -38,7 +31,7 @@ class DefaultGetNetConfig(AbstractPythonComponentFunction): errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage except Exception, err: - log.info("Exception in the script {}",err.getMessage()) + log.error("Exception in the script {}",err.getMessage()) status = netconf_constant.STATUS_FAILURE errorMessage = "Get Running Config Failure ::"+err.getMessage() diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index 448e03dc1..421e50098 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -4,15 +4,19 @@ from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_DEFAULT_OPERATION_REP class NetconfClient: - def __init__(self, log, nc): + def __init__(self, log, componentFunction): self.log = log - self.nc = nc + self.componentFunction = componentFunction + self.nc = None + + def createRPCServiceFromRequirement(self, requirementName): + self.nc = self.componentFunction.netconfRpcClientService(requirementName) def disconnect(self): self.nc.disconnect() return - def connect(self,deviceInfo): + def connect(self, deviceInfo): self.nc.connect(deviceInfo) return -- cgit 1.2.3-korg From bc67e43da12a2b341a15087adfae6e613990b5a2 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 12 Feb 2019 15:53:39 -0500 Subject: Create restconf component function module Change-Id: I04c29bfc981b677d81da73441228215ce4868833 Issue-ID: CCSDK-1060 Signed-off-by: Muthuramalingam, Brinda Santh --- .../node_type/component-restconf-executor.json | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json new file mode 100644 index 000000000..884be5dc6 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json @@ -0,0 +1,40 @@ +{ + "description": "This is Netconf Transaction Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentRestconfExecutor": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "required": true, + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file -- cgit 1.2.3-korg From b33481f0d4251bb9d0ef8536c58e4a2d5b4ffe19 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 12 Feb 2019 19:16:47 -0500 Subject: Add Sub Attribute parsing capabilit Change-Id: Ie353f8e5b86f7472a4790c32705f4b8c3d5e5826 Issue-ID: CCSDK-1061 Signed-off-by: Muthuramalingam, Brinda Santh --- .../baseconfiguration/Definitions/activation-blueprint.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 637b589f6..84c78c62c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -251,7 +251,14 @@ "properties": { "login-key": "sample-key", "login-account": "sample-account", - "target-ip-address": "localhost", + "target-ip-address": { + "get_attribute": [ + "resource-assignment", + "", + "assignment-params", + "$.ipAddress" + ] + }, "port-number": 830, "connection-time-out": 30 } -- cgit 1.2.3-korg From 1f53e61c6f5af7fdcd6be97ba3aff4d84694dc05 Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Wed, 13 Feb 2019 15:45:50 -0500 Subject: Python library for Jython execution Change-Id: Iee2701b4dade7207950f17c92ea1265c361cf803 Issue-ID: CCSDK-696 Signed-off-by: Steve Alphonse Siani --- .../SampleResourceAssignmentProcessorScript.py | 13 -- .../Definitions/resources_definition_types.json | 8 + .../Scripts/python/SamplePythonComponentNode.py | 10 +- .../Scripts/python/SampleRAProcessor.py | 20 ++- .../Definitions/activation-blueprint.json | 128 ++++++++++++++ .../Definitions/artifact_types.json | 28 ++++ .../Definitions/baseconfig-mapping.json | 23 +++ .../capability_python/Definitions/data_types.json | 17 ++ .../capability_python/Definitions/node_types.json | 183 +++++++++++++++++++++ .../Definitions/policy_types.json | 3 + .../Definitions/relationship_types.json | 3 + .../Definitions/resources_definition_types.json | 51 ++++++ .../Plans/CONFIG_AssignActivateNetconf_1.0.0.xml | 42 +++++ .../kotlin/ResourceAssignmentProcessor.cba.kts | 44 +++++ .../Scripts/kotlin/ScriptComponent.cba.kts | 46 ++++++ .../Scripts/python/DefaultGetNetConfig.py | 48 ++++++ .../Scripts/python/SamplePythonComponentNode.py | 18 ++ .../Scripts/python/SampleRAProcessor.py | 29 ++++ .../capability_python/TOSCA-Metadata/TOSCA.meta | 8 + .../Templates/baseconfig-template.vtl | 4 + .../abstract_blueprint_function.py | 8 +- .../ccsdk_blueprints/abstract_ra_processor.py | 43 ++++- .../python/ccsdk_blueprints/blueprint_constants.py | 3 + .../ccsdk_blueprints/blueprint_runtime_service.py | 8 + .../ccsdk_blueprints/resource_assignment_utils.py | 14 -- .../ccsdk_blueprints/sample_blueprint_component.py | 10 +- .../sample_ra_processor_function.py | 10 +- 27 files changed, 782 insertions(+), 40 deletions(-) delete mode 100644 components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ScriptComponent.cba.kts create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Templates/baseconfig-template.vtl delete mode 100644 components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py deleted file mode 100644 index f9b533090..000000000 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Scripts/SampleResourceAssignmentProcessorScript.py +++ /dev/null @@ -1,13 +0,0 @@ -from resource_assignment_processor_function import JythonComponentFunction -from blueprint_constants import * - - -class SampleJythonComponentNode(JythonComponentFunction): - - def process(self, execution_request): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None - - def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json index c88712146..d2d32e81e 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -11,6 +11,14 @@ "input": { "type": "source-input", "properties": {} + }, + "capability": { + "type": "source-capability", + "properties": { + "type": "JYTHON-COMPONENT", + "instance-name": "SampleRAProcessor", + "instance-dependencies": [] + } } } }, diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py index 0a583dc57..890481219 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py @@ -1,12 +1,18 @@ from abstract_blueprint_function import AbstractPythonComponentFunction from blueprint_constants import * + class SamplePythonComponentNode(AbstractPythonComponentFunction): + def __init__(self): + AbstractPythonComponentFunction.__init__(self) + def process(self, execution_request): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + AbstractPythonComponentFunction.process(self, execution_request) + print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH return None def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + AbstractPythonComponentFunction.recover(self, runtime_exception, execution_request) + print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py index 9729f04f2..30b9ff951 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SampleRAProcessor.py @@ -4,10 +4,26 @@ from blueprint_constants import * class SampleRAProcessor(AbstractRAProcessor): + def __init__(self): + AbstractRAProcessor.__init__(self) + def process(self, execution_request): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + + AbstractRAProcessor.process(self, execution_request) + print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + if self.ra_valid is True: + value = self.resolve_values_script(execution_request, self.value_to_resolve) + self.set_resource_data_value(execution_request, value) + else: + raise BluePrintProcessorException("Error on resource assignment. Message = " + self.error_message) return None def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + AbstractRAProcessor.recover(self, runtime_exception, execution_request) + print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH return None + + def resolve_values_script(self, execution_request, value_to_resolve): + # TODO : DO business logic here + print "Resolve value for " + value_to_resolve + " here..." + return "test_python" diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json new file mode 100755 index 000000000..168732c1d --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json @@ -0,0 +1,128 @@ +{ + "tosca_definitions_version" : "controller_blueprint_1_0_0", + "metadata" : { + "template_author" : "Alexis de Talhouët", + "author-email" : "adetalhouet89@gmail.com", + "user-groups" : "ADMIN, OPERATION", + "template_name" : "capability_python", + "template_version" : "1.0.0", + "template_tags" : "test" + }, + "imports" : [ { + "file" : "Definitions/data_types.json" + }, { + "file" : "Definitions/relationship_types.json" + }, { + "file" : "Definitions/artifact_types.json" + }, { + "file" : "Definitions/node_types.json" + }, { + "file" : "Definitions/policy_types.json" + } ], + "topology_template" : { + "inputs" : { + "request-id" : { + "required" : true, + "type" : "string" + }, + "action-name" : { + "required" : true, + "type" : "string" + } + }, + "workflows" : { + "assign-activate" : { + "steps" : { + "activate-process" : { + "description" : "Resource Assign and Netconf Activation Workflow", + "target" : "assign-activate-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "assign-activate-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(assign-activate).", + "required" : true, + "type" : "dt-assign-activate-properties" + } + } + } + }, + "node_templates" : { + "assign-activate-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-assign-activate-process" ] + }, + "dependency-node-templates" : [ "resource-assignment", "activate-jython" ] + }, + "artifacts" : { + "dg-assign-activate-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/CONFIG_AssignActivateNetconf_1.0.0.xml" + } + } + }, + "resource-assignment" : { + "type" : "component-resource-resolution", + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "artifact-prefix-names" : [ "baseconfig" ] + }, + "outputs" : { + "resource-assignment-params" : { + "get_attribute" : [ "SELF", "assignment-params" ] + }, + "status" : "success" + } + } + } + } + }, + "artifacts" : { + "baseconfig-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/baseconfig-template.vtl" + }, + "baseconfig-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Definitions/baseconfig-mapping.json" + } + } + }, + "activate-jython" : { + "type" : "component-jython-executor", + "interfaces" : { + "ComponentJythonExecutor" : { + "operations" : { + "process" : { + "implementation" : { + "primary" : "component-script" + }, + "inputs" : { + "instance-dependencies" : [ ] + }, + "outputs" : { + "response-data" : "", + "status" : "" + } + } + } + } + }, + "artifacts" : { + "component-script" : { + "type" : "artifact-script-jython", + "file" : "Scripts/SamplePythonComponentNode.py" + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json new file mode 100755 index 000000000..aa5295e44 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json @@ -0,0 +1,28 @@ +{ + "artifact_types" : { + "artifact-directed-graph" : { + "description" : "Directed Graph File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json", "xml" ] + }, + "artifact-mapping-resource" : { + "description" : "Resource Mapping File used along with Configuration template", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json" ] + }, + "artifact-script-jython" : { + "description" : "Jython Script File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "py" ] + }, + "artifact-template-velocity" : { + "description" : " Velocity Template used for Configuration", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "vtl" ] + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json new file mode 100755 index 000000000..de6c24116 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json @@ -0,0 +1,23 @@ +[ + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "capability", + "dependencies": [ + ] + }, + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json new file mode 100755 index 000000000..98a8e4b79 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json @@ -0,0 +1,17 @@ +{ + "data_types" : { + "dt-assign-activate-properties" : { + "description" : "Dynamic DataType definition for workflow(assign-activate).", + "version" : "1.0.0", + "properties" : { + "vnf-id" : { + "type" : "string" + }, + "service-instance-id" : { + "type" : "string" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json new file mode 100755 index 000000000..b40c8cb34 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json @@ -0,0 +1,183 @@ +{ + "node_types" : { + "component-jython-executor" : { + "description" : "This is Jython Execution Component.", + "version" : "1.0.0", + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ComponentJythonExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "instance-dependencies" : { + "description" : "Instance Names to Inject to Jython Script.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "outputs" : { + "response-data" : { + "description" : "Execution Response Data in JSON format.", + "required" : false, + "type" : "string" + }, + "status" : { + "description" : "Status of the Component Execution ( success or failure )", + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.component.Jython" + }, + "component-resource-resolution" : { + "description" : "This is Resource Assignment Component API", + "version" : "1.0.0", + "attributes" : { + "assignment-params" : { + "required" : true, + "type" : "string" + } + }, + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "template-name" : { + "description" : "Service Template Name.", + "required" : true, + "type" : "string" + }, + "template-version" : { + "description" : "Service Template Version.", + "required" : true, + "type" : "string" + }, + "resource-type" : { + "description" : "Request type.", + "required" : true, + "type" : "string" + }, + "template-names" : { + "description" : "Name of the artifact Node Templates, to get the template Content.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "artifact-prefix-names" : { + "description" : "Template , Resource Assignment Artifact Prefix names", + "required" : false, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "request-id" : { + "description" : "Request Id, Unique Id for the request.", + "required" : false, + "type" : "string" + }, + "resource-id" : { + "description" : "Resource Id.", + "required" : false, + "type" : "string" + }, + "action-name" : { + "description" : "Action Name of the process", + "required" : false, + "type" : "string" + } + }, + "outputs" : { + "resource-assignment-params" : { + "required" : true, + "type" : "string" + }, + "status" : { + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "dg-generic" : { + "description" : "This is Generic Directed Graph Type", + "version" : "1.0.0", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + }, + "dependency-node-templates" : { + "description" : "Dependent Step Components NodeTemplate name.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.DG" + }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.component.Jython" : { + "description" : "This is Jython Component", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json new file mode 100755 index 000000000..1e44cc70a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json new file mode 100755 index 000000000..4ddd7a57c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json @@ -0,0 +1,3 @@ +{ + "relationship_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json new file mode 100755 index 000000000..d2c470fe8 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json @@ -0,0 +1,51 @@ +{ + "service-instance-id" : { + "tags" : "service-instance-id, tosca.datatypes.Root, data_type", + "name" : "service-instance-id", + "property" : { + "description" : "To be provided", + "type" : "string" + }, + "updated-by" : "Singal, Kapil ", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + }, + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": { + }, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "capability": { + "type": "source-capability", + "properties": { + "type": "JYTHON-COMPONENT", + "instance-name": "SampleRAProcessor", + "instance-dependencies": [] + } + } + } + }, + "vnf-id" : { + "tags" : "vnf-id", + "name" : "vnf-id", + "property" : { + "description" : "vnf-id", + "type" : "string" + }, + "updated-by" : "Singal, Kapil ", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml new file mode 100755 index 000000000..eb41b7dfa --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts new file mode 100755 index 000000000..f1da61407 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts @@ -0,0 +1,44 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.* +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive + +open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() { + + lateinit var resourceAssignment: ResourceAssignment + + override fun getName(): String { + return "resource-assignment-processor-custom-capability" + } + + override fun process(resourceAssignment: ResourceAssignment) { + this.resourceAssignment = resourceAssignment + } + + override fun prepareResponse(): ResourceAssignment { + return resourceAssignment + } + + override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + TODO("To Implement") + } + +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ScriptComponent.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ScriptComponent.cba.kts new file mode 100755 index 000000000..184c49335 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/kotlin/ScriptComponent.cba.kts @@ -0,0 +1,46 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode + +open class SampleKotlinComponent : BlueprintFunctionNode { + + override fun getName(): String { + return "my Name" + } + + override fun prepareRequest(executionRequest: String): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun process(executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun recover(runtimeException: RuntimeException, executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun prepareResponse(): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun apply(t: String): String { + return "Successfully Executed Scripts" + } +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py new file mode 100755 index 000000000..e2f5655a2 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/DefaultGetNetConfig.py @@ -0,0 +1,48 @@ +import netconf_constant +from netconfclient import NetconfClient +from java.lang import Exception +from abstract_blueprint_function import AbstractPythonComponentFunction +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService + + + +class DefaultGetNetConfig(AbstractPythonComponentFunction): + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] + requestId = '1234' + + bluePrintRuntimeService = globals()['bluePrintRuntimeService'] + + capabilityProperty = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device","netconf") + + log.info("capabilityProperty {}",capabilityProperty) + netconfService = NetconfRpcService() + nc = NetconfClient(log, netconfService) + + nc.connect(netconfService.getNetconfDeviceInfo(capabilityProperty)) + runningConfigTemplate = "runningconfig-template" + + runningConfigMessageId = "get-config-" + requestId + + deviceResponse = nc.getConfig(messageId=runningConfigMessageId, + filter=runningConfigTemplate) + + log.info("Get Running Config Response {} ", deviceResponse.responseMessage) + if(deviceResponse !='null') : + status = deviceResponse.status + responseData = "{}" + if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): + errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage + + except Exception, err: + log.info("Exception in the script {}",err.getMessage()) + status = netconf_constant.STATUS_FAILURE + errorMessage = "Get Running Config Failure ::"+err.getMessage() + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py new file mode 100755 index 000000000..890481219 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SamplePythonComponentNode.py @@ -0,0 +1,18 @@ +from abstract_blueprint_function import AbstractPythonComponentFunction +from blueprint_constants import * + + +class SamplePythonComponentNode(AbstractPythonComponentFunction): + + def __init__(self): + AbstractPythonComponentFunction.__init__(self) + + def process(self, execution_request): + AbstractPythonComponentFunction.process(self, execution_request) + print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + AbstractPythonComponentFunction.recover(self, runtime_exception, execution_request) + print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py new file mode 100755 index 000000000..30b9ff951 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py @@ -0,0 +1,29 @@ +from abstract_ra_processor import AbstractRAProcessor +from blueprint_constants import * + + +class SampleRAProcessor(AbstractRAProcessor): + + def __init__(self): + AbstractRAProcessor.__init__(self) + + def process(self, execution_request): + + AbstractRAProcessor.process(self, execution_request) + print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH + if self.ra_valid is True: + value = self.resolve_values_script(execution_request, self.value_to_resolve) + self.set_resource_data_value(execution_request, value) + else: + raise BluePrintProcessorException("Error on resource assignment. Message = " + self.error_message) + return None + + def recover(self, runtime_exception, execution_request): + AbstractRAProcessor.recover(self, runtime_exception, execution_request) + print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def resolve_values_script(self, execution_request, value_to_resolve): + # TODO : DO business logic here + print "Resolve value for " + value_to_resolve + " here..." + return "test_python" diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta new file mode 100755 index 000000000..9066e4845 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,8 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh M +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: Brinda Santh, activation-blueprint + +Name: Plans/ActivateProcess.bpmn +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Templates/baseconfig-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Templates/baseconfig-template.vtl new file mode 100755 index 000000000..9cbaec11b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Templates/baseconfig-template.vtl @@ -0,0 +1,4 @@ +{ + "service-instance-id": "$service-instance-id", + "vnf-id": "$vnf-id" +} \ No newline at end of file diff --git a/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py index 0ddab16e7..1ffa75d4b 100644 --- a/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py +++ b/components/scripts/python/ccsdk_blueprints/abstract_blueprint_function.py @@ -1,11 +1,15 @@ from org.onap.ccsdk.apps.blueprintsprocessor.services.execution import AbstractComponentFunction + class AbstractPythonComponentFunction(AbstractComponentFunction): + def __init__(self): + AbstractComponentFunction.__init__(self) + def process(self, execution_request): - print "Processing calling.." + print "Processing calling from parent..." return None def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + print "Recovering calling from parent..." return None diff --git a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py index f7d54ea88..2cacaf526 100644 --- a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py +++ b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py @@ -1,12 +1,49 @@ from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import ResourceAssignmentProcessor +from blueprint_constants import * +from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils import ResourceAssignmentUtils +from org.onap.ccsdk.apps.controllerblueprints.core import BluePrintProcessorException +from java.lang import Exception class AbstractRAProcessor(ResourceAssignmentProcessor): + def __init__(self): + ResourceAssignmentProcessor.__init__(self) + self.status = PROPERTY_BLUEPRINT_STATUS_SUCCESS + self.error_message = None + self.ra_valid = False + self.value_to_resolve = None + def process(self, execution_request): - print "Processing calling.." - return None + print "Processing calling from parent..." + try: + self.ra_valid = self.validate(execution_request) + self.value_to_resolve = execution_request.name + except Exception, e: + self.status = PROPERTY_BLUEPRINT_STATUS_FAILURE + self.error_message = "Get Running python scripting Failure :" + e.getMessage() def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + print "Recovering calling from parent.." + return None + + def set_resource_data_value(self, execution_request, value): + try: + if value is not None: + ResourceAssignmentUtils.Companion.setResourceDataValue(execution_request, self.raRuntimeService, value) + else: + ResourceAssignmentUtils.Companion.setFailedResourceDataValue(execution_request, "Fail to resole value") + except BluePrintProcessorException, err: + raise BluePrintProcessorException("Error on resource assignment. Message = " + err.message) + return None + + @staticmethod + def validate(ra): + if ra.name is None or ra.name is None: + raise Exception("Failed getting value for template key (" + ra.name + ") and " + + "dictionary key (" + ra.dictionaryName + + ") of type (" + ra.type + ")") + else: + pass + return True diff --git a/components/scripts/python/ccsdk_blueprints/blueprint_constants.py b/components/scripts/python/ccsdk_blueprints/blueprint_constants.py index 2ec95f312..50246773f 100644 --- a/components/scripts/python/ccsdk_blueprints/blueprint_constants.py +++ b/components/scripts/python/ccsdk_blueprints/blueprint_constants.py @@ -6,6 +6,9 @@ PROPERTY_BLUEPRINT_INPUTS_DATA= "blueprint-inputs-data" PROPERTY_BLUEPRINT_CONTEXT= "blueprint-context" PROPERTY_BLUEPRINT_NAME= "template_name" PROPERTY_BLUEPRINT_VERSION= "template_version" +PROPERTY_BLUEPRINT_USER_SYSTEM= "System" +PROPERTY_BLUEPRINT_STATUS_SUCCESS= "success" +PROPERTY_BLUEPRINT_STATUS_FAILURE= "failure" METADATA_USER_GROUPS = "user-groups" METADATA_TEMPLATE_NAME = "template_name" diff --git a/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py b/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py index 022b47244..7c7beff7f 100644 --- a/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py +++ b/components/scripts/python/ccsdk_blueprints/blueprint_runtime_service.py @@ -11,3 +11,11 @@ class BluePrintRuntimeService: def setNodeTemplatePropertyValue(self, nodeTemplateName, propertyName, value): return self.bps.setNodeTemplatePropertyValue(nodeTemplateName, propertyName, value) + + def put_resolution_store(self, ra_name, value): + self.bps.putResolutionStore(ra_name, value) + return None + + def put_dictionary_store(self, ra_dictionary_name, value): + self.bps.putResolutionStore(ra_dictionary_name, value) + return None diff --git a/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py b/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py deleted file mode 100644 index 53cc5d708..000000000 --- a/components/scripts/python/ccsdk_blueprints/resource_assignment_utils.py +++ /dev/null @@ -1,14 +0,0 @@ -class ResourceAssignmentUtils: - - - @classmethod - def set_ressource_data_value(cls, ra, runtime_exception, value): - print "Set resource here..." - # TODO - return None - - @staticmethod - def set_ressource_value(ra, runtime_exception, value): - print "Set resource here..." - # TODO - return None \ No newline at end of file diff --git a/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py index 62665dc8f..a1e6c5d3b 100644 --- a/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py +++ b/components/scripts/python/ccsdk_blueprints/sample_blueprint_component.py @@ -1,12 +1,18 @@ from abstract_blueprint_function import AbstractPythonComponentFunction from blueprint_constants import * + class SampleBlueprintComponent(AbstractPythonComponentFunction): + def __init__(self): + AbstractPythonComponentFunction.__init__(self) + def process(self, execution_request): - print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + super(SamplePythonComponentNode, self).process(execution_request) + print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH return None def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + super(SamplePythonComponentNode, self).recover(runtime_exception, execution_request) + print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH return None diff --git a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py index 8f68bfec0..6ec5d82ab 100644 --- a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py +++ b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py @@ -1,12 +1,18 @@ from abstract_ra_processor import AbstractRAProcessor +from blueprint_constants import * class SampleRAProcessorFunction(AbstractRAProcessor): + def __init__(self): + AbstractRAProcessor.__init__(self) + def process(self, execution_request): - print "Processing calling.." + AbstractRAProcessor.process(self, execution_request) + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH return None def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + AbstractRAProcessor.recover(self, runtime_exception, execution_request) + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH return None -- cgit 1.2.3-korg From 148dd1c3c3d394791817246bd973104142fe93d5 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 15 Feb 2019 13:58:24 -0500 Subject: Fix sonar build Sonar build on ccsdk/apps is failing because one of the submodules (components/model-catatlog/proto-definition) does not have the standard maven src/main and src/test directories. Adding these directories fixes sonar build (they need to contain a file - in this case a README - otherwise git will not add the empty directory) Change-Id: Ia74254b58e5b006bd72c35cd6ce872b88de35016 Issue-ID: CCSDK-1081 Signed-off-by: Timoney, Dan (dt5972) --- components/model-catalog/proto-definition/src/main/README.md | 1 + components/model-catalog/proto-definition/src/test/README.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 components/model-catalog/proto-definition/src/main/README.md create mode 100644 components/model-catalog/proto-definition/src/test/README.md (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/src/main/README.md b/components/model-catalog/proto-definition/src/main/README.md new file mode 100644 index 000000000..f63edde3f --- /dev/null +++ b/components/model-catalog/proto-definition/src/main/README.md @@ -0,0 +1 @@ +Standard maven directory for source diff --git a/components/model-catalog/proto-definition/src/test/README.md b/components/model-catalog/proto-definition/src/test/README.md new file mode 100644 index 000000000..4701e06b7 --- /dev/null +++ b/components/model-catalog/proto-definition/src/test/README.md @@ -0,0 +1 @@ +Standard maven directory for unit test cases -- cgit 1.2.3-korg From 3daf7d0156076f868ae566f4503135757a4afd4d Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Tue, 12 Feb 2019 23:05:01 -0500 Subject: Rework netconf-executor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rework connection logic - rework rpc service - rework netconf session handling - rework netconf device communicator - rework python netconf bindings - rework python netconf client - add python script showcasing netconf functions Change-Id: Ibb9bf811e7d96e993aa866371d56c172de83be2c Issue-ID: CCSDK-790:x Signed-off-by: Alexis de Talhouët --- .../Definitions/activation-blueprint.json | 4 +- .../baseconfiguration/Definitions/node_types.json | 2 +- .../Scripts/python/DefaultGetNetConfig.py | 41 ------- .../Scripts/python/NetconfRpcExample.py | 52 +++++++++ .../node_type/component-netconf-executor.json | 2 +- .../scripts/python/ccsdk_netconf/constant.py | 15 --- .../scripts/python/ccsdk_netconf/netconfclient.py | 126 ++++++++++++--------- 7 files changed, 126 insertions(+), 116 deletions(-) delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py delete mode 100644 components/scripts/python/ccsdk_netconf/constant.py (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 84c78c62c..07c988b19 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -211,7 +211,7 @@ "activate-netconf": { "type": "component-netconf-executor", "interfaces": { - "NetconfExecutorComponent": { + "ComponentNetconfExecutor": { "operations": { "process": { "implementation": { @@ -240,7 +240,7 @@ "artifacts": { "component-script": { "type": "artifact-script-jython", - "file": "Scripts/python/DefaultGetNetConfig.py" + "file": "Scripts/python/NetconfRpcExample.py" } } }, diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index 400db435c..527307048 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -60,7 +60,7 @@ } }, "interfaces": { - "NetconfExecutorComponent": { + "ComponentNetconfExecutor": { "operations": { "process": { "inputs": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py deleted file mode 100644 index c966b1a4b..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py +++ /dev/null @@ -1,41 +0,0 @@ -import netconf_constant -from netconfclient import NetconfClient -from java.lang import Exception -from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfComponentFunction - -class DefaultGetNetConfig(NetconfComponentFunction): - - def process(self, execution_request): - try: - log = globals()[netconf_constant.SERVICE_LOG] - print(globals()) - #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] - requestId = '1234' - nc = NetconfClient(log, self) - - # Create RPC Serivice - nc.createRPCServiceFromRequirement("netconf-connection") - - runningConfigTemplate = "runningconfig-template" - - runningConfigMessageId = "get-config-" + requestId - - deviceResponse = nc.getConfig(messageId=runningConfigMessageId, - filter=runningConfigTemplate) - - log.info("Get Running Config Response {} ", deviceResponse.responseMessage) - if(deviceResponse !='null') : - status = deviceResponse.status - responseData = "{}" - if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): - errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage - - except Exception, err: - log.error("Exception in the script {}",err.getMessage()) - status = netconf_constant.STATUS_FAILURE - errorMessage = "Get Running Config Failure ::"+err.getMessage() - - def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH - return None - diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py new file mode 100644 index 000000000..acdb94aa1 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py @@ -0,0 +1,52 @@ +# Copyright (c) 2019 Bell Canada. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import netconf_constant +from java.lang import Exception as JavaException +from netconfclient import NetconfClient +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \ + NetconfComponentFunction + + +class NetconfRpcExample(NetconfComponentFunction): + + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + nc = NetconfClient(log, self, "netconf-connection") + nc.connect() + + payload = "DEMO" + + response = nc.lock(message_id="lock-123") + if not response.isSuccess(): + log.error(response.errorMessage) + + # nc.edit_config(message_id="edit-config-1", message_content=payload,edit_default_peration="none") + # nc.validate(message_id="validate-123") + # nc.discard_change(message_id="discard-123") + # nc.validate(message_id="validate-123") + # nc.commit(message_id="commit-123") + # nc.unlock(message_id="unlock-123") + # nc.disconnect() + + except JavaException, err: + log.error("Java Exception in the script {}", err) + except Exception, err: + log.error("Python Exception in the script {}", err) + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index b8ac762e5..9565f6611 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -14,7 +14,7 @@ } }, "interfaces": { - "NetconfExecutorComponent": { + "ComponentNetconfExecutor": { "operations": { "process": { "inputs": { diff --git a/components/scripts/python/ccsdk_netconf/constant.py b/components/scripts/python/ccsdk_netconf/constant.py deleted file mode 100644 index 534ca9e13..000000000 --- a/components/scripts/python/ccsdk_netconf/constant.py +++ /dev/null @@ -1,15 +0,0 @@ -SERVICE_LOG = "log" -SERVICE_NETCONF = "netconfService" -SERVICE_MESSAGE = "messageService" - -PARAM_REQUEST_ID = "requestId" -PARAM_ACTION = "action" - -STATUS_SUCCESS = "success" -STATUS_FAILURE = "failure" - -CONFIG_TARGET_RUNNING = "running" -CONFIG_TARGET_CANDIDATE = "candidate" -CONFIG_DEFAULT_OPERATION_MERGE = "merge" -CONFIG_DEFAULT_OPERATION_REPLACE = "replace" -CONFIG_DEFAULT_OPERATION_NONE = "none" diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index 421e50098..cdaf84092 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,60 +1,74 @@ -from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_DEFAULT_OPERATION_REPLACE - +from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ + CONFIG_DEFAULT_OPERATION_REPLACE class NetconfClient: - def __init__(self, log, componentFunction): - self.log = log - self.componentFunction = componentFunction - self.nc = None - - def createRPCServiceFromRequirement(self, requirementName): - self.nc = self.componentFunction.netconfRpcClientService(requirementName) - - def disconnect(self): - self.nc.disconnect() - return - - def connect(self, deviceInfo): - self.nc.connect(deviceInfo) - return - - def lock(self, messageId, configTarget, messageTimeout=30): - deviceResponse = self.nc.lock(messageId, configTarget, messageTimeout) - return deviceResponse - - def getConfig(self, messageId, filter, configTarget=CONFIG_TARGET_RUNNING, messageTimeout=30): - self.log.info("in the ncclient getConfig {}",messageId) - self.log.info("in the ncclient getConfig {}",filter) - deviceResponse = self.nc.getConfig(messageId, filter, configTarget, messageTimeout) - return deviceResponse - - def editConfig(self, messageId, messageContent, reConnect=False, wait=0, lock=False, - configTarget=CONFIG_TARGET_RUNNING, editDefaultOperation=CONFIG_DEFAULT_OPERATION_REPLACE, - deleteConfig= False, validate= False, commit=False, discardChanges =True, unlock=False, - preRestartWait=0, postRestartWait=0, messageTimeout=30): - deviceResponse = self.nc.editConfig(messageId, messageContent, reConnect, wait, lock, configTarget, - editDefaultOperation, deleteConfig, validate, commit, discardChanges, unlock, - preRestartWait, postRestartWait, messageTimeout) - return deviceResponse - - def commit(self, messageId, message, discardChanges =True, messageTimeout=30): - deviceResponse = self.nc.commit(messageId, message, discardChanges, messageTimeout) - return deviceResponse - - def unLock(self, messageId, configTarget, messageTimeout=30): - deviceResponse = self.nc.unLock(messageId, configTarget, messageTimeout) - return deviceResponse - - def discardChanges(self, messageId, messageTimeout=30): - deviceResponse = self.nc.discardChanges(messageId, messageTimeout) - return deviceResponse - - def close(self, messageId, force=False, messageTimeout=30): - deviceResponse = self.nc.close(messageId, force, messageTimeout) - return deviceResponse - - def rpc(self, request, messageId, messageTimeout=30): - deviceResponse = self.nc.rpc(request, messageId, messageTimeout) - return deviceResponse + def __init__(self, log, component_function, requirement_name): + self.log = log + self.component_function = component_function + netconf_device = self.component_function.initializeNetconfConnection( + requirement_name) + self.netconf_rpc_client = netconf_device.netconfRpcService + self.netconf_session = netconf_device.netconfSession + + def disconnect(self): + self.netconf_session.disconnect() + return + + def connect(self): + self.netconf_session.connect() + return + + def lock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, + message_timeout=30): + device_response = self.netconf_rpc_client.lock(message_id, config_target, + message_timeout) + return device_response + + def get_config(self, message_id, filter="", + config_target=CONFIG_TARGET_RUNNING, message_timeout=30): + self.log.info("in the ncclient getConfig {}", message_id) + device_response = self.netconf_rpc_client.getConfig(message_id, filter, + config_target, + message_timeout) + return device_response + + def edit_config(self, message_id, message_content, lock=False, + config_target=CONFIG_TARGET_CANDIDATE, + edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE, + deleteConfig=False, validate=False, commit=False, discard_change=False, + unlock=False, message_timeout=30): + device_response = self.netconf_rpc_client.editConfig(message_id, + message_content, lock, + config_target, + edit_default_peration, + deleteConfig, validate, + commit, discard_change, + unlock, + message_timeout) + return device_response + + def commit(self, message_id, discard_change=True, + message_timeout=30): + device_response = self.netconf_rpc_client.commit(message_id, discard_change, + message_timeout) + return device_response + + def unlock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, + message_timeout=30): + device_response = self.netconf_rpc_client.unLock(message_id, config_target, + message_timeout) + return device_response + + def validate(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, + message_timeout=30): + device_response = self.netconf_rpc_client.validate(message_id, + config_target, + message_timeout) + return device_response + + def discard_change(self, message_id, message_timeout=30): + device_response = self.netconf_rpc_client.discardConfig(message_id, + message_timeout) + return device_response -- cgit 1.2.3-korg From 69a0884d638631452dcbb2989adc39c07b097409 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 15 Feb 2019 09:15:35 -0500 Subject: restconf kotlin script support Change-Id: I07eaa4a2422b461e1b7eb13ec04bf7d10ea08770 Issue-ID: CCSDK-1080 Signed-off-by: Muthuramalingam, Brinda Santh --- .../baseconfiguration/Definitions/node_types.json | 2 +- .../node_type/component-netconf-executor.json | 2 +- .../node_type/component-restconf-executor.json | 24 ++++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index 527307048..65271838e 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -89,7 +89,7 @@ } } }, - "derived_from": "tosca.nodes.component.Jython" + "derived_from": "tosca.nodes.Component" }, "component-resource-resolution": { "description": "This is Resource Assignment Component API", diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 9565f6611..0bbcba97c 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -43,5 +43,5 @@ } } }, - "derived_from": "tosca.nodes.component.Jython" + "derived_from": "tosca.nodes.Component" } \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json index 884be5dc6..192ed2566 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json @@ -1,5 +1,5 @@ { - "description": "This is Netconf Transaction Configuration Component API", + "description": "This is Restconf Transaction Configuration Component API", "version": "1.0.0", "capabilities": { "component-node": { @@ -11,9 +11,29 @@ "operations": { "process": { "inputs": { + "script-type": { + "description": "Script type, kotlin type is supported", + "required": true, + "type": "string", + "default": "internal", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython", + "internal" + ] + } + ] + }, + "script-class-reference": { + "description": "Kotlin Script class name or jython script name.", + "required": true, + "type": "string" + }, "instance-dependencies": { "required": true, - "description": "Instance Names to Inject to Jython Script.", + "description": "Instance names to inject to Jython or Kotlin Script.", "type": "list", "entry_schema": { "type": "string" -- cgit 1.2.3-korg From 455c33fc94acfad8d8f577e2439e5ac56adfa05c Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Sun, 17 Feb 2019 09:31:35 -0500 Subject: Netconf resolution service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0346c88cd11136561426260a206bd7bf07f90dd3 Issue-ID: CCSDK-1086 Signed-off-by: Alexis de Talhouët --- .../Definitions/activation-blueprint.json | 13 +++++++++++- .../baseconfiguration/Definitions/node_types.json | 8 ++++++++ .../Scripts/python/NetconfRpcExample.py | 18 +++++++++-------- .../Templates/hostname-mapping.json | 13 ++++++++++++ .../Templates/hostname-template.vtl | 7 +++++++ .../node_type/component-netconf-executor.json | 10 +++++++++- components/scripts/python/ccsdk_netconf/common.py | 23 ++++++++++++++++++++++ .../scripts/python/ccsdk_netconf/netconfclient.py | 2 -- 8 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 07c988b19..162411f8d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -219,7 +219,10 @@ }, "inputs": { "instance-dependencies": [ - "json-parser-service" + + ], + "artifact-prefix-names": [ + "hostname" ] }, "outputs": { @@ -238,6 +241,14 @@ } }, "artifacts": { + "hostname-template": { + "type": "artifact-template-velocity", + "file": "Templates/hostname-template.vtl" + }, + "hostname-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/hostname-mapping.json" + }, "component-script": { "type": "artifact-script-jython", "file": "Scripts/python/NetconfRpcExample.py" diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index 65271838e..d3093d9c3 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -71,6 +71,14 @@ "entry_schema": { "type": "string" } + }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } } }, "outputs": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py index acdb94aa1..26c66b667 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py @@ -13,8 +13,8 @@ # limitations under the License. import netconf_constant +from common import ResolutionHelper from java.lang import Exception as JavaException -from netconfclient import NetconfClient from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \ NetconfComponentFunction @@ -26,21 +26,23 @@ class NetconfRpcExample(NetconfComponentFunction): log = globals()[netconf_constant.SERVICE_LOG] print(globals()) nc = NetconfClient(log, self, "netconf-connection") - nc.connect() + rr = ResolutionHelper(self) - payload = "DEMO" + payload = rr.resolve_and_generate_message_from_template_prefix("hostname") + nc.connect() response = nc.lock(message_id="lock-123") if not response.isSuccess(): log.error(response.errorMessage) - # nc.edit_config(message_id="edit-config-1", message_content=payload,edit_default_peration="none") + nc.edit_config(message_id="edit-config-1", message_content=payload, + edit_default_peration="none") # nc.validate(message_id="validate-123") # nc.discard_change(message_id="discard-123") - # nc.validate(message_id="validate-123") - # nc.commit(message_id="commit-123") - # nc.unlock(message_id="unlock-123") - # nc.disconnect() + nc.validate(message_id="validate-123") + nc.commit(message_id="commit-123") + nc.unlock(message_id="unlock-123") + nc.disconnect() except JavaException, err: log.error("Java Exception in the script {}", err) diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json new file mode 100644 index 000000000..1e02d6900 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "hostname", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "hostname", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl new file mode 100644 index 000000000..1e80b6d1c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl @@ -0,0 +1,7 @@ + + + + + $hostname + + diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 0bbcba97c..b59a7384b 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -25,6 +25,14 @@ "entry_schema": { "type": "string" } + }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } } }, "outputs": { @@ -43,5 +51,5 @@ } } }, - "derived_from": "tosca.nodes.Component" + "derived_from": "tosca.nodes.Component" } \ No newline at end of file diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py index 139597f9c..25244b13a 100644 --- a/components/scripts/python/ccsdk_netconf/common.py +++ b/components/scripts/python/ccsdk_netconf/common.py @@ -1,2 +1,25 @@ +# Copyright (c) 2019 Bell Canada. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +class ResolutionHelper: + def __init__(self, component_function): + self.component_function = component_function + + def resolve_and_generate_message_from_template_prefix(self, artifact_prefix): + return self.component_function.resolveAndGenerateMessage(artifact_prefix) + + def resolve_and_generate_message(self, artifact_mapping, artifact_template): + return self.component_function.resolveAndGenerateMessage(artifact_mapping, + artifact_template) diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index cdaf84092..341aae738 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,7 +1,6 @@ from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ CONFIG_DEFAULT_OPERATION_REPLACE - class NetconfClient: def __init__(self, log, component_function, requirement_name): @@ -28,7 +27,6 @@ class NetconfClient: def get_config(self, message_id, filter="", config_target=CONFIG_TARGET_RUNNING, message_timeout=30): - self.log.info("in the ncclient getConfig {}", message_id) device_response = self.netconf_rpc_client.getConfig(message_id, filter, config_target, message_timeout) -- cgit 1.2.3-korg From a69b9f500b4f15f78e468cce8561af193a7eb83b Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 18 Feb 2019 08:08:24 -0500 Subject: Simplify NetconfRpcService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6daac25c272ab6b437c07602167a76a2d61816db Issue-ID: CCSDK-790 Signed-off-by: Alexis de Talhouët --- .../Definitions/activation-blueprint.json | 8 +- .../Definitions/hostname-mapping.json | 13 + .../baseconfiguration/Definitions/node_types.json | 287 ++++++++++++++------- .../Definitions/resources_definition_types.json | 34 ++- .../Scripts/python/NetconfRpcExample.py | 16 +- .../Templates/hostname-mapping.json | 13 - .../node_type/component-netconf-executor.json | 30 ++- .../node_type/component-resource-resolution.json | 24 +- .../starter-type/node_type/source-capability.json | 16 -- .../starter-type/node_type/vnf-netconf-device.json | 2 +- .../starter-dictionary/hostname.json | 14 + .../scripts/python/ccsdk_netconf/netconfclient.py | 54 ++-- 12 files changed, 292 insertions(+), 219 deletions(-) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/hostname-mapping.json delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/hostname.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 162411f8d..c21f4c9d0 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -218,11 +218,9 @@ "primary": "component-script" }, "inputs": { + "script-type": "jython", + "script-class-reference": "Scripts/python/NetconfRpcExample.py", "instance-dependencies": [ - - ], - "artifact-prefix-names": [ - "hostname" ] }, "outputs": { @@ -247,7 +245,7 @@ }, "hostname-mapping": { "type": "artifact-mapping-resource", - "file": "Templates/hostname-mapping.json" + "file": "Definitions/hostname-mapping.json" }, "component-script": { "type": "artifact-script-jython", diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/hostname-mapping.json new file mode 100644 index 000000000..1e02d6900 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/hostname-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "hostname", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "hostname", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index d3093d9c3..3912a472d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -1,48 +1,44 @@ { "node_types": { - "dg-generic": { - "description": "This is Generic Directed Graph Type", + "component-jython-executor": { + "description": "This is Jython Execution Component.", "version": "1.0.0", - "properties": { - "content": { - "required": true, - "type": "string" - }, - "dependency-node-templates": { - "required": true, - "description": "Dependent Step Components", - "type": "list", - "entry_schema": { - "type": "string" + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentJythonExecutor": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "description": "Instance Names to Inject to Jython Script.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } } } }, - "derived_from": "tosca.nodes.DG" - }, - "tosca.nodes.Component": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.DG": { - "description": "This is Directed Graph Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.ResourceSource" : { - "description" : "TOSCA base type for Resource Sources", - "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" - }, - "tosca.nodes.Vnf" : { - "description" : "This is VNF Node Type", - "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" - }, - "tosca.nodes.component.Jython": { - "description": "This is Resource Assignment Jython Component API", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" + "derived_from": "tosca.nodes.component.Jython" }, "component-netconf-executor": { "description": "This is Netconf Transaction Configuration Component API", @@ -64,17 +60,29 @@ "operations": { "process": { "inputs": { - "instance-dependencies": { - "description": "Instance Names to Inject to Jython Script.", + "script-type": { + "description": "Script type, kotlin type is supported", "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } + "type": "string", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython", + "internal" + ] + } + ], + "default": "internal" }, - "artifact-prefix-names": { - "required": false, - "description": "Template , Resource Assignment Artifact Prefix names", + "script-class-reference": { + "description": "Kotlin Script class name or jython script name.", + "required": true, + "type": "string" + }, + "instance-dependencies": { + "description": "Instance names to inject to Jython or Kotlin Script.", + "required": true, "type": "list", "entry_schema": { "type": "string" @@ -108,37 +116,43 @@ "type": "string" } }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, "interfaces": { "ResourceResolutionComponent": { "operations": { "process": { "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, "resource-type": { + "description": "Request type.", "required": false, "type": "string" }, + "artifact-prefix-names": { + "description": "Template , Resource Assignment Artifact Prefix names", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "description": "Request Id, Unique Id for the request.", "required": true, "type": "string" }, "resource-id": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, + "description": "Resource Id.", + "required": false, "type": "string" }, - "artifact-prefix-names": { + "action-name": { + "description": "Action Name of the process", "required": false, - "description": "Template , Resource Assignment Artifact Prefix names", - "type": "list", - "entry_schema": { - "type": "string" - } + "type": "string" } }, "outputs": { @@ -157,45 +171,128 @@ }, "derived_from": "tosca.nodes.Component" }, - "component-jython-executor": { - "description": "This is Jython Execution Component.", + "dg-generic": { + "description": "This is Generic Directed Graph Type", "version": "1.0.0", - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" + "properties": { + "content": { + "required": true, + "type": "string" + }, + "dependency-node-templates": { + "description": "Dependent Step Components NodeTemplate name.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } } }, - "interfaces": { - "ComponentJythonExecutor": { - "operations": { - "process": { - "inputs": { - "instance-dependencies": { - "required": true, - "description": "Instance Names to Inject to Jython Script.", - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "response-data": { - "description": "Execution Response Data in JSON format.", - "required": false, - "type": "string" - }, - "status": { - "description": "Status of the Component Execution ( success or failure )", - "required": true, - "type": "string" - } - } + "derived_from": "tosca.nodes.DG" + }, + "source-input": { + "description": "This is Input Resource Source Node Type", + "version": "1.0.0", + "properties": { + "key": { + "required": false, + "type": "string" + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" + }, + "source-rest": { + "description": "This is Rest Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": false, + "type": "string", + "constraints": [ + { + "valid_values": [ + "JSON" + ] + } + ], + "default": "JSON" + }, + "url-path": { + "required": true, + "type": "string" + }, + "path": { + "required": true, + "type": "string" + }, + "expression-type": { + "required": false, + "type": "string", + "constraints": [ + { + "valid_values": [ + "JSON_PATH", + "JSON_POINTER" + ] } + ], + "default": "JSON_PATH" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" } } }, - "derived_from": "tosca.nodes.component.Jython" + "derived_from": "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component": { + "description": "This is default Component Node", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.DG": { + "description": "This is Directed Graph Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource": { + "description": "TOSCA base type for Resource Sources", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.Vnf": { + "description": "This is VNF Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "tosca.nodes.component.Jython": { + "description": "This is Jython Component", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" }, "vnf-netconf-device": { "description": "This is VNF Device with Netconf Capability", @@ -215,7 +312,7 @@ "default": "sdnc-tacacs" }, "source": { - "required": true, + "required": false, "type": "string", "default": "npm" }, diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json index d2d32e81e..ace1a9425 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -1,35 +1,41 @@ { + "hostname": { + "tags": "hostname", + "name": "hostname", + "property": { + "description": "hostname", + "type": "string" + }, + "updated-by": "Singal, Kapil ", + "sources": { + "input": { + "type": "source-input" + } + } + }, "service-instance-id": { - "name": "service-instance-id", "tags": "service-instance-id, tosca.datatypes.Root, data_type", - "updated-by": "Singal, Kapil ", + "name": "service-instance-id", "property": { "description": "To be provided", "type": "string" }, + "updated-by": "Singal, Kapil ", "sources": { "input": { "type": "source-input", "properties": {} - }, - "capability": { - "type": "source-capability", - "properties": { - "type": "JYTHON-COMPONENT", - "instance-name": "SampleRAProcessor", - "instance-dependencies": [] - } } } }, "vnf-id": { - "name": "vnf-id", "tags": "vnf-id", - "updated-by": "Singal, Kapil ", + "name": "vnf-id", "property": { "description": "vnf-id", "type": "string" }, + "updated-by": "Singal, Kapil ", "sources": { "input": { "type": "source-input", @@ -38,13 +44,13 @@ } }, "vnf_name": { - "name": "vnf_name", "tags": "vnf_name", - "updated-by": "Singal, Kapil ", + "name": "vnf_name", "property": { "description": "vnf_name", "type": "string" }, + "updated-by": "Singal, Kapil ", "sources": { "primary-config-data": { "type": "source-rest", diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py index 26c66b667..94cd72a48 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py @@ -15,6 +15,7 @@ import netconf_constant from common import ResolutionHelper from java.lang import Exception as JavaException +from netconfclient import NetconfClient from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \ NetconfComponentFunction @@ -31,17 +32,16 @@ class NetconfRpcExample(NetconfComponentFunction): payload = rr.resolve_and_generate_message_from_template_prefix("hostname") nc.connect() - response = nc.lock(message_id="lock-123") + response = nc.lock() if not response.isSuccess(): log.error(response.errorMessage) - nc.edit_config(message_id="edit-config-1", message_content=payload, - edit_default_peration="none") - # nc.validate(message_id="validate-123") - # nc.discard_change(message_id="discard-123") - nc.validate(message_id="validate-123") - nc.commit(message_id="commit-123") - nc.unlock(message_id="unlock-123") + nc.edit_config(message_content=payload, edit_default_peration="none") + nc.validate() + nc.discard_change() + nc.validate() + nc.commit() + nc.unlock() nc.disconnect() except JavaException, err: diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json deleted file mode 100644 index 1e02d6900..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "name": "hostname", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "hostname", - "dictionary-source": "input", - "dependencies": [ - ] - } -] diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index b59a7384b..85b69b09d 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -18,17 +18,29 @@ "operations": { "process": { "inputs": { - "instance-dependencies": { + "script-type": { + "description": "Script type, kotlin type is supported", "required": true, - "description": "Instance Names to Inject to Jython Script.", - "type": "list", - "entry_schema": { - "type": "string" - } + "type": "string", + "default": "internal", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython", + "internal" + ] + } + ] }, - "artifact-prefix-names": { - "required": false, - "description": "Template , Resource Assignment Artifact Prefix names", + "script-class-reference": { + "description": "Kotlin Script class name or jython script name.", + "required": true, + "type": "string" + }, + "instance-dependencies": { + "required": true, + "description": "Instance names to inject to Jython or Kotlin Script.", "type": "list", "entry_schema": { "type": "string" diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json index d01660efc..7e3065ae2 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json @@ -17,31 +17,13 @@ "operations": { "process": { "inputs": { - "template-name": { - "description": "Service Template Name.", - "required": true, - "type": "string" - }, - "template-version": { - "description": "Service Template Version.", - "required": true, - "type": "string" - }, "resource-type": { "description": "Request type.", - "required": true, + "required": false, "type": "string" }, - "template-names": { - "description": "Name of the artifact Node Templates, to get the template Content.", - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - }, "artifact-prefix-names": { - "required": false, + "required": true, "description": "Template , Resource Assignment Artifact Prefix names", "type": "list", "entry_schema": { @@ -50,7 +32,7 @@ }, "request-id": { "description": "Request Id, Unique Id for the request.", - "required": false, + "required": true, "type": "string" }, "resource-id": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json index 2bdd7d574..4d9488cbc 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json @@ -29,22 +29,6 @@ "type": "string" } }, - "input-key-mapping": { - "description": "Context name to input parameters name mapping.", - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "description": "Context name to output parameters name mapping.", - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, "key-dependencies": { "description": "Resource Resolution dependency dictionary names.", "required": true, diff --git a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json index c6f512dfb..dcc47b362 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json +++ b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json @@ -16,7 +16,7 @@ "default": "sdnc-tacacs" }, "source": { - "required": true, + "required": false, "type": "string", "default": "npm" }, diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/hostname.json b/components/model-catalog/resource-dictionary/starter-dictionary/hostname.json new file mode 100755 index 000000000..f60751edc --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/hostname.json @@ -0,0 +1,14 @@ +{ + "name": "hostname", + "tags": "hostname", + "updated-by" : "Singal, Kapil ", + "property": { + "description" : "hostname", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input" + } + } +} diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index 341aae738..dd7d2dc22 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,6 +1,7 @@ from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ CONFIG_DEFAULT_OPERATION_REPLACE + class NetconfClient: def __init__(self, log, component_function, requirement_name): @@ -19,54 +20,33 @@ class NetconfClient: self.netconf_session.connect() return - def lock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.lock(message_id, config_target, - message_timeout) + def lock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.lock(config_target) return device_response - def get_config(self, message_id, filter="", - config_target=CONFIG_TARGET_RUNNING, message_timeout=30): - device_response = self.netconf_rpc_client.getConfig(message_id, filter, - config_target, - message_timeout) + def get_config(self, filter="", config_target=CONFIG_TARGET_RUNNING): + device_response = self.netconf_rpc_client.getConfig(filter, config_target) return device_response - def edit_config(self, message_id, message_content, lock=False, - config_target=CONFIG_TARGET_CANDIDATE, - edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE, - deleteConfig=False, validate=False, commit=False, discard_change=False, - unlock=False, message_timeout=30): - device_response = self.netconf_rpc_client.editConfig(message_id, - message_content, lock, + def edit_config(self, message_content, config_target=CONFIG_TARGET_CANDIDATE, + edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE): + device_response = self.netconf_rpc_client.editConfig(message_content, config_target, - edit_default_peration, - deleteConfig, validate, - commit, discard_change, - unlock, - message_timeout) + edit_default_peration) return device_response - def commit(self, message_id, discard_change=True, - message_timeout=30): - device_response = self.netconf_rpc_client.commit(message_id, discard_change, - message_timeout) + def commit(self): + device_response = self.netconf_rpc_client.commit() return device_response - def unlock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.unLock(message_id, config_target, - message_timeout) + def unlock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.unLock(config_target) return device_response - def validate(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.validate(message_id, - config_target, - message_timeout) + def validate(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.validate(config_target) return device_response - def discard_change(self, message_id, message_timeout=30): - device_response = self.netconf_rpc_client.discardConfig(message_id, - message_timeout) + def discard_change(self): + device_response = self.netconf_rpc_client.discardConfig() return device_response -- cgit 1.2.3-korg From e0f3198bffd8c5f4945ce0bb91ef3024b5996bbc Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 18 Feb 2019 15:10:25 -0500 Subject: Add component function scripting service Change-Id: I7c5b49617823dd623566fb4be4d431012420e17c Issue-ID: CCSDK-959 Signed-off-by: Muthuramalingam, Brinda Santh --- .../baseconfiguration/Environments/source-rest.properties | 9 +++++++++ .../definition-type/starter-type/node_type/source-rest.json | 4 ++++ .../resource-dictionary/starter-dictionary/mdsal-source.json | 1 + components/parent/pom.xml | 1 + 4 files changed, 15 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-rest.properties (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-rest.properties b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-rest.properties new file mode 100644 index 000000000..37bad8d0a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-rest.properties @@ -0,0 +1,9 @@ +blueprintsprocessor.restclient.primary-config-data.type=basic-auth +blueprintsprocessor.restclient.primary-config-data.url=http://127.0.0.1:9111 +blueprintsprocessor.restclient.primary-config-data.userId=sampleuser +blueprintsprocessor.restclient.primary-config-data.token=sampletoken + +blueprintsprocessor.restclient.primary-config-data1.type=basic-auth +blueprintsprocessor.restclient.primary-config-data1.url=http://127.0.0.1:9111 +blueprintsprocessor.restclient.primary-config-data1.userId=sampleuser +blueprintsprocessor.restclient.primary-config-data1.token=sampletoken \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json index f8dd8b6fc..044983040 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json @@ -14,6 +14,10 @@ } ] }, + "endpoint-selector": { + "required": false, + "type": "string" + }, "url-path": { "required": true, "type": "string" diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json index 67661ecd0..ee67b9256 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json @@ -11,6 +11,7 @@ "type": "source-rest", "properties": { "type": "JSON", + "endpoint-selector" : "", "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type", "path": "/v4-assigned-ip-list/0/v4-ip-prefix", "input-key-mapping": { diff --git a/components/parent/pom.xml b/components/parent/pom.xml index 761b0fad7..94a06a1fd 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -29,6 +29,7 @@ Components Parent pom + 1.8 2.1.2.RELEASE 5.1.4.RELEASE 1.3.20 -- cgit 1.2.3-korg From f926e302a848923aeb07ee336ddaf335d4e99fa1 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Wed, 20 Feb 2019 11:34:23 -0500 Subject: Add dsl model definition Change-Id: Ic2332e32d142f231cc8a3a25e2528cde455da827 Issue-ID: CCSDK-1095 Signed-off-by: Muthuramalingam, Brinda Santh Signed-off-by: Balazinski --- .../baseconfiguration/Definitions/activation-blueprint.json | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index c21f4c9d0..138260fed 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -24,6 +24,15 @@ "file": "Definitions/policy_types.json" } ], + "dsl_definitions" : { + "dynamic-rest-source": { + "type" : "basic-type", + "url" : "http://localhost:8080", + "userId" : { + "get_input": "rest-user-name" + } + } + }, "topology_template": { "inputs": { "request-id": { -- cgit 1.2.3-korg From 5d9772fbec43dd9f5b8a7de6192e4b8c8fe71c40 Mon Sep 17 00:00:00 2001 From: Rodrigo Ottero Date: Thu, 28 Feb 2019 14:08:55 +0000 Subject: *WIP*: draft of a blueprint for configuring a PNF This is a still-in-development draft of a blueprint, intended to be used to configure PNFs. It has been put in review as requested, to make easier for the community to make comments on it. The design considers that a blueprint will be created for each possible PNF. In some files, there are questions about the structure or content. The- se questions are surrounded by HTML comment tags , even if the file itself is not HTML - the intent is just to clearly highlight the questions. All of them are preceded by the string "QUESTION", to facil- itate search. Change-Id: Ib3ed2afb80693429dc23b7ac73c5cbe49b3f5c9a Issue-ID: CCSDK-1107 Signed-off-by: Rodrigo Ottero --- .../Definitions/activation-blueprint.json | 228 +++++++++++++++++++++ .../Definitions/artifact_types.json | 28 +++ .../Definitions/data_types.json | 23 +++ .../Definitions/node_types.json | 168 +++++++++++++++ .../Definitions/policy_types.json | 3 + .../Definitions/relationship_types.json | 9 + .../Definitions/resources_definition_types.json | 16 ++ .../Plans/CONFIG_configAssign.xml | 19 ++ .../capability_restconf/Plans/CONFIG_configure.xml | 19 ++ .../Scripts/RestconfAssignConfig.kts | 1 + .../Scripts/RestconfConfigure.kts | 1 + .../capability_restconf/TOSCA-Metada/TOSCA.meta | 5 + .../Templates/config-assign-pnf-mapping.json | 16 ++ .../config-assign-restconf-configlet-template.vtl | 19 ++ .../Templates/configure-pnf-mapping.json | 38 ++++ .../configure-restconf-mount-template.vtl | 14 ++ .../configure-restconf-unmount-template.vtl | 1 + 17 files changed, 608 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json new file mode 100644 index 000000000..96ae88e59 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json @@ -0,0 +1,228 @@ + +{ + "tosca_definitions_version" : "controller_blueprint_1_0_0", + "metadata" : { + "template_author" : "Rodrigo Ottero", + "author-email" : "rodrigo.ottero@est.tech", + "user-groups" : "ADMIN, OPERATION", + "template_name" : "pnf restconf", + "template_version" : "1.0.0", + "template_tags" : "pnf, restconf, config, configuration" + }, + "imports" : [ { + "file" : "Definitions/data_types.json" + }, { + "file" : "Definitions/relationship_types.json" + }, { + "file" : "Definitions/artifact_types.json" + }, { + "file" : "Definitions/node_types.json" + }, { + "file" : "Definitions/policy_types.json" + } ], + "topology_template" : { + "inputs" : { + "serviceInstanceId" : { + "required" : true, + "type" : "string" + }, + "identifier" : { + "required" : true, + "type" : "string" + } + }, + "workflows" : { + "config-assign" : { + "steps" : { + "activate-process" : { + "description" : "Create a configlet", + "target" : "config-assign-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "config-assign-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(config-assign).", + "required" : true, + "type" : "dt-config-assign-properties" + } + } + }, + "configure" : { + "steps" : { + "activate-process" : { + "description" : "Send a configlet to the pnf", + "target" : "configure-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "configure-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(configure).", + "required" : true, + "type" : "dt-configure-properties" + } + } + } + }, + "node_templates" : { + "config-assign-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-config-assign-process" ] + }, + "dependency-node-templates" : [ "config-assign" ] + }, + "artifacts" : { + "dg-config-assign-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/CONFIG_configAssign.xml" + } + } + }, + "config-assign" : { + "type" : "component-restconf-executor", + "requirements" : { + "restconf-connection" : { + "capability" : "restconf", + "node" : "sample-restconf-server", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentRestconfExecutor" : { + "operations" : { + "process" : { + "implementation" : { + "primary" : "component-script" + }, + "inputs" : { + "script-type" : "kotlin", + "script-class-reference" : "Scripts/kotlin/RestconfAssignConfig.kts", + "instance-dependencies" : [ ], + "artifact-prefix-names": [ + "config-assign" + ] + }, + "outputs" : { + "response-data" : "", + "status" : "" + } + } + } + } + }, + "artifacts" : { + "config-assign-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/config-assign-restconf-configlet-template.vtl" + }, + "config-assign-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/config-assign-pnf-mapping.json" + }, + "component-script" : { + "type" : "artifact-script-kotlin", + "file" : "Scripts/kotlin/RestconfAssignConfig.py" + } + } + }, + "configure-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-configure-process" ] + }, + "dependency-node-templates" : [ "configure" ] + }, + "artifacts" : { + "dg-config-assign-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/CONFIG_configure.xml" + } + } + }, + "configure" : { + "type" : "component-restconf-executor", + "requirements" : { + "restconf-connection" : { + "capability" : "restconf", + "node" : "sample-restconf-server", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentRestconfExecutor" : { + "operations" : { + "process" : { + "implementation" : { + "primary" : "component-script" + }, + "inputs" : { + "script-type" : "kotlin", + "script-class-reference" : "Scripts/kotlin/RestconfConfigure.kts", + "instance-dependencies" : [ ], + "artifact-prefix-names": [ + "configure-restconf-mount", "configure-restconf-unmount" + ] + }, + "outputs" : { + "response-data" : "", + "status" : "" + } + } + } + } + }, + "artifacts" : { + "configure-mount-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/configure-restconf-mount-template.vtl" + }, + "configure-unmount-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/configure-restconf-unmount-template.vtl" + }, + "configure-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/configure-pnf-mapping.json" + }, + "component-script" : { + "type" : "artifact-script-kotlin", + "file" : "Scripts/kotlin/RestconfConfigure.py" + } + } + }, + "sample-restconf-device" : { + "type" : "pnf-netconf-device", + "capabilities" : { + "restconf" : { + "properties" : { + "login-key" : { + "get_input" : "password" + }, + "login-account" : { + "get_input" : "username" + }, + "target-ip-address" : { + "get_input" : "ip" + }, + "port-number" : 830, + "connection-time-out" : 5 + } + } + } + } + } + } +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json new file mode 100644 index 000000000..aa5295e44 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/artifact_types.json @@ -0,0 +1,28 @@ +{ + "artifact_types" : { + "artifact-directed-graph" : { + "description" : "Directed Graph File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json", "xml" ] + }, + "artifact-mapping-resource" : { + "description" : "Resource Mapping File used along with Configuration template", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json" ] + }, + "artifact-script-jython" : { + "description" : "Jython Script File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "py" ] + }, + "artifact-template-velocity" : { + "description" : " Velocity Template used for Configuration", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "vtl" ] + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json new file mode 100644 index 000000000..d9153f3f0 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json @@ -0,0 +1,23 @@ +{ + "data_types" : { + "dt-assign-activate-properties" : { + "description" : "Dynamic DataType definition for workflow(assign-activate).", + "version" : "1.0.0", + "properties" : { + "hostname" : { + "type" : "string" + }, + "ip": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json new file mode 100644 index 000000000..c8e3e6a93 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json @@ -0,0 +1,168 @@ +{ + "node_types" : { + "component-restconf-executor" : { + "description" : "This is Restconf Configuration Component API", + "version" : "1.0.0", + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "requirements" : { + "restconf-connection" : { + "capability" : "restconf", + "node" : "pnf-restconf-device", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentRestconfExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "script-type" : { + "description" : "Script type, kotlin type is supported", + "required" : true, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "kotlin", "jython", "internal" ] + } ], + "default" : "internal" + }, + "script-class-reference" : { + "description" : "Kotlin Script class name or jython script name.", + "required" : true, + "type" : "string" + }, + "instance-dependencies" : { + "description" : "Instance names to inject to Jython or Kotlin Script.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "outputs" : { + "response-data" : { + "description" : "Execution Response Data in JSON format.", + "required" : false, + "type" : "string" + }, + "status" : { + "description" : "Status of the Component Execution ( success or failure )", + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "dg-generic" : { + "description" : "This is Generic Directed Graph Type", + "version" : "1.0.0", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + }, + "dependency-node-templates" : { + "description" : "Dependent Step Components NodeTemplate name.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.DG" + }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Pnf": { + "description": "This is the PNF Node Type", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "pnf-restconf-device" : { + "description" : "This is a PNF Device with Restconf Capability", + "version" : "1.0.0", + "capabilities" : { + "netconf" : { + "type" : "tosca.capabilities.Restconf", + "properties" : { + "login-key" : { + "required" : true, + "type" : "string", + "default" : "sdnc" + }, + "login-account" : { + "required" : true, + "type" : "string", + "default" : "sdnc-tacacs" + }, + "source" : { + "required" : false, + "type" : "string", + "default" : "npm" + }, + "target-ip-address" : { + "required" : true, + "type" : "string" + }, + "port-number" : { + "required" : true, + "type" : "integer", + "default" : 830 + }, + "connection-time-out" : { + "required" : false, + "type" : "integer", + "default" : 30 + } + } + } + }, + "derived_from" : "tosca.nodes.Pnf" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json new file mode 100644 index 000000000..1e44cc70a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json new file mode 100644 index 000000000..027bfc0fc --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json @@ -0,0 +1,9 @@ +{ + "relationship_types" : { + "tosca.relationships.ConnectsTo" : { + "description" : "Relationship tosca.relationships.ConnectsTo", + "version" : "1.0.0", + "derived_from" : "tosca.relationships.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json new file mode 100644 index 000000000..b77f451ad --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json @@ -0,0 +1,16 @@ +{ + "hostname" : { + "tags" : "hostname", + "name" : "hostname", + "property" : { + "description" : "hostname", + "type" : "string" + }, + "updated-by" : "Singal, Kapil ", + "sources" : { + "input" : { + "type" : "source-input" + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml new file mode 100644 index 000000000..417f72de9 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml new file mode 100644 index 000000000..94fe6dde0 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts new file mode 100644 index 000000000..a0990367e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts @@ -0,0 +1 @@ +TBD diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts new file mode 100644 index 000000000..a0990367e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts @@ -0,0 +1 @@ +TBD diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta new file mode 100644 index 000000000..6ac9caf57 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Rodrigo Ottero +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: activation-blueprint diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json new file mode 100644 index 000000000..85533abc5 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json @@ -0,0 +1,16 @@ + +[ + { + "name": "odl_host", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "odl_host", + "dictionary-source": "capability", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl new file mode 100644 index 000000000..e3d7a6716 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl @@ -0,0 +1,19 @@ + +example-patch +Example patch + + edit1 + create + /car-entry + + + 0 + + + + + edit2 + delete + /car-entry/0 + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json new file mode 100644 index 000000000..123680c0c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json @@ -0,0 +1,38 @@ + +[ + { + "name": "pnf_id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "pnf_id", + "dictionary-source": "capability", + "dependencies": [ + ] + }, + { + "name": "pnf_ip", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "pnf_ip", + "dictionary-source": "capability", + "dependencies": [ + ] + }, + { + "name": "pnf_ip_port", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "pnf_ip_port", + "dictionary-source": "capability", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl new file mode 100644 index 000000000..17f7a3679 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl @@ -0,0 +1,14 @@ + + $pnf_id + + ODL-private-key + netconf + + $pnf_ip + $pnf_ip_port + false + + TLS + + 2 + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl new file mode 100644 index 000000000..a0990367e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl @@ -0,0 +1 @@ +TBD -- cgit 1.2.3-korg From 9c08b516cca8a42560a3302eaf663d3c248c4a53 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 25 Feb 2019 16:03:16 -0500 Subject: Get DSL Property in Resource Resolution Change-Id: I768c2515bc4b0eaa829213ac4d045628ca960adb Issue-ID: CCSDK-1106 Signed-off-by: Muthuramalingam, Brinda Santh --- .../starter-type/node_type/source-capability.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json index 4d9488cbc..e0c440649 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json @@ -2,22 +2,22 @@ "description": "This is Component Resource Source Node Type", "version": "1.0.0", "properties": { - "type": { + "script-type": { "required": true, "type": "string", - "default": "KOTLIN-COMPONENT", + "default": "kotlin", "constraints": [ { "valid_values": [ - "KOTLIN-COMPONENT", - "JAVA-COMPONENT", - "JYTHON-COMPONENT" + "kotlin", + "internal", + "jython" ] } ] }, - "instance-name": { - "description": "Capability component instance reference name for JAVA-COMPONENT, Script Class name for KOTLIN-COMPONENT.", + "script-class-reference": { + "description": "Capability reference name for internal and kotlin, for jython script file path", "required": true, "type": "string" }, -- cgit 1.2.3-korg From e950b19db14ee325416f8e73420d682d07e5e6cf Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Thu, 28 Feb 2019 08:59:20 -0500 Subject: Adjust python script for resource-assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie96b4dc99c4da461a5fe7dfb424fdec6c221f9e0 Issue-ID: CCSDK-1091 Signed-off-by: Alexis de Talhouët --- .../Scripts/python/SampleRAProcessor.py | 22 ++------- .../ccsdk_blueprints/abstract_ra_processor.py | 56 +++++++--------------- .../sample_ra_processor_function.py | 10 ++-- 3 files changed, 26 insertions(+), 62 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py index 30b9ff951..acf12b333 100755 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Scripts/python/SampleRAProcessor.py @@ -7,23 +7,11 @@ class SampleRAProcessor(AbstractRAProcessor): def __init__(self): AbstractRAProcessor.__init__(self) - def process(self, execution_request): - - AbstractRAProcessor.process(self, execution_request) - print "Processing calling..." + PROPERTY_BLUEPRINT_BASE_PATH - if self.ra_valid is True: - value = self.resolve_values_script(execution_request, self.value_to_resolve) - self.set_resource_data_value(execution_request, value) - else: - raise BluePrintProcessorException("Error on resource assignment. Message = " + self.error_message) + def process(self, resource_assignment): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + self.set_resource_data_value(resource_assignment, "") return None - def recover(self, runtime_exception, execution_request): - AbstractRAProcessor.recover(self, runtime_exception, execution_request) - print "Recovering calling..." + PROPERTY_BLUEPRINT_BASE_PATH + def recover(self, runtime_exception, resource_assignment): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH return None - - def resolve_values_script(self, execution_request, value_to_resolve): - # TODO : DO business logic here - print "Resolve value for " + value_to_resolve + " here..." - return "test_python" diff --git a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py index 2cacaf526..6489b1e73 100644 --- a/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py +++ b/components/scripts/python/ccsdk_blueprints/abstract_ra_processor.py @@ -1,49 +1,29 @@ -from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import ResourceAssignmentProcessor -from blueprint_constants import * -from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils import ResourceAssignmentUtils -from org.onap.ccsdk.apps.controllerblueprints.core import BluePrintProcessorException -from java.lang import Exception +from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import \ + ResourceAssignmentProcessor +from org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils import \ + ResourceAssignmentUtils +from org.onap.ccsdk.apps.controllerblueprints.core import \ + BluePrintProcessorException class AbstractRAProcessor(ResourceAssignmentProcessor): - def __init__(self): - ResourceAssignmentProcessor.__init__(self) - self.status = PROPERTY_BLUEPRINT_STATUS_SUCCESS - self.error_message = None - self.ra_valid = False - self.value_to_resolve = None - - def process(self, execution_request): - print "Processing calling from parent..." - try: - self.ra_valid = self.validate(execution_request) - self.value_to_resolve = execution_request.name - except Exception, e: - self.status = PROPERTY_BLUEPRINT_STATUS_FAILURE - self.error_message = "Get Running python scripting Failure :" + e.getMessage() + def process(self, resource_assignment): + print "Processing.." + return None - def recover(self, runtime_exception, execution_request): - print "Recovering calling from parent.." + def recover(self, runtime_exception, resource_assignment): + print "Recovering.." return None - def set_resource_data_value(self, execution_request, value): + def set_resource_data_value(self, resource_assignment, value): try: if value is not None: - ResourceAssignmentUtils.Companion.setResourceDataValue(execution_request, self.raRuntimeService, value) + ResourceAssignmentUtils.Companion.setResourceDataValue( + resource_assignment, self.raRuntimeService, value) else: - ResourceAssignmentUtils.Companion.setFailedResourceDataValue(execution_request, "Fail to resole value") + ResourceAssignmentUtils.Companion.setFailedResourceDataValue( + resource_assignment, "Fail to resolve value") except BluePrintProcessorException, err: - raise BluePrintProcessorException("Error on resource assignment. Message = " + err.message) - - return None - - @staticmethod - def validate(ra): - if ra.name is None or ra.name is None: - raise Exception("Failed getting value for template key (" + ra.name + ") and " + - "dictionary key (" + ra.dictionaryName + - ") of type (" + ra.type + ")") - else: - pass - return True + raise BluePrintProcessorException( + "Error on resource assignment. Message = " + err.message) diff --git a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py index 6ec5d82ab..fa821082e 100644 --- a/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py +++ b/components/scripts/python/ccsdk_blueprints/sample_ra_processor_function.py @@ -4,15 +4,11 @@ from blueprint_constants import * class SampleRAProcessorFunction(AbstractRAProcessor): - def __init__(self): - AbstractRAProcessor.__init__(self) - - def process(self, execution_request): - AbstractRAProcessor.process(self, execution_request) + def process(self, resource_assignment): print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + self.set_resource_data_value(resource_assignment, "") return None - def recover(self, runtime_exception, execution_request): - AbstractRAProcessor.recover(self, runtime_exception, execution_request) + def recover(self, runtime_exception, resource_assignment): print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH return None -- cgit 1.2.3-korg From 2028db8399fd7afa55cb129beef501994753cb63 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 4 Mar 2019 10:22:04 -0500 Subject: Define EventType contract for gRPC message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic8bde56d13f774120c8d64a56993ade71e7b4612 Issue-ID: CCSDK-1118 Signed-off-by: Alexis de Talhouët --- .../model-catalog/proto-definition/proto/BluePrintCommon.proto | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/proto/BluePrintCommon.proto b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto index 0f17783aa..de92bdc1c 100644 --- a/components/model-catalog/proto-definition/proto/BluePrintCommon.proto +++ b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto @@ -26,6 +26,13 @@ message Status { int32 code = 1; string errorMessage = 2; string message = 3; - string eventType = 4; + EventType eventType = 4; string timestamp = 5; +} + +enum EventType { + EVENT_COMPONENT_FAILURE = 0; + EVENT_COMPONENT_PROCESSING = 1; + EVENT_COMPONENT_NOTIFICATION = 2; + EVENT_COMPONENT_EXECUTED = 3; } \ No newline at end of file -- cgit 1.2.3-korg From d882d5ea5199cca12c246c1a184a8358892c7186 Mon Sep 17 00:00:00 2001 From: vinal patel Date: Wed, 20 Feb 2019 16:02:44 -0500 Subject: Ressource resolution using configurable database Change-Id: I8589e4db45ba3d5bcb906f25bcc76b5136159608 Issue-ID: CCSDK-1092 Signed-off-by: vinal patel --- .../Definitions/activation-blueprint.json | 11 +++++++++++ .../Definitions/resources_definition_types.json | 13 +++++++++++++ .../Environments/source-db.properties | 1 + .../starter-dictionary/service-instance-id.json | 22 ++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-db.properties (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 138260fed..6025dbd6d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -31,6 +31,17 @@ "userId" : { "get_input": "rest-user-name" } + }, + "dynamic-db-source": { + "type" : "maria-db", + "url" : "jdbc:mysql://localhost:3306/sdnctl", + "username" : "sdnctl", + "password" : { + "get_attribute": [ + "BPP", + "dynamic-db-source.password" + ] + } } }, "topology_template": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json index ace1a9425..eaf45b35f 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -25,6 +25,19 @@ "input": { "type": "source-input", "properties": {} + }, + "primary-db": { + "type": "source-primary-db", + "properties": { + "endpoint-selector": "dynamic-db-source", + "query": "SELECT artifact_name FROM sdnctl.BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": { + }, + "output-key-mapping": { + "service-instance-id": "artifact_name" + }, + "key-dependencies" : [] + } } } }, diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-db.properties b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-db.properties new file mode 100644 index 000000000..49a7eb47b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Environments/source-db.properties @@ -0,0 +1 @@ +dynamic-db-source.password=sdnctl \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json index 37b98687c..cb9704350 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json @@ -10,6 +10,28 @@ "input" : { "type" : "source-input", "properties" : { } + }, + "any-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": { + }, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": { + }, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } } } } \ No newline at end of file -- cgit 1.2.3-korg From 38e4e9267b7339c02767a8f2b38af85d8316ef1c Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Thu, 7 Mar 2019 11:23:17 -0500 Subject: Add support for resource-resolution storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0113191075804f6b77ce54c741bf0a1ccd356c77 Issue-ID: CCSDK-338 Signed-off-by: Alexis de Talhouët --- .../starter-type/node_type/component-netconf-executor.json | 5 +++++ .../starter-type/node_type/component-resource-resolution.json | 10 ++++++++++ components/scripts/python/ccsdk_netconf/common.py | 3 +++ 3 files changed, 18 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 85b69b09d..e5cb4cba0 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -33,6 +33,11 @@ } ] }, + "dynamic-properties": { + "description": "Resolvable dynamic property.", + "required": false, + "type": "string" + }, "script-class-reference": { "description": "Kotlin Script class name or jython script name.", "required": true, diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json index 7e3065ae2..5dbef4dcc 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json @@ -17,6 +17,16 @@ "operations": { "process": { "inputs": { + "resolution-key": { + "description": "Key for service instance related correlation.", + "required": false, + "type": "string" + }, + "store-result": { + "description": "Whether or not to store the output.", + "required": false, + "type": "boolean" + }, "resource-type": { "description": "Request type.", "required": false, diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py index 25244b13a..f161e29ff 100644 --- a/components/scripts/python/ccsdk_netconf/common.py +++ b/components/scripts/python/ccsdk_netconf/common.py @@ -23,3 +23,6 @@ class ResolutionHelper: def resolve_and_generate_message(self, artifact_mapping, artifact_template): return self.component_function.resolveAndGenerateMessage(artifact_mapping, artifact_template) + + def retrieve_resolved_template_from_database(self, key, artifact_template): + return self.component_function.resolveFromDatabase(key, artifact_template) -- cgit 1.2.3-korg From 8fb0ac2772263d922841661f50fee1ae821008a5 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Wed, 27 Feb 2019 20:16:47 -0500 Subject: Add blueprint runtime validator Change-Id: I9e2aa1aec392fc4191d547115fa90e8811f0f9e9 Issue-ID: CCSDK-1110 Signed-off-by: Muthuramalingam, Brinda Santh --- .../baseconfiguration/Definitions/node_types.json | 52 ++++++++++++++++++++++ .../starter-type/node_type/source-primary-db.json | 4 ++ 2 files changed, 56 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index 3912a472d..b2ba348a4 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -208,6 +208,54 @@ }, "derived_from": "tosca.nodes.ResourceSource" }, + "source-primary-db": { + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "endpoint-selector": { + "required": false, + "type": "string" + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" + }, "source-rest": { "description": "This is Rest Resource Source Node Type", "version": "1.0.0", @@ -224,6 +272,10 @@ ], "default": "JSON" }, + "endpoint-selector": { + "required": false, + "type": "string" + }, "url-path": { "required": true, "type": "string" diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json index 661a9503b..702748f8a 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-primary-db.json @@ -14,6 +14,10 @@ } ] }, + "endpoint-selector": { + "required": false, + "type": "string" + }, "query": { "required": true, "type": "string" -- cgit 1.2.3-korg From a1c4477bfe00531af77fb71e8a2c6066b165ae55 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 8 Mar 2019 16:57:08 -0500 Subject: Add JSON type validation and enrichment Change-Id: I479b8214c7979dd5bc28acac68f747f06f3f231e Issue-ID: CCSDK-1134 Signed-off-by: Muthuramalingam, Brinda Santh --- .../Definitions/activation-blueprint.json | 23 +++++++++++++--------- .../baseconfiguration/Definitions/node_types.json | 15 ++++++++++++++ .../node_type/component-jython-executor.json | 5 +++++ .../node_type/component-netconf-executor.json | 5 +++++ .../node_type/component-resource-resolution.json | 5 +++++ .../node_type/component-restconf-executor.json | 5 +++++ 6 files changed, 49 insertions(+), 9 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 6025dbd6d..7a9239819 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -24,19 +24,23 @@ "file": "Definitions/policy_types.json" } ], - "dsl_definitions" : { + "dsl_definitions": { + "dynamic-netconf-properties": { + "device-name": "netconf device", + "host-name": "sample-host" + }, "dynamic-rest-source": { - "type" : "basic-type", - "url" : "http://localhost:8080", - "userId" : { + "type": "basic-type", + "url": "http://localhost:8080", + "userId": { "get_input": "rest-user-name" } }, "dynamic-db-source": { - "type" : "maria-db", - "url" : "jdbc:mysql://localhost:3306/sdnctl", - "username" : "sdnctl", - "password" : { + "type": "maria-db", + "url": "jdbc:mysql://localhost:3306/sdnctl", + "username": "sdnctl", + "password": { "get_attribute": [ "BPP", "dynamic-db-source.password" @@ -241,7 +245,8 @@ "script-type": "jython", "script-class-reference": "Scripts/python/NetconfRpcExample.py", "instance-dependencies": [ - ] + ], + "dynamic-properties": "*dynamic-netconf-properties" }, "outputs": { "response-data": "", diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index b2ba348a4..8f6c44f94 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -20,6 +20,11 @@ "entry_schema": { "type": "string" } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { @@ -87,6 +92,11 @@ "entry_schema": { "type": "string" } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { @@ -153,6 +163,11 @@ "description": "Action Name of the process", "required": false, "type": "string" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json index af8aae12e..5a024a7d6 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json @@ -18,6 +18,11 @@ "entry_schema": { "type": "string" } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index e5cb4cba0..7e429c011 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -50,6 +50,11 @@ "entry_schema": { "type": "string" } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json index 5dbef4dcc..f437a79a9 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json @@ -54,6 +54,11 @@ "description": "Action Name of the process", "required": false, "type": "string" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json index 192ed2566..cb28a4a10 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-restconf-executor.json @@ -38,6 +38,11 @@ "entry_schema": { "type": "string" } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" } }, "outputs": { -- cgit 1.2.3-korg From 0df592839717bd316ee5d9e866418072ff543cd8 Mon Sep 17 00:00:00 2001 From: ottero Date: Mon, 11 Mar 2019 14:03:09 +0000 Subject: Blueprint for configuring a PNF This is the first version of a blueprint, intended to be used to configure PNFs. The design considers that a blueprint will be created for each possible PNF. Change-Id: I4994149441257eb417b6d5f611e12cd81595177f Issue-ID: CCSDK-1107 Signed-off-by: ottero --- .../Definitions/activation-blueprint.json | 73 +++++-------------- .../Definitions/data_types.json | 25 +++---- .../Definitions/node_types.json | 83 +--------------------- .../Definitions/relationship_types.json | 8 +-- .../Definitions/resources_definition_types.json | 17 +---- .../Plans/CONFIG_configAssign.xml | 4 -- .../capability_restconf/Plans/CONFIG_configure.xml | 4 -- .../Scripts/RestconfAssignConfig.kts | 1 - .../Scripts/RestconfConfigure.kts | 1 - .../Scripts/python/RestconfAssignConfig.py | 38 ++++++++++ .../Scripts/python/RestconfConfigure.py | 38 ++++++++++ .../capability_restconf/TOSCA-Metada/TOSCA.meta | 5 -- .../capability_restconf/TOSCA-Metadata/TOSCA.meta | 5 ++ .../Templates/config-assign-pnf-mapping.json | 15 +--- .../Templates/configure-pnf-mapping.json | 37 +--------- .../configure-restconf-mount-template.vtl | 8 +-- 16 files changed, 115 insertions(+), 247 deletions(-) delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json index 96ae88e59..90b2e3ab0 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json @@ -1,16 +1,10 @@ - { "tosca_definitions_version" : "controller_blueprint_1_0_0", "metadata" : { "template_author" : "Rodrigo Ottero", "author-email" : "rodrigo.ottero@est.tech", "user-groups" : "ADMIN, OPERATION", - "template_name" : "pnf restconf", + "template_name" : "configuration_over_restconf", "template_version" : "1.0.0", "template_tags" : "pnf, restconf, config, configuration" }, @@ -90,15 +84,10 @@ } } }, + + "config-assign" : { "type" : "component-restconf-executor", - "requirements" : { - "restconf-connection" : { - "capability" : "restconf", - "node" : "sample-restconf-server", - "relationship" : "tosca.relationships.ConnectsTo" - } - }, "interfaces" : { "ComponentRestconfExecutor" : { "operations" : { @@ -107,12 +96,9 @@ "primary" : "component-script" }, "inputs" : { - "script-type" : "kotlin", - "script-class-reference" : "Scripts/kotlin/RestconfAssignConfig.kts", - "instance-dependencies" : [ ], - "artifact-prefix-names": [ - "config-assign" - ] + "script-type" : "jython", + "script-class-reference" : "Scripts/python/RestconfAssignConfig.py", + "instance-dependencies" : [ ] }, "outputs" : { "response-data" : "", @@ -132,11 +118,14 @@ "file" : "Templates/config-assign-pnf-mapping.json" }, "component-script" : { - "type" : "artifact-script-kotlin", - "file" : "Scripts/kotlin/RestconfAssignConfig.py" + "type" : "artifact-script-jython", + "file" : "Scripts/python/RestconfAssignConfig.py" } } }, + + + "configure-process" : { "type" : "dg-generic", "properties" : { @@ -154,13 +143,6 @@ }, "configure" : { "type" : "component-restconf-executor", - "requirements" : { - "restconf-connection" : { - "capability" : "restconf", - "node" : "sample-restconf-server", - "relationship" : "tosca.relationships.ConnectsTo" - } - }, "interfaces" : { "ComponentRestconfExecutor" : { "operations" : { @@ -169,12 +151,9 @@ "primary" : "component-script" }, "inputs" : { - "script-type" : "kotlin", - "script-class-reference" : "Scripts/kotlin/RestconfConfigure.kts", - "instance-dependencies" : [ ], - "artifact-prefix-names": [ - "configure-restconf-mount", "configure-restconf-unmount" - ] + "script-type" : "jython", + "script-class-reference" : "Scripts/python/RestconfConfigure.py", + "instance-dependencies" : [ ] }, "outputs" : { "response-data" : "", @@ -198,28 +177,8 @@ "file" : "Templates/configure-pnf-mapping.json" }, "component-script" : { - "type" : "artifact-script-kotlin", - "file" : "Scripts/kotlin/RestconfConfigure.py" - } - } - }, - "sample-restconf-device" : { - "type" : "pnf-netconf-device", - "capabilities" : { - "restconf" : { - "properties" : { - "login-key" : { - "get_input" : "password" - }, - "login-account" : { - "get_input" : "username" - }, - "target-ip-address" : { - "get_input" : "ip" - }, - "port-number" : 830, - "connection-time-out" : 5 - } + "type" : "artifact-script-jython", + "file" : "Scripts/python/RestconfConfigure.py" } } } diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json index d9153f3f0..9f35eef88 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json @@ -1,22 +1,15 @@ { "data_types" : { - "dt-assign-activate-properties" : { - "description" : "Dynamic DataType definition for workflow(assign-activate).", + "dt-config-assign-properties" : { + "description" : "Dynamic DataType definition for workflow(config-assign).", "version" : "1.0.0", - "properties" : { - "hostname" : { - "type" : "string" - }, - "ip": { - "type": "string" - }, - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - }, + "properties" : { }, + "derived_from" : "tosca.datatypes.Dynamic" + }, + "dt-configure-properties" : { + "description" : "Dynamic DataType definition for workflow(configure).", + "version" : "1.0.0", + "properties" : { }, "derived_from" : "tosca.datatypes.Dynamic" } } diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json index c8e3e6a93..be3bd319a 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json @@ -1,20 +1,13 @@ { "node_types" : { "component-restconf-executor" : { - "description" : "This is Restconf Configuration Component API", + "description" : "This is Restconf Transaction Configuration Component API", "version" : "1.0.0", "capabilities" : { "component-node" : { "type" : "tosca.capabilities.Node" } }, - "requirements" : { - "restconf-connection" : { - "capability" : "restconf", - "node" : "pnf-restconf-device", - "relationship" : "tosca.relationships.ConnectsTo" - } - }, "interfaces" : { "ComponentRestconfExecutor" : { "operations" : { @@ -80,24 +73,6 @@ }, "derived_from" : "tosca.nodes.DG" }, - "source-input" : { - "description" : "This is Input Resource Source Node Type", - "version" : "1.0.0", - "properties" : { - "key" : { - "required" : false, - "type" : "string" - }, - "key-dependencies" : { - "required" : true, - "type" : "list", - "entry_schema" : { - "type" : "string" - } - } - }, - "derived_from" : "tosca.nodes.ResourceSource" - }, "tosca.nodes.Component" : { "description" : "This is default Component Node", "version" : "1.0.0", @@ -107,62 +82,6 @@ "description" : "This is Directed Graph Node Type", "version" : "1.0.0", "derived_from" : "tosca.nodes.Root" - }, - "tosca.nodes.ResourceSource" : { - "description" : "TOSCA base type for Resource Sources", - "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" - }, - "tosca.nodes.Vnf" : { - "description" : "This is VNF Node Type", - "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" - }, - "tosca.nodes.Pnf": { - "description": "This is the PNF Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" - }, - "pnf-restconf-device" : { - "description" : "This is a PNF Device with Restconf Capability", - "version" : "1.0.0", - "capabilities" : { - "netconf" : { - "type" : "tosca.capabilities.Restconf", - "properties" : { - "login-key" : { - "required" : true, - "type" : "string", - "default" : "sdnc" - }, - "login-account" : { - "required" : true, - "type" : "string", - "default" : "sdnc-tacacs" - }, - "source" : { - "required" : false, - "type" : "string", - "default" : "npm" - }, - "target-ip-address" : { - "required" : true, - "type" : "string" - }, - "port-number" : { - "required" : true, - "type" : "integer", - "default" : 830 - }, - "connection-time-out" : { - "required" : false, - "type" : "integer", - "default" : 30 - } - } - } - }, - "derived_from" : "tosca.nodes.Pnf" } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json index 027bfc0fc..4ddd7a57c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json @@ -1,9 +1,3 @@ { - "relationship_types" : { - "tosca.relationships.ConnectsTo" : { - "description" : "Relationship tosca.relationships.ConnectsTo", - "version" : "1.0.0", - "derived_from" : "tosca.relationships.Root" - } - } + "relationship_types" : { } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json index b77f451ad..6f31cf5a2 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json @@ -1,16 +1 @@ -{ - "hostname" : { - "tags" : "hostname", - "name" : "hostname", - "property" : { - "description" : "hostname", - "type" : "string" - }, - "updated-by" : "Singal, Kapil ", - "sources" : { - "input" : { - "type" : "source-input" - } - } - } -} \ No newline at end of file +{ } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml index 417f72de9..220cba9f7 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml @@ -1,7 +1,3 @@ - - diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml index 94fe6dde0..c48ffbed4 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml @@ -1,7 +1,3 @@ - - diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts deleted file mode 100644 index a0990367e..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts +++ /dev/null @@ -1 +0,0 @@ -TBD diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts deleted file mode 100644 index a0990367e..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts +++ /dev/null @@ -1 +0,0 @@ -TBD diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py new file mode 100644 index 000000000..36dd32ffc --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py @@ -0,0 +1,38 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + + +from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \ + RestconfComponentFunction + + +class RestconfAssignConfig(RestconfComponentFunction): + + + def process(self, execution_request): + # create instances of the needed objects + # retrieve any needed information not present on the request, like pnf ip + # create the configlet + # persist the configlet + # end + print("process", execution_request) + + + def recover(self, runtime_exception, execution_request): + print("recover") + return None \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py new file mode 100644 index 000000000..c584baa9b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py @@ -0,0 +1,38 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + + +from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \ + RestconfComponentFunction + + +class RestconfConfigure(RestconfComponentFunction): + + + def process(self, execution_request): + # create instances of the needed objects + # retrieve any needed information not present on the request, like pnf ip + # retrieve the configlet + # send the configlet + # end + print("process", execution_request) + + + def recover(self, runtime_exception, execution_request): + print("recover") + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta deleted file mode 100644 index 6ac9caf57..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta +++ /dev/null @@ -1,5 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Rodrigo Ottero -Entry-Definitions: Definitions/activation-blueprint.json -Template-Tags: activation-blueprint diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..6ac9caf57 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Rodrigo Ottero +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: activation-blueprint diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json index 85533abc5..41b42e677 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json @@ -1,16 +1,3 @@ - [ - { - "name": "odl_host", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "odl_host", - "dictionary-source": "capability", - "dependencies": [ - ] - } + ] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json index 123680c0c..41b42e677 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json @@ -1,38 +1,3 @@ - [ - { - "name": "pnf_id", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "pnf_id", - "dictionary-source": "capability", - "dependencies": [ - ] - }, - { - "name": "pnf_ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "pnf_ip", - "dictionary-source": "capability", - "dependencies": [ - ] - }, - { - "name": "pnf_ip_port", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "pnf_ip_port", - "dictionary-source": "capability", - "dependencies": [ - ] - } + ] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl index 17f7a3679..a899aa45c 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl @@ -1,14 +1,14 @@ - $pnf_id + $pnf-id ODL-private-key netconf - $pnf_ip - $pnf_ip_port + $pnf-ip + 6513 false TLS - 2 + 5 -- cgit 1.2.3-korg From 9e6da2d51f8c45aa3fdd1d3a5c535bd98119e8c5 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 11 Mar 2019 11:41:37 -0400 Subject: Refractor processor core module name Change-Id: Ic4a40d6cbc5e53e79ddc36bea529fe16f6210a26 Issue-ID: CCSDK-1136 Signed-off-by: Muthuramalingam, Brinda Santh --- .../baseconfiguration/Plans/ActivateProcess.bpmn | 66 ---------------------- .../baseconfiguration/TOSCA-Metadata/TOSCA.meta | 4 +- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn deleted file mode 100644 index 89ae342f8..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn +++ /dev/null @@ -1,66 +0,0 @@ - - - - - SequenceFlow_0l0dq58 - - - SequenceFlow_1ay0k6p - - - - - - - - - - SequenceFlow_0l0dq58 - SequenceFlow_1ay0k6p - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta index 9066e4845..8f1df9f2a 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta @@ -1,8 +1,6 @@ TOSCA-Meta-File-Version: 1.0.0 CSAR-Version: 1.0 -Created-By: Brinda Santh M +Created-By: Brinda Santh Entry-Definitions: Definitions/activation-blueprint.json Template-Tags: Brinda Santh, activation-blueprint -Name: Plans/ActivateProcess.bpmn -Content-Type: application/vnd.oasis.bpmn -- cgit 1.2.3-korg From 51da489d08f63d3ac8f176609d442bcf7f7a04bd Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 8 Mar 2019 13:41:18 -0500 Subject: Enhance / fix REST resource resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - provide sync web client - add support for VERB - add support for payload - fix URI resolution from input-key-mapping Change-Id: Id4f1973a15778ad4f2ab0f7e2a4b2c61054a234d Issue-ID: CCSDK-1131 Signed-off-by: Alexis de Talhouët --- .../starter-type/node_type/source-rest.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json index 044983040..b28e9341d 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/source-rest.json +++ b/components/model-catalog/definition-type/starter-type/node_type/source-rest.json @@ -14,6 +14,23 @@ } ] }, + "verb": { + "required": false, + "type": "string", + "default": "GET", + "constraints": [ + { + "valid_values": [ + "GET", "POST", "DELETE", "PUT" + ] + } + ] + }, + "payload": { + "required": false, + "type": "string", + "default": "" + }, "endpoint-selector": { "required": false, "type": "string" -- cgit 1.2.3-korg From 1746f00c7134f0bba8cfd2b4a00030b07f231ed1 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Tue, 12 Mar 2019 16:49:54 -0400 Subject: Add intial test CBA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If7c18e8ad472cebc3e36858fcb0cdf4c7ef6d52d Issue-ID: CCSDK-1149 Signed-off-by: Alexis de Talhouët --- .../golden/Definitions/activation-blueprint.json | 333 +++++++++++++++++ .../golden/Definitions/artifact_types.json | 22 ++ .../golden/Definitions/data_types.json | 106 ++++++ .../golden/Definitions/node_types.json | 413 +++++++++++++++++++++ .../golden/Definitions/policy_types.json | 3 + .../golden/Definitions/relationship_types.json | 9 + .../Definitions/resources_definition_types.json | 148 ++++++++ .../test-blueprint/golden/Plans/ConfigDeploy.xml | 15 + .../golden/Plans/ResourceAssignment.xml | 22 ++ .../test-blueprint/golden/Plans/Rollback.xml | 15 + .../blueprint-model/test-blueprint/golden/README | 134 +++++++ .../golden/Scripts/python/DescriptionExample.py | 46 +++ .../golden/Scripts/python/NetconfRpcExample.py | 61 +++ .../golden/Scripts/python/Rollback.py | 47 +++ .../golden/Scripts/python/__init__.py | 0 .../golden/TOSCA-Metadata/TOSCA.meta | 6 + .../golden/Templates/hostname-mapping.json | 13 + .../golden/Templates/hostname-template.vtl | 7 + .../Templates/junos-rollback-RPC-mapping.json | 1 + .../Templates/junos-rollback-RPC-template.vtl | 3 + .../golden/Templates/vf-module-1-mapping.json | 64 ++++ .../golden/Templates/vf-module-1-template.vtl | 4 + .../golden/Templates/vfw-interface-mapping.json | 88 +++++ .../golden/Templates/vfw-interface-template.vtl | 18 + .../starter-type/data_type/dt-netbox-ip.json | 15 + .../test-dictionary/create_netbox_ip.json | 29 ++ .../test-dictionary/delete_netbox_ip.json | 30 ++ .../test-dictionary/hostname.json | 14 + .../test-dictionary/interface-description.json | 21 ++ .../test-dictionary/interface-name.json | 15 + .../test-dictionary/prefix-id.json | 16 + .../test-dictionary/unit-number.json | 14 + .../test-dictionary/vf-module-number.json | 16 + .../test-dictionary/vf-module-type.json | 27 ++ 34 files changed, 1775 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/README create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl create mode 100644 components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/hostname.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/interface-description.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/interface-name.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/unit-number.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json create mode 100644 components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json new file mode 100644 index 000000000..b6464f3c8 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/activation-blueprint.json @@ -0,0 +1,333 @@ +{ + "tosca_definitions_version" : "controller_blueprint_1_0_0", + "metadata" : { + "template_author" : "Alexis de Talhouët", + "author-email" : "adetalhouet89@gmail.com", + "user-groups" : "ADMIN, OPERATION", + "template_name" : "test", + "template_version" : "1.0.0", + "template_tags" : "test" + }, + "imports" : [ { + "file" : "Definitions/data_types.json" + }, { + "file" : "Definitions/relationship_types.json" + }, { + "file" : "Definitions/artifact_types.json" + }, { + "file" : "Definitions/node_types.json" + }, { + "file" : "Definitions/policy_types.json" + } ], + "dsl_definitions" : { + "ipam-1" : { + "type" : "token-auth", + "url" : "http://localhost:32778", + "token" : "Token 0123456789abcdef0123456789abcdef01234567" + }, + "config-deploy-properties" : { + "resolution-key" : { + "get_input" : "resolution-key" + } + } + }, + "topology_template" : { + "workflows" : { + "resource-assignment" : { + "steps" : { + "resource-assignment-process" : { + "description" : "Resource Assign Workflow", + "target" : "resource-assignment-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "artifact-name" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "store-result" : { + "required" : true, + "type" : "boolean" + }, + "resolution-key" : { + "required" : true, + "type" : "string" + }, + "resource-assignment-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(resource-assignment).", + "required" : true, + "type" : "dt-resource-assignment-properties" + } + } + }, + "config-deploy" : { + "steps" : { + "config-deploy" : { + "description" : "Resource Assign and Python Netconf Activation Workflow", + "target" : "config-deploy-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "resolution-key" : { + "required" : false, + "type" : "string" + }, + "password" : { + "required" : true, + "type" : "string" + }, + "username" : { + "required" : true, + "type" : "string" + }, + "ip" : { + "required" : true, + "type" : "string" + }, + "config-deploy-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(config-deploy).", + "required" : true, + "type" : "dt-config-deploy-properties" + } + } + }, + "rollback" : { + "steps" : { + "rollback" : { + "description" : "Roolback Workflow", + "target" : "rollback-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "resolution-key" : { + "required" : false, + "type" : "string" + }, + "password" : { + "required" : true, + "type" : "string" + }, + "username" : { + "required" : true, + "type" : "string" + }, + "ip" : { + "required" : true, + "type" : "string" + }, + "config-deploy-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(config-deploy).", + "required" : true, + "type" : "dt-config-deploy-properties" + }, + "rollback-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(rollback).", + "required" : true, + "type" : "dt-rollback-properties" + } + } + } + }, + "node_templates" : { + "resource-assignment-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-resource-assignment-process" ] + }, + "dependency-node-templates" : [ "resource-assignment" ] + }, + "artifacts" : { + "dg-resource-assignment-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/ResourceAssignment.xml" + } + } + }, + "resource-assignment" : { + "type" : "component-resource-resolution", + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "resolution-key" : { + "get_input" : "resolution-key" + }, + "store-result" : { + "get_input" : "store-result" + }, + "artifact-prefix-names" : { + "get_input" : "artifact-name" + } + }, + "outputs" : { + "resource-assignment-params" : { + "get_attribute" : [ "SELF", "assignment-params" ] + }, + "status" : "success" + } + } + } + } + }, + "artifacts" : { + "hostname-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/hostname-template.vtl" + }, + "hostname-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/hostname-mapping.json" + }, + "vf-module-1-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/vf-module-1-template.vtl" + }, + "vf-module-1-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/vf-module-1-mapping.json" + } + } + }, + "config-deploy-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-config-deploy-process" ] + }, + "dependency-node-templates" : [ "config-deploy" ] + }, + "artifacts" : { + "dg-config-deploy-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/ConfigDeploy.xml" + } + } + }, + "config-deploy" : { + "type" : "component-netconf-executor", + "requirements" : { + "netconf-connection" : { + "capability" : "netconf", + "node" : "netconf-device", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentNetconfExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "script-type" : "jython", + "script-class-reference" : "Scripts/python/NetconfRpcExample.py", + "instance-dependencies" : [ ], + "dynamic-properties" : "*config-deploy-properties" + }, + "outputs" : { + "response-data" : "", + "status" : "SUCCESS" + } + } + } + } + }, + "artifacts" : { + "vfw-interface-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/vfw-interface-template.vtl" + }, + "vfw-interface-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/vfw-interface-mapping.json" + } + } + }, + "rollback-process" : { + "type" : "dg-generic", + "properties" : { + "content" : { + "get_artifact" : [ "SELF", "dg-rollback-process" ] + }, + "dependency-node-templates" : [ "config-deploy" ] + }, + "artifacts" : { + "dg-rollback-process" : { + "type" : "artifact-directed-graph", + "file" : "Plans/Rollback.xml" + } + } + }, + "rollback" : { + "type" : "component-netconf-executor", + "requirements" : { + "netconf-connection" : { + "capability" : "netconf", + "node" : "netconf-device", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentNetconfExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "script-type" : "jython", + "script-class-reference" : "Scripts/python/Rollback.py", + "instance-dependencies" : [ ], + "dynamic-properties" : "*config-deploy-properties" + }, + "outputs" : { + "response-data" : "", + "status" : "SUCCESS" + } + } + } + } + }, + "artifacts" : { + "junos-rollback-RPC-template" : { + "type" : "artifact-template-velocity", + "file" : "Templates/junos-rollback-RPC-template.vtl" + }, + "junos-rollback-RPC-mapping" : { + "type" : "artifact-mapping-resource", + "file" : "Templates/junos-rollback-RPC-mapping.json" + } + } + }, + "netconf-device" : { + "type" : "vnf-netconf-device", + "capabilities" : { + "netconf" : { + "properties" : { + "login-key" : { + "get_input" : "password" + }, + "login-account" : { + "get_input" : "username" + }, + "target-ip-address" : { + "get_input" : "ip" + }, + "port-number" : 830, + "connection-time-out" : 5 + } + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json new file mode 100644 index 000000000..6ec3b4105 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/artifact_types.json @@ -0,0 +1,22 @@ +{ + "artifact_types" : { + "artifact-directed-graph" : { + "description" : "Directed Graph File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json", "xml" ] + }, + "artifact-mapping-resource" : { + "description" : "Resource Mapping File used along with Configuration template", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json" ] + }, + "artifact-template-velocity" : { + "description" : " Velocity Template used for Configuration", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "vtl" ] + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json new file mode 100644 index 000000000..d60e6f00c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/data_types.json @@ -0,0 +1,106 @@ +{ + "data_types" : { + "dt-config-deploy-properties" : { + "description" : "Dynamic DataType definition for workflow(config-deploy).", + "version" : "1.0.0", + "properties" : { + "vfw_interface_ip" : { + "type" : "dt-netbox-ip" + }, + "interface-name" : { + "type" : "string" + }, + "interface-description" : { + "type" : "string" + }, + "unit-number" : { + "type" : "string" + }, + "prefix-id" : { + "type" : "string", + "default" : "11" + }, + "vf-module-type" : { + "type" : "string" + }, + "vf-module-number" : { + "type" : "string", + "default" : "3" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + }, + "dt-netbox-ip" : { + "description" : "This is Netbox IP Data Type", + "version" : "1.0.0", + "properties" : { + "address" : { + "required" : true, + "type" : "string" + }, + "id" : { + "required" : true, + "type" : "integer" + } + }, + "derived_from" : "tosca.datatypes.Root" + }, + "dt-resource-assignment-properties" : { + "description" : "Dynamic DataType definition for workflow(resource-assignment).", + "version" : "1.0.0", + "properties" : { + "hostname" : { + "type" : "string" + }, + "vfw_interface_ip" : { + "type" : "dt-netbox-ip" + }, + "interface-description" : { + "type" : "string" + }, + "vf-module-type" : { + "type" : "string" + }, + "vf-module-number" : { + "type" : "string", + "default" : "3" + }, + "prefix-id" : { + "type" : "integer", + "default" : 11 + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + }, + "dt-rollback-properties" : { + "description" : "Dynamic DataType definition for workflow(rollback).", + "version" : "1.0.0", + "properties" : { + "vfw_interface_ip" : { + "type" : "dt-netbox-ip" + }, + "interface-name" : { + "type" : "string" + }, + "interface-description" : { + "type" : "string" + }, + "unit-number" : { + "type" : "string" + }, + "prefix-id" : { + "type" : "string", + "default" : "11" + }, + "vf-module-type" : { + "type" : "string" + }, + "vf-module-number" : { + "type" : "string", + "default" : "3" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json new file mode 100644 index 000000000..b05869217 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json @@ -0,0 +1,413 @@ +{ + "node_types" : { + "component-netconf-executor" : { + "description" : "This is Netconf Transaction Configuration Component API", + "version" : "1.0.0", + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "requirements" : { + "netconf-connection" : { + "capability" : "netconf", + "node" : "vnf-netconf-device", + "relationship" : "tosca.relationships.ConnectsTo" + } + }, + "interfaces" : { + "ComponentNetconfExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "script-type" : { + "description" : "Script type, kotlin type is supported", + "required" : true, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "kotlin", "jython", "internal" ] + } ], + "default" : "internal" + }, + "dynamic-properties" : { + "description" : "Dynamic Json Content or DSL Json reference.", + "required" : false, + "type" : "json" + }, + "script-class-reference" : { + "description" : "Kotlin Script class name or jython script name.", + "required" : true, + "type" : "string" + }, + "instance-dependencies" : { + "description" : "Instance names to inject to Jython or Kotlin Script.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "outputs" : { + "response-data" : { + "description" : "Execution Response Data in JSON format.", + "required" : false, + "type" : "string" + }, + "status" : { + "description" : "Status of the Component Execution ( success or failure )", + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "component-resource-resolution" : { + "description" : "This is Resource Assignment Component API", + "version" : "1.0.0", + "attributes" : { + "assignment-params" : { + "required" : true, + "type" : "string" + } + }, + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "resolution-key" : { + "description" : "Key for service instance related correlation.", + "required" : false, + "type" : "string" + }, + "store-result" : { + "description" : "Whether or not to store the output.", + "required" : false, + "type" : "boolean" + }, + "resource-type" : { + "description" : "Request type.", + "required" : false, + "type" : "string" + }, + "artifact-prefix-names" : { + "description" : "Template , Resource Assignment Artifact Prefix names", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "request-id" : { + "description" : "Request Id, Unique Id for the request.", + "required" : true, + "type" : "string" + }, + "resource-id" : { + "description" : "Resource Id.", + "required" : false, + "type" : "string" + }, + "action-name" : { + "description" : "Action Name of the process", + "required" : false, + "type" : "string" + }, + "dynamic-properties" : { + "description" : "Dynamic Json Content or DSL Json reference.", + "required" : false, + "type" : "json" + } + }, + "outputs" : { + "resource-assignment-params" : { + "required" : true, + "type" : "string" + }, + "status" : { + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "dg-generic" : { + "description" : "This is Generic Directed Graph Type", + "version" : "1.0.0", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + }, + "dependency-node-templates" : { + "description" : "Dependent Step Components NodeTemplate name.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.DG" + }, + "source-capability" : { + "description" : "This is Component Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "script-type" : { + "required" : true, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "kotlin", "internal", "jython" ] + } ], + "default" : "kotlin" + }, + "script-class-reference" : { + "description" : "Capability reference name for internal and kotlin, for jython script file path", + "required" : true, + "type" : "string" + }, + "instance-dependencies" : { + "description" : "Instance dependency Names to Inject to Kotlin / Jython Script.", + "required" : false, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "key-dependencies" : { + "description" : "Resource Resolution dependency dictionary names.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "source-default" : { + "description" : "This is Default Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "source-primary-db" : { + "description" : "This is Database Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "type" : { + "required" : true, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "SQL", "PLSQL" ] + } ] + }, + "endpoint-selector" : { + "required" : false, + "type" : "string" + }, + "query" : { + "required" : true, + "type" : "string" + }, + "input-key-mapping" : { + "required" : false, + "type" : "map", + "entry_schema" : { + "type" : "string" + } + }, + "output-key-mapping" : { + "required" : false, + "type" : "map", + "entry_schema" : { + "type" : "string" + } + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "source-rest" : { + "description" : "This is Rest Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "type" : { + "required" : false, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "JSON" ] + } ], + "default" : "JSON" + }, + "verb" : { + "required" : false, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "GET", "POST", "DELETE", "PUT" ] + } ], + "default" : "GET" + }, + "payload" : { + "required" : false, + "type" : "string", + "default" : "" + }, + "endpoint-selector" : { + "required" : false, + "type" : "string" + }, + "url-path" : { + "required" : true, + "type" : "string" + }, + "path" : { + "required" : true, + "type" : "string" + }, + "expression-type" : { + "required" : false, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "JSON_PATH", "JSON_POINTER" ] + } ], + "default" : "JSON_PATH" + }, + "input-key-mapping" : { + "required" : false, + "type" : "map", + "entry_schema" : { + "type" : "string" + } + }, + "output-key-mapping" : { + "required" : false, + "type" : "map", + "entry_schema" : { + "type" : "string" + } + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "vnf-netconf-device" : { + "description" : "This is VNF Device with Netconf Capability", + "version" : "1.0.0", + "capabilities" : { + "netconf" : { + "type" : "tosca.capabilities.Netconf", + "properties" : { + "login-key" : { + "required" : true, + "type" : "string", + "default" : "sdnc" + }, + "login-account" : { + "required" : true, + "type" : "string", + "default" : "sdnc-tacacs" + }, + "source" : { + "required" : false, + "type" : "string", + "default" : "npm" + }, + "target-ip-address" : { + "required" : true, + "type" : "string" + }, + "port-number" : { + "required" : true, + "type" : "integer", + "default" : 830 + }, + "connection-time-out" : { + "required" : false, + "type" : "integer", + "default" : 30 + } + } + } + }, + "derived_from" : "tosca.nodes.Vnf" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json new file mode 100644 index 000000000..1e44cc70a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json new file mode 100644 index 000000000..027bfc0fc --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/relationship_types.json @@ -0,0 +1,9 @@ +{ + "relationship_types" : { + "tosca.relationships.ConnectsTo" : { + "description" : "Relationship tosca.relationships.ConnectsTo", + "version" : "1.0.0", + "derived_from" : "tosca.relationships.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json new file mode 100644 index 000000000..446a8a681 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json @@ -0,0 +1,148 @@ +{ + "create_netbox_ip" : { + "tags" : "oam-local-ipv4-address", + "name" : "create_netbox_ip", + "property" : { + "description" : "netbox ip", + "type" : "dt-netbox-ip" + }, + "updated-by" : "adetalhouet", + "sources" : { + "primary-config-data" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "verb" : "POST", + "endpoint-selector" : "ipam-1", + "url-path" : "/api/ipam/prefixes/$prefix-id/available-ips/", + "path" : "", + "input-key-mapping" : { + "prefix-id" : "prefix-id" + }, + "output-key-mapping" : { + "address" : "address", + "id" : "id" + }, + "key-dependencies" : [ "prefix-id" ] + } + } + } + }, + "hostname" : { + "tags" : "hostname", + "name" : "hostname", + "property" : { + "description" : "hostname", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "input" : { + "type" : "source-input" + } + } + }, + "interface-description" : { + "tags" : "interface-description", + "name" : "interface-description", + "property" : { + "description" : "interface-description", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "capability" : { + "type" : "source-capability", + "properties" : { + "script-type" : "jython", + "script-class-reference" : "DescriptionExample", + "instance-dependencies" : [ ] + } + } + } + }, + "interface-name" : { + "tags" : "interface-name", + "name" : "interface-name", + "property" : { + "description" : "interface-name", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } + }, + "prefix-id" : { + "tags" : "prefix-id", + "name" : "prefix-id", + "property" : { + "description" : "prefix-id", + "type" : "integer" + }, + "updated-by" : "adetalhouet", + "sources" : { + "default" : { + "type" : "source-default", + "properties" : { } + } + } + }, + "unit-number" : { + "tags" : "unit-number", + "name" : "unit-number", + "property" : { + "description" : "unit-number", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "input" : { + "type" : "source-input" + } + } + }, + "vf-module-number" : { + "tags" : "vf-module-number", + "name" : "vf-module-number", + "property" : { + "description" : "vf-module-number", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "default" : { + "type" : "source-default", + "properties" : { } + } + } + }, + "vf-module-type" : { + "tags" : "vf-module-type", + "name" : "vf-module-type", + "property" : { + "description" : "vf-module-type", + "type" : "string" + }, + "updated-by" : "adetalhouet", + "sources" : { + "primary-db" : { + "type" : "source-primary-db", + "properties" : { + "type" : "SQL", + "query" : "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid", + "input-key-mapping" : { + "vfmoduleid" : "vf-module-number" + }, + "output-key-mapping" : { + "vf-module-type" : "value" + }, + "key-dependencies" : [ "vf-module-number" ] + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml new file mode 100644 index 000000000..ec154a15b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ConfigDeploy.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml new file mode 100644 index 000000000..15872e524 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/ResourceAssignment.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml new file mode 100644 index 000000000..c1231d7a5 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Plans/Rollback.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/README b/components/model-catalog/blueprint-model/test-blueprint/golden/README new file mode 100644 index 000000000..06f91123e --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/README @@ -0,0 +1,134 @@ + +Example + + Pre-requisite + + Netbox running: https://github.com/netbox-community/netbox-docker + NETCONF capable device (JUNOS use in this example, but templates could be changed for another OS) + Blueprint processor + + resources + + Bellow a table of the resource used within this example, and how this resource + are resolved. + The resources are used in the context of device configuration. These shouldn't be + confused with SDC model resources. + + name | resolve through + ------------------------------------------------------ + prefix-id | default + vfw_interface_ip | rest (through Netbox) + hostname | input + vf-module-number | default + vf-module-type | database + unit-number | input + interface-name | input + interface-description | capability (python script) + + 3 workflow + + resource-assignment (dry-run) + + Ability to resolve multiple templates and mappings at the same time, + based on the request 'artifact-name', and provide the result as output. + Example provide two templates: hostname and vf-module-1 + + In order to perform dry-run, we need to store the template and have + the ability to retrieve the stored result later point in time. For this + we have to specify that we want to store the result, and we need to provide + a resolution-key. + + Here is the request payload: + + artifact name: template(s) to resolve + store-result: whether to save the generated configlet in DB + resolution-key: To identify the configlet saved in the DB + hostname: Value defined to be result trough input in the hostname mapping file + + { + "resource-assignment-request": { + "artifact-name": [ "hostname", "vf-module-1" ], + "resolution-key": "hostname-demo-123", + "store-result": true, + "resource-assignment-properties": { + "hostname": "demo123" + } + } + } + + Output: + + { + "resource-assignment-params": { + "hostname": "\n\n \n \n demo123\n \n\n", + "vf-module-1": "\n This is the Virtual Firewall entity\n 10.10.10.39/24\n" + }, + "status": "success" + } + + config-deploy + + This action will run a python script that will retrieved the resolved template + from previous step using the resolution-key and the artifact-name. + The script will also resolve another template during its execution: the Interface Template. + Finally, this action will push these resolved templates into a device (JUNOS) using NETCONF. + The python script will make use of utilities classes provided by the platform: + resolution helper and netconf client. + + Information about the device is modelled as a requirement of this action, specifying that + username, password and ip of the device should be provided as input. Note: you could resolve + those information using the resource resolution framework, if need be. + + Here is the request payload: + + resolution-key: To identify the configlet saved in the DB in previous step + username: NETCONF device user + password: NETCONF device password + ip: NETCONF device ip + interface-name: Name of the interface to configure + unit-number: Unit to configure for the interface + + { + "resolution-key": "hostname-demo-123", + "username": "user", + "password": "pass", + "ip": "10.198.1.35", + "config-deploy-properties": { + "interface-name": "ge-0/0/7", + unit-number": "0" + } + } + + Output: + + No specific output beside success or failure. + + rollback + + This action will rollback the last committed config on the device, using NETCONF and device + specific RPC. To do so, a python script will be used, similar as in previous action, to dynamically + resolve the rollback template payload, and send the RPC to the device. + + Information about the NETCONF device is provided in a similar fashion as previous step. Actually, the + same model is used. + + Here is the request payload: + + username: NETCONF device user + password: NETCONF device password + ip: NETCONF device ip + + { + "username": "pass", + "password": "user", + "ip": "10.10.10.10" + } + + Output: + + No specific output beside success or failure. + + +Postman collection used for this example. 4 requests are provided one per workflow to execute, and 1 to load the CBA in the runtime environment. + + https://www.getpostman.com/collections/4d199ff02a735bd3e680 \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py new file mode 100644 index 000000000..fce7c3249 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py @@ -0,0 +1,46 @@ +# Copyright (c) 2019 Bell Canada. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from abstract_ra_processor import AbstractRAProcessor +from blueprint_constants import * +from java.lang import Exception as JavaException + +class DescriptionExample(AbstractRAProcessor): + + def process(self, resource_assignment): + try: + # get dependencies result + value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type") + + # logic based on dependency outcome + result = "" + if value == "vfw": + result = "This is the Virtual Firewall entity" + elif value == "vsn": + result = "This is the Virtual Sink entity" + elif value == "vpg": + result = "This is the Virtual Packet Generator" + + # set value for resource getting currently resolved + self.set_resource_data_value(resource_assignment, result) + + except JavaException, err: + log.error("Java Exception in the script {}", err) + except Exception, err: + log.error("Python Exception in the script {}", err) + return None + + def recover(self, runtime_exception, resource_assignment): + print "NoOp" + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py new file mode 100644 index 000000000..ed22989fb --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py @@ -0,0 +1,61 @@ +# Copyright (c) 2019 Bell Canada. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import netconf_constant +from common import ResolutionHelper +from java.lang import Exception as JavaException +from netconfclient import NetconfClient +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \ + NetconfComponentFunction + + +class NetconfRpcExample(NetconfComponentFunction): + + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + + nc = NetconfClient(log, self, "netconf-connection") + rr = ResolutionHelper(self) + + # Get meshed template from DB + resolution_key = self.getDynamicProperties("resolution-key").asText() + artifact_name = "hostname" + payloadHostname = rr.retrieve_resolved_template_from_database(resolution_key, artifact_name) + + # resolve param and mesh template + payloadInterface = rr.resolve_and_generate_message_from_template_prefix("vfw-interface") + + nc.connect() + nc.lock() + #if not response.isSuccess(): + # og.error(response.errorMessage) + nc.discard_change() + nc.edit_config(message_content=payloadInterface, edit_default_peration="none") + nc.edit_config(message_content=payloadHostname, edit_default_peration="none") + nc.validate() + nc.commit() + #nc.commit(confirmed = True, confirm_timeout=15) + nc.unlock() + nc.disconnect() + + except JavaException, err: + log.error("Java Exception in the script {}", err) + except Exception, err: + log.error("Python Exception in the script {}", err) + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py new file mode 100644 index 000000000..73419d716 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py @@ -0,0 +1,47 @@ +# Copyright (c) 2019 Bell Canada. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import netconf_constant +from common import ResolutionHelper +from java.lang import Exception as JavaException +from netconfclient import NetconfClient +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \ + NetconfComponentFunction + + +class Rollback(NetconfComponentFunction): + + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + + nc = NetconfClient(log, self, "netconf-connection") + rr = ResolutionHelper(self) + + # rollback config on device + nc.connect() + payloadHostnameRollback = rr.resolve_and_generate_message_from_template_prefix("junos-rollback-RPC") + nc.invoke_rpc(payloadHostnameRollback) + nc.commit() + nc.disconnect() + + except JavaException, err: + log.error("Java Exception in the script {}", err) + except Exception, err: + log.error("Python Exception in the script {}", err) + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..065eda192 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,6 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Alexis de Talhouët +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: test +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json new file mode 100644 index 000000000..1e02d6900 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "hostname", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "hostname", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl new file mode 100644 index 000000000..1e80b6d1c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/hostname-template.vtl @@ -0,0 +1,7 @@ + + + + + $hostname + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-mapping.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl new file mode 100644 index 000000000..655a2b1c8 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/junos-rollback-RPC-template.vtl @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json new file mode 100644 index 000000000..eba259e33 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json @@ -0,0 +1,64 @@ +[ + { + "name": "interface-description", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "interface-description", + "dictionary-source": "capability", + "dependencies": [ + "vf-module-type" + ] + }, + { + "name": "vf-module-type", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vf-module-type", + "dictionary-source": "primary-db", + "dependencies": [ + "vf-module-number" + ] + }, + { + "name": "vf-module-number", + "input-param": true, + "property": { + "type": "string", + "default": "3" + }, + "dictionary-name": "vf-module-number", + "dictionary-source": "default", + "dependencies": [ + + ] + }, + { + "name": "prefix-id", + "input-param": true, + "property": { + "type": "integer", + "default": 11 + }, + "dictionary-name": "prefix-id", + "dictionary-source": "default", + "dependencies": [ + + ] + }, + { + "name": "vfw_interface_ip", + "input-param": true, + "property": { + "type": "dt-netbox-ip" + }, + "dictionary-name": "create_netbox_ip", + "dictionary-source": "primary-config-data", + "dependencies": [ + "prefix-id" + ] + } +] \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl new file mode 100644 index 000000000..9ba34a057 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-template.vtl @@ -0,0 +1,4 @@ + + $interface-description + $vfw_interface_ip.address + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json new file mode 100644 index 000000000..149d3eb20 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json @@ -0,0 +1,88 @@ +[ + { + "name": "interface-description", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "interface-description", + "dictionary-source": "capability", + "dependencies": [ + "vf-module-type" + ] + }, + { + "name": "interface-name", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "interface-name", + "dictionary-source": "input", + "dependencies": [ + + ] + }, + { + "name": "unit-number", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "unit-number", + "dictionary-source": "input", + "dependencies": [ + + ] + }, + { + "name": "prefix-id", + "input-param": true, + "property": { + "type": "string", + "default": "11" + }, + "dictionary-name": "prefix-id", + "dictionary-source": "default", + "dependencies": [ + + ] + }, + { + "name": "vf-module-type", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vf-module-type", + "dictionary-source": "primary-db", + "dependencies": [ + "vf-module-number" + ] + }, + { + "name": "vf-module-number", + "input-param": true, + "property": { + "type": "string", + "default": "3" + }, + "dictionary-name": "vf-module-number", + "dictionary-source": "default", + "dependencies": [ + + ] + }, + { + "name": "vfw_interface_ip", + "input-param": true, + "property": { + "type": "dt-netbox-ip" + }, + "dictionary-name": "create_netbox_ip", + "dictionary-source": "primary-config-data", + "dependencies": [ + "prefix-id" + ] + } +] \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl new file mode 100644 index 000000000..3223535e5 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-template.vtl @@ -0,0 +1,18 @@ + + + + $interface-name + + $unit-number + $interface-description + + +
+ $vfw_interface_ip.address +
+
+
+
+
+
+
\ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json b/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json new file mode 100644 index 000000000..81c908d62 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/data_type/dt-netbox-ip.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0", + "description": "This is Netbox IP Data Type", + "properties": { + "address": { + "required": true, + "type": "string" + }, + "id": { + "required": true, + "type": "integer" + } + }, + "derived_from": "tosca.datatypes.Root" +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json b/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json new file mode 100644 index 000000000..297a8ef87 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/create_netbox_ip.json @@ -0,0 +1,29 @@ +{ + "tags" : "oam-local-ipv4-address", + "name" : "create_netbox_ip", + "property" : { + "description" : "netbox ip", + "type" : "dt-netbox-ip" + }, + "updated-by" : "adetalhouet", + "sources" : { + "primary-config-data" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "verb" : "POST", + "endpoint-selector" : "ipam-1", + "url-path" : "/api/ipam/prefixes/$prefix-id/available-ips/", + "path" : "", + "input-key-mapping" : { + "prefix-id" : "prefix-id" + }, + "output-key-mapping" : { + "address" : "address", + "id" : "id" + }, + "key-dependencies" : [ "prefix-id" ] + } + } + } + } \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json b/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json new file mode 100644 index 000000000..35a8a351c --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/delete_netbox_ip.json @@ -0,0 +1,30 @@ +{ + "tags": "oam-local-ipv4-address", + "name": "delete_netbox_ip", + "property": { + "description": "delete netbox ip", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "primary-config-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "verb": "DELETE", + "endpoint-selector": "ipam-1", + "url-path": "/api/ipam/ip-addresses/$ip-address-id", + "path": "/address", + "input-key-mapping": { + "ip-address-id": "ip-address-id" + }, + "output-key-mapping": { + + }, + "key-dependencies": [ + "ip-address-id" + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/hostname.json b/components/model-catalog/resource-dictionary/test-dictionary/hostname.json new file mode 100644 index 000000000..025cce336 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/hostname.json @@ -0,0 +1,14 @@ +{ + "tags": "hostname", + "name": "hostname", + "property": { + "description": "hostname", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "input": { + "type": "source-input" + } + } + } \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json b/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json new file mode 100644 index 000000000..d13bfc44b --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/interface-description.json @@ -0,0 +1,21 @@ +{ + "tags": "interface-description", + "name": "interface-description", + "property": { + "description": "interface-description", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "capability": { + "type": "source-capability", + "properties": { + "script-type": "jython", + "script-class-reference": "DescriptionExample", + "instance-dependencies": [ + + ] + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json b/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json new file mode 100644 index 000000000..53a11ed70 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/interface-name.json @@ -0,0 +1,15 @@ +{ + "name" : "interface-name", + "tags" : "interface-name", + "updated-by" : "adetalhouet", + "property" : { + "description" : "interface-name", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json b/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json new file mode 100644 index 000000000..e515eca55 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/prefix-id.json @@ -0,0 +1,16 @@ +{ + "tags": "prefix-id", + "name": "prefix-id", + "property" :{ + "description": "prefix-id", + "type": "integer" + }, + "updated-by": "adetalhouet", + "sources": { + "default": { + "type": "source-default", + "properties": { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json b/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json new file mode 100644 index 000000000..333fd78eb --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/unit-number.json @@ -0,0 +1,14 @@ +{ + "tags": "unit-number", + "name": "unit-number", + "property": { + "description": "unit-number", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "input": { + "type": "source-input" + } + } + } \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json new file mode 100644 index 000000000..cdd40f669 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-number.json @@ -0,0 +1,16 @@ +{ + "tags": "vf-module-number", + "name": "vf-module-number", + "property" :{ + "description": "vf-module-number", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "default": { + "type": "source-default", + "properties": { + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json new file mode 100644 index 000000000..b06057c45 --- /dev/null +++ b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json @@ -0,0 +1,27 @@ +{ + "name": "vf-module-type", + "tags": "vf-module-type", + "property": { + "description": "vf-module-type", + "type": "string" + }, + "updated-by": "adetalhouet", + "sources": { + "primary-db": { + "type": "source-primary-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid", + "input-key-mapping": { + "vfmoduleid": "vf-module-number" + }, + "output-key-mapping": { + "vf-module-type": "value" + }, + "key-dependencies": [ + "vf-module-number" + ] + } + } + } +} \ No newline at end of file -- cgit 1.2.3-korg From bffb79d389970b1fb96ea6ee6f0414c460691d5f Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Fri, 22 Feb 2019 16:22:59 -0500 Subject: Python lib for RA and component executor Change-Id: Iacec0dbbd3e7c1dc955ac913f346365732248f05 Issue-ID: CCSDK-1091 Signed-off-by: Steve Alphonse Siani --- .../capability_python/Definitions/activation-blueprint.json | 2 +- .../starter-dictionary/service-instance-id.json | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json index 168732c1d..b02397e85 100755 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json @@ -119,7 +119,7 @@ "artifacts" : { "component-script" : { "type" : "artifact-script-jython", - "file" : "Scripts/SamplePythonComponentNode.py" + "file" : "Scripts/python/SamplePythonComponentNode.py" } } } diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json index cb9704350..737c7577b 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/service-instance-id.json @@ -32,6 +32,14 @@ "service-instance-id": "artifact_name" } } + }, + "capability": { + "type": "source-capability", + "properties": { + "script-type": "jython", + "script-class-reference": "SampleRAProcessor", + "instance-dependencies": [] + } } } } \ No newline at end of file -- cgit 1.2.3-korg From 6afa8a4b2ef4f6fa01e3858ed192bf99bea18778 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 14 Mar 2019 13:55:01 -0400 Subject: Prepare for release 0.4.1 Prepare to create release version 0.4.1 by using released version of parent pom Change-Id: Icf8432e14626a55b916b6f4d4a8992b79c29eff7 Issue-ID: CCSDK-1156 Signed-off-by: Timoney, Dan (dt5972) --- components/model-catalog/proto-definition/pom.xml | 5 ++--- components/parent/pom.xml | 3 +-- components/pom.xml | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml index 4680f6291..35fc9a9a1 100644 --- a/components/model-catalog/proto-definition/pom.xml +++ b/components/model-catalog/proto-definition/pom.xml @@ -15,8 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. --> - + 4.0.0 org.onap.ccsdk.apps @@ -84,4 +83,4 @@
- \ No newline at end of file + diff --git a/components/parent/pom.xml b/components/parent/pom.xml index 1d633efe6..dd74622dd 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -16,8 +16,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 org.onap.ccsdk.apps diff --git a/components/pom.xml b/components/pom.xml index c18e968fe..1915fecf7 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -15,8 +15,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + org.onap.ccsdk.apps ccsdk-apps -- cgit 1.2.3-korg From c4f36ee4781ab90d343a0fe9d4f75da6ad8d970c Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 15 Mar 2019 17:07:19 -0400 Subject: Add workflow node template enrichment Change-Id: I15c2db6ab81bae2176d1606157f13416c1fac660 Issue-ID: CCSDK-1168 Signed-off-by: Muthuramalingam, Brinda Santh --- .../Definitions/artifact_types.json | 3 + .../Definitions/component_invoke.json | 88 ++++++++++++++++++++++ .../component_invoke/Definitions/data_types.json | 3 + .../component_invoke/Definitions/node_types.json | 54 +++++++++++++ .../component_invoke/Definitions/policy_types.json | 3 + .../Definitions/relationship_types.json | 3 + .../Definitions/resources_definition_types.json | 1 + .../component_invoke/TOSCA-Metadata/TOSCA.meta | 5 ++ .../node_type/component-netconf-executor.json | 5 -- .../node_type/component-sample-executor.json | 45 +++++++++++ 10 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta create mode 100644 components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json new file mode 100644 index 000000000..eadc848be --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/artifact_types.json @@ -0,0 +1,3 @@ +{ + "artifact_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json new file mode 100644 index 000000000..eeb9815fa --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json @@ -0,0 +1,88 @@ +{ + "tosca_definitions_version": "controller_blueprint_1_0_0", + "metadata": { + "template_author": "Brinda Santh ", + "template_name": "component_invoke", + "template_version": "1.0.0", + "template_tags": "brinda, component_invoke" + }, + "imports": [ + { + "file": "Definitions/data_types.json" + }, + { + "file": "Definitions/relationship_types.json" + }, + { + "file": "Definitions/artifact_types.json" + }, + { + "file": "Definitions/node_types.json" + }, + { + "file": "Definitions/policy_types.json" + } + ], + "topology_template": { + "workflows": { + "component-invoke": { + "steps": { + "activate-process": { + "description": "Sample Component Invocation flow", + "target": "sample-component", + "activities": [ + { + "call_operation": "sample-component" + } + ] + } + }, + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + } + } + }, + "node_templates": { + "sample-component": { + "type": "component-sample-executor", + "interfaces": { + "ComponentSampleExecutor": { + "operations": { + "process": { + "inputs": { + "sample-property": "sample-value", + "sample-list-property": [ + "json-parser-service" + ], + "dynamic-properties": { + "prop1": "prop1-value", + "prop2": "prop2-value" + } + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json new file mode 100644 index 000000000..8c304c40b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/data_types.json @@ -0,0 +1,3 @@ +{ + "data_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json new file mode 100644 index 000000000..1e02cef4a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/node_types.json @@ -0,0 +1,54 @@ +{ + "node_types": { + "component-sample-executor": { + "description": "This is Sample Component API", + "version": "1.0.0", + "interfaces": { + "ComponentSampleExecutor": { + "operations": { + "process": { + "inputs": { + "sample-property": { + "description": "Sample Property.", + "required": true, + "type": "string" + }, + "sample-list-property": { + "description": "Dependent Step Components NodeTemplate name.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "tosca.nodes.Component": { + "description": "This is default Component Node", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json new file mode 100644 index 000000000..1e44cc70a --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json new file mode 100644 index 000000000..4ddd7a57c --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/relationship_types.json @@ -0,0 +1,3 @@ +{ + "relationship_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json new file mode 100644 index 000000000..6f31cf5a2 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/resources_definition_types.json @@ -0,0 +1 @@ +{ } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..a7c130a23 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh +Entry-Definitions: Definitions/component_invoke.json +Template-Tags: Brinda Santh, component_invoke \ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index 7e429c011..3233d2121 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -33,11 +33,6 @@ } ] }, - "dynamic-properties": { - "description": "Resolvable dynamic property.", - "required": false, - "type": "string" - }, "script-class-reference": { "description": "Kotlin Script class name or jython script name.", "required": true, diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json new file mode 100644 index 000000000..68b3ebde2 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-sample-executor.json @@ -0,0 +1,45 @@ +{ + "description": "This is Sample Component API", + "version": "1.0.0", + "interfaces": { + "ComponentSampleExecutor": { + "operations": { + "process": { + "inputs": { + "sample-property": { + "description": "Sample Property.", + "required": true, + "type": "string" + }, + "sample-list-property": { + "required": true, + "description": "Dependent Step Components NodeTemplate name.", + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +} \ No newline at end of file -- cgit 1.2.3-korg From 3ac0d20b08dd8c31ff85ad3ca5c53df11b6d96e4 Mon Sep 17 00:00:00 2001 From: ottero Date: Sun, 17 Mar 2019 19:38:32 +0000 Subject: Adding custom headers capability to REST client For YANG PATCH requests to ODL to work, they need to have a Content- type header of application/yang.patch+json and should not have Accept as application/json Current REST client inserts a default header to the requests with this content: Content-Type: application/json Accept: application/json The solution was to add the possibility of sending custom headers alon- gside the other parameters. Change-Id: I2cf0cd2ef7b87f4f5a246d427dffafe266cb33f7 Issue-ID: CCSDK-926 Signed-off-by: ottero --- .../Definitions/activation-blueprint.json | 115 +++++++++++---------- .../Definitions/config-assign-pnf-mapping.json | 13 +++ .../Definitions/config-deploy-pnf-mapping.json | 13 +++ .../Definitions/data_types.json | 16 ++- .../Definitions/node_types.json | 107 +++++++++++++++++++ .../Definitions/resources_definition_types.json | 18 +++- .../Plans/CONFIG_configDeploy.xml | 15 +++ .../capability_restconf/Plans/CONFIG_configure.xml | 15 --- .../Scripts/python/RestconfAssignConfig.py | 38 ------- .../Scripts/python/RestconfConfigDeploy.py | 112 ++++++++++++++++++++ .../Scripts/python/RestconfConfigure.py | 38 ------- .../Templates/config-assign-pnf-mapping.json | 3 - .../config-assign-restconf-configlet-template.vtl | 56 ++++++---- .../config-deploy-restconf-mount-template.vtl | 14 +++ .../Templates/configure-pnf-mapping.json | 3 - .../configure-restconf-mount-template.vtl | 14 --- .../configure-restconf-unmount-template.vtl | 1 - .../starter-dictionary/entity.json | 15 +++ .../starter-dictionary/pnf-id.json | 15 +++ .../starter-dictionary/pnf-name.json | 15 +++ 20 files changed, 448 insertions(+), 188 deletions(-) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl delete mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/entity.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json create mode 100755 components/model-catalog/resource-dictionary/starter-dictionary/pnf-name.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json index 90b2e3ab0..628a7d04d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json @@ -19,17 +19,20 @@ }, { "file" : "Definitions/policy_types.json" } ], - "topology_template" : { - "inputs" : { - "serviceInstanceId" : { - "required" : true, - "type" : "string" - }, - "identifier" : { - "required" : true, - "type" : "string" + "dsl_definitions" : { + "config-assign-properties" : { + "resolution-key" : { + "get_input" : "resolution-key" } }, + "config-deploy-properties" : { + "resolution-key" : { + "get_input" : "resolution-key" + } + } + + }, + "topology_template" : { "workflows" : { "config-assign" : { "steps" : { @@ -42,6 +45,21 @@ } }, "inputs" : { + "resolution-key" : { + "required" : true, + "type" : "string" + }, + "artifact-name" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "store-result" : { + "required" : true, + "type" : "boolean" + }, "config-assign-properties" : { "description" : "Dynamic PropertyDefinition for workflow(config-assign).", "required" : true, @@ -49,21 +67,25 @@ } } }, - "configure" : { + "config-deploy" : { "steps" : { "activate-process" : { "description" : "Send a configlet to the pnf", - "target" : "configure-process", + "target" : "config-deploy-process", "activities" : [ { "call_operation" : "" } ] } }, "inputs" : { - "configure-properties" : { - "description" : "Dynamic PropertyDefinition for workflow(configure).", + "resolution-key" : { + "required" : true, + "type" : "string" + }, + "config-deploy-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(config-deploy).", "required" : true, - "type" : "dt-configure-properties" + "type" : "dt-config-deploy-properties" } } } @@ -84,25 +106,24 @@ } } }, - - "config-assign" : { - "type" : "component-restconf-executor", + "type" : "component-resource-resolution", "interfaces" : { - "ComponentRestconfExecutor" : { + "ResourceResolutionComponent" : { "operations" : { "process" : { - "implementation" : { - "primary" : "component-script" - }, "inputs" : { - "script-type" : "jython", - "script-class-reference" : "Scripts/python/RestconfAssignConfig.py", - "instance-dependencies" : [ ] + "resolution-key" : { + "get_input" : "resolution-key" + }, + "store-result" : true, + "artifact-prefix-names" : ["config-assign"] }, "outputs" : { - "response-data" : "", - "status" : "" + "resource-assignment-params" : { + "get_attribute" : [ "SELF", "assignment-params" ] + }, + "status" : "success" } } } @@ -115,33 +136,26 @@ }, "config-assign-mapping" : { "type" : "artifact-mapping-resource", - "file" : "Templates/config-assign-pnf-mapping.json" - }, - "component-script" : { - "type" : "artifact-script-jython", - "file" : "Scripts/python/RestconfAssignConfig.py" + "file" : "Definitions/config-assign-pnf-mapping.json" } } }, - - - - "configure-process" : { + "config-deploy-process" : { "type" : "dg-generic", "properties" : { "content" : { - "get_artifact" : [ "SELF", "dg-configure-process" ] + "get_artifact" : [ "SELF", "dg-config-deploy-process" ] }, - "dependency-node-templates" : [ "configure" ] + "dependency-node-templates" : [ "config-deploy" ] }, "artifacts" : { "dg-config-assign-process" : { "type" : "artifact-directed-graph", - "file" : "Plans/CONFIG_configure.xml" + "file" : "Plans/CONFIG_configDeploy.xml" } } }, - "configure" : { + "config-deploy" : { "type" : "component-restconf-executor", "interfaces" : { "ComponentRestconfExecutor" : { @@ -152,36 +166,33 @@ }, "inputs" : { "script-type" : "jython", - "script-class-reference" : "Scripts/python/RestconfConfigure.py", - "instance-dependencies" : [ ] + "script-class-reference" : "Scripts/python/RestconfConfigDeploy.py", + "instance-dependencies" : [ ], + "dynamic-properties" : "*config-deploy-properties" }, "outputs" : { "response-data" : "", - "status" : "" + "status" : "success" } } } } }, "artifacts" : { - "configure-mount-template" : { - "type" : "artifact-template-velocity", - "file" : "Templates/configure-restconf-mount-template.vtl" - }, - "configure-unmount-template" : { + "config-deploy-template" : { "type" : "artifact-template-velocity", - "file" : "Templates/configure-restconf-unmount-template.vtl" + "file" : "Templates/config-deploy-restconf-mount-template.vtl" }, - "configure-mapping" : { + "config-deploy-mapping" : { "type" : "artifact-mapping-resource", - "file" : "Templates/configure-pnf-mapping.json" + "file" : "Definitions/config-deploy-pnf-mapping.json" }, "component-script" : { "type" : "artifact-script-jython", - "file" : "Scripts/python/RestconfConfigure.py" + "file" : "Scripts/python/RestconfConfigDeploy.py" } } } } } -} +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json new file mode 100644 index 000000000..fc8e1bf64 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-assign-pnf-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "entity", + "input-param": true, + "property": { + "type": "json" + }, + "dictionary-name": "entity", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json new file mode 100644 index 000000000..fc8e1bf64 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/config-deploy-pnf-mapping.json @@ -0,0 +1,13 @@ +[ + { + "name": "entity", + "input-param": true, + "property": { + "type": "json" + }, + "dictionary-name": "entity", + "dictionary-source": "input", + "dependencies": [ + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json index 9f35eef88..e5aa763ba 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json @@ -3,13 +3,21 @@ "dt-config-assign-properties" : { "description" : "Dynamic DataType definition for workflow(config-assign).", "version" : "1.0.0", - "properties" : { }, + "properties" : { + "entity" : { + "type" : "json" + } + }, "derived_from" : "tosca.datatypes.Dynamic" }, - "dt-configure-properties" : { - "description" : "Dynamic DataType definition for workflow(configure).", + "dt-config-deploy-properties" : { + "description" : "Dynamic DataType definition for workflow(config-deploy).", "version" : "1.0.0", - "properties" : { }, + "properties" : { + "entity" : { + "type" : "json" + } + }, "derived_from" : "tosca.datatypes.Dynamic" } } diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json index be3bd319a..ed7c580bc 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json @@ -1,5 +1,84 @@ { "node_types" : { + "component-resource-resolution" : { + "description" : "This is Resource Assignment Component API", + "version" : "1.0.0", + "attributes" : { + "assignment-params" : { + "required" : true, + "type" : "string" + } + }, + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "resolution-key" : { + "description" : "Key for service instance related correlation.", + "required" : false, + "type" : "string" + }, + "store-result" : { + "description" : "Whether or not to store the output.", + "required" : false, + "type" : "boolean" + }, + "resource-type" : { + "description" : "Request type.", + "required" : false, + "type" : "string" + }, + "artifact-prefix-names" : { + "description" : "Template , Resource Assignment Artifact Prefix names", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "request-id" : { + "description" : "Request Id, Unique Id for the request.", + "required" : true, + "type" : "string" + }, + "resource-id" : { + "description" : "Resource Id.", + "required" : false, + "type" : "string" + }, + "action-name" : { + "description" : "Action Name of the process", + "required" : false, + "type" : "string" + }, + "dynamic-properties" : { + "description" : "Dynamic Json Content or DSL Json reference.", + "required" : false, + "type" : "json" + } + }, + "outputs" : { + "resource-assignment-params" : { + "required" : true, + "type" : "string" + }, + "status" : { + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, "component-restconf-executor" : { "description" : "This is Restconf Transaction Configuration Component API", "version" : "1.0.0", @@ -34,6 +113,11 @@ "entry_schema" : { "type" : "string" } + }, + "dynamic-properties" : { + "description" : "Dynamic Json Content or DSL Json reference.", + "required" : false, + "type" : "json" } }, "outputs" : { @@ -73,6 +157,24 @@ }, "derived_from" : "tosca.nodes.DG" }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, "tosca.nodes.Component" : { "description" : "This is default Component Node", "version" : "1.0.0", @@ -82,6 +184,11 @@ "description" : "This is Directed Graph Node Type", "version" : "1.0.0", "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json index 6f31cf5a2..98a73b101 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json @@ -1 +1,17 @@ -{ } \ No newline at end of file +{ + "entity" : { + "tags" : "entity", + "name" : "entity", + "property" : { + "description" : "entity", + "type" : "json" + }, + "updated-by" : "Rodrigo Ottero ", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml new file mode 100644 index 000000000..fbed3d575 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configDeploy.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml deleted file mode 100644 index c48ffbed4..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py deleted file mode 100644 index 36dd32ffc..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py +++ /dev/null @@ -1,38 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - - -from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \ - RestconfComponentFunction - - -class RestconfAssignConfig(RestconfComponentFunction): - - - def process(self, execution_request): - # create instances of the needed objects - # retrieve any needed information not present on the request, like pnf ip - # create the configlet - # persist the configlet - # end - print("process", execution_request) - - - def recover(self, runtime_exception, execution_request): - print("recover") - return None \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py new file mode 100644 index 000000000..33f9400eb --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigDeploy.py @@ -0,0 +1,112 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +from time import sleep + +from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \ + RestconfComponentFunction +from java.lang import Exception as JavaException + + +class RestconfConfigDeploy(RestconfComponentFunction): + + log = globals()["log"] + seconds_to_sleep = 5 + base_mount_url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + server_identifier = "sdncodl" + configlet_template_name = "config-assign" + + def process(self, execution_request): + + self.log.info("Started execution of process method") + try: + self.log.info("getting resolution-key") + resolution_key = self.getDynamicProperties("resolution-key").asText() + self.log.info("resolution_key: {}", resolution_key) + + self.log.info("getting pnf-id") + pnf_id = execution_request.payload.get("config-deploy-request").get("config-deploy-properties").get("entity").get("pnf-id") + pnf_id = str(pnf_id).strip('\"') + self.log.info("pnf-id: {}", pnf_id) + + self.log.info("mounting device {}", pnf_id) + self.mount(pnf_id) + + self.log.info("sleeping for {} seconds", self.seconds_to_sleep) + sleep(self.seconds_to_sleep) + + try: + self.log.info("configuring device {}", pnf_id) + self.apply_configuration(pnf_id, resolution_key, self.configlet_template_name) + except Exception, err: + self.log.error("an error occurred while configuring device {}", err) + raise err + finally: + self.log.info("unmounting device {}", pnf_id) + self.unmount(pnf_id) + + self.log.info("Ended execution of process method") + + except JavaException, err: + self.log.error("Java Exception in the script", err) + raise err + except Exception, err: + self.log.error("Python Exception in the script", err) + raise err + + def mount(self, pnf_id): + self.log.info("meshing mount payload") + mount_payload = self.resolveAndGenerateMessage("config-deploy-mapping", "config-deploy-template") + self.log.info("mount payload: \n {}", mount_payload) + + # defining custom header + headers = { + "Content-Type": "application/xml" + } + + url = self.base_mount_url + str(pnf_id) + self.log.info("sending mount request, url: {}", url) + web_client_service = self.restClientService(self.server_identifier) + web_client_service.exchangeResource("PUT", url, mount_payload, headers) + + def unmount(self, pnf_id): + url = self.base_mount_url + str(pnf_id) + self.log.info("sending unmount request, url: {}", url) + web_client_service = self.restClientService(self.server_identifier) + web_client_service.exchangeResource("DELETE", url, "") + + def apply_configuration(self, pnf_id, resolution_key, template_name): + self.log.info("Retrieving configlet from database (resolution-key: {}, template_name: {}", + resolution_key, template_name) + configlet = self.resolveFromDatabase(resolution_key, template_name) + self.log.info("Configlet: {}", configlet) + + # defining custom header + headers = { + "Content-Type": "application/yang.patch+json" + } + + url = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + pnf_id \ + + "/yang-ext:mount/mynetconf:netconflist" + self.log.info("sending patch request, url: {}", url) + web_client_service = self.restClientService(self.server_identifier) + result = web_client_service.exchangeResource("PATCH", url, configlet, headers) + self.log.info("Configuration application result: {}", result) + + def recover(self, runtime_exception, execution_request): + self.log.info("Recover method, no code to execute") + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py deleted file mode 100644 index c584baa9b..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py +++ /dev/null @@ -1,38 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= - - -from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \ - RestconfComponentFunction - - -class RestconfConfigure(RestconfComponentFunction): - - - def process(self, execution_request): - # create instances of the needed objects - # retrieve any needed information not present on the request, like pnf ip - # retrieve the configlet - # send the configlet - # end - print("process", execution_request) - - - def recover(self, runtime_exception, execution_request): - print("recover") - return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json deleted file mode 100644 index 41b42e677..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - -] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl index e3d7a6716..3812380ea 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-restconf-configlet-template.vtl @@ -1,19 +1,37 @@ - -example-patch -Example patch - - edit1 - create - /car-entry - - - 0 - - - - - edit2 - delete - /car-entry/0 - - +{ + "ietf-restconf:yang-patch":{ + "patch-id":"patch-1", + "edit":[ + { + "edit-id":"edit1", + "operation":"merge", + "target":"/", + "value":{ + "netconflist":{ + "netconf":[ + { + "netconf-id":"40", + "netconf-param":"4040" + } + ] + } + } + }, + { + "edit-id":"edit2", + "operation":"merge", + "target":"/", + "value":{ + "netconflist":{ + "netconf":[ + { + "netconf-id":"50", + "netconf-param":"98765" + } + ] + } + } + } + ] + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl new file mode 100644 index 000000000..935177658 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-deploy-restconf-mount-template.vtl @@ -0,0 +1,14 @@ + + $entity.pnf-id + + ODL-private-key + netconf + + $entity.pnf-name + 6513 + false + + TLS + + 5 + diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json deleted file mode 100644 index 41b42e677..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - -] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl deleted file mode 100644 index a899aa45c..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl +++ /dev/null @@ -1,14 +0,0 @@ - - $pnf-id - - ODL-private-key - netconf - - $pnf-ip - 6513 - false - - TLS - - 5 - diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl deleted file mode 100644 index a0990367e..000000000 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-unmount-template.vtl +++ /dev/null @@ -1 +0,0 @@ -TBD diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/entity.json b/components/model-catalog/resource-dictionary/starter-dictionary/entity.json new file mode 100755 index 000000000..83a32a922 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/entity.json @@ -0,0 +1,15 @@ +{ + "name" : "entity", + "tags" : "entity", + "updated-by" : "Rodrigo Ottero ", + "property" : { + "description" : "entity", + "type" : "json" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json new file mode 100755 index 000000000..32468533a --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-id.json @@ -0,0 +1,15 @@ +{ + "name" : "pnf-id", + "tags" : "pnf-id", + "updated-by" : "Rodrigo Ottero ", + "property" : { + "description" : "pnf-id", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-name.json new file mode 100755 index 000000000..edcc3e9a0 --- /dev/null +++ b/components/model-catalog/resource-dictionary/starter-dictionary/pnf-name.json @@ -0,0 +1,15 @@ +{ + "name" : "pnf-name", + "tags" : "pnf-name", + "updated-by" : "Rodrigo Ottero ", + "property" : { + "description" : "pnf-name", + "type" : "string" + }, + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } +} \ No newline at end of file -- cgit 1.2.3-korg From ccd1091289c20f3834610d344b270b46cc8d90c5 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Wed, 13 Mar 2019 17:39:15 -0400 Subject: Propagate exceptions correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idaf66eeaa6e57d27c576099fd6ffdeb8b6d8d6c6 Issue-ID: CCSDK-1120 Signed-off-by: Alexis de Talhouët --- .../test-blueprint/golden/Scripts/python/DescriptionExample.py | 4 ++-- .../test-blueprint/golden/Scripts/python/NetconfRpcExample.py | 2 +- .../blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py index fce7c3249..4cf635afe 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/DescriptionExample.py @@ -42,5 +42,5 @@ class DescriptionExample(AbstractRAProcessor): return None def recover(self, runtime_exception, resource_assignment): - print "NoOp" - return None + print self.addError(runtime_exception.getMessage()) + return None \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py index ed22989fb..2d22f8bba 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/NetconfRpcExample.py @@ -57,5 +57,5 @@ class NetconfRpcExample(NetconfComponentFunction): log.error("Python Exception in the script {}", err) def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print self.addError(runtime_exception.getMessage()) return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py index 73419d716..deec47007 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Scripts/python/Rollback.py @@ -43,5 +43,5 @@ class Rollback(NetconfComponentFunction): log.error("Python Exception in the script {}", err) def recover(self, runtime_exception, execution_request): - print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + print self.addError(runtime_exception.getMessage()) return None -- cgit 1.2.3-korg From 2d0bfb6f58496fc52cad29a3f9b9064bcae67ed3 Mon Sep 17 00:00:00 2001 From: vinal patel Date: Wed, 20 Feb 2019 16:02:44 -0500 Subject: Ressource resolution using configurable database Change-Id: I40338a221884d6f4df4c8a7dc3dac1f58f142074 Issue-ID: CCSDK-1092 Signed-off-by: vinal patel --- .../baseconfiguration/Definitions/node_types.json | 2 +- .../Definitions/resources_definition_types.json | 4 +- .../golden/Definitions/node_types.json | 2 +- .../Definitions/resources_definition_types.json | 4 +- .../golden/Templates/vf-module-1-mapping.json | 2 +- .../golden/Templates/vfw-interface-mapping.json | 2 +- .../node_type/source-processor-db.json | 48 ++++++++++++++++++++++ .../test-dictionary/vf-module-type.json | 4 +- 8 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 components/model-catalog/definition-type/starter-type/node_type/source-processor-db.json (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json index 8f6c44f94..68a8ae6bd 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -223,7 +223,7 @@ }, "derived_from": "tosca.nodes.ResourceSource" }, - "source-primary-db": { + "source-processor-db": { "description": "This is Database Resource Source Node Type", "version": "1.0.0", "properties": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json index eaf45b35f..6e3d5e94f 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -26,8 +26,8 @@ "type": "source-input", "properties": {} }, - "primary-db": { - "type": "source-primary-db", + "processor-db": { + "type": "source-processor-db", "properties": { "endpoint-selector": "dynamic-db-source", "query": "SELECT artifact_name FROM sdnctl.BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json index b05869217..f143e560b 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/node_types.json @@ -236,7 +236,7 @@ }, "derived_from" : "tosca.nodes.ResourceSource" }, - "source-primary-db" : { + "source-processor-db" : { "description" : "This is Database Resource Source Node Type", "version" : "1.0.0", "properties" : { diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json index 446a8a681..15f02a1ce 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Definitions/resources_definition_types.json @@ -129,8 +129,8 @@ }, "updated-by" : "adetalhouet", "sources" : { - "primary-db" : { - "type" : "source-primary-db", + "processor-db" : { + "type" : "source-processor-db", "properties" : { "type" : "SQL", "query" : "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid", diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json index eba259e33..b7335b513 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vf-module-1-mapping.json @@ -18,7 +18,7 @@ "type": "string" }, "dictionary-name": "vf-module-type", - "dictionary-source": "primary-db", + "dictionary-source": "processor-db", "dependencies": [ "vf-module-number" ] diff --git a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json index 149d3eb20..c1ebe5688 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json +++ b/components/model-catalog/blueprint-model/test-blueprint/golden/Templates/vfw-interface-mapping.json @@ -55,7 +55,7 @@ "type": "string" }, "dictionary-name": "vf-module-type", - "dictionary-source": "primary-db", + "dictionary-source": "processor-db", "dependencies": [ "vf-module-number" ] diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-processor-db.json b/components/model-catalog/definition-type/starter-type/node_type/source-processor-db.json new file mode 100644 index 000000000..702748f8a --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/source-processor-db.json @@ -0,0 +1,48 @@ +{ + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "endpoint-selector": { + "required": false, + "type": "string" + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json index b06057c45..9e8c4096f 100644 --- a/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json +++ b/components/model-catalog/resource-dictionary/test-dictionary/vf-module-type.json @@ -7,8 +7,8 @@ }, "updated-by": "adetalhouet", "sources": { - "primary-db": { - "type": "source-primary-db", + "processor-db": { + "type": "source-processor-db", "properties": { "type": "SQL", "query": "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid", -- cgit 1.2.3-korg From 61f4924a42bf9a3e4f52e89f2d4f84395a34acd2 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 19 Mar 2019 16:31:51 -0400 Subject: Compile against Fluorine SR2 Updated to compile against Fluorine SR2 Change-Id: I434068531ce4a661a04c20201e0fddf3f6b92f47 Issue-ID: CCSDK-1156 Signed-off-by: Timoney, Dan (dt5972) --- components/model-catalog/proto-definition/pom.xml | 2 +- components/parent/pom.xml | 2 +- components/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'components/model-catalog') diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml index 35fc9a9a1..d12470843 100644 --- a/components/model-catalog/proto-definition/pom.xml +++ b/components/model-catalog/proto-definition/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.apps ccsdk-apps - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ../../../ diff --git a/components/parent/pom.xml b/components/parent/pom.xml index dd74622dd..0d5d964e6 100644 --- a/components/parent/pom.xml +++ b/components/parent/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.apps components - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.onap.ccsdk.apps.components parent diff --git a/components/pom.xml b/components/pom.xml index 1915fecf7..115b3a981 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.apps ccsdk-apps - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT 4.0.0 components -- cgit 1.2.3-korg From baa596db5ef0ace285f03a68aa8d9307454fc860 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Thu, 21 Mar 2019 15:56:38 -0400 Subject: Add workflow output resolution Change-Id: I3d5bb339fd07257e86ada85e4a30040183808848 Issue-ID: CCSDK-1175 Signed-off-by: Muthuramalingam, Brinda Santh --- .../Definitions/activation-blueprint.json | 15 +++++++++++++++ .../component_invoke/Definitions/component_invoke.json | 12 ++++++++++++ 2 files changed, 27 insertions(+) (limited to 'components/model-catalog') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 7a9239819..a8329b837 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -318,6 +318,21 @@ } ] } + }, + "outputs": { + "response-property": { + "type": "string", + "value": "executed" + }, + "template-properties": { + "type": "json", + "value": { + "get_attribute": [ + "resource-assignment", + "assignment-params" + ] + } + } } }, "activate": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json index eeb9815fa..9e040b85d 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json +++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json @@ -54,6 +54,18 @@ "required": true, "type": "string" } + }, + "outputs": { + "response-property1": { + "type": "string", + "value": "executed" + }, + "response-property2": { + "type": "string", + "value": { + "get_input": "action-name" + } + } } } }, -- cgit 1.2.3-korg