summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json377
-rw-r--r--components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json31
-rw-r--r--components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json37
-rw-r--r--components/core/load/model_type/node_type/artifact-config-template.json4
-rw-r--r--components/core/load/model_type/node_type/component-config-generator.json2
-rw-r--r--components/core/load/model_type/node_type/component-netconf-executor.json2
-rw-r--r--components/core/load/model_type/node_type/component-resource-assignment.json2
-rw-r--r--components/core/load/model_type/node_type/dg-activate-netconf.json14
-rw-r--r--components/core/load/model_type/node_type/dg-config-generator.json14
-rw-r--r--components/core/load/model_type/node_type/dg-resource-assign-activate.json14
-rw-r--r--components/core/load/model_type/node_type/dg-resource-assignment.json14
-rw-r--r--components/core/load/model_type/node_type/tosca.nodes.Artifact.json5
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt21
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt33
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt6
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt20
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt37
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt111
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt189
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt64
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt14
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt94
-rw-r--r--components/core/src/test/resources/componentnode/default.json6
-rw-r--r--components/core/src/test/resources/data/default-context.json2
-rw-r--r--components/core/src/test/resources/properties/convert.json4
-rw-r--r--components/core/src/test/resources/properties/default.json4
-rw-r--r--components/resource-dict/load/resource_dictionary/db-source.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/default-source.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/input-source.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/mdsal-source.json2
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt6
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt4
33 files changed, 688 insertions, 453 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))