diff options
81 files changed, 1396 insertions, 1615 deletions
diff --git a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json index 7b9b7dd7..bc10f767 100644 --- a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json @@ -2,7 +2,7 @@ "metadata": {
"template_author": "Brinda Santh Muthuramalingam",
"author-email": "brindasanth@gmail.com",
- "user-groups" : "ADMIN, OPERATION",
+ "user-groups": "ADMIN, OPERATION",
"template_name": "baseconfiguration",
"template_version": "1.0.0",
"template_tags": "brinda, tosca"
@@ -24,121 +24,120 @@ "hostname": {
"required": true,
"type": "string"
+ },
+ "template_name": {
+ "required": true,
+ "type": "string"
+ },
+ "template_version": {
+ "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"
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
},
"interfaces": {
- "DefaultComponentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
- "action-name": { "get_input" : "action-name" },
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
"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"] }
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ }
},
"outputs": {
- "resource-assignment-params": "",
- "status": ""
+ "resource-assignment-params": { "get_attribute" : ["SELF", "params"] },
+ "status": "Success"
}
}
}
}
},
- "artifacts": {
- "baseconfig-template": {
- "type": "artifact-template-velocity",
- "file": "Templates/baseconfig-template.vtl"
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": {
+ "get_input": "template_version"
},
- "baseconfig-mapping": {
- "type": "artifact-mapping-resource",
- "file": "Mappings/baseconfig-mapping.json"
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
}
- }
- },
- "resource-assignment-py": {
- "type": "component-resource-assignment",
- "properties":{
- "request-id": "1234"
+ },
+ "capabilities": {
+ "dg-node": {}
},
"interfaces": {
- "DefaultComponentNode": {
+ "CONFIG": {
"operations": {
- "process": {
- "implementation" :{
- "primary" : "component-script"
- },
+ "ResourceAssignment": {
"inputs": {
- "action-name": { "get_input" : "action-name" }
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
+ "params": []
}
}
}
}
},
- "artifacts": {
- "component-script": {
- "type": "artifact-script-python",
- "file": "Scripts/baseconfig-template.vtl"
- }
- }
+ "type": "dg-resource-assignment"
}
},
- "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" : [
+ "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" : [
+ "on_success": [
"download-licence"
]
},
- "download-licence" : {
- "description" : "Call Download Licence Component",
- "target" : "activate-netconf",
- "activities" : [
+ "download-licence": {
+ "description": "Call Download Licence Component",
+ "target": "activate-netconf",
+ "activities": [
{
"call_operation": "NetconfTransactionNode.process"
}
@@ -199,106 +198,105 @@ }
},
"node_types": {
- "bpmn-activate": {
- "description": "This is BPMN Activate node type",
+ "dg-resource-assignment": {
+ "description": "This is Resource Assignment Directed Graph",
"version": "1.0.0",
"properties": {
- "content": {
+ "mode": {
"required": false,
- "type": "string"
- },
- "process-name": {
- "required": false,
- "type": "string"
+ "type": "string",
+ "default": "sync"
},
"version": {
"required": false,
"type": "string",
- "default" : "LATEST"
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": false
}
},
- "derived_from": "tosca.nodes.Component"
- },
- "tosca.nodes.Component": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
}
},
"interfaces": {
- "DefaultOperation": {
+ "CONFIG": {
"operations": {
- "validate": {
+ "ResourceAssignment": {
"inputs": {
- "action-name": {
- "description": "validate for action",
+ "params": {
"required": false,
- "type": "string"
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
}
}
}
}
}
},
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "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"
+ "derived_from": "tosca.nodes.DG"
},
"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"
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
}
},
"interfaces": {
- "DefaultComponentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"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,
+ "description": "Action Name of the process",
+ "required": true,
"type": "string"
},
- "resource-type": {
- "required": false,
+ "template-name": {
+ "description": "Service Template Name.",
+ "required": true,
"type": "string"
},
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "template-version": {
+ "description": "Service Template Version.",
"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",
+ "resource-type": {
+ "description": "Request type.",
"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",
+ "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"
},
- "mapping-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "resource-id": {
+ "description": "Resource Id.",
"required": true,
"type": "string"
}
@@ -319,64 +317,95 @@ },
"derived_from": "tosca.nodes.Component"
},
- "component-resource-assignment-python": {
+ "tosca.nodes.DG": {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.Component": {
+ "description": "This is Resource Assignment Component API",
+ "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"
+ }
+ },
+ "data_types": {
+ "datatype-resource-assignment": {
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
"properties": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
"required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
"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"
- }
- }
- }
+ },
+ "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.nodes.component.Python"
- }
- },
- "data_types": {
- "sample-property" : {
- "description": "This is sample data type",
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "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": {
- "content": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
"required": false,
"type": "string"
},
- "process-name": {
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
"required": false,
"type": "string"
},
- "version": {
+ "entry_schema": {
"required": false,
- "type": "string",
- "default" : "LATEST"
+ "type": "string"
}
},
- "derived_from" : "tosca.datatypes.Root"
+ "derived_from": "tosca.datatypes.Root"
}
}
}
\ No newline at end of file diff --git a/components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json b/components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json index 6d469ea8..207fcc41 100644 --- a/components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json +++ b/components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json @@ -1,34 +1,5 @@ {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "derived_from": "tosca.nodes.Root"
+ "derived_from": "tosca.nodes.Root"
}
\ No newline at end of file diff --git a/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json b/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json index 65028ace..cb091da0 100644 --- a/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json +++ b/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json @@ -38,7 +38,7 @@ "login-key": "sdnc",
"login-account": "sndc-local",
"source": "local",
- "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "target-ip-address": { "get_attribute": ["SELF", "lo0-local-ipv4-address"]},
"port-number": 22,
"connection-time-out": 30
}
@@ -58,21 +58,21 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {
"operations": {
"process": {
"inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name": { "get_input" : "action-name" },
+ "service-template-name": { "get_input" : "template_name" },
+ "service-template-version": { "get_input" : "service-template-version" },
"resource-type": "vnf-type",
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"hostname\" }",
+ "request-id": { "get_input" : "request-id" },
+ "resource-id": { "get_input" : "hostname" },
"execution-script": "execution-script"
},
"outputs": {
- "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
- "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ "response-data": { "get_input" : ["SELF", "netconf-executor-baseconfig.response-data"] },
+ "status": { "get_input" : ["SELF", "netconf-executor-baseconfig.status"] }
},
"implementation" : {
"primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
@@ -88,7 +88,7 @@ "component-node": {}
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
@@ -96,12 +96,12 @@ "base-config-template",
"licence-template"
],
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name": { "get_input" : "action-name" },
+ "service-template-name": { "get_input" : "template_name" },
+ "service-template-version": { "get_input" : "service-template-version" },
"resource-type": "vnf-type",
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"hostname\" }"
+ "request-id": { "get_input" : "request-id" },
+ "resource-id": { "get_input" : "hostname" }
},
"outputs": {
"resource-assignment-params": "success",
@@ -127,12 +127,7 @@ }
},
"capabilities": {
- "dg-node": {},
- "content": {
- "properties": {
- "type": "json"
- }
- }
+ "dg-node": {}
},
"interfaces": {
"CONFIG": {
diff --git a/components/core/load/model_type/node_type/artifact-config-template.json b/components/core/load/model_type/node_type/artifact-config-template.json index be9bbfc0..af99d75b 100644 --- a/components/core/load/model_type/node_type/artifact-config-template.json +++ b/components/core/load/model_type/node_type/artifact-config-template.json @@ -12,7 +12,7 @@ },
"capabilities": {
"content": {
- "type": "tosca.capability.Content",
+ "type": "tosca.capabilities.Content",
"properties": {
"content": {
"required": true,
@@ -21,7 +21,7 @@ }
},
"mapping": {
- "type": "tosca.capability.Mapping",
+ "type": "tosca.capabilities.Mapping",
"properties": {
"mapping": {
"required": false,
diff --git a/components/core/load/model_type/node_type/component-config-generator.json b/components/core/load/model_type/node_type/component-config-generator.json index 764f9e89..9e86b8ae 100644 --- a/components/core/load/model_type/node_type/component-config-generator.json +++ b/components/core/load/model_type/node_type/component-config-generator.json @@ -7,7 +7,7 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {
+ "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": {
"operations": {
"process": {
"inputs": {
diff --git a/components/core/load/model_type/node_type/component-netconf-executor.json b/components/core/load/model_type/node_type/component-netconf-executor.json index aed667aa..7dcff583 100644 --- a/components/core/load/model_type/node_type/component-netconf-executor.json +++ b/components/core/load/model_type/node_type/component-netconf-executor.json @@ -14,7 +14,7 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {
"operations": {
"process": {
"inputs": {
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 03f3c284..1389bc32 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-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
diff --git a/components/core/load/model_type/node_type/dg-activate-netconf.json b/components/core/load/model_type/node_type/dg-activate-netconf.json index a9d16edd..57667de9 100644 --- a/components/core/load/model_type/node_type/dg-activate-netconf.json +++ b/components/core/load/model_type/node_type/dg-activate-netconf.json @@ -21,20 +21,6 @@ "capabilities": { "dg-node": { "type": "tosca.capabilities.Node" - }, - "content": { - "type": "tosca.capability.Content", - "properties": { - "type": { - "required": false, - "type": "string", - "default": "json" - }, - "content": { - "required": true, - "type": "string" - } - } } }, "requirements": { diff --git a/components/core/load/model_type/node_type/dg-config-generator.json b/components/core/load/model_type/node_type/dg-config-generator.json index 6794b3c8..e59c34b6 100644 --- a/components/core/load/model_type/node_type/dg-config-generator.json +++ b/components/core/load/model_type/node_type/dg-config-generator.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/components/core/load/model_type/node_type/dg-resource-assign-activate.json b/components/core/load/model_type/node_type/dg-resource-assign-activate.json index 22a4d813..ca703a79 100644 --- a/components/core/load/model_type/node_type/dg-resource-assign-activate.json +++ b/components/core/load/model_type/node_type/dg-resource-assign-activate.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": false,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/components/core/load/model_type/node_type/dg-resource-assignment.json b/components/core/load/model_type/node_type/dg-resource-assignment.json index 7c01faa1..9cce82a9 100644 --- a/components/core/load/model_type/node_type/dg-resource-assignment.json +++ b/components/core/load/model_type/node_type/dg-resource-assignment.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": false,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/components/core/load/model_type/node_type/tosca.nodes.Artifact.json b/components/core/load/model_type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 00000000..81410527 --- /dev/null +++ b/components/core/load/model_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/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 ffad8e56..d4bd20a6 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 @@ -16,6 +16,7 @@ */
package org.onap.ccsdk.apps.controllerblueprints.core
+
/**
* BluePrintConstants
*
@@ -94,10 +95,28 @@ object BluePrintConstants { const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"
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_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"
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 af3966aa..e25b3eea 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 @@ -50,6 +50,39 @@ object BluePrintTypes { BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
)
+ @Deprecated("This has to move to Relationship Types Model Drive")
+ @JvmStatic
+ val validRelationShipDerivedFroms: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
+ )
+
+ @Deprecated("This has to move to Capability Types Model Drive")
+ @JvmStatic
+ val validCapabilityTypes: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
+ )
+
@JvmStatic
fun validModelTypes(): List<String> {
val validTypes: MutableList<String> = arrayListOf()
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 84592204..8bfa2db7 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 @@ -31,12 +31,6 @@ object ConfigModelConstant { const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
- const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"
- const val MODEL_TYPE_CAPABILITY_SSH = "tosca.capability.Ssh"
- const val MODEL_TYPE_CAPABILITY_SFTP = "tosca.capability.Sftp"
- const val MODEL_TYPE_CAPABILITY_CHEF = "tosca.capability.Chef"
- const val MODEL_TYPE_CAPABILITY_ANSIBLEF = "tosca.capability.Ansible"
-
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 ef8bbf2d..70f3c556 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 @@ -309,7 +309,7 @@ A capability definition defines a named, typed set of data that can be associate class CapabilityDefinition {
@get:JsonIgnore
var id: String? = null
- var type: String? = null
+ lateinit var type: String
var description: String? = null
var properties: MutableMap<String, PropertyDefinition>? = null
@get:JsonProperty("valid_source_types")
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt index f38c317e..b125c594 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt @@ -130,6 +130,14 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe @Throws(BluePrintException::class)
override fun enrichNodeType(nodeTypeName: String, nodeType: NodeType) {
+ log.debug("Enriching NodeType({})", nodeTypeName)
+ val derivedFrom = nodeType.derivedFrom
+
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
+ val derivedFromNodeType = populateNodeType(nodeTypeName)
+ // Enrich NodeType
+ enrichNodeType(derivedFrom, derivedFromNodeType)
+ }
// NodeType Property Definitions
enrichNodeTypeProperties(nodeTypeName, nodeType)
@@ -172,7 +180,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
// Populate Node type Interface Operation
- log.info("*** ** Enriching NodeType: {} Interface {}", nodeTypeName, interfaceName)
+ log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)
populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
}
@@ -235,21 +243,25 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe }
open fun populateNodeType(nodeTypeName: String): NodeType {
- val nodeType = bluePrintRepoService.getNodeType(nodeTypeName)?.block()
+
+ val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)
+ ?: bluePrintRepoService.getNodeType(nodeTypeName)?.block()
?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
}
open fun populateArtifactType(artifactTypeName: String): ArtifactType {
- val artifactType = bluePrintRepoService.getArtifactType(artifactTypeName)?.block()
+ val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName)?.block()
?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
}
open fun populateDataTypes(dataTypeName: String): DataType {
- val dataType = bluePrintRepoService.getDataType(dataTypeName)?.block()
+ val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
+ ?: bluePrintRepoService.getDataType(dataTypeName)?.block()
?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
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 19d515e0..82e232d0 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 @@ -25,6 +25,7 @@ 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
+
/**
*
*
@@ -115,32 +116,34 @@ object BluePrintExpressionService { @JvmStatic
fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
- check(arrayNode.size() >= 3) {
+ check(arrayNode.size() >= 2) {
throw BluePrintException(String.format("missing attribute expression, " +
"it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
" <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))
}
var reqOrCapEntityName: String? = null
- var propertyName = ""
- var subProperty: String? = null
- if (arrayNode.size() == 2) {
- propertyName = arrayNode[1].textValue()
- } else if (arrayNode.size() == 3) {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- } else if (arrayNode.size() > 3) {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->
- index >= 3
- }.map { it.textValue() }
- subProperty = propertyPaths.joinToString("/")
+ var attributeName = ""
+ var subAttributeName: String? = null
+ when {
+ arrayNode.size() == 2 -> attributeName = arrayNode[1].textValue()
+ arrayNode.size() == 3 -> {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ attributeName = arrayNode[2].textValue()
+ }
+ arrayNode.size() > 3 -> {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ attributeName = arrayNode[2].textValue()
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->
+ index >= 3
+ }.map { it.textValue() }
+ subAttributeName = propertyPaths.joinToString("/")
+ }
}
return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
reqOrCapEntityName = reqOrCapEntityName,
- attributeName = propertyName,
- subAttributeName = subProperty
+ attributeName = attributeName,
+ subAttributeName = subAttributeName
)
}
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 ce0bceee..1fdb6c3c 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 @@ -29,6 +29,9 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+
/**
*
*
@@ -78,8 +81,8 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c }
open fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
- interfaceName: String, operationName: String): MutableMap<String, Any?> {
- log.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
+ interfaceName: String, operationName: String): MutableMap<String, Any?> {
+ log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " +
"operationName({})", nodeTemplateName, interfaceName, operationName)
val propertyAssignmentValue: MutableMap<String, Any?> = hashMapOf()
@@ -117,17 +120,25 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c // Set for Return of method
propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
}
- log.info("resolved input assignments for node template ({}), values ({})", nodeTemplateName, propertyAssignmentValue)
+ log.trace("resolved input assignments for node template ({}), values ({})", nodeTemplateName,
+ propertyAssignmentValue)
return propertyAssignmentValue
}
open fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
- interfaceName: String, operationName: String, componentContext: MutableMap<String, Any?>) {
- log.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
+ interfaceName: String, operationName: String): MutableMap<String, Any?> {
+ log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ({}),interface name ({}), " +
"operationName({})", nodeTemplateName, interfaceName, operationName)
+ val propertyAssignmentValue: MutableMap<String, Any?> = hashMapOf()
+
+ val propertyAssignments: MutableMap<String, Any> =
+ bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
+ ?: throw BluePrintException(String.format("failed to get output definitions for node template (%s), " +
+ "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName))
+
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
@@ -138,21 +149,32 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c // Iterate Node Type Properties
nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
- val operationOutputPropertyName: String = StringBuilder().append(nodeTemplateName)
- .append(".").append(interfaceName)
- .append(".").append(operationName)
- .append(".").append(nodeTypePropertyName).toString()
- // Get the Value from component context
- val resolvedValue: JsonNode = componentContext[operationOutputPropertyName] as? JsonNode
- ?: NullNode.getInstance()
+ // Get the Express or Value for the Node Template
+ val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+
+ var resolvedValue: JsonNode = NullNode.getInstance()
+ if (propertyAssignment != null) {
+ // Resolve the Expressing
+ val propertyAssignmentExpression = PropertyAssignmentService(context, this)
+ resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
+ } else {
+ // Assign default value to the Operation
+ nodeTypeProperty.defaultValue?.let {
+ resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
+ }
+ }
+ // Set for Return of method
+ propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
+
// Store operation output values into context
- setNodeTemplateOperationPropertyValue(nodeTemplateName, interfaceName, operationName, nodeTypePropertyName, resolvedValue)
- log.debug("resolved output assignments for node template ({}), property name ({}), value ({})", nodeTemplateName, nodeTypePropertyName, resolvedValue)
+ setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, nodeTypePropertyName, resolvedValue)
+ log.trace("resolved output assignments for node template ({}), property name ({}), value ({})", nodeTemplateName, nodeTypePropertyName, resolvedValue)
}
+ return propertyAssignmentValue
}
open fun resolveNodeTemplateArtifact(nodeTemplateName: String,
- artifactName: String): String {
+ artifactName: String): String {
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName)
@@ -186,8 +208,16 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c context[path] = value
}
+ open fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
+
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ context[path] = value
+ }
+
open fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode) {
+ value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
@@ -198,10 +228,10 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c }
open fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode) {
+ value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -209,10 +239,10 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c }
open fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode) {
+ value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -230,19 +260,27 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS).append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- open fun getPropertyValue(nodeTemplateName: String, propertyName: String): JsonNode? {
+ open fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode? {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- open fun getRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode? {
+ open fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode? {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ return context[path] as JsonNode
+ }
+
+ open fun getNodeTemplateRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName:
+ String): JsonNode? {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
@@ -250,7 +288,8 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c return context[path] as JsonNode
}
- open fun getCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode? {
+ open fun getNodeTemplateCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName:
+ String): JsonNode? {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
@@ -275,4 +314,24 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c setWorkflowInputValue(workflowName, propertyName, valueNode)
}
}
+
+ open fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode {
+
+ val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).toString()
+ context.keys.filter {
+ it.startsWith(path)
+ }.map {
+ val key = it.replace(path, "")
+ if (keys.contains(key)) {
+ val value = context[it] as JsonNode
+ jsonNode.set(key, value)
+ }
+ }
+ return jsonNode
+ }
+
+
}
\ 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 a60f532e..3bea59f9 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 @@ -111,7 +111,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.add("dataTypes")
dataTypes.forEach { dataTypeName, dataType ->
paths.add(dataTypeName)
- message.appendln("--> Data Type :" + paths.joinToString(separator))
+ message.appendln("--> DataType :" + paths.joinToString(separator))
dataType.properties?.let { validatePropertyDefinitions(dataType.properties!!) }
paths.removeAt(paths.lastIndex)
}
@@ -136,7 +136,15 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { //Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
+ serviceTemplate.nodeTypes?.get(derivedFrom)
+ ?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
+ derivedFrom, nodeTypeName))
+ }
+
nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
+ nodeType.capabilities?.let { validateCapabilityDefinitions(nodeTypeName, nodeType) }
+ nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) }
nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
paths.removeAt(paths.lastIndex)
}
@@ -144,7 +152,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class)
open fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) {
check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get node type ({})'s derived from({}) definition ", nodeTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get node type ({})'s derivedFrom({}) definition ", nodeTypeName, derivedFrom))
}
}
@@ -178,16 +186,16 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class)
open fun validateNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
paths.add(nodeTemplateName)
- message.appendln("---> Node Template :" + paths.joinToString(separator))
+ message.appendln("---> NodeTemplate :" + paths.joinToString(separator))
val type: String = nodeTemplate.type
val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException(format("Failed to get node type definition for node template : {}", nodeTemplateName))
+ ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
- nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeTemplate.capabilities!!) }
- nodeTemplate.requirements?.let { validateRequirementAssignments(nodeTemplate.requirements!!) }
+ nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, nodeTemplateName, nodeTemplate) }
+ nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, nodeTemplateName, nodeTemplate) }
nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, nodeTemplateName, nodeTemplate) }
paths.removeAt(paths.lastIndex)
}
@@ -199,12 +207,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.add(artifactDefinitionName)
message.appendln("Validating artifact " + paths.joinToString(separator))
val type: String = artifactDefinition.type
- ?: throw BluePrintException("type is missing for artifact definition :" + artifactDefinitionName)
+ ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
// Check Artifact Type
checkValidArtifactType(artifactDefinitionName, type)
val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for artifact definition : {}", artifactDefinitionName))
+ ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
paths.removeAt(paths.lastIndex)
}
@@ -250,7 +258,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for data type ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
checkPrimitiveOrComplex(entrySchemaType, propertyName)
}
else -> checkPropertyDataType(dataType, propertyName)
@@ -284,12 +292,69 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignments(capabilities: MutableMap<String, CapabilityAssignment>) {
+ open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ val capabilities = nodeTemplate.capabilities
+ paths.add("capabilities")
+ capabilities?.forEach { capabilityName, capabilityAssignment ->
+ paths.add(capabilityName)
+
+ val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) capability definition ({}) " +
+ "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type))
+
+ validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
+
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
+ capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+
+ capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ val requirements = nodeTemplate.requirements
+ paths.add("requirements")
+ requirements?.forEach { requirementName, requirementAssignment ->
+ paths.add(requirementName)
+ val requirementDefinition = nodeType.requirements?.get(requirementName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) requirement definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type))
+ // Validate Requirement Assignment
+ validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignments(requirements: MutableMap<String, RequirementAssignment>) {
+ open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
+ log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
+ val requirementNodeTemplateName = requirementAssignment.node!!
+ val capabilityName = requirementAssignment.capability
+ val relationship = requirementAssignment.relationship!!
+
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
+ throw BluePrintException(format("Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
+ relationship, nodeTemplateName, requirementAssignmentName))
+ }
+
+ val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
+ requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName))
+
+ relationShipNodeTemplate.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
+ requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName))
+
}
@@ -301,8 +366,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) interface definition ({}) from" +
- " node type ({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) interface definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
interfaceAssignment)
@@ -336,10 +401,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) operation definition ({}) ",
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) ",
nodeTemplateName, operationAssignmentName))
- log.info("Validation Node Template({}) Interface({}) Operation ({})", nodeTemplateName,
+ log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
interfaceAssignmentName, operationAssignmentName)
val inputs = operationAssignments.inputs
@@ -347,17 +412,88 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) operation definition ({}) " +
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
"property definition({})", nodeTemplateName, operationAssignmentName, propertyName))
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
+ outputs?.forEach { propertyName, propertyAssignment ->
+ val propertyDefinition = operationDefinition.outputs?.get(propertyName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
+ "output property definition({})", nodeTemplateName, operationAssignmentName,
+ propertyName))
+ // Check the property values with property definition
+ validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ }
+
}
}
}
+ @Throws(BluePrintException::class)
+ open fun validateCapabilityDefinitions(nodeTypeName: String, nodeType: NodeType) {
+ val capabilities = nodeType.capabilities
+ paths.add("capabilities")
+ capabilities?.forEach { capabilityName, capabilityDefinition ->
+ paths.add(capabilityName)
+
+ validateCapabilityDefinition(nodeTypeName, nodeType, capabilityName, capabilityDefinition)
+
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
+ capabilityDefinition: CapabilityDefinition) {
+ val capabilityType = capabilityDefinition.type
+ check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
+ throw BluePrintException(format("Failed to get CapabilityType({}) for NodeType({})",
+ capabilityType, nodeTypeName))
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementDefinitions(nodeName: String, nodeType: NodeType) {
+ paths.add("requirements")
+ val requirements = nodeType.requirements
+
+ requirements?.forEach { requirementDefinitionName, requirementDefinition ->
+ paths.add(requirementDefinitionName)
+ message.appendln("Validating : " + paths.joinToString(separator))
+ validateRequirementDefinition(nodeName, nodeType, requirementDefinitionName, requirementDefinition)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition) {
+
+ log.info("Validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
+ val requirementNodeTypeName = requirementDefinition.node!!
+ val capabilityName = requirementDefinition.capability
+ val relationship = requirementDefinition.relationship!!
+
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
+ throw BluePrintException(format("Failed to get relationship({}) for NodeType({})'s requirement({}) ",
+ relationship, nodeTypeName, requirementDefinitionName))
+ }
+
+ val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s for requirement({}) ",
+ requirementNodeTypeName, requirementDefinitionName))
+
+ relationShipNodeType.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
+ requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName))
+
+ }
+
@Throws(BluePrintException::class)
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
@@ -394,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 artifact type for artifact definition : {}", artifactDefinitionName))
+ ?: throw BluePrintException(format("Failed to ArtifactType for ArtifactDefinition : {}", artifactDefinitionName))
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -402,14 +538,21 @@ 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 artifact type ({})'s derived from({}) definition ", artifactTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get ArtifactType ({})'s derivedFrom({}) definition ", artifactTypeName, derivedFrom))
}
}
@Throws(BluePrintException::class)
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get data type ({})'s derived from({}) definition ", dataTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get DataType ({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun checkValidRelationshipTypeDerivedFrom(relationshipTypeName: String, derivedFrom: String) {
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(derivedFrom)) {
+ throw BluePrintException(format("Failed to get relationship type ({})'s derivedFrom({}) definition ", relationshipTypeName, derivedFrom))
}
}
@@ -423,7 +566,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get Entry Schema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -435,7 +578,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
check(isValid) {
- throw BluePrintException(format("property({}) defined of type({}) is not compatable with the value ({})",
+ throw BluePrintException(format("property({}) defined of type({}) is not comptable with the value ({})",
propertyName, propertyType, propertyAssignment))
}
}
@@ -443,7 +586,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { private fun checkPropertyDataType(dataType: String, propertyName: String) {
val dataType = serviceTemplate.dataTypes?.get(dataType)
- ?: throw BluePrintException(format("Data type ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataType, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
@@ -453,7 +596,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
} else {
- throw BluePrintException(format("Data type ({}) for the property ({}) is not valid", dataType))
+ throw BluePrintException(format("DataType ({}) for the property ({}) is not valid", dataType))
}
}
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 ece09d6e..131bb30a 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 @@ -20,6 +20,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
+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.format
@@ -27,6 +28,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.core.utils.ResourceResolverUtils
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
+
/**
*
*
@@ -42,11 +44,11 @@ class PropertyAssignmentService(var context: MutableMap<String, Any>, If Property Assignment is Expression.
Get the Expression
- Recurssely resolve the expression
+ Recursively resolve the expression
*/
fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
- assignment: Any): JsonNode {
+ assignment: Any): JsonNode {
val valueNode: JsonNode
log.trace("Assignment ({})", assignment)
val expressionData = BluePrintExpressionService.getExpressionData(assignment)
@@ -63,30 +65,30 @@ If Property Assignment is Expression. var valueNode: JsonNode = NullNode.getInstance()
- if(expressionData.isExpression) {
+ if (expressionData.isExpression) {
val command = expressionData.command!!
- when(command){
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT ->{
+ when (command) {
+ BluePrintConstants.EXPRESSION_GET_INPUT -> {
valueNode = bluePrintRuntimeService.getInputValue(expressionData.inputExpression?.propertyName!!)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE ->{
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
valueNode = resolveAttributeExpression(nodeTemplateName, expressionData.attributeExpression!!)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY ->{
+ BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
valueNode = resolvePropertyExpression(nodeTemplateName, expressionData.propertyExpression!!)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT ->{
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
valueNode = resolveOperationOutputExpression(nodeTemplateName, expressionData.operationOutputExpression!!)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT ->{
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
valueNode = resolveArtifactExpression(nodeTemplateName, expressionData.artifactExpression!!)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE ->{
+ BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE -> {
}
- else ->{
- throw BluePrintException(String.format("for property ({}), command ({}) is not supported ", propName, command))
+ else -> {
+ throw BluePrintException(format("for property ({}), command ({}) is not supported ", propName, command))
}
}
}
@@ -104,20 +106,30 @@ If Property Assignment is Expression. val subAttributeName: String? = attributeExpression.subAttributeName
var attributeNodeTemplateName = nodeTemplateName
- if (!attributeExpression.modelableEntityName.equals("SELF", true)) {
- attributeNodeTemplateName = attributeExpression.modelableEntityName
- }
-
- val nodeTemplateAttributeExpression = bluePrintContext.nodeTemplateByName(attributeNodeTemplateName).attributes?.get(attributeName)
- ?: throw BluePrintException(String.format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, attributeName))
+ when (attributeExpression.modelableEntityName) {
+ "ENV" -> {
+ val environmentValue = System.getProperty(attributeName)
+ valueNode = JacksonUtils.jsonNode(environmentValue)
+ }
+ else -> {
+ if (!attributeExpression.modelableEntityName.equals("SELF", true)) {
+ attributeNodeTemplateName = attributeExpression.modelableEntityName
+ }
+ /* Enable in ONAP Dublin Release
+ val nodeTemplateAttributeExpression = bluePrintContext.nodeTemplateByName(attributeNodeTemplateName).attributes?.get(attributeName)
+ ?: throw BluePrintException(format("failed to get attribute definitions for node template " +
+ "({})'s property name ({}) ", nodeTemplateName, attributeName))
- var propertyDefinition: AttributeDefinition = bluePrintContext.nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)!!
+ var attributeDefinition: AttributeDefinition = bluePrintContext.nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)!!
- log.info("node template name ({}), property Name ({}) resolved value ({})", attributeNodeTemplateName, attributeName, nodeTemplateAttributeExpression)
+ log.info("node template name ({}), property Name ({}) resolved value ({})", attributeNodeTemplateName, attributeName, nodeTemplateAttributeExpression)
+ */
- // Check it it is a nested expression
- valueNode = resolveAssignmentExpression(attributeNodeTemplateName, attributeName, nodeTemplateAttributeExpression)
+ valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(attributeNodeTemplateName, attributeName)
+ ?: throw BluePrintException(format("failed to get node template ({})'s attribute ({}) ", nodeTemplateName, attributeName))
+ }
+ }
// subPropertyName?.let {
// valueNode = valueNode.at(JsonPointer.valueOf(subPropertyName))
// }
@@ -171,7 +183,7 @@ If Property Assignment is Expression. /*
get_artifact: [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ]
*/
- fun resolveArtifactExpression(nodeTemplateName: String, artifactExpression: ArtifactExpression): JsonNode {
+ fun resolveArtifactExpression(nodeTemplateName: String, artifactExpression: ArtifactExpression): JsonNode {
var artifactNodeTemplateName = nodeTemplateName
if (!artifactExpression.modelableEntityName.equals("SELF", true)) {
@@ -179,15 +191,15 @@ If Property Assignment is Expression. }
val artifactDefinition: ArtifactDefinition = bluePrintContext.nodeTemplateByName(artifactNodeTemplateName)
.artifacts?.get(artifactExpression.artifactName)
- ?: throw BluePrintException(String.format("failed to get artifact definitions for node template ({})'s " +
+ ?: throw BluePrintException(format("failed to get artifact definitions for node template ({})'s " +
"artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName))
return JacksonUtils.jsonNodeFromObject(artifactContent(artifactDefinition))
}
fun artifactContent(artifactDefinition: ArtifactDefinition): String {
- val bluePrintBasePath: String = context[org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] as? String
- ?: throw BluePrintException(String.format("failed to get property (%s) from context", org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH))
+ val bluePrintBasePath: String = context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] as? String
+ ?: throw BluePrintException(format("failed to get property (%s) from context", BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH))
if (artifactDefinition.repository != null) {
TODO()
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt index 911a891a..a0214023 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt @@ -60,14 +60,22 @@ class BluePrintExpressionServiceTest { @Test
fun testAttributeExpression() {
- val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"resource\"] }")
val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data")
assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
- assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
- assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
+ assertEquals("resource", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
+
+ val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
+ val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)
+ assertNotNull(expressionData1, " Failed to populate expression data")
+ assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")
+ assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")
+ assertEquals("resource/name",expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
}
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 5d24b072..f1980d27 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 @@ -1,5 +1,6 @@ /*
* 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.
@@ -17,7 +18,6 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.NullNode
import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
@@ -48,24 +48,20 @@ class BluePrintRuntimeServiceTest { @Test
fun testResolveNodeTemplateProperties() {
log.info("************************ testResolveNodeTemplateProperties **********************")
- val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
- .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
- val context: MutableMap<String, Any> = hashMapOf()
- context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
- val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
- val inputDataPath = "src/test/resources/data/default-context.json"
+ val inputDataPath = "src/test/resources/data/default-context.json"
val inputNode: JsonNode = jsonNodeFromFile(inputDataPath)
bluePrintRuntimeService.assignInputs(inputNode)
- val propContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
- log.info("Context {}" ,bluePrintRuntimeService.context)
+ val propContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateProperties("resource-assignment-action")
+ log.info("Context {}", bluePrintRuntimeService.context)
assertNotNull(propContext, "Failed to populate interface property values")
- assertEquals(propContext.get("process-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name")
- assertEquals(propContext.get("version"), jsonNodeFromObject("sample-action"), "Failed to populate parameter version")
+ assertEquals(propContext.get("mode"), jsonNodeFromObject("sync"), "Failed to populate parameter process-name")
+ assertEquals(propContext.get("version"), jsonNodeFromObject("1.0.0"), "Failed to populate parameter version")
}
@Test
@@ -78,54 +74,80 @@ class BluePrintRuntimeServiceTest { val context: MutableMap<String, Any> = hashMapOf()
context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
- val inputDataPath = "src/test/resources/data/default-context.json"
+ val inputDataPath = "src/test/resources/data/default-context.json"
BluePrintRuntimeUtils.assignInputsFromFile(bluePrintContext, inputDataPath, context)
val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
- log.info("Prepared Context {}" ,context)
+ log.info("Prepared Context {}", context)
- val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "DefaultComponentNode", "process")
+ val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component",
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process")
- log.trace("In Context {}" ,inContext)
+ log.info("In Context {}", inContext)
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext.get("action-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext.get("request-id"), jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- assertEquals(inContext.get("template-content"), jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name")
-
}
@Test
fun testResolveNodeTemplateInterfaceOperationOutputs() {
log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
- val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
- .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
- assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
- val context: MutableMap<String, Any> = hashMapOf()
- context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
- val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+ val successValue: JsonNode = jsonNodeFromObject("Success")
+ val paramValue: JsonNode = jsonNodeFromObject("param-content")
+
+ bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "params", paramValue)
- val componentContext: MutableMap<String, Any?> = hashMapOf()
- val successValue : JsonNode= jsonNodeFromObject("Success")
- componentContext["resource-assignment.DefaultComponentNode.process.status"] = successValue
- componentContext["resource-assignment.DefaultComponentNode.process.resource-assignment-params"] = null
+ bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component",
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process")
- bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
- "DefaultComponentNode", "process", componentContext)
+ val resourceAssignmentParamsNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment-ra-component",
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", "resource-assignment-params")
- assertEquals(NullNode.instance,
- context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/resource-assignment-params"),
- "Failed to get operation property resource-assignment-params")
+ val statusNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment-ra-component",
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", "status")
- assertEquals(successValue,
- context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/status"),
- "Failed to get operation property status")
+ assertEquals(paramValue, resourceAssignmentParamsNode, "Failed to get operation property resource-assignment-params")
+
+ assertEquals(successValue, statusNode, "Failed to get operation property status")
}
+
+ @Test
+ fun testNodeTemplateContextProperty() {
+ log.info("************************ testNodeTemplateContextProperty **********************")
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
+
+ bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",
+ jsonNodeFromObject("context1-value"))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",
+ jsonNodeFromObject("context2-value"))
+
+ log.info("Context {}", bluePrintRuntimeService.context)
+
+ val keys = listOf("context1", "context2")
+
+ val jsonValueNode = bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
+ assertNotNull(jsonValueNode, "Failed to get Json for Node Template Context Properties")
+ log.info("JSON Prepared Value Context {}", jsonValueNode)
+
+ }
+
+ private fun getBluePrintRuntimeService(): BluePrintRuntimeService {
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+
+ val context: MutableMap<String, Any> = hashMapOf()
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+
+ return BluePrintRuntimeService(bluePrintContext, context)
+ }
+
}
\ No newline at end of file diff --git a/components/core/src/test/resources/componentnode/default.json b/components/core/src/test/resources/componentnode/default.json index b7265fcd..184b5988 100644 --- a/components/core/src/test/resources/componentnode/default.json +++ b/components/core/src/test/resources/componentnode/default.json @@ -41,13 +41,13 @@ "generate-configuration": {
"type": "mock-component-generateConfig",
"interfaces": {
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {
"operations": {
"process": {
"inputs": {
"entity-type": "vnf-type",
"template-content": "sample-template",
- "entity-id": "{ \"get_input\" : \"vnf-id\" }"
+ "entity-id": { "get_input" : "vnf-id" }
},
"outputs": {
"mergedData": "merged Data",
@@ -63,7 +63,7 @@ "node_types": {
"mock-component-generateConfig": {
"interfaces": {
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {
"operations": {
"process": {
"inputs": {
diff --git a/components/core/src/test/resources/data/default-context.json b/components/core/src/test/resources/data/default-context.json index fcd4cbe2..e033f6f5 100644 --- a/components/core/src/test/resources/data/default-context.json +++ b/components/core/src/test/resources/data/default-context.json @@ -1,5 +1,7 @@ {
"request-id" : "12345",
"hostname" : "localhost",
+ "template_name": "baseconfiguration",
+ "template_version": "1.0.0",
"action-name" : "sample-action"
}
\ No newline at end of file diff --git a/components/core/src/test/resources/properties/convert.json b/components/core/src/test/resources/properties/convert.json index cb7d08e4..af79915f 100644 --- a/components/core/src/test/resources/properties/convert.json +++ b/components/core/src/test/resources/properties/convert.json @@ -19,12 +19,12 @@ "required": true
}
],
- "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",
+ "pre-data": { "get_input" : "get-resource-assignment.config-params" },
"prifix": "get-resource-assignment"
},
"outputs": {
"resource-assignment-status": "success",
- "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"
+ "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params" }
}
}
}
diff --git a/components/core/src/test/resources/properties/default.json b/components/core/src/test/resources/properties/default.json index 0ac97f90..ec416dc9 100644 --- a/components/core/src/test/resources/properties/default.json +++ b/components/core/src/test/resources/properties/default.json @@ -1,5 +1,5 @@ {
- "default": "{ \"get_input\" : \"loopback-default\" }",
+ "default": { "get_input" : "loopback-default" },
"domain": "ethernet",
"criteria": [
{
@@ -8,7 +8,7 @@ "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
},
{
- "value": "{ \"get_input\" : \"host-ip-address\" }",
+ "value": { "get_input" : "host-ip-address" },
"type": "simple",
"nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
}
diff --git a/components/resource-dict/load/resource_dictionary/db-source.json b/components/resource-dict/load/resource_dictionary/db-source.json index 92b16a21..b96dc63f 100644 --- a/components/resource-dict/load/resource_dictionary/db-source.json +++ b/components/resource-dict/load/resource_dictionary/db-source.json @@ -4,8 +4,6 @@ "description": "name of the ",
"type": "string"
},
- "resource-type": "ONAP",
- "resource-path": "vnf/bundle-id",
"updated-by": "brindasanth@onap.com",
"tags": "bundle-id, brindasanth@onap.com",
"sources": {
diff --git a/components/resource-dict/load/resource_dictionary/default-source.json b/components/resource-dict/load/resource_dictionary/default-source.json index 1c47f37b..64bfa0cc 100644 --- a/components/resource-dict/load/resource_dictionary/default-source.json +++ b/components/resource-dict/load/resource_dictionary/default-source.json @@ -6,8 +6,6 @@ "type": "string"
},
"updated-by": "brindasanth@onap.com",
- "resource-type": "ONAP",
- "resource-path": "vnf/v4-ip-type",
"sources": {
"default": {
"type": "source-default",
diff --git a/components/resource-dict/load/resource_dictionary/input-source.json b/components/resource-dict/load/resource_dictionary/input-source.json index 676d92f8..152a5eef 100644 --- a/components/resource-dict/load/resource_dictionary/input-source.json +++ b/components/resource-dict/load/resource_dictionary/input-source.json @@ -4,8 +4,6 @@ "description": "name of the ",
"type": "string"
},
- "resource-path": "action-name",
- "resource-type": "ONAP",
"updated-by": "brindasanth@onap.com",
"tags": null,
"sources": {
diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json index b49146a0..b38986a4 100644 --- a/components/resource-dict/load/resource_dictionary/mdsal-source.json +++ b/components/resource-dict/load/resource_dictionary/mdsal-source.json @@ -6,8 +6,6 @@ "type": "string"
},
"updated-by": "brindasanth@onap.com",
- "resource-type": "ATT",
- "resource-path": "vnf/oam-local-ipv4-address",
"sources": {
"mdsal": {
"type": "source-rest",
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt index 0808073f..ff260871 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt @@ -36,12 +36,6 @@ open class ResourceDefinition { @JsonProperty(value = "updated-by") lateinit var updatedBy: String - @JsonProperty(value = "resource-type", required = true) - lateinit var resourceType: String - - @JsonProperty(value = "resource-path", required = true) - lateinit var resourcePath: String - @JsonProperty(value = "sources", required = true) lateinit var sources: MutableMap<String, NodeTemplate> } 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 228b39e2..fae509d2 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 @@ -1,5 +1,6 @@ /* * 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. @@ -87,9 +88,6 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida val dependenciesNames = resourceAssignments.mapNotNull { it.dependencies }.flatten() - log.info("Resource assignment definitions : {}", resourceAssignmentMap.keys) - log.info("Resource assignment Dictionary dependencies : {}", dependenciesNames) - val notPresentDictionaries = dependenciesNames.filter { !resourceAssignmentMap.containsKey(it) }.distinct() if (notPresentDictionaries.isNotEmpty()) { validationMessage.appendln(String.format("No assignments for Dictionary Keys (%s)", notPresentDictionaries)) diff --git a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json index 851ded2c..06e7e930 100644 --- a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json @@ -2,7 +2,7 @@ "metadata": {
"template_author": "Brinda Santh Muthuramalingam",
"author-email": "brindasanth@gmail.com",
- "user-groups" : "ADMIN, OPERATION",
+ "user-groups": "ADMIN, OPERATION",
"template_name": "baseconfiguration",
"template_version": "1.0.0",
"template_tags": "brinda, tosca"
@@ -30,9 +30,21 @@ "activate-process": {
"type": "bpmn-activate",
"properties": {
- "process-name": { "get_input" : "action-name" },
- "version" : { "get_property" : ["SELF", "process-name"] },
- "content": { "get_artifact" : ["SELF", "activate-process"] }
+ "process-name": {
+ "get_input": "action-name"
+ },
+ "version": {
+ "get_property": [
+ "SELF",
+ "process-name"
+ ]
+ },
+ "content": {
+ "get_artifact": [
+ "SELF",
+ "activate-process"
+ ]
+ }
},
"artifacts": {
"activate-process": {
@@ -43,7 +55,7 @@ },
"resource-assignment": {
"type": "component-resource-assignment",
- "properties":{
+ "properties": {
"request-id": "1234"
},
"interfaces": {
@@ -51,12 +63,28 @@ "operations": {
"process": {
"inputs": {
- "action-name": { "get_input" : "action-name" },
+ "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"] }
+ "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": "",
@@ -79,18 +107,20 @@ },
"resource-assignment-py": {
"type": "component-resource-assignment",
- "properties":{
+ "properties": {
"request-id": "1234"
},
"interfaces": {
"DefaultComponentNode": {
"operations": {
"process": {
- "implementation" :{
- "primary" : "component-script"
+ "implementation": {
+ "primary": "component-script"
},
"inputs": {
- "action-name": { "get_input" : "action-name" }
+ "action-name": {
+ "get_input": "action-name"
+ }
},
"outputs": {
"resource-assignment-params": "",
@@ -108,37 +138,37 @@ }
}
},
- "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" : [
+ "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" : [
+ "on_success": [
"download-licence"
]
},
- "download-licence" : {
- "description" : "Call Download Licence Component",
- "target" : "activate-netconf",
- "activities" : [
+ "download-licence": {
+ "description": "Call Download Licence Component",
+ "target": "activate-netconf",
+ "activities": [
{
"call_operation": "NetconfTransactionNode.process"
}
@@ -214,77 +244,24 @@ "version": {
"required": false,
"type": "string",
- "default" : "LATEST"
+ "default": "LATEST"
}
},
- "derived_from": "tosca.nodes.Component"
+ "derived_from": "tosca.nodes.DG"
},
"tosca.nodes.Component": {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
+ "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",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
"derived_from": "tosca.nodes.Root"
},
"component-resource-assignment": {
@@ -387,7 +364,7 @@ }
},
"data_types": {
- "sample-property" : {
+ "sample-property": {
"description": "This is sample data type",
"version": "1.0.0",
"properties": {
@@ -402,10 +379,10 @@ "version": {
"required": false,
"type": "string",
- "default" : "LATEST"
+ "default": "LATEST"
}
},
- "derived_from" : "tosca.datatypes.Root"
+ "derived_from": "tosca.datatypes.Root"
}
}
}
\ No newline at end of file diff --git a/ms/controllerblueprints/application/load/model_type/node_type/artifact-config-template.json b/ms/controllerblueprints/application/load/model_type/node_type/artifact-config-template.json index be9bbfc0..af99d75b 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/artifact-config-template.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/artifact-config-template.json @@ -12,7 +12,7 @@ },
"capabilities": {
"content": {
- "type": "tosca.capability.Content",
+ "type": "tosca.capabilities.Content",
"properties": {
"content": {
"required": true,
@@ -21,7 +21,7 @@ }
},
"mapping": {
- "type": "tosca.capability.Mapping",
+ "type": "tosca.capabilities.Mapping",
"properties": {
"mapping": {
"required": false,
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/component-resource-assignment.json b/ms/controllerblueprints/application/load/model_type/node_type/component-resource-assignment.json index 34c02848..d424a8e4 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/component-resource-assignment.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/component-resource-assignment.json @@ -7,16 +7,16 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
- "service-template-name": {
+ "template-name": {
"description": "Service Template Name.",
"required": true,
"type": "string"
},
- "service-template-version": {
+ "template-version": {
"description": "Service Template Version.",
"required": true,
"type": "string"
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json index a9d16edd..57667de9 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json @@ -21,20 +21,6 @@ "capabilities": { "dg-node": { "type": "tosca.capabilities.Node" - }, - "content": { - "type": "tosca.capability.Content", - "properties": { - "type": { - "required": false, - "type": "string", - "default": "json" - }, - "content": { - "required": true, - "type": "string" - } - } } }, "requirements": { diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json index 6794b3c8..e59c34b6 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json index 22a4d813..ca703a79 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": false,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json index 7c01faa1..9cce82a9 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json @@ -21,20 +21,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": false,
- "type": "string"
- }
- }
}
},
"requirements": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 00000000..81410527 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_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/ms/controllerblueprints/application/load/model_type/node_type/vnf-netconf-device.json b/ms/controllerblueprints/application/load/model_type/node_type/vnf-netconf-device.json index 54573bad..246f1770 100644 --- a/ms/controllerblueprints/application/load/model_type/node_type/vnf-netconf-device.json +++ b/ms/controllerblueprints/application/load/model_type/node_type/vnf-netconf-device.json @@ -3,7 +3,7 @@ "version": "1.0.0",
"capabilities": {
"netconf": {
- "type": "tosca.capability.Netconf",
+ "type": "tosca.capabilities.Netconf",
"properties": {
"login-key": {
"required": true,
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json b/ms/controllerblueprints/application/load/resource_dictionary/db-source.json index ba86b3c7..a0c78af0 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json +++ b/ms/controllerblueprints/application/load/resource_dictionary/db-source.json @@ -4,8 +4,6 @@ "description": "name of the ",
"type": "string"
},
- "resource-type": "ONAP",
- "resource-path": "vnf/bundle-id",
"updated-by": "brindasanth@onap.com",
"tags": "db-source, brindasanth@onap.com",
"sources": {
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json b/ms/controllerblueprints/application/load/resource_dictionary/input-source.json index 7cd58d61..acfad16b 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json +++ b/ms/controllerblueprints/application/load/resource_dictionary/input-source.json @@ -4,8 +4,6 @@ "description": "name of the ",
"type": "string"
},
- "resource-path": "action-name",
- "resource-type": "ONAP",
"updated-by": "brindasanth@onap.com",
"tags": "action-name, brindasanth",
"sources": {
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json b/ms/controllerblueprints/application/load/resource_dictionary/v4-ip-type.json index e7e06000..1b4432d5 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json +++ b/ms/controllerblueprints/application/load/resource_dictionary/v4-ip-type.json @@ -4,8 +4,6 @@ "description": "name of the ",
"type": "string"
},
- "resource-path": "vnf/v4-ip-type",
- "resource-type": "ONAP",
"updated-by": "brindasanth@onap.com",
"tags": "v4-ip-type, source-input, brindasanth",
"sources": {
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties index 2d355d65..b65d5bfe 100644 --- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties +++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties @@ -40,11 +40,11 @@ spring.jpa.properties.hibernate.format_sql=true spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl spring.datasource.username=sdnctl spring.datasource.password=sdnctl -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto = none spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy -spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect #Load Blueprints # blueprints.load.initial-data may be overridden by ENV variables diff --git a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql index 1ba9c365..47e0cce7 100644 --- a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql +++ b/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql @@ -71,12 +71,8 @@ CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE ( -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY (
name VARCHAR(100) NOT NULL,
- resource_path VARCHAR(500) NOT NULL,
- resource_type VARCHAR(100) NOT NULL,
data_type VARCHAR(100) NOT NULL,
entry_schema VARCHAR(100) NULL DEFAULT NULL,
- valid_values LONGTEXT NULL DEFAULT NULL,
- sample_value LONGTEXT NULL DEFAULT NULL,
definition LONGTEXT NOT NULL,
description LONGTEXT NOT NULL,
tags LONGTEXT NOT NULL,
diff --git a/ms/controllerblueprints/application/src/main/resources/sql/schema.sql b/ms/controllerblueprints/application/src/main/resources/sql/schema.sql index b884cf34..9c38bec0 100644 --- a/ms/controllerblueprints/application/src/main/resources/sql/schema.sql +++ b/ms/controllerblueprints/application/src/main/resources/sql/schema.sql @@ -66,12 +66,8 @@ CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE ( -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
name VARCHAR(100) NOT NULL,
- resource_path VARCHAR(500) NOT NULL,
- resource_type VARCHAR(100) NOT NULL,
data_type VARCHAR(100) NOT NULL,
entry_schema VARCHAR(100) NULL DEFAULT NULL,
- valid_values LONGTEXT NULL DEFAULT NULL,
- sample_value LONGTEXT NULL DEFAULT NULL,
definition LONGTEXT NOT NULL,
description LONGTEXT NOT NULL,
tags LONGTEXT NOT NULL,
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json deleted file mode 100644 index 851ded2c..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ /dev/null @@ -1,411 +0,0 @@ -{
- "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.Component"
- },
- "tosca.nodes.Component": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "derived_from": "tosca.nodes.Root"
- },
- "tosca.nodes.component.Python": {
- "description": "This is Resource Assignment Python Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "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/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json deleted file mode 100644 index 6abfb51b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -{
- "assignments": "Sample Assignments"
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn deleted file mode 100644 index 5e94c0f8..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
- xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
- xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
- xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1"
- targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
- <bpmn:process id="ActivateProcess" isExecutable="true">
- <bpmn:startEvent id="StartEvent_1">
- <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing>
- </bpmn:startEvent>
- <bpmn:endEvent id="EndEvent_1pr0kil">
- <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/>
- <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/>
- <bpmn:serviceTask id="activate_device_task" name="Activate Device"
- camunda:delegateExpression="${componentDelegateService}">
- <bpmn:extensionElements>
- <camunda:inputOutput>
- <camunda:inputParameter name="selector"><![CDATA[resource-assignment
-]]></camunda:inputParameter>
- </camunda:inputOutput>
- </bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing>
- </bpmn:serviceTask>
- </bpmn:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="175" y="143" width="36" height="36"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="148" y="179" width="90" height="20"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil">
- <dc:Bounds x="575" y="114" width="36" height="36"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="593" y="154" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58">
- <di:waypoint xsi:type="dc:Point" x="211" y="161"/>
- <di:waypoint xsi:type="dc:Point" x="273" y="161"/>
- <di:waypoint xsi:type="dc:Point" x="273" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="334" y="149"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="288" y="149" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p">
- <di:waypoint xsi:type="dc:Point" x="434" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="505" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="505" y="132"/>
- <di:waypoint xsi:type="dc:Point" x="575" y="132"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="520" y="134.5" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task">
- <dc:Bounds x="334" y="109" width="100" height="80"/>
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py deleted file mode 100644 index eb198c79..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py +++ /dev/null @@ -1,8 +0,0 @@ -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/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py +++ /dev/null diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 05c2c67f..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/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: vrr-test, Brinda Santh
-
-Name: Plans/ActivateProcess.bpmn
-Content-Type: application/vnd.oasis.bpmn
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl deleted file mode 100644 index 026c5917..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl +++ /dev/null @@ -1 +0,0 @@ -This is Sample Velocity Template
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py +++ /dev/null diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json index a06165bf..41f6e92f 100644 --- a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json +++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json @@ -3,7 +3,7 @@ "template_author": "Brinda Santh ( bs2796@onap.com )",
"template_name": "vrr-test",
"template_version": "1.0.0",
- "template_tags" : "brinda, VRR",
+ "template_tags": "brinda, VRR",
"release": "201802",
"service-type": "AVPN",
"vnf-type": "VRR"
@@ -172,20 +172,30 @@ "resource-assignment": {
"type": "component-resource-assignment",
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
- "action-name": "{ \"get_input\" : \"action-name\" }",
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
+ "action-name": {
+ "get_input": "action-name"
+ },
"resource-type": "vnf-type",
"template-names": [
"base-config-template",
"licence-template"
],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "vnf-id"
+ }
},
"outputs": {
"resource-assignment-params": "",
@@ -205,8 +215,12 @@ "netconf": {
"properties": {
"profile-name": "sample",
- "oam-ipv4-address": "{ \"get_attribute\" : \"hostname\" }",
- "port-number": "{ \"get_attribute\" : \"host-port\" }",
+ "oam-ipv4-address": {
+ "get_input": "hostname"
+ },
+ "port-number": {
+ "get_input": "host-port"
+ },
"connection-time-out": 30
}
}
@@ -218,19 +232,29 @@ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
"operations": {
"process": {
- "implementation" : {
- "primary" : "file://netconf-adaptor/DefaultGetConfig.py"
+ "implementation": {
+ "primary": "file://netconf-adaptor/DefaultGetConfig.py"
},
"inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
+ "action-name": {
+ "get_input": "action-name"
+ },
"resource-type": "vnf-type",
- "request-id": "{ \"get_attribute\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "vnf-id"
+ },
"execution-script": "execution-script"
},
"outputs": {
- "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
- "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ "response-data": {
+ "get_attribute": ["SELF", "netconf-executor-baseconfig.response-data"]
+ },
+ "status": {
+ "get_attribute": ["SELF", "netconf-executor-baseconfig.status"]
+ }
}
}
}
@@ -274,20 +298,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": false,
- "type": "string"
- }
- }
}
},
"requirements": {
@@ -325,7 +335,7 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
@@ -334,12 +344,12 @@ "required": true,
"type": "string"
},
- "service-template-name": {
+ "template-name": {
"description": "Service Template Name.",
"required": true,
"type": "string"
},
- "service-template-version": {
+ "template-version": {
"description": "Service Template Version.",
"required": true,
"type": "string"
@@ -398,7 +408,7 @@ },
"capabilities": {
"content": {
- "type": "tosca.capability.Content",
+ "type": "tosca.capabilities.Content",
"properties": {
"content": {
"required": true,
@@ -407,7 +417,7 @@ }
},
"mapping": {
- "type": "tosca.capability.Mapping",
+ "type": "tosca.capabilities.Mapping",
"properties": {
"mapping": {
"required": false,
@@ -426,7 +436,7 @@ "version": "1.0.0",
"capabilities": {
"netconf": {
- "type": "tosca.capability.Netconf",
+ "type": "tosca.capabilities.Netconf",
"properties": {
"profile-name": {
"required": true,
@@ -449,7 +459,7 @@ }
},
"ssh": {
- "type": "tosca.capability.Ssh",
+ "type": "tosca.capabilities.Ssh",
"properties": {
"profile-name": {
"required": true,
@@ -477,7 +487,7 @@ }
},
"sftp": {
- "type": "tosca.capability.Sftp",
+ "type": "tosca.capabilities.Sftp",
"properties": {
"profile-name": {
"required": true,
@@ -530,20 +540,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
}
},
"requirements": {
@@ -597,12 +593,12 @@ "required": true,
"type": "string"
},
- "service-template-name": {
+ "template-name": {
"description": "Service Template Name",
"required": true,
"type": "string"
},
- "service-template-version": {
+ "template-version": {
"description": "Service Template Version",
"required": true,
"type": "string"
@@ -644,6 +640,26 @@ }
},
"derived_from": "tosca.nodes.Component"
+ },
+ "tosca.nodes.DG": {
+ "description": "This is Directed Graph Node Type",
+ "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.Artifact": {
+ "description": "This is Deprecated Artifact Node Type.",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.Component": {
+ "description": "This is default Component Node",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
}
},
"data_types": {
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml index 9efadd18..524e0ebe 100644 --- a/ms/controllerblueprints/modules/service/pom.xml +++ b/ms/controllerblueprints/modules/service/pom.xml @@ -55,19 +55,14 @@ <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
- <!--<dependency>-->
- <!--<groupId>org.mariadb.jdbc</groupId>-->
- <!--<artifactId>mariadb-java-client</artifactId>-->
- <!--</dependency>-->
-
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java index c6d80cfb..cfcf93d2 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java @@ -157,30 +157,28 @@ public class DataBaseInitService { fileName = file.getFilename();
log.trace("Loading : {}", fileName);
String definitionContent = getResourceContent(file);
- ResourceDefinition dictionaryDefinition =
+ ResourceDefinition resourceDefinition =
JacksonUtils.readValue(definitionContent, ResourceDefinition.class);
- if (dictionaryDefinition != null) {
- Preconditions.checkNotNull(dictionaryDefinition.getProperty(), "Failed to get Property Definition");
+ if (resourceDefinition != null) {
+ Preconditions.checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition");
ResourceDictionary resourceDictionary = new ResourceDictionary();
- resourceDictionary.setResourcePath(dictionaryDefinition.getResourcePath());
- resourceDictionary.setName(dictionaryDefinition.getName());
- resourceDictionary.setDefinition(dictionaryDefinition);
-
- resourceDictionary.setResourceType(dictionaryDefinition.getResourceType());
- resourceDictionary.setDescription(dictionaryDefinition.getProperty().getDescription());
- resourceDictionary.setDataType(dictionaryDefinition.getProperty().getType());
- if(dictionaryDefinition.getProperty().getEntrySchema() != null){
- resourceDictionary.setEntrySchema(dictionaryDefinition.getProperty().getEntrySchema().getType());
+ resourceDictionary.setName(resourceDefinition.getName());
+ resourceDictionary.setDefinition(resourceDefinition);
+
+ Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing");
+ resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription());
+ resourceDictionary.setDataType(resourceDefinition.getProperty().getType());
+ if(resourceDefinition.getProperty().getEntrySchema() != null){
+ resourceDictionary.setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType());
}
- resourceDictionary.setUpdatedBy(dictionaryDefinition.getUpdatedBy());
- if (StringUtils.isBlank(dictionaryDefinition.getTags())) {
+ resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy());
+ if (StringUtils.isBlank(resourceDefinition.getTags())) {
resourceDictionary.setTags(
- dictionaryDefinition.getName() + ", " + dictionaryDefinition.getUpdatedBy()
- + ", " + dictionaryDefinition.getResourceType() + ", "
- + dictionaryDefinition.getUpdatedBy());
+ resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy()
+ + ", " + resourceDefinition.getUpdatedBy());
} else {
- resourceDictionary.setTags(dictionaryDefinition.getTags());
+ resourceDictionary.setTags(resourceDefinition.getTags());
}
resourceDictionaryService.saveResourceDictionary(resourceDictionary);
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java index 2bc2963b..925a6c49 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java @@ -1,5 +1,6 @@ /*
* 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.
@@ -16,6 +17,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service;
+import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
@@ -43,7 +45,7 @@ public class ModelTypeService { /**
* This is a ModelTypeService, used to save and get the model types stored in database
*
- * @param modelTypeRepository
+ * @param modelTypeRepository modelTypeRepository
*/
public ModelTypeService(ModelTypeRepository modelTypeRepository) {
this.modelTypeRepository = modelTypeRepository;
@@ -53,19 +55,15 @@ public class ModelTypeService { /**
* This is a getModelTypeByName service
*
- * @param modelTypeName
+ * @param modelTypeName modelTypeName
* @return ModelType
- * @throws BluePrintException
*/
- public ModelType getModelTypeByName(String modelTypeName) throws BluePrintException {
+ public ModelType getModelTypeByName(String modelTypeName) {
ModelType modelType = null;
- if (StringUtils.isNotBlank(modelTypeName)) {
- Optional<ModelType> modelTypeOption = modelTypeRepository.findByModelName(modelTypeName);
- if (modelTypeOption.isPresent()) {
- modelType = modelTypeOption.get();
- }
- } else {
- throw new BluePrintException("Model Name Information is missing.");
+ Preconditions.checkArgument(StringUtils.isNotBlank(modelTypeName), "Model Name Information is missing.");
+ Optional<ModelType> modelTypeOption = modelTypeRepository.findByModelName(modelTypeName);
+ if (modelTypeOption.isPresent()) {
+ modelType = modelTypeOption.get();
}
return modelType;
}
@@ -74,27 +72,25 @@ public class ModelTypeService { /**
* This is a searchModelTypes service
*
- * @param tags
+ * @param tags tags
* @return List<ModelType>
- * @throws BluePrintException
*/
- public List<ModelType> searchModelTypes(String tags) throws BluePrintException {
- if (tags != null) {
- return modelTypeRepository.findByTagsContainingIgnoreCase(tags);
- } else {
- throw new BluePrintException("No Search Information provide");
- }
+ public List<ModelType> searchModelTypes(String tags) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No Search Information provide");
+ return modelTypeRepository.findByTagsContainingIgnoreCase(tags);
}
/**
* This is a saveModel service
*
- * @param modelType
+ * @param modelType modelType
* @return ModelType
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public ModelType saveModel(ModelType modelType) throws BluePrintException {
+ Preconditions.checkNotNull(modelType, "Model Type Information is missing.");
+
ModelTypeValidator.validateModelType(modelType);
Optional<ModelType> dbModelType = modelTypeRepository.findByModelName(modelType.getModelName());
@@ -118,60 +114,34 @@ public class ModelTypeService { /**
* This is a deleteByModelName service
*
- * @param modelName
- * @throws BluePrintException
+ * @param modelName modelName
*/
- public void deleteByModelName(String modelName) throws BluePrintException {
- if (modelName != null) {
- modelTypeRepository.deleteByModelName(modelName);
- } else {
- throw new BluePrintException("Model Name Information is missing.");
- }
- }
+ public void deleteByModelName(String modelName) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(modelName), "Model Name Information is missing.");
+ modelTypeRepository.deleteByModelName(modelName);
- /**
- * This is a getModelTypeByTags service
- *
- * @param tags
- * @return List<ModelType>
- * @throws BluePrintException
- */
- public List<ModelType> getModelTypeByTags(String tags) throws BluePrintException {
- if (StringUtils.isNotBlank(tags)) {
- return modelTypeRepository.findByTagsContainingIgnoreCase(tags);
- } else {
- throw new BluePrintException("Model Tag Information is missing.");
- }
}
/**
* This is a getModelTypeByDefinitionType service
*
- * @param definitionType
+ * @param definitionType definitionType
* @return List<ModelType>
- * @throws BluePrintException
*/
- public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {
- if (StringUtils.isNotBlank(definitionType)) {
- return modelTypeRepository.findByDefinitionType(definitionType);
- } else {
- throw new BluePrintException("Model definitionType Information is missing.");
- }
+ public List<ModelType> getModelTypeByDefinitionType(String definitionType) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(definitionType), "Model definitionType Information is missing.");
+ return modelTypeRepository.findByDefinitionType(definitionType);
}
/**
* This is a getModelTypeByDerivedFrom service
*
- * @param derivedFrom
+ * @param derivedFrom derivedFrom
* @return List<ModelType>
- * @throws BluePrintException
*/
- public List<ModelType> getModelTypeByDerivedFrom(String derivedFrom) throws BluePrintException {
- if (StringUtils.isNotBlank(derivedFrom)) {
- return modelTypeRepository.findByDerivedFrom(derivedFrom);
- } else {
- throw new BluePrintException("Model derivedFrom Information is missing.");
- }
+ public List<ModelType> getModelTypeByDerivedFrom(String derivedFrom) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(derivedFrom), "Model derivedFrom Information is missing.");
+ return modelTypeRepository.findByDerivedFrom(derivedFrom);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java index 70e43d69..62aa0e29 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java @@ -112,8 +112,6 @@ public class ResourceDictionaryService { // Validate the Resource Definitions
resourceDictionaryValidationService.validate(resourceDefinition);
- resourceDictionary.setResourceType(resourceDefinition.getResourceType());
- resourceDictionary.setResourcePath(resourceDefinition.getResourcePath());
resourceDictionary.setTags(resourceDefinition.getTags());
resourceDefinition.setUpdatedBy(resourceDictionary.getUpdatedBy());
// Set the Property Definitions
@@ -134,8 +132,6 @@ public class ResourceDictionaryService { dbResourceDictionary.setName(resourceDictionary.getName());
dbResourceDictionary.setDefinition(resourceDictionary.getDefinition());
dbResourceDictionary.setDescription(resourceDictionary.getDescription());
- dbResourceDictionary.setResourceType(resourceDictionary.getResourceType());
- dbResourceDictionary.setResourcePath(resourceDictionary.getResourcePath());
dbResourceDictionary.setTags(resourceDictionary.getTags());
dbResourceDictionary.setUpdatedBy(resourceDictionary.getUpdatedBy());
dbResourceDictionary.setDataType(resourceDictionary.getDataType());
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java index 7af9972a..42c8e83b 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java @@ -43,14 +43,6 @@ public class ResourceDictionary implements Serializable { @ApiModelProperty(required=true)
private String name;
- @Column(name = "resource_path", nullable = false)
- @ApiModelProperty(required=true)
- private String resourcePath;
-
- @Column(name = "resource_type", nullable = false)
- @ApiModelProperty(required=true)
- private String resourceType;
-
@Column(name = "data_type", nullable = false)
@ApiModelProperty(required=true)
private String dataType;
@@ -59,14 +51,6 @@ public class ResourceDictionary implements Serializable { private String entrySchema;
@Lob
- @Column(name = "valid_values")
- private String validValues;
-
- @Lob
- @Column(name = "sample_value")
- private String sampleValue;
-
- @Lob
@Convert(converter = JpaResourceDefinitionConverter.class)
@Column(name = "definition", nullable = false)
@ApiModelProperty(required=true)
@@ -95,11 +79,8 @@ public class ResourceDictionary implements Serializable { @Override
public String toString() {
String buffer = "[" + ", name = " + name +
- ", resourcePath = " + resourcePath +
- ", resourceType = " + resourceType +
", dataType = " + dataType +
", entrySchema = " + entrySchema +
- ", validValues = " + validValues +
", definition =" + definition +
", description = " + description +
", updatedBy = " + updatedBy +
@@ -109,14 +90,6 @@ public class ResourceDictionary implements Serializable { return buffer;
}
- public String getResourcePath() {
- return resourcePath;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-
public String getName() {
return name;
}
@@ -125,14 +98,6 @@ public class ResourceDictionary implements Serializable { this.name = name;
}
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
public String getDataType() {
return dataType;
}
@@ -149,22 +114,6 @@ public class ResourceDictionary implements Serializable { this.entrySchema = entrySchema;
}
- public String getValidValues() {
- return validValues;
- }
-
- public void setValidValues(String validValues) {
- this.validValues = validValues;
- }
-
- public String getSampleValue() {
- return sampleValue;
- }
-
- public void setSampleValue(String sampleValue) {
- this.sampleValue = sampleValue;
- }
-
public ResourceDefinition getDefinition() {
return definition;
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java index 16031b6e..c53040e2 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java @@ -37,7 +37,7 @@ public interface ResourceDictionaryRepository extends JpaRepository<ResourceDict /**
* This is a findByName method
*
- * @param name
+ * @param name name
* @return Optional<ResourceMapping>
*/
Optional<ResourceDictionary> findByName(String name);
@@ -45,7 +45,7 @@ public interface ResourceDictionaryRepository extends JpaRepository<ResourceDict /**
* This is a findByNameIn method
*
- * @param names
+ * @param names names
* @return Optional<ResourceMapping>
*/
List<ResourceDictionary> findByNameIn(List<String> names);
@@ -53,7 +53,7 @@ public interface ResourceDictionaryRepository extends JpaRepository<ResourceDict /**
* This is a findByTagsContainingIgnoreCase method
*
- * @param tags
+ * @param tags tags
* @return Optional<ModelType>
*/
List<ResourceDictionary> findByTagsContainingIgnoreCase(String tags);
@@ -61,9 +61,9 @@ public interface ResourceDictionaryRepository extends JpaRepository<ResourceDict /**
* This is a deleteByName method
*
- * @param name
+ * @param name name
*/
- ResourceDictionary deleteByName(String name);
+ void deleteByName(String name);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java index 082b1507..988cad06 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java @@ -1,5 +1,6 @@ /*
* 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.
@@ -44,48 +45,28 @@ public class ModelTypeRest { @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByName(name);
- } catch (Exception e) {
- throw new BluePrintException(1000, e.getMessage(), e);
- }
+ return modelTypeService.getModelTypeByName(name);
}
@GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {
- try {
- return modelTypeService.searchModelTypes(tags);
- } catch (Exception e) {
- throw new BluePrintException(1001, e.getMessage(), e);
- }
+ return modelTypeService.searchModelTypes(tags);
}
@GetMapping(path = "/by-definition/{definitionType}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByDefinitionType(definitionType);
- } catch (Exception e) {
- throw new BluePrintException(1002, e.getMessage(), e);
- }
+ return modelTypeService.getModelTypeByDefinitionType(definitionType);
}
@PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {
- try {
- return modelTypeService.saveModel(modelType);
- } catch (Exception e) {
- throw new BluePrintException(1100, e.getMessage(), e);
- }
+ return modelTypeService.saveModel(modelType);
}
@DeleteMapping(path = "/{name}")
public void deleteModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
- try {
- modelTypeService.deleteByModelName(name);
- } catch (Exception e) {
- throw new BluePrintException(1400, e.getMessage(), e);
- }
+ modelTypeService.deleteByModelName(name);
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java index a4aced60..e0cf6c69 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java @@ -1,5 +1,6 @@ /*
* 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.
@@ -47,51 +48,32 @@ public class ResourceDictionaryRest { public @ResponseBody
ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)
throws BluePrintException {
- try {
- return resourceDictionaryService.saveResourceDictionary(dataDictionary);
- } catch (Exception e) {
- throw new BluePrintException(4100, e.getMessage(), e);
- }
+ return resourceDictionaryService.saveResourceDictionary(dataDictionary);
}
@DeleteMapping(path = "/{name}")
public void deleteResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
- try {
- resourceDictionaryService.deleteResourceDictionary(name);
- } catch (Exception e) {
- throw new BluePrintException(4400, e.getMessage(), e);
- }
+ resourceDictionaryService.deleteResourceDictionary(name);
}
@GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
- try {
- return resourceDictionaryService.getResourceDictionaryByName(name);
- } catch (Exception e) {
- throw new BluePrintException(4001, e.getMessage(), e);
- }
+ return resourceDictionaryService.getResourceDictionaryByName(name);
}
@PostMapping(path = "/by-names", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)
throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByNames(names);
- } catch (Exception e) {
- throw new BluePrintException(4002, e.getMessage(), e);
- }
+ return resourceDictionaryService.searchResourceDictionaryByNames(names);
}
@GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByTags(tags);
- } catch (Exception e) {
- throw new BluePrintException(4003, e.getMessage(), e);
- }
+ return resourceDictionaryService.searchResourceDictionaryByTags(tags);
+
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java index a22285b8..caa6bba4 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java @@ -1,5 +1,6 @@ /*
* 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.
@@ -49,53 +50,33 @@ public class ServiceTemplateRest { @PostMapping(path = "/enrich", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3500, e.getMessage(), e);
- }
+ return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
}
@PostMapping(path = "/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.validateServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3501, e.getMessage(), e);
- }
+ return serviceTemplateService.validateServiceTemplate(serviceTemplate);
}
@PostMapping(path = "/resource-assignment/auto-map", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {
- try {
- return serviceTemplateService.autoMap(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3502, e.getMessage(), e);
- }
+ return serviceTemplateService.autoMap(resourceAssignments);
}
@PostMapping(path = "/resource-assignment/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)
throws BluePrintException {
- try {
- return serviceTemplateService.validateResourceAssignments(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3503, e.getMessage(), e);
- }
+ return serviceTemplateService.validateResourceAssignments(resourceAssignments);
}
@PostMapping(path = "/resource-assignment/generate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)
throws BluePrintException {
- try {
- return serviceTemplateService.generateResourceAssignments(templateContent);
- } catch (Exception e) {
- throw new BluePrintException(3504, e.getMessage(), e);
- }
+ return serviceTemplateService.generateResourceAssignments(templateContent);
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java index 1c2a7337..57330d90 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java @@ -45,10 +45,6 @@ public class ResourceDictionaryValidator { Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getName()),
"DataDictionary Alias Name Information is missing.");
- Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourcePath()),
- "DataDictionary Resource Name Information is missing.");
- Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourceType()),
- "DataDictionary Resource Type Information is missing.");
Preconditions.checkNotNull( resourceDictionary.getDefinition(),
"DataDictionary Definition Information is missing.");
Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDescription()),
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt new file mode 100644 index 00000000..141ba92c --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt @@ -0,0 +1,76 @@ +/* + * 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.service.repository + +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType +import org.springframework.stereotype.Service +import reactor.core.publisher.Flux +import reactor.core.publisher.Mono +import reactor.core.scheduler.Schedulers + +/** + * ModelTypeReactRepository. + * + * @author Brinda Santh + */ +@Service +open class ModelTypeReactRepository(private val modelTypeRepository: ModelTypeRepository) { + + fun save(modelType: ModelType): Mono<ModelType> { + return Mono.justOrEmpty(modelTypeRepository.save(modelType)) + } + + fun findByModelName(modelName: String): Mono<ModelType> { + return Mono.justOrEmpty(modelTypeRepository.findByModelName(modelName)) + } + + fun findByModelNameIn(modelNames: List<String>): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByModelNameIn(modelNames)) + .subscribeOn(Schedulers.elastic()) + } + + fun findByDerivedFrom(derivedFrom: String): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByDerivedFrom(derivedFrom)) + .subscribeOn(Schedulers.elastic()) + } + + fun findByDerivedFromIn(derivedFroms: List<String>): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByDerivedFromIn(derivedFroms)) + .subscribeOn(Schedulers.elastic()) + } + + fun findByDefinitionType(definitionType: String): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByDefinitionType(definitionType)) + .subscribeOn(Schedulers.elastic()) + } + + fun findByDefinitionTypeIn(definitionTypes: List<String>): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByDefinitionTypeIn(definitionTypes)) + .subscribeOn(Schedulers.elastic()) + } + + fun findByTagsContainingIgnoreCase(tags: String): Flux<ModelType> { + return Flux.fromIterable(modelTypeRepository.findByTagsContainingIgnoreCase(tags)) + .subscribeOn(Schedulers.elastic()) + } + + fun deleteByModelName(modelName: String): Mono<Void> { + modelTypeRepository.deleteByModelName(modelName) + return Mono.empty() + } + +}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt index 064b5c38..0865b69d 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt @@ -16,7 +16,6 @@ package org.onap.ccsdk.apps.controllerblueprints.service.repository -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary import org.springframework.stereotype.Service import reactor.core.publisher.Flux @@ -49,10 +48,9 @@ open class ResourceDictionaryReactRepository(private val resourceDictionaryRepos .subscribeOn(Schedulers.elastic()) } - fun deleteByName(name: String): Mono<ResourceDictionary> { - return Mono.fromCallable { - resourceDictionaryRepository.deleteByName(name) - } + fun deleteByName(name: String): Mono<Void> { + resourceDictionaryRepository.deleteByName(name) + return Mono.empty() } }
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json index 14f724e5..5b5332fc 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json +++ b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json @@ -13,11 +13,11 @@ "required": true,
"type": "string"
},
- "service-template-name": {
+ "template-name": {
"required": true,
"type": "string"
},
- "service-template-version": {
+ "template-version": {
"required": true,
"type": "string"
},
@@ -146,7 +146,7 @@ "resource-assignment": {
"type": "component-resource-assignment",
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
@@ -155,8 +155,8 @@ "base-config-template",
"licence-template"
],
- "request-id": "{ \"get_attribute\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
+ "request-id": { "get_input" : "request-id" },
+ "resource-id": { "get_input" : "vnf-id" }
},
"outputs": {
"resource-assignment-params": "",
@@ -220,10 +220,10 @@ ],
"resource-type": "vnf-type",
"initialise-sftp": false,
- "request-id": "{ \"get_input\" : \"request-id\" }",
+ "request-id": {"get_input" : "request-id"},
"initialise-ssh": false,
- "resource-id": "{ \"get_input\" : \"vnf-id\" }",
- "action-name": "{ \"get_input\" : \"action-name\" }"
+ "resource-id": { "get_input" : "vnf-id" },
+ "action-name": {"get_input" : "action-name"}
},
"outputs": {
"rpc-response-message": "",
@@ -279,7 +279,7 @@ "version": "1.0.0",
"capabilities": {
"netconf": {
- "type": "tosca.capability.Netconf",
+ "type": "tosca.capabilities.Netconf",
"properties": {
"password": {
"required": false,
@@ -311,7 +311,7 @@ }
},
"ssh": {
- "type": "tosca.capability.Ssh",
+ "type": "tosca.capabilities.Ssh",
"properties": {
"password": {
"required": false,
@@ -343,7 +343,7 @@ }
},
"sftp": {
- "type": "tosca.capability.Sftp",
+ "type": "tosca.capabilities.Sftp",
"properties": {
"password": {
"required": false,
@@ -400,20 +400,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
}
},
"requirements": {
@@ -465,20 +451,6 @@ "capabilities": {
"dg-node": {
"type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capability.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
}
},
"requirements": {
@@ -521,7 +493,7 @@ },
"capabilities": {
"content": {
- "type": "tosca.capability.Content",
+ "type": "tosca.capabilities.Content",
"properties": {
"content": {
"required": true,
@@ -530,7 +502,7 @@ }
},
"mapping": {
- "type": "tosca.capability.Mapping",
+ "type": "tosca.capabilities.Mapping",
"properties": {
"mapping": {
"required": false,
@@ -553,7 +525,7 @@ }
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql index 1ba9c365..47e0cce7 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql @@ -71,12 +71,8 @@ CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE ( -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY (
name VARCHAR(100) NOT NULL,
- resource_path VARCHAR(500) NOT NULL,
- resource_type VARCHAR(100) NOT NULL,
data_type VARCHAR(100) NOT NULL,
entry_schema VARCHAR(100) NULL DEFAULT NULL,
- valid_values LONGTEXT NULL DEFAULT NULL,
- sample_value LONGTEXT NULL DEFAULT NULL,
definition LONGTEXT NOT NULL,
description LONGTEXT NOT NULL,
tags LONGTEXT NOT NULL,
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql index b884cf34..9c38bec0 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql @@ -66,12 +66,8 @@ CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE ( -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
name VARCHAR(100) NOT NULL,
- resource_path VARCHAR(500) NOT NULL,
- resource_type VARCHAR(100) NOT NULL,
data_type VARCHAR(100) NOT NULL,
entry_schema VARCHAR(100) NULL DEFAULT NULL,
- valid_values LONGTEXT NULL DEFAULT NULL,
- sample_value LONGTEXT NULL DEFAULT NULL,
definition LONGTEXT NOT NULL,
description LONGTEXT NOT NULL,
tags LONGTEXT NOT NULL,
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java new file mode 100644 index 00000000..8e258ab6 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java @@ -0,0 +1,123 @@ +/* + * 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.service; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.junit.*; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.onap.ccsdk.apps.controllerblueprints.TestApplication; +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants; +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType; +import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestTest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@RunWith(SpringRunner.class) +@DataJpaTest +@Transactional(propagation = Propagation.NOT_SUPPORTED) +@ContextConfiguration(classes = {TestApplication.class}) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class ModelTypeServiceTest { + private static EELFLogger log = EELFManager.getInstance().getLogger(ModelTypeRestTest.class); + @Autowired + ModelTypeService modelTypeService; + + String modelName = "test-datatype"; + + @Test + public void test01SaveModelType() throws Exception { + log.info("**************** test01SaveModelType ********************"); + + String content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json"); + ModelType modelType = new ModelType(); + modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); + modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT); + modelType.setDescription("Definition for Sample Datatype "); + modelType.setDefinition(JacksonUtils.jsonNode(content)); + modelType.setModelName(modelName); + modelType.setVersion("1.0.0"); + modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," + + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); + modelType.setUpdatedBy("xxxxxx@xxx.com"); + modelType = modelTypeService.saveModel(modelType); + log.info("Saved Mode {}", modelType.toString()); + Assert.assertNotNull("Failed to get Saved ModelType", modelType); + Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.getModelName()); + + ModelType dbModelType = modelTypeService.getModelTypeByName(modelType.getModelName()); + Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType.getModelName() + ")", + dbModelType); + + // Model Update + modelType.setUpdatedBy("bs2796@xxx.com"); + modelType = modelTypeService.saveModel(modelType); + Assert.assertNotNull("Failed to get Saved ModelType", modelType); + Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.getUpdatedBy()); + + } + + @Test + public void test02SearchModelTypes() throws Exception { + log.info("*********************** test02SearchModelTypes ***************************"); + + String tags = "test-datatype"; + + List<ModelType> dbModelTypes = modelTypeService.searchModelTypes(tags); + Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes); + Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size() > 0); + + } + + @Test + public void test03GetModelType() throws Exception { + log.info("************************* test03GetModelType *********************************"); + ModelType dbModelType = modelTypeService.getModelTypeByName(modelName); + Assert.assertNotNull("Failed to get response for api call getModelByName ", dbModelType); + Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType.getModelName()); + + List<ModelType> dbDatatypeModelTypes = + modelTypeService.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); + Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes); + Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size() > 0); + + List<ModelType> dbModelTypeByDerivedFroms = + modelTypeService.getModelTypeByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT); + Assert.assertNotNull("Failed to find getModelTypeByDerivedFrom by tags", dbModelTypeByDerivedFroms); + Assert.assertTrue("Failed to find getModelTypeByDerivedFrom by count", dbModelTypeByDerivedFroms.size() > 0); + + } + + @Test + public void test04DeleteModelType() throws Exception { + log.info( + "************************ test03DeleteModelType ***********************"); + ModelType dbResourceMapping = modelTypeService.getModelTypeByName(modelName); + Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping); + Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping.getModelName()); + + modelTypeService.deleteByModelName(dbResourceMapping.getModelName()); + } +}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java new file mode 100644 index 00000000..7549b780 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java @@ -0,0 +1,110 @@ +/* + * 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.service.repository; + +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.onap.ccsdk.apps.controllerblueprints.TestApplication; +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants; +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.annotation.Commit; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Arrays; +import java.util.List; + +/** + * ModelTypeReactRepositoryTest. + * + * @author Brinda Santh + */ + +@RunWith(SpringRunner.class) +@DataJpaTest +@ContextConfiguration(classes = {TestApplication.class}) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class ModelTypeReactRepositoryTest { + + @Autowired + private ModelTypeReactRepository modelTypeReactRepository; + + String modelName = "test-datatype"; + + @Test + @Commit + public void test01Save() { + String content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json"); + ModelType modelType = new ModelType(); + modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); + modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT); + modelType.setDescription("Definition for Sample Datatype "); + modelType.setDefinition(JacksonUtils.jsonNode(content)); + modelType.setModelName(modelName); + modelType.setVersion("1.0.0"); + modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," + + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); + modelType.setUpdatedBy("xxxxxx@xxx.com"); + + ModelType dbModelType = modelTypeReactRepository.save(modelType).block(); + Assert.assertNotNull("Failed to get Saved ModelType", dbModelType); + } + + @Test + public void test02Finds() { + ModelType dbFindByModelName = modelTypeReactRepository.findByModelName(modelName).block(); + Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName); + + List<ModelType> dbFindByDefinitionType = + modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block(); + Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType); + Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType.size() > 0); + + List<ModelType> dbFindByDerivedFrom = + modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block(); + Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom); + Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom.size() > 0); + + List<ModelType> dbFindByModelNameIn = + modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block(); + Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn); + Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn.size() > 0); + + List<ModelType> dbFindByDefinitionTypeIn = + modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block(); + Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn); + Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn.size() > 0); + + List<ModelType> dbFindByDerivedFromIn = + modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block(); + Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn); + Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn.size() > 0); + } + + @Test + @Commit + public void test03Delete() { + modelTypeReactRepository.deleteByModelName(modelName).block(); + } + +} diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java index 1e740ec3..ab939ffa 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java @@ -28,6 +28,7 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.annotation.Commit; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @@ -46,46 +47,55 @@ import java.util.List; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ResourceDictionaryReactRepositoryTest { + private String sourceName = "test-source"; + @Autowired protected ResourceDictionaryReactRepository resourceDictionaryReactRepository; - @Before - public void init() { - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("load/resource_dictionary/db-source" + + @Test + @Commit + public void test01Save() { + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/db-source" + ".json", ResourceDefinition.class); + Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition); + resourceDefinition.setName(sourceName); ResourceDictionary resourceDictionary = transformResourceDictionary(resourceDefinition); ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.save(resourceDictionary).block(); - Assert.assertNotNull("Failed to query React Resource Dictionary by Name", dbResourceDictionary); + Assert.assertNotNull("Failed to save ResourceDictionary", dbResourceDictionary); } @Test - public void test01FindByNameReact() throws Exception { - ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.findByName("db-source").block(); + public void test02FindByNameReact() { + ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.findByName(sourceName).block(); Assert.assertNotNull("Failed to query React Resource Dictionary by Name", dbResourceDictionary); } @Test - public void test02FindByNameInReact() throws Exception { + public void test03FindByNameInReact() { List<ResourceDictionary> dbResourceDictionaries = - resourceDictionaryReactRepository.findByNameIn(Arrays.asList("db-source")).collectList().block(); + resourceDictionaryReactRepository.findByNameIn(Arrays.asList(sourceName)).collectList().block(); Assert.assertNotNull("Failed to query React Resource Dictionary by Names", dbResourceDictionaries); } @Test - public void test03FindByTagsContainingIgnoreCaseReact() throws Exception { + public void test04FindByTagsContainingIgnoreCaseReact() { List<ResourceDictionary> dbTagsResourceDictionaries = - resourceDictionaryReactRepository.findByTagsContainingIgnoreCase("db-source").collectList().block(); + resourceDictionaryReactRepository.findByTagsContainingIgnoreCase(sourceName).collectList().block(); Assert.assertNotNull("Failed to query React Resource Dictionary by Tags", dbTagsResourceDictionaries); } + @Test + @Commit + public void test05Delete() { + resourceDictionaryReactRepository.deleteByName("db-source").block(); + } + private ResourceDictionary transformResourceDictionary(ResourceDefinition resourceDefinition) { ResourceDictionary resourceDictionary = new ResourceDictionary(); resourceDictionary.setName(resourceDefinition.getName()); resourceDictionary.setDataType(resourceDefinition.getProperty().getType()); resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription()); - resourceDictionary.setResourcePath(resourceDefinition.getResourcePath()); - resourceDictionary.setResourceType(resourceDefinition.getResourceType()); resourceDictionary.setTags(resourceDefinition.getTags()); resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy()); resourceDictionary.setDefinition(resourceDefinition); diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java index 82346954..5955ae19 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java @@ -58,11 +58,8 @@ public class ResourceDictionaryRestTest { Charset.defaultCharset());
ResourceDictionary dataDictionary = new ResourceDictionary();
- dataDictionary.setResourcePath("test/vnf/ipaddress");
dataDictionary.setName("test-name");
dataDictionary.setDefinition(JacksonUtils.readValue(definition, ResourceDefinition.class));
- dataDictionary.setValidValues("127.0.0.1");
- dataDictionary.setResourceType("ONAP");
dataDictionary.setDataType("string");
dataDictionary.setDescription("Sample Resource Mapping");
dataDictionary.setTags("test, ipaddress");
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java index 93ea4c49..46b725f8 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java @@ -37,16 +37,15 @@ public class ServiceTemplateValidationTest { public void testBluePrintDirs() {
List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");
Assert.assertNotNull("Failed to get blueprint directories", dirs);
- Assert.assertEquals("Failed to get actual directories", 2, dirs.size());
+ Assert.assertEquals("Failed to get actual directories", 1, dirs.size());
}
@Test
public void validateServiceTemplate() throws Exception {
- validateServiceTemplate("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json");
validateServiceTemplate("load/blueprints/vrr-test/Definitions/vrr-test.json");
}
- //@Test
+ @Test
public void validateEnhancedServiceTemplate() throws Exception {
ServiceTemplate serviceTemplate = JacksonUtils
.readValueFromClassPathFile("enhance/enhanced-template.json", ServiceTemplate.class);
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index b17663e9..429588b3 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -15,47 +15,6 @@ # limitations under the License. # -info.build.artifact=@project.artifactId@ -info.build.name=@project.name@ -info.build.description=@project.description@ -info.build.version=@project.version@ -info.build.groupId=@project.groupId@ -logging.level.root=info - -server.contextPath=/ -server.servlet-path=/ -spring.jersey.application-path=/api/controller-blueprints/v1 -server.routingPath=/api - - -mots.application.acronym=MOTS_ID -platform.identifier=AJSC7_JERSEY -#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration - -#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex - - -#The max number of active threads in this pool -server.tomcat.max-threads=200 -#The minimum number of threads always kept alive -server.tomcat.min-Spare-Threads=25 -#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads -server.tomcat.max-idle-time=60000 - -#for changing the tomcat port... -#server.port=8081 - - - -#Servlet context parameters -server.context_parameters.p-name=value #context parameter with p-name as key and value as value. - -# make this true for AAF authentication and place cadi.properties into etc folder -aaf.enabled=true - -# set to true to enable version proxy -#ivp.enabled=false - spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false @@ -68,5 +27,5 @@ blueprints.load.initial-data=true load.dataTypePath=./../../application/load/model_type/data_type load.nodeTypePath=./../../application/load/model_type/node_type load.artifactTypePath=./../../application/load/model_type/artifact_type -load.resourceDictionaryPath=load/resource_dictionary +load.resourceDictionaryPath=./../../application/load/resource_dictionary load.blueprintsPath=./../../application/load/blueprints
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json index 155dc723..70d03e0a 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -39,7 +39,12 @@ "login-key": "sdnc",
"login-account": "sndc-local",
"source": "local",
- "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "target-ip-address": {
+ "get_attribute": [
+ "SELF",
+ "lo0-local-ipv4-address"
+ ]
+ },
"port-number": 22,
"connection-time-out": 30
}
@@ -63,20 +68,40 @@ "operations": {
"process": {
"inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "template-name": "{ \"get_attribute\" : \"template_name\" }",
- "template-version": "{ \"get_attribute\" : \"template_version\" }",
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
"resource-type": "vnf-type",
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"hostname\" }",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ },
"execution-script": "execution-script"
},
"outputs": {
- "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
- "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ "response-data": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.response-data"
+ ]
+ },
+ "status": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.status"
+ ]
+ }
},
- "implementation" : {
- "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ "implementation": {
+ "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
}
}
}
@@ -89,7 +114,7 @@ "component-node": {}
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
@@ -97,12 +122,22 @@ "base-config-template",
"licence-template"
],
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template-version"
+ },
"resource-type": "vnf-type",
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"hostname\" }"
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ }
},
"outputs": {
"resource-assignment-params": "success",
@@ -128,12 +163,7 @@ }
},
"capabilities": {
- "dg-node": {},
- "content": {
- "properties": {
- "type": "json"
- }
- }
+ "dg-node": {}
},
"interfaces": {
"CONFIG": {
@@ -162,12 +192,7 @@ }
},
"capabilities": {
- "dg-node": {},
- "content": {
- "properties": {
- "type": "json"
- }
- }
+ "dg-node": {}
},
"interfaces": {
"CONFIG": {
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index c3f25738..bf3deffb 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -173,20 +173,6 @@ "capabilities" : {
"dg-node" : {
"type" : "tosca.capabilities.Node"
- },
- "content" : {
- "type" : "tosca.capability.Content",
- "properties" : {
- "type" : {
- "required" : false,
- "type" : "string",
- "default" : "json"
- },
- "content" : {
- "required" : false,
- "type" : "string"
- }
- }
}
},
"requirements" : {
@@ -215,6 +201,11 @@ },
"derived_from" : "tosca.nodes.DG"
},
+ "tosca.nodes.Component" : {
+ "description" : "This is default Component Node",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"component-resource-assignment" : {
"description" : "This is Resource Assignment Component API",
"version" : "1.0.0",
@@ -224,16 +215,16 @@ }
},
"interfaces" : {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode" : {
"operations" : {
"process" : {
"inputs" : {
- "service-template-name" : {
+ "template-name" : {
"description" : "Service Template Name.",
"required" : true,
"type" : "string"
},
- "service-template-version" : {
+ "template-version" : {
"description" : "Service Template Version.",
"required" : true,
"type" : "string"
@@ -283,6 +274,11 @@ },
"derived_from" : "tosca.nodes.Component"
},
+ "tosca.nodes.DG" : {
+ "description" : "This is Directed Graph Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"artifact-config-template" : {
"description" : "This is Configuration Velocity Template",
"version" : "1.0.0",
@@ -297,7 +293,7 @@ },
"capabilities" : {
"content" : {
- "type" : "tosca.capability.Content",
+ "type" : "tosca.capabilities.Content",
"properties" : {
"content" : {
"required" : true,
@@ -306,7 +302,7 @@ }
},
"mapping" : {
- "type" : "tosca.capability.Mapping",
+ "type" : "tosca.capabilities.Mapping",
"properties" : {
"mapping" : {
"required" : false,
@@ -325,7 +321,7 @@ "version" : "1.0.0",
"capabilities" : {
"netconf" : {
- "type" : "tosca.capability.Netconf",
+ "type" : "tosca.capabilities.Netconf",
"properties" : {
"login-key" : {
"required" : true,
@@ -361,6 +357,11 @@ },
"derived_from" : "tosca.nodes.Vnf"
},
+ "tosca.nodes.Vnf" : {
+ "description" : "This is VNF Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"component-netconf-executor" : {
"description" : "This is Netconf Transaction Configuration Component API",
"version" : "1.0.0",
@@ -386,12 +387,12 @@ "required" : true,
"type" : "string"
},
- "service-template-name" : {
+ "template-name" : {
"description" : "Service Template Name",
"required" : true,
"type" : "string"
},
- "service-template-version" : {
+ "template-version" : {
"description" : "Service Template Version",
"required" : true,
"type" : "string"
@@ -440,6 +441,11 @@ },
"derived_from" : "tosca.nodes.Component"
},
+ "tosca.nodes.Artifact" : {
+ "description" : "This is Deprecated Artifact Node Type.",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"dg-activate-netconf" : {
"description" : "This is Download Netconf Directed Graph",
"version" : "1.0.0",
@@ -463,20 +469,6 @@ "capabilities" : {
"dg-node" : {
"type" : "tosca.capabilities.Node"
- },
- "content" : {
- "type" : "tosca.capability.Content",
- "properties" : {
- "type" : {
- "required" : false,
- "type" : "string",
- "default" : "json"
- },
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
}
},
"requirements" : {
@@ -543,7 +535,9 @@ "login-key" : "sdnc",
"login-account" : "sndc-local",
"source" : "local",
- "target-ip-address" : "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "target-ip-address" : {
+ "get_attribute" : [ "SELF", "lo0-local-ipv4-address" ]
+ },
"port-number" : 22,
"connection-time-out" : 30
}
@@ -570,17 +564,31 @@ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
},
"inputs" : {
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "template_name" : "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name" : {
+ "get_input" : "action-name"
+ },
+ "template-name" : {
+ "get_input" : "template_name"
+ },
+ "template-version" : {
+ "get_input" : "template_version"
+ },
"resource-type" : "vnf-type",
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"hostname\" }",
+ "request-id" : {
+ "get_input" : "request-id"
+ },
+ "resource-id" : {
+ "get_input" : "hostname"
+ },
"execution-script" : "execution-script"
},
"outputs" : {
- "response-data" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
- "status" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ "response-data" : {
+ "get_attribute" : [ "SELF", "netconf-executor-baseconfig.response-data" ]
+ },
+ "status" : {
+ "get_attribute" : [ "SELF", "netconf-executor-baseconfig.status" ]
+ }
}
}
}
@@ -593,17 +601,27 @@ "component-node" : { }
},
"interfaces" : {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode" : {
"operations" : {
"process" : {
"inputs" : {
"template-names" : [ "base-config-template", "licence-template" ],
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "service-template-name" : "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name" : {
+ "get_input" : "action-name"
+ },
+ "template-name" : {
+ "get_input" : "template_name"
+ },
+ "template-version" : {
+ "get_input" : "template-version"
+ },
"resource-type" : "vnf-type",
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"hostname\" }"
+ "request-id" : {
+ "get_input" : "request-id"
+ },
+ "resource-id" : {
+ "get_input" : "hostname"
+ }
},
"outputs" : {
"resource-assignment-params" : "success",
@@ -622,12 +640,7 @@ "is-start-flow" : false
},
"capabilities" : {
- "dg-node" : { },
- "content" : {
- "properties" : {
- "type" : "json"
- }
- }
+ "dg-node" : { }
},
"requirements" : {
"component-dependency" : {
@@ -656,12 +669,7 @@ "is-start-flow" : false
},
"capabilities" : {
- "dg-node" : { },
- "content" : {
- "properties" : {
- "type" : "json"
- }
- }
+ "dg-node" : { }
},
"requirements" : {
"component-dependency" : {
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json index 198823bb..334fb24e 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json @@ -8,8 +8,6 @@ }
},
"updated-by": "Brinda Santh (bs2796)",
- "resource-type": "ONAP",
- "resource-path": "/v4-aggregat-list",
"tags": "ipaddress",
"sources": {
"input": {
|