aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/client/pom.xml2
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts4
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html8
-rw-r--r--cds-ui/pom.xml2
-rw-r--r--cds-ui/server/package.json3
-rw-r--r--cds-ui/server/pom.xml2
-rw-r--r--cds-ui/server/src/controllers/data-dictionary.controller.ts11
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts17
-rw-r--r--cds-ui/server/src/services/resource-dictionary.service.ts3
-rw-r--r--components/scripts/python/ccsdk_netconf/common.py5
-rw-r--r--docs/bluePrintsProcessorMS.rst73
-rw-r--r--docs/controllerBlueprintStudioProcessorMS.rst32
-rw-r--r--docs/datadictionary/index.rst4
-rw-r--r--docs/datadictionary/media/mandatory.JPG (renamed from docs/datadictionary/media/image0.JPG)bin48105 -> 48105 bytes
-rw-r--r--docs/datadictionary/media/optional.JPG (renamed from docs/datadictionary/media/image1.JPG)bin79730 -> 79730 bytes
-rw-r--r--docs/datadictionary/resourcesource.rst11
-rw-r--r--docs/microservices/controllerBlueprintStudioProcessorMS.rst13
-rw-r--r--docs/microservices/enrichment.rst36
-rw-r--r--docs/microservices/images/blueprintprocessor.jpg (renamed from docs/media/blueprintprocessor.jpg)bin47208 -> 47208 bytes
-rw-r--r--docs/microservices/media/Enrichment-REST.pngbin0 -> 156586 bytes
-rw-r--r--docs/microservices/media/Enrichment-UI1.pngbin0 -> 33981 bytes
-rw-r--r--docs/microservices/media/Enrichment-UI2.pngbin0 -> 90202 bytes
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt7
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt31
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/pom.xml7
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml7
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt13
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/pom.xml3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt39
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt23
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt25
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt161
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt10
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt25
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt1
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt36
-rw-r--r--pom.xml5
48 files changed, 419 insertions, 256 deletions
diff --git a/cds-ui/client/pom.xml b/cds-ui/client/pom.xml
index 86504b7ea..ed0087d7d 100644
--- a/cds-ui/client/pom.xml
+++ b/cds-ui/client/pom.xml
@@ -50,8 +50,8 @@ limitations under the License.
<version>1.3</version>
<configuration>
<nodeVersion>v8.12.0</nodeVersion>
+ <npmVersion>6.4.1</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
- <npmDownloadRoot>https://nodejs.org/dist/npm/</npmDownloadRoot>
<installDirectory>./</installDirectory>
</configuration>
<executions>
diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts
index 283ce735f..bcfcc4e0c 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -96,5 +96,7 @@ export const GlobalContants = {
export const ResourceDictionaryURLs = {
saveResourceDictionary: '/resourcedictionary/save',
searchResourceDictionaryByTags: '/resourcedictionary/search',
- searchResourceDictionaryByName: ''
+ searchResourceDictionaryByName: '',
+ getSources: '/resourcedictionary/source-mapping',
+ getModelType: '/resourcedictionary/model-type'
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
index 57ff00df5..1e8f469b6 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
@@ -19,7 +19,7 @@ limitations under the License.
============LICENSE_END============================================
-->
<mat-radio-group>
- <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br> <br>
- <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br> <br>
- <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button>
+ <mat-radio-button value="1" (click)="selected(1)">Upload From local</mat-radio-button><br> <br>
+ <mat-radio-button value="2" (click)="selected(2)">Existing Template File</mat-radio-button><br> <br>
+ <mat-radio-button value="3" (click)="selected(3)">Create New</mat-radio-button>
</mat-radio-group> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
index 5be2a1457..19db82cc6 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
@@ -21,9 +21,10 @@
*/-->
-<button disabled style="opacity: 0.5;" (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button>
+<button (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button>
<br><br>
-<div *ngIf="designerMode">
+<!-- <div *ngIf="designerMode"> -->
+<div [hidden] = "!designerMode">
<mat-card class="metadata-card">
<mat-card-header>
<mat-card-title>Resource Metadata</mat-card-title>
@@ -45,7 +46,8 @@
</mat-card>
</div>
-<div *ngIf="editorMode">
+<!-- <div *ngIf="editorMode"> -->
+<div [hidden] = "!editorMode">
<json-editor class="jsoneditor" *ngIf="editorMode" [options]="options" [data]="resources" on-change="onChange($event)"></json-editor>
</div>
diff --git a/cds-ui/pom.xml b/cds-ui/pom.xml
index e4c545e27..a22dd4328 100644
--- a/cds-ui/pom.xml
+++ b/cds-ui/pom.xml
@@ -24,7 +24,7 @@ limitations under the License.
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/cds-ui/server/package.json b/cds-ui/server/package.json
index 627a34eaa..8abadb15b 100644
--- a/cds-ui/server/package.json
+++ b/cds-ui/server/package.json
@@ -86,5 +86,4 @@
"@types/node": "^10.11.2",
"@types/request": "^2.48.1"
}
-
-} \ No newline at end of file
+}
diff --git a/cds-ui/server/pom.xml b/cds-ui/server/pom.xml
index 8d758c710..d0fc42190 100644
--- a/cds-ui/server/pom.xml
+++ b/cds-ui/server/pom.xml
@@ -80,8 +80,8 @@ limitations under the License.
<version>1.3</version>
<configuration>
<nodeVersion>v8.12.0</nodeVersion>
+ <npmVersion>6.4.1</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
- <npmDownloadRoot>https://nodejs.org/dist/npm/</npmDownloadRoot>
<installDirectory>./</installDirectory>
</configuration>
<executions>
diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts
index 486c28658..63587e6b3 100644
--- a/cds-ui/server/src/controllers/data-dictionary.controller.ts
+++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts
@@ -84,4 +84,15 @@ export class DataDictionaryController {
}) resourceDictionaryList: JSON): Promise<any> {
return await this.rdservice.searchbyNames(resourceDictionaryList);
}
+
+ @get('/resourcedictionary/model-type/{source}', {
+ responses: {
+ '200': {
+ content: { 'application/json': {} },
+ },
+ },
+ })
+ async getmodelType(@param.path.string('source') source: string) {
+ return await this.rdservice.getModelType(source);
+ }
}
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
index c749eee62..af96aca04 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
@@ -87,6 +87,23 @@ export default {
"searchbyNames": ["resourceDictionaryList"]
}
+ },
+ ,
+ {
+ "template": {
+ "method": "GET",
+ "url": controllerApiConfig.http.url + "/model-type/{source}",
+ "headers": {
+ "accepts": "application/json",
+ "content-type": "application/json",
+ "authorization": controllerApiConfig.http.authToken
+ },
+ "responsePath": "$.*"
+ },
+ "functions": {
+ "getModelType": ["source"]
+
+ }
}
]
}; \ No newline at end of file
diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts
index 8bc61fad1..9a781d6b8 100644
--- a/cds-ui/server/src/services/resource-dictionary.service.ts
+++ b/cds-ui/server/src/services/resource-dictionary.service.ts
@@ -7,7 +7,8 @@ export interface ResourceDictionaryService {
getSourceMapping(): Promise<JSON>;
getByTags(tags: string): Promise<JSON>;
save(resourceDictionary: JSON): Promise<JSON>;
- searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
+ searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
+ getModelType(source: string): Promise<JSON>;
}
export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py
index f161e29ff..ad2057f32 100644
--- a/components/scripts/python/ccsdk_netconf/common.py
+++ b/components/scripts/python/ccsdk_netconf/common.py
@@ -1,4 +1,5 @@
# Copyright (c) 2019 Bell Canada.
+# Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,11 +19,11 @@ class ResolutionHelper:
self.component_function = component_function
def resolve_and_generate_message_from_template_prefix(self, artifact_prefix):
- return self.component_function.resolveAndGenerateMessage(artifact_prefix)
+ return self.component_function.contentFromResolvedArtifact(artifact_prefix)
def resolve_and_generate_message(self, artifact_mapping, artifact_template):
return self.component_function.resolveAndGenerateMessage(artifact_mapping,
artifact_template)
def retrieve_resolved_template_from_database(self, key, artifact_template):
- return self.component_function.resolveFromDatabase(key, artifact_template)
+ return self.component_function.storedContentFromResolvedArtifact(key, artifact_template)
diff --git a/docs/bluePrintsProcessorMS.rst b/docs/bluePrintsProcessorMS.rst
deleted file mode 100644
index 3f308138f..000000000
--- a/docs/bluePrintsProcessorMS.rst
+++ /dev/null
@@ -1,73 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.
-.. Copyright (C) 2019 IBM.
-
-Blueprints Processor
-====================
-
-.. toctree::
- :maxdepth: 1
- :titlesonly:
-
-Micro service to Manage Controller Blueprint Models, such as Resource Dictionary, Service Models, Velocity Templates etc, which will serve service for Controller Design Studio and Controller runtimes.
-
-This microservice is used to deploy Controller Blueprint Archive file in Run time database. This also helps to test the Valid Blueprint.
-
-Architecture:
--------------
-
-|image0|
-
-.. |image0| image:: images/blueprintprocessor.jpg
- :height: 600px
- :width: 800px
-
-Running Blueprints Processor Microservice Locally:
---------------------------------------------------
-
-The purpose of this page is to show how to run the Blueprints Processor microservice locally, using the docker-compose.yaml file provided in the project.
-
-Check out the CDS' code:
-
-Check out the latest code from Gerrit: https://gerrit.onap.org/r/#/admin/projects/ccsdk/cds
-
-Build CDS locally:
-In the checked out directory, type
-
- mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none
-
-Create the needed Docker images:
-
-The Blueprints Processor microservice project has a module, called distribution, that provides a docker-compose.yaml file that can be used to spin up Docker containers to run this microservice.
-
-The first step is to create any custom image needed, by building the distribution module. From the CDS home directory (where the code was checked out), navigate to the module:
-
- cd ms/blueprintsprocessor/distribution/
-Build it using the Maven profile called Docker:
-
- mvn clean install -Pdocker
-
-Start Docker containers using docker-composer:
-----------------------------------------------
-
-Navigate to the docker-compose file in the distribution module:
-
- cd src/main/dc/
-
-From there, start the containers:
-
- docker-compose up -d
-This will spin the Docker containers declared inside the docker-compose.yaml file in the background.
-
-
-To verify the logs generated by docker-composer, type:
-
- docker-compose logs -f
-
-
-Testing the environment:
-------------------------
-
-Point your browser to http://localhost:8000/api/v1/execution-service/ping (please note that the port is 8000, not 8080)
-
-To authenticate, use ccsdkapps / ccsdkapps as login / password. \ No newline at end of file
diff --git a/docs/controllerBlueprintStudioProcessorMS.rst b/docs/controllerBlueprintStudioProcessorMS.rst
deleted file mode 100644
index 6f3152d20..000000000
--- a/docs/controllerBlueprintStudioProcessorMS.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.
-.. Copyright (C) 2019 IBM.
-
-Controller Blueprints Studio Processor
-======================================
-
-The Controller Blueprint Archive is the overall service design, fully model-driven, intent based package needed for SELF SERVICE provisioning and configuration management automation.
-
-The CBA is .zip file which is saved in Controller Blueprint Database.
-
-Dynamic API:
-------------
-
-The nature of the API request and response is meant to be model driven and dynamic. They both share the same definition.
-
-The actionName, under the actionIdentifiers refers to the name of a Workflow (see workflow)
-
-The content of the payload is what is fully dynamic / model driven.
-
-The first top level element will always be either $actionName-request for a request or $actionName-response for a response.
-
-Then the content within this element is fully based on the workflow input and output.
-
-
-Enrichment:
------------
-
-Helps to generate complete valid CBA file.
-
-
- \ No newline at end of file
diff --git a/docs/datadictionary/index.rst b/docs/datadictionary/index.rst
index 88122b49f..0d87158d9 100644
--- a/docs/datadictionary/index.rst
+++ b/docs/datadictionary/index.rst
@@ -61,10 +61,10 @@ Also please click below for resource source available details
.. _Resource: https://wiki.onap.org/display/DW/Modeling+Concepts#ModelingConcepts-NodeResourceSource
-.. |image0| image:: media/image0.jpg
+.. |image0| image:: media/mandatory.jpg
:width: 7.88889in
:height: 4.43750in
-.. |image1| image:: media/image1.jpg
+.. |image1| image:: media/optional.jpg
:width: 7.88889in
:height: 4.43750in \ No newline at end of file
diff --git a/docs/datadictionary/media/image0.JPG b/docs/datadictionary/media/mandatory.JPG
index 074d20076..074d20076 100644
--- a/docs/datadictionary/media/image0.JPG
+++ b/docs/datadictionary/media/mandatory.JPG
Binary files differ
diff --git a/docs/datadictionary/media/image1.JPG b/docs/datadictionary/media/optional.JPG
index a27502a75..a27502a75 100644
--- a/docs/datadictionary/media/image1.JPG
+++ b/docs/datadictionary/media/optional.JPG
Binary files differ
diff --git a/docs/datadictionary/resourcesource.rst b/docs/datadictionary/resourcesource.rst
index 1bc0de4f1..1a69fd63f 100644
--- a/docs/datadictionary/resourcesource.rst
+++ b/docs/datadictionary/resourcesource.rst
@@ -11,12 +11,10 @@ Expects the value to be provided as input to the request.
source-input:
-{
"description": "This is Input Resource Source Node Type",
"version": "1.0.0",
"properties": {},
"derived_from": "tosca.nodes.ResourceSource"
-}
Default:
@@ -25,12 +23,11 @@ Expects the value to be defaulted in the model itself.
source-default:
-{
"description": "This is Default Resource Source Node Type",
"version": "1.0.0",
"properties": {},
"derived_from": "tosca.nodes.ResourceSource"
-}
+
sql:
@@ -42,7 +39,7 @@ CDS is currently deployed along the side of SDNC, hence the primary database con
|image0|
-.. |image0| image:: sqltable.jpg
+.. |image0| image:: media/sqltable.jpg
:width: 7.88889in
:height: 4.43750in
@@ -68,7 +65,7 @@ CDS is currently deployed along the side of SDNC, hence the default rest connect
|image1|
-.. |image1| image:: resttable.jpg
+.. |image1| image:: media/resttable.jpg
:width: 7.88889in
:height: 4.43750in
@@ -99,7 +96,7 @@ Expects a script to be provided.
|image2|
-.. |image2| image:: capabilitytable.jpg
+.. |image2| image:: media/capabilitytable.jpg
:width: 7.88889in
:height: 4.43750in
diff --git a/docs/microservices/controllerBlueprintStudioProcessorMS.rst b/docs/microservices/controllerBlueprintStudioProcessorMS.rst
index 5c67d6c1d..683b6943d 100644
--- a/docs/microservices/controllerBlueprintStudioProcessorMS.rst
+++ b/docs/microservices/controllerBlueprintStudioProcessorMS.rst
@@ -10,7 +10,7 @@ The Controller Blueprint Archive is the overall service design, fully model-driv
The CBA is .zip file which is saved in Controller Blueprint Database.
Dynamic API:
-===========
+------------
The nature of the API request and response is meant to be model driven and dynamic. They both share the same definition.
@@ -22,11 +22,18 @@ The first top level element will always be either $actionName-request for a requ
Then the content within this element is fully based on the workflow input and output.
+.. toctree::
+ :maxdepth: 1
+
+ dynamicapi
Enrichment:
-===========
+-----------
Helps to generate complete valid CBA file.
-
+.. toctree::
+ :maxdepth: 1
+
+ enrichment
\ No newline at end of file
diff --git a/docs/microservices/enrichment.rst b/docs/microservices/enrichment.rst
new file mode 100644
index 000000000..55984d77c
--- /dev/null
+++ b/docs/microservices/enrichment.rst
@@ -0,0 +1,36 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright (C) 2019 IBM.
+
+
+Enrichment
+==========
+.. toctree::
+ :maxdepth: 1
+
+Once the base CBA zip file is done, the enrichment process will complete the design by providing all the definitions required for the self-service provisioning.
+
+The following shows 2 ways to run CBA enrichment
+
+*REST API request
+
+|image0|
+
+*CDS UI
+
+|image1|
+
+
+|image2|
+
+.. |image0| image:: media/Enrichment-REST.png
+ :width: 7.88889in
+ :height: 4.43750in
+
+.. |image1| image:: media/Enrichment-UI1.png
+ :width: 7.88889in
+ :height: 4.43750in
+
+.. |image2| image:: media/Enrichment-UI2.png
+ :width: 7.88889in
+ :height: 4.43750in \ No newline at end of file
diff --git a/docs/media/blueprintprocessor.jpg b/docs/microservices/images/blueprintprocessor.jpg
index c618e0e32..c618e0e32 100644
--- a/docs/media/blueprintprocessor.jpg
+++ b/docs/microservices/images/blueprintprocessor.jpg
Binary files differ
diff --git a/docs/microservices/media/Enrichment-REST.png b/docs/microservices/media/Enrichment-REST.png
new file mode 100644
index 000000000..005f7960b
--- /dev/null
+++ b/docs/microservices/media/Enrichment-REST.png
Binary files differ
diff --git a/docs/microservices/media/Enrichment-UI1.png b/docs/microservices/media/Enrichment-UI1.png
new file mode 100644
index 000000000..62b870cab
--- /dev/null
+++ b/docs/microservices/media/Enrichment-UI1.png
Binary files differ
diff --git a/docs/microservices/media/Enrichment-UI2.png b/docs/microservices/media/Enrichment-UI2.png
new file mode 100644
index 000000000..44497050a
--- /dev/null
+++ b/docs/microservices/media/Enrichment-UI2.png
Binary files differ
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index a9552510d..e4129932b 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -17,8 +17,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt
index bac211ab2..510621b2e 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,4 +51,8 @@ fun AbstractComponentFunction.netconfDeviceInfo(requirementName: String): Device
private fun AbstractComponentFunction.netconfDeviceInfo(capabilityProperty: MutableMap<String, JsonNode>): DeviceInfo {
return JacksonUtils.getInstanceFromMap(capabilityProperty, DeviceInfo::class.java)
-} \ No newline at end of file
+}
+
+/**
+ * Blocking Methods called from Jython Scripts
+ */ \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index fa5d882b0..0f35e6338 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -44,6 +44,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
const val INPUT_ARGUMENT_PROPERTIES = "argument-properties"
const val INPUT_COMMAND = "command"
const val INPUT_PACKAGES = "packages"
+ const val DEFAULT_SELECTOR = "remote-python"
const val ATTRIBUTE_PREPARE_ENV_LOG = "prepare-environment-logs"
const val ATTRIBUTE_EXEC_CMD_LOG = "execute-command-logs"
@@ -58,13 +59,13 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val blueprintVersion = bluePrintContext.version()
val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
+ .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
+ ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
val artifactDefinition =
- bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
checkNotBlank(artifactDefinition.file) { "couldn't get python script path($artifactName)" }
@@ -90,14 +91,20 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
try {
// Open GRPC Connection
- remoteScriptExecutionService.init(endPointSelector.asText())
+ if (DEFAULT_SELECTOR == endPointSelector.asText()) {
+ remoteScriptExecutionService.init(endPointSelector.asText())
+ } else {
+ // Get endpoint from DSL
+ val endPointSelectorJson = bluePrintRuntimeService.resolveDSLExpression(endPointSelector.asText())
+ remoteScriptExecutionService.init(endPointSelectorJson)
+ }
// If packages are defined, then install in remote server
if (packages != null) {
val prepareEnvInput = PrepareRemoteEnvInput(requestId = processId,
- remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName,
- blueprintVersion = blueprintVersion),
- packages = packages
+ remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName,
+ blueprintVersion = blueprintVersion),
+ packages = packages
)
val prepareEnvOutput = remoteScriptExecutionService.prepareEnv(prepareEnvInput)
log.info("$ATTRIBUTE_PREPARE_ENV_LOG - ${prepareEnvOutput.response}")
@@ -111,10 +118,10 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val properties = dynamicProperties?.returnNullIfMissing()?.rootFieldsToMap() ?: hashMapOf()
val remoteExecutionInput = RemoteScriptExecutionInput(
- requestId = processId,
- remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
- command = scriptCommand,
- properties = properties)
+ requestId = processId,
+ remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
+ command = scriptCommand,
+ properties = properties)
val remoteExecutionOutput = remoteScriptExecutionService.executeCommand(remoteExecutionInput)
log.info("$ATTRIBUTE_EXEC_CMD_LOG - ${remoteExecutionOutput.response}")
setAttribute(ATTRIBUTE_EXEC_CMD_LOG, JacksonUtils.jsonNodeFromObject(remoteExecutionOutput.response))
@@ -131,7 +138,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
private fun formatNestedJsonNode(node: JsonNode): String {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 31aa7c7c1..13202c6ea 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -185,7 +185,7 @@ class ComponentRemotePythonExecutorTest {
}
class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
- override suspend fun init(selector: String) {
+ override suspend fun init(selector: Any) {
}
override suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index b38ebb1b0..df7e0482c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -51,6 +51,9 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = occurrence
val jsonResponse = JsonNodeFactory.instance.objectNode()
+ // Initialize Output Attribute to empty JSON
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
+ ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
// validate inputs if we need to store the resource and template resolution.
if (storeResult) {
@@ -84,7 +87,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
}
- // Set Output Attributes
+ // Set Output Attributes with resolved value
bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 0e97267da..938affc82 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
+import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
@@ -25,10 +26,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.R
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.TemplateResolutionService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -47,7 +45,7 @@ interface ResourceResolutionService {
resolutionKey: String): String
suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactNames: List<String>, properties: Map<String, Any>): MutableMap<String, String>
+ artifactNames: List<String>, properties: Map<String, Any>): MutableMap<String, JsonNode>
suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
artifactPrefix: String, properties: Map<String, Any>): String
@@ -85,17 +83,19 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
artifactNames: List<String>,
- properties: Map<String, Any>): MutableMap<String, String> {
+ properties: Map<String, Any>): MutableMap<String, JsonNode> {
val resourceAssignmentRuntimeService =
ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService, artifactNames.toString())
- val resolvedParams: MutableMap<String, String> = hashMapOf()
+ val resolvedParams: MutableMap<String, JsonNode> = hashMapOf()
artifactNames.forEach { artifactName ->
val resolvedContent = resolveResources(resourceAssignmentRuntimeService, nodeTemplateName,
artifactName, properties)
- resolvedParams[artifactName] = resolvedContent
+
+ resolvedParams[artifactName] = resolvedContent.asJsonType()
+
}
return resolvedParams
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
index 560bc4142..b63fa6798 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
@@ -71,6 +71,8 @@ class ResourceResolutionComponentTest {
resourceResolutionComponent.stepName = "step"
resourceResolutionComponent.interfaceName = "interfaceName"
resourceResolutionComponent.operationName = "operationName"
+
+ every { bluePrintRuntimeService.setNodeTemplateAttributeValue(any(), any(), any()) } returns Unit
}
@Test
@@ -139,7 +141,6 @@ class ResourceResolutionComponentTest {
any<List<String>>(),
any<MutableMap<String, Any>>())
} returns mutableMapOf()
- every { bluePrintRuntimeService.setNodeTemplateAttributeValue(any(), any(), any()) } returns Unit
runBlocking {
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
index d423dfd06..65d1474f3 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
@@ -14,10 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
@@ -47,4 +44,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
index 6949c4f43..1ba04033d 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
@@ -14,10 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
@@ -43,4 +40,4 @@
<artifactId>sshd-core</artifactId>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 056f7e96d..b5dac5a39 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -86,7 +86,7 @@ fun BluePrintTypes.componentScriptExecutor(): NodeType {
property(ComponentScriptExecutor.SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING, true,
"Script Type") {
defaultValue(BluePrintConstants.SCRIPT_INTERNAL)
- constrains {
+ constrain {
validValues(listOf(BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive(),
BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive()))
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index 3af57a22b..d4195ae45 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -22,6 +22,7 @@ import com.google.protobuf.Timestamp
import com.google.protobuf.util.JsonFormat
import io.grpc.ManagedChannel
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcClientService
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcLibPropertyService
import org.onap.ccsdk.cds.controllerblueprints.command.api.*
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -31,9 +32,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
interface RemoteScriptExecutionService {
- suspend fun init(selector: String)
+ suspend fun init(selector: Any)
suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput
suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput
suspend fun close()
@@ -51,9 +51,14 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
private var channel: ManagedChannel? = null
private lateinit var commandExecutorServiceGrpc: CommandExecutorServiceGrpc.CommandExecutorServiceBlockingStub
- override suspend fun init(selector: String) {
+ override suspend fun init(selector: Any) {
// Get the GRPC Client Service based on selector
- val grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector)
+ val grpcClientService: BluePrintGrpcClientService
+ if (selector is JsonNode) {
+ grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector)
+ } else {
+ grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector.toString())
+ }
// Get the GRPC Channel
channel = grpcClientService.channel()
// Create Non Blocking Stub
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index dc689ece0..4d05550ef 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -14,8 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/pom.xml b/ms/controllerblueprints/modules/blueprint-core/pom.xml
index d0710b238..f18821e2c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-core/pom.xml
@@ -15,8 +15,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 4832970f3..a5b18a1f6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -64,8 +64,33 @@ fun Double.asJsonPrimitive(): DoubleNode {
return DoubleNode.valueOf(this)
}
+/**
+ * Utility to convert Primitive object to Json Type Primitive.
+ */
+fun <T : Any?> T.asJsonPrimitive(): JsonNode {
+ return if (this == null || this is MissingNode || this is NullNode) {
+ NullNode.instance
+ } else {
+ when (this) {
+ is String ->
+ this.asJsonPrimitive()
+ is Boolean ->
+ this.asJsonPrimitive()
+ is Int ->
+ this.asJsonPrimitive()
+ is Double ->
+ this.asJsonPrimitive()
+ else ->
+ throw BluePrintException("$this type is not supported")
+ }
+ }
+}
+
+/**
+ * Utility to convert Complex or Primitive object to Json Type.
+ */
fun <T : Any?> T.asJsonType(): JsonNode {
- return if (this == null) {
+ return if (this == null || this is MissingNode || this is NullNode) {
NullNode.instance
} else {
when (this) {
@@ -131,15 +156,11 @@ fun JsonNode.returnNullIfMissing(): JsonNode? {
}
fun <T : JsonNode> T?.isNull(): Boolean {
- return if (this == null || this is NullNode || this is MissingNode) {
- true
- } else false
+ return this == null || this is NullNode || this is MissingNode
}
fun <T : JsonNode> T?.isNotNull(): Boolean {
- return if (this == null || this is NullNode || this is MissingNode) {
- false
- } else true
+ return !(this == null || this is NullNode || this is MissingNode)
}
/**
@@ -232,4 +253,8 @@ fun nullToEmpty(value: String?): String {
return if (isNotEmpty(value)) value!! else ""
}
+inline fun <reified T : JsonNode> T.isComplexType(): Boolean {
+ return this is ObjectNode || this is ArrayNode
+}
+
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
index 15b3e22fb..d3013402b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,7 +67,8 @@ data class OperationOutputExpression(
val modelableEntityName: String = "SELF",
val interfaceName: String,
val operationName: String,
- val propertyName: String
+ val propertyName: String,
+ var subPropertyName: String? = null
)
data class DSLExpression(
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
index 9e934c7c7..68e5b0aec 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
@@ -63,26 +63,24 @@ class Credential {
A constraint clause defines an operation along with one or more compatible values that can be used to define a constraint on a property or parameter’s allowed values when it is defined in a TOSCA Service Template or one of its entities.
*/
class ConstraintClause {
- @get:JsonProperty("equal")
var equal: JsonNode? = null
@get:JsonProperty("greater_than")
- var greaterThan: Any? = null
+ var greaterThan: JsonNode? = null
@get:JsonProperty("greater_or_equal")
- var greaterOrEqual: Any? = null
+ var greaterOrEqual: JsonNode? = null
@get:JsonProperty("less_than")
- var lessThan: Any? = null
+ var lessThan: JsonNode? = null
@get:JsonProperty("less_or_equal")
- var lessOrEqual: Any? = null
+ var lessOrEqual: JsonNode? = null
@get:JsonProperty("in_range")
- var inRange: Any? = null
+ var inRange: MutableList<JsonNode>? = null
@get:JsonProperty("valid_values")
var validValues: MutableList<JsonNode>? = null
- @get:JsonProperty("length")
- var length: Any? = null
+ var length: JsonNode? = null
@get:JsonProperty("min_length")
- var minLength: Any? = null
+ var minLength: JsonNode? = null
@get:JsonProperty("max_length")
- var maxLength: Any? = null
+ var maxLength: JsonNode? = null
var pattern: String? = null
var schema: String? = null
}
@@ -164,6 +162,9 @@ class PropertyDefinition {
var constraints: MutableList<ConstraintClause>? = null
@get:JsonProperty("entry_schema")
var entrySchema: EntrySchema? = null
+ @get:JsonProperty("external-schema")
+ var externalSchema: String? = null
+ var metadata: MutableMap<String, String>? = null
// Mainly used in Workflow Outputs
@get:ApiModelProperty(notes = "Property Value, It may be Expression or Json type values")
var value: JsonNode? = null
@@ -398,7 +399,7 @@ A Relationship Type is a reusable entity that defines the type of one or more re
class RelationshipType : EntityType() {
var interfaces: MutableMap<String, InterfaceDefinition>? = null
@get:JsonProperty("valid_target_types")
- var validTargetTypes: ArrayList<String>? = null
+ var validTargetTypes: MutableList<String>? = null
}
/*
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index f19ae8eb8..eec59d1a7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -76,11 +76,18 @@ class NodeTemplateBuilder(private val id: String,
private val type: String,
private val description: String? = "") {
private var nodeTemplate: NodeTemplate = NodeTemplate()
+ private var properties: MutableMap<String, JsonNode>? = null
private var interfaces: MutableMap<String, InterfaceAssignment>? = null
private var artifacts: MutableMap<String, ArtifactDefinition>? = null
private var capabilities: MutableMap<String, CapabilityAssignment>? = null
private var requirements: MutableMap<String, RequirementAssignment>? = null
+ fun properties(block: PropertiesAssignmentBuilder.() -> Unit) {
+ if (properties == null)
+ properties = hashMapOf()
+ properties = PropertiesAssignmentBuilder().apply(block).build()
+ }
+
fun operation(interfaceName: String, description: String? = "",
block: OperationAssignmentBuilder.() -> Unit) {
if (interfaces == null)
@@ -122,6 +129,7 @@ class NodeTemplateBuilder(private val id: String,
nodeTemplate.id = id
nodeTemplate.type = type
nodeTemplate.description = description
+ nodeTemplate.properties = properties
nodeTemplate.interfaces = interfaces
nodeTemplate.artifacts = artifacts
nodeTemplate.capabilities = capabilities
@@ -133,12 +141,27 @@ class NodeTemplateBuilder(private val id: String,
class ArtifactDefinitionBuilder(private val id: String, private val type: String, private val file: String) {
private var artifactDefinition: ArtifactDefinition = ArtifactDefinition()
- // TODO()
+ private var properties: MutableMap<String, JsonNode>? = null
+
+ fun repository(repository: String) {
+ artifactDefinition.repository = repository
+ }
+
+ fun deployPath(deployPath: String) {
+ artifactDefinition.deployPath = deployPath
+ }
+
+ fun properties(block: PropertiesAssignmentBuilder.() -> Unit) {
+ if (properties == null)
+ properties = hashMapOf()
+ properties = PropertiesAssignmentBuilder().apply(block).build()
+ }
fun build(): ArtifactDefinition {
artifactDefinition.id = id
artifactDefinition.type = type
artifactDefinition.file = file
+ artifactDefinition.properties = properties
return artifactDefinition
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
index 0f011948d..8afe695ca 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
@@ -17,8 +17,8 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import com.fasterxml.jackson.databind.node.ArrayNode
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.data.*
@@ -162,7 +162,16 @@ class ArtifactTypeBuilder(id: String, version: String, derivedFrom: String,
class PolicyTypeBuilder(id: String, version: String, derivedFrom: String,
description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
private var policyType = PolicyType()
- // TODO()
+
+ fun targets(targetsStr: String) {
+ val arrayNode = targetsStr.jsonAsJsonType() as ArrayNode
+ targets(arrayNode.asListOfString())
+ }
+
+ fun targets(target: List<String>) {
+ policyType.targets = target.toMutableList()
+ }
+
fun build(): PolicyType {
buildEntityType(policyType)
return policyType
@@ -174,7 +183,16 @@ class RelationshipTypeBuilder(private val id: String, private val version: Strin
: EntityTypeBuilder(id, version, derivedFrom, description) {
private var relationshipType = RelationshipType()
- // TODO()
+
+ fun validTargetTypes(validTargetTypesStr: String) {
+ val arrayNode = validTargetTypesStr.jsonAsJsonType() as ArrayNode
+ validTargetTypes(arrayNode.asListOfString())
+ }
+
+ fun validTargetTypes(validTargetTypes: List<String>) {
+ relationshipType.validTargetTypes = validTargetTypes.toMutableList()
+ }
+
fun build(): RelationshipType {
buildEntityType(relationshipType)
relationshipType.id = id
@@ -187,7 +205,15 @@ class RelationshipTypeBuilder(private val id: String, private val version: Strin
class DataTypeBuilder(id: String, version: String, derivedFrom: String,
description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
private var dataType = DataType()
- // TODO()
+
+ fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
+ if (dataType.constraints == null) {
+ dataType.constraints = mutableListOf()
+ }
+ val constraintClause = ConstraintClauseBuilder().apply(block).build()
+ dataType.constraints!!.add(constraintClause)
+ }
+
fun build(): DataType {
buildEntityType(dataType)
return dataType
@@ -264,29 +290,6 @@ class OperationDefinitionBuilder(private val id: String,
}
}
-class AttributesDefinitionBuilder {
- private val attributes: MutableMap<String, AttributeDefinition> = hashMapOf()
-
- fun attribute(id: String, attribute: AttributeDefinition) {
- attributes[id] = attribute
- }
-
- fun attribute(id: String, type: String?, required: Boolean?, description: String?) {
- val attribute = AttributeDefinitionBuilder(id, type, required, description).build()
- attributes[id] = attribute
- }
-
- fun attribute(id: String, type: String?, required: Boolean?, description: String?,
- block: AttributeDefinitionBuilder.() -> Unit) {
- val attribute = AttributeDefinitionBuilder(id, type, required, description).apply(block).build()
- attributes[id] = attribute
- }
-
- fun build(): MutableMap<String, AttributeDefinition> {
- return attributes
- }
-}
-
class AttributeDefinitionBuilder(private val id: String,
private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
private val required: Boolean? = false,
@@ -302,7 +305,17 @@ class AttributeDefinitionBuilder(private val id: String,
attributeDefinition.entrySchema = EntrySchemaBuilder(entrySchemaType).apply(block).build()
}
- // TODO("Constrains")
+ fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
+ if (attributeDefinition.constraints == null) {
+ attributeDefinition.constraints = mutableListOf()
+ }
+ val constraintClause = ConstraintClauseBuilder().apply(block).build()
+ attributeDefinition.constraints!!.add(constraintClause)
+ }
+
+ fun defaultValue(defaultValue: Any) {
+ defaultValue(defaultValue.asJsonType())
+ }
fun defaultValue(defaultValue: JsonNode) {
attributeDefinition.defaultValue = defaultValue
@@ -355,8 +368,12 @@ class PropertyDefinitionBuilder(private val id: String,
propertyDefinition.entrySchema = EntrySchemaBuilder(entrySchemaType).apply(block).build()
}
- fun constrains(block: ConstraintClauseBuilder.() -> Unit) {
- propertyDefinition.constraints = ConstraintClauseBuilder().apply(block).build()
+ fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
+ if (propertyDefinition.constraints == null) {
+ propertyDefinition.constraints = mutableListOf()
+ }
+ val constraintClause = ConstraintClauseBuilder().apply(block).build()
+ propertyDefinition.constraints!!.add(constraintClause)
}
fun defaultValue(defaultValue: Any) {
@@ -380,13 +397,11 @@ class PropertyDefinitionBuilder(private val id: String,
}
}
-class ConstraintClauseBuilder {
- private val constraints: MutableList<ConstraintClause> = mutableListOf()
- //TODO("Implementation")
+class ConstraintsClauseBuilder {
+ val constraints: MutableList<ConstraintClause> = mutableListOf()
- fun validValues(values: List<JsonNode>) {
- val constraintClause = ConstraintClause()
- constraintClause.validValues = values.toMutableList()
+ fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
+ val constraintClause = ConstraintClauseBuilder().apply(block).build()
constraints.add(constraintClause)
}
@@ -395,10 +410,82 @@ class ConstraintClauseBuilder {
}
}
+class ConstraintClauseBuilder {
+ private val constraintClause = ConstraintClause()
+
+ fun equal(equal: Any) = equal(equal.asJsonType())
+
+ fun equal(equal: JsonNode) {
+ constraintClause.equal = equal
+ }
+
+ fun greaterOrEqual(greaterOrEqual: Any) {
+ constraintClause.greaterOrEqual = greaterOrEqual.asJsonPrimitive()
+ }
+
+ fun greaterThan(greaterThan: Any) {
+ constraintClause.greaterThan = greaterThan.asJsonPrimitive()
+ }
+
+ fun lessOrEqual(lessOrEqual: Any) {
+ constraintClause.lessOrEqual = lessOrEqual.asJsonPrimitive()
+ }
+
+ fun lessThan(lessThan: Any) {
+ constraintClause.lessThan = lessThan.asJsonPrimitive()
+ }
+
+ fun inRange(inRangeStr: String) = inRange(inRangeStr.jsonAsJsonType() as ArrayNode)
+
+ fun inRange(inRangeNode: ArrayNode) {
+ constraintClause.inRange = inRangeNode.toMutableList()
+ }
+
+ fun validValues(validValuesStr: String) = validValues(validValuesStr.jsonAsJsonType() as ArrayNode)
+
+ fun validValues(validValuesNode: ArrayNode) = validValues(validValuesNode.toMutableList())
+
+ fun validValues(validValues: List<JsonNode>) {
+ constraintClause.validValues = validValues.toMutableList()
+ }
+
+ fun length(length: Any) {
+ constraintClause.length = length.asJsonPrimitive()
+ }
+
+ fun minLength(minLength: Any) {
+ constraintClause.minLength = minLength.asJsonPrimitive()
+ }
+
+ fun maxLength(maxLength: Any) {
+ constraintClause.maxLength = maxLength.asJsonPrimitive()
+ }
+
+ fun pattern(pattern: String) {
+ constraintClause.pattern = pattern
+ }
+
+ fun schema(schema: String) {
+ constraintClause.schema = schema
+ }
+
+ fun build(): ConstraintClause {
+ return constraintClause
+ }
+}
+
class EntrySchemaBuilder(private val type: String) {
private var entrySchema: EntrySchema = EntrySchema()
+ fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
+ if (entrySchema.constraints == null) {
+ entrySchema.constraints = mutableListOf()
+ }
+ val constraintClause = ConstraintClauseBuilder().apply(block).build()
+ entrySchema.constraints!!.add(constraintClause)
+ }
+
fun build(): EntrySchema {
entrySchema.type = type
return entrySchema
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
index 32cb6ac77..fbf911664 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -170,10 +170,16 @@ object BluePrintExpressionService {
throw BluePrintException(String.format("missing operation output expression, " +
"it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}", jsonNode))
}
+
+ var subPropertyName: String? = null
+ if (arrayNode.size() == 5)
+ subPropertyName = arrayNode[4].asText()
+
return OperationOutputExpression(modelableEntityName = arrayNode[0].asText(),
interfaceName = arrayNode[1].asText(),
operationName = arrayNode[2].asText(),
- propertyName = arrayNode[3].asText()
+ propertyName = arrayNode[3].asText(),
+ subPropertyName = subPropertyName
)
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index e6f3f71ca..ba210df10 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018-2019 IBM.
+ * Modifications Copyright © 2018-2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -213,8 +213,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun loadEnvironments(type: String, fileName: String) {
BluePrintMetadataUtils.environmentFileProperties(fileName).forEach { key, value ->
- setNodeTemplateAttributeValue(type, key.toString(), value.toString()
- .asJsonPrimitive())
+ setNodeTemplateAttributeValue(type, key.toString(), value.asJsonType())
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
index 931d31e9d..30bd75f7d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +21,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.data.*
-import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JsonParserUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ResourceResolverUtils
@@ -143,8 +140,8 @@ If Property Assignment is Expression.
}
if (subAttributeName != null) {
- if (valueNode.isObject || valueNode.isArray)
- valueNode = JsonParserUtils.parse(valueNode, subAttributeName)
+ if (valueNode.isComplexType())
+ valueNode = JsonParserUtils.parse(valueNode.asJsonString(), subAttributeName)
}
return valueNode
}
@@ -176,8 +173,8 @@ If Property Assignment is Expression.
valueNode = resolveAssignmentExpression(propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
if (subPropertyName != null) {
- if (valueNode.isObject || valueNode.isArray)
- valueNode = JsonParserUtils.parse(valueNode, subPropertyName)
+ if (valueNode.isComplexType())
+ valueNode = JsonParserUtils.parse(valueNode.asJsonString(), subPropertyName)
}
return valueNode
}
@@ -190,9 +187,17 @@ If Property Assignment is Expression.
if (!operationOutputExpression.modelableEntityName.equals("SELF", true)) {
outputNodeTemplateName = operationOutputExpression.modelableEntityName
}
- return bluePrintRuntimeService.getNodeTemplateOperationOutputValue(outputNodeTemplateName,
+
+ var valueNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(outputNodeTemplateName,
operationOutputExpression.interfaceName, operationOutputExpression.operationName,
operationOutputExpression.propertyName)
+
+ val subPropertyName: String? = operationOutputExpression.subPropertyName
+ if (subPropertyName != null) {
+ if (valueNode.isComplexType())
+ valueNode = JsonParserUtils.parse(valueNode.asJsonString(), subPropertyName)
+ }
+ return valueNode
}
/*
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
index 5e9fd6207..9b1b66b5b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
@@ -296,6 +296,5 @@ class JacksonUtils {
else -> getJsonNode(value)
}
}
-
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
index 342ff7636..e5eef5a41 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2018 IBM.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +39,7 @@ class JsonParserUtils {
}
fun paths(jsonNode: JsonNode, expression: String): List<String> {
- return paths(jsonNode.toString(), expression)
+ return paths(jsonNode, expression)
}
fun parse(jsonContent: String, expression: String): JsonNode {
@@ -54,7 +55,8 @@ class JsonParserUtils {
}
fun parseNSet(jsonNode: JsonNode, expression: String, valueNode: JsonNode): JsonNode {
- return parseNSet(jsonNode.toString(), expression, valueNode)
+
+ return parseNSet(jsonNode, expression, valueNode)
}
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index 020edc78e..c0641be69 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import kotlin.test.assertNotNull
@@ -153,6 +154,41 @@ class BluePrintDSLTest {
}
@Test
+ fun testNodeTypePropertyConstrains() {
+ val nodeType = nodeType("data-node", "1.0.0", "tosca.Nodes.root", "") {
+ property("ip-address", "string", true, "") {
+ defaultValue("127.0.0.1")
+ constrain {
+ validValues(arrayListOf("""127.0.0.1""".asJsonPrimitive()))
+ length(10)
+ maxLength(20)
+ minLength(10)
+ }
+
+ }
+ property("disk-space", "string", true, "") {
+ defaultValue(10)
+ constrain {
+ validValues("""["200KB", "400KB"]""")
+ equal("200KB")
+ inRange("""["100KB", "500KB" ]""")
+ maxLength("10MB")
+ minLength("10KB")
+ }
+ constrain {
+ validValues("""[ 200, 400]""")
+ greaterOrEqual("10KB")
+ greaterThan("20KB")
+ lessOrEqual("200KB")
+ lessThan("190KB")
+ }
+ }
+ }
+ assertNotNull(nodeType, "failed to get nodeType")
+ // println(nodeType.asJsonString(true))
+ }
+
+ @Test
fun testServiceTemplateWorkflow() {
val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
"brindasanth@onap.com", "sample, blueprints") {
diff --git a/pom.xml b/pom.xml
index 2a227c747..a5a88244c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,13 +15,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<relativePath/>
</parent>