summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/client/pom.xml2
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html6
-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--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/enrichment.rst36
-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/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
-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.kt35
-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/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt36
-rw-r--r--pom.xml5
27 files changed, 283 insertions, 198 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/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/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/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/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/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/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/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..cea18ef9b 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)
}
/**
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/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>