summaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorVijay Venkatesh Kumar <vv770d@att.com>2020-02-19 17:35:15 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-19 17:35:15 +0000
commit38808a23e76deb763a39f457a15b2ef56282b609 (patch)
tree2dc309b32cd3154a7268b5e319b15e58ac3e320d /mod
parentfc08a5916376cb6164bd4a6a3f8f2ee43fe85a5d (diff)
parent7b27a8acf25d5d92a0160360175b5d0ecd2ef4d7 (diff)
Merge "Added policyNodes, db, tls support"
Diffstat (limited to 'mod')
-rw-r--r--mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_with_dmaap.yaml376
-rw-r--r--mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_without_dmaap_yaml.yaml330
-rw-r--r--mod/bpgenerator/TestCases/helloworld/compspec/hello-changed.json154
-rw-r--r--mod/bpgenerator/TestCases/ves/blueprints/ves-no-change_yaml.yaml187
-rw-r--r--mod/bpgenerator/TestCases/ves/blueprints/ves-with-dmaap_yaml.yaml314
-rw-r--r--mod/bpgenerator/TestCases/ves/componentSpecs/ves.json276
-rw-r--r--mod/bpgenerator/TestCases/ves/inputFiles/ves_nodmaap.json11
-rw-r--r--mod/bpgenerator/pom.xml8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/Fixes.java34
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java130
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java90
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java24
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/GetAttribute.java34
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java22
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java11
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java51
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java121
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java51
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java37
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java35
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java40
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java34
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java37
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java72
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ComponentSpec.java14
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/PolicyInfo.java35
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/TypePolicy.java36
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java26
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java25
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java16
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapBlueprint.java13
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapNode.java22
-rw-r--r--mod/bpgenerator/version.properties4
33 files changed, 2484 insertions, 186 deletions
diff --git a/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_with_dmaap.yaml b/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_with_dmaap.yaml
new file mode 100644
index 0000000..95961ee
--- /dev/null
+++ b/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_with_dmaap.yaml
@@ -0,0 +1,376 @@
+# ============LICENSE_START=======================================================
+# org.onap.dcae
+# ================================================================================
+# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+#description: Hello World mS for subscribing the data from local DMaaP, DR or MR, processing them and publishing them as PM files to local DMaaP DR
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+description: Hello World mS for subscribing the data from local DMaaP, DR or MR, processing
+ them and publishing them as PM files to local DMaaP DR
+imports:
+- https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.1/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml
+inputs:
+ DCAE-HELLO-WORLD-PUB-DR_DCAE-HELLO-WORLD-PUB-DR_feed_location:
+ type: string
+ DCAE-HELLO-WORLD-PUB-DR_feed_name:
+ type: string
+ DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_aaf_password:
+ type: string
+ DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_aaf_username:
+ type: string
+ DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_client_role:
+ type: string
+ DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_location:
+ type: string
+ DCAE-HELLO-WORLD-PUB-MR_topic_name:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_decompress:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_location:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_password:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_priviliged:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_username:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_feed_name:
+ type: string
+ DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_aaf_password:
+ type: string
+ DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_aaf_username:
+ type: string
+ DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_client_role:
+ type: string
+ DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_location:
+ type: string
+ DCAE-HELLO-WORLD-SUB-MR_topic_name:
+ type: string
+ dcae.collectors.vcc.helloworld.pm_cpu_limit:
+ type: string
+ default: "250m"
+ dcae.collectors.vcc.helloworld.pm_cpu_request:
+ type: string
+ default: "250m"
+ dcae.collectors.vcc.helloworld.pm_memory_limit:
+ type: string
+ default: "128Mi"
+ dcae.collectors.vcc.helloworld.pm_memory_request:
+ type: string
+ default: "128Mi"
+ dcaes_database_name:
+ type: string
+ description: db name
+ default: ""
+ dcaes_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ dti_database_name:
+ type: string
+ description: db name
+ default: ""
+ dti_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ envs:
+ default: &envs {}
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ repo_database_name:
+ type: string
+ description: db name
+ default: ""
+ repo_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ service_component_name_override:
+ type: string
+ default: ""
+ tag_version:
+ type: string
+ default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ tca_policy_00_policy_id:
+ type: string
+ description: policy_id
+ default: ""
+ tca_policy_11_policy_id:
+ type: string
+ description: policy_id
+ default: "tca_policy_id_11"
+ use_tls:
+ type: boolean
+ description: flag to indicate tls enable/disable
+ default: true
+ vcc_hello_name:
+ type: string
+ default: "fsdfa"
+node_templates:
+ DCAE-HELLO-WORLD-PUB-DR_feed:
+ type: ccsdk.nodes.Feed
+ properties:
+ feed_name:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_feed_name
+ DCAE-HELLO-WORLD-PUB-MR_topic:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: DCAE-HELLO-WORLD-PUB-MR_topic_name
+ DCAE-HELLO-WORLD-SUB-DR_feed:
+ type: ccsdk.nodes.Feed
+ properties:
+ feed_name:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_feed_name
+ DCAE-HELLO-WORLD-SUB-MR_topic:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: DCAE-HELLO-WORLD-SUB-MR_topic_name
+ dcae.collectors.vcc.helloworld.pm:
+ type: dcae.nodes.ContainerizedServiceComponentUsingDmaap
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports: []
+ envs:
+ <<: *envs
+ DCAES_DB_NAME:
+ get_input: dcaes_database_name
+ DCAES_DB_ADMIN_HOST:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - host
+ DCAES_DB_ADMIN_USER:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - user
+ DCAES_DB_ADMIN_PASS:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - password
+ DTI_DB_NAME:
+ get_input: dti_database_name
+ DTI_DB_ADMIN_HOST:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - host
+ DTI_DB_ADMIN_USER:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - user
+ DTI_DB_ADMIN_PASS:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - password
+ REPO_DB_NAME:
+ get_input: repo_database_name
+ REPO_DB_ADMIN_HOST:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - host
+ REPO_DB_ADMIN_USER:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - user
+ REPO_DB_ADMIN_PASS:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - password
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes:
+ DCAE-HELLO-WORLD-PUB-DR:
+ dmaap_info: <<DCAE-HELLO-WORLD-PUB-DR_feed>>
+ type: data_router
+ DCAE-HELLO-WORLD-PUB-MR:
+ dmaap_info: <<DCAE-HELLO-WORLD-PUB-MR_topic>>
+ type: message_router
+ pass:
+ get_input: DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_aaf_password
+ user:
+ get_input: DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_aaf_username
+ streams_subscribes:
+ DCAE-HELLO-WORLD-SUB-DR:
+ dmaap_info: <<DCAE-HELLO-WORLD-SUB-DR_feed>>
+ type: data_router
+ DCAE-HELLO-WORLD-SUB-MR:
+ dmaap_info: <<DCAE-HELLO-WORLD-SUB-MR_topic>>
+ type: message_router
+ pass:
+ get_input: DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_aaf_password
+ user:
+ get_input: DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_aaf_username
+ isSelfServeComponent: false
+ service_component_name_override:
+ get_input: service_component_name_override
+ useDtiConfig: false
+ vcc_hello_name:
+ get_input: vcc_hello_name
+ docker_config:
+ healthcheck:
+ interval: 60s
+ timeout: 20s
+ script: /opt/app/vcc/bin/common/HealthCheck_HelloWorld.sh
+ type: docker
+ volumes:
+ - container:
+ bind: /opt/app/dcae-certificate
+ host:
+ path: /opt/app/dcae-certificate
+ - container:
+ bind: /opt/logs/DCAE/dmd/AGENT
+ host:
+ path: /opt/logs/DCAE/helloworldpm/dmd/AGENT
+ - container:
+ bind: /opt/logs/DCAE/dmd/WATCHER
+ host:
+ path: /opt/logs/DCAE/helloworldpm/dmd/WATCHER
+ - container:
+ bind: /opt/app/vcc/logs/DCAE
+ host:
+ path: /opt/logs/DCAE/helloworldpm/vcc-logs
+ - container:
+ bind: /opt/app/vcc/archive/data
+ host:
+ path: /opt/data/DCAE/helloworldpm/vcc-archive
+ image:
+ get_input: tag_version
+ service_component_type: dcae-collectors-vcc-helloworld-pm
+ log_info:
+ log_directory: /opt/app/VESCollector/logs/ecomp
+ replicas:
+ get_input: replicas
+ streams_publishes:
+ - name: DCAE-HELLO-WORLD-PUB-DR_feed
+ location:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_DCAE-HELLO-WORLD-PUB-DR_feed_location
+ type: data_router
+ - name: DCAE-HELLO-WORLD-PUB-MR_topic
+ location:
+ get_input: DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_location
+ client_role:
+ get_input: DCAE-HELLO-WORLD-PUB-MR_DCAE-HELLO-WORLD-PUB-MR_topic_client_role
+ type: message_router
+ streams_subscribes:
+ - name: DCAE-HELLO-WORLD-SUB-MR_topic
+ location:
+ get_input: DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_location
+ client_role:
+ get_input: DCAE-HELLO-WORLD-SUB-MR_DCAE-HELLO-WORLD-SUB-MR_topic_client_role
+ type: message_router
+ - name: DCAE-HELLO-WORLD-SUB-DR_feed
+ location:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_location
+ type: data_router
+ username:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_username
+ password:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_password
+ privileged:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_priviliged
+ decompress:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_DCAE-HELLO-WORLD-SUB-DR_feed_decompress
+ route: /DCAE-HELLO-WORLD-SUB-DR
+ scheme: https
+ tls_info:
+ cert_directory: /opt/app/dh/etc/cert
+ use_tls:
+ get_input: use_tls
+ resource_config:
+ limits:
+ cpu:
+ get_input: dcae.collectors.vcc.helloworld.pm_cpu_limit
+ memory:
+ get_input: dcae.collectors.vcc.helloworld.pm_memory_limit
+ requests:
+ cpu:
+ get_input: dcae.collectors.vcc.helloworld.pm_cpu_request
+ memory:
+ get_input: dcae.collectors.vcc.helloworld.pm_memory_request
+ relationships:
+ - type: ccsdk.relationships.publish_files
+ target: DCAE-HELLO-WORLD-PUB-DR_feed
+ - type: ccsdk.relationships.publish_events
+ target: DCAE-HELLO-WORLD-PUB-MR_topic
+ - type: ccsdk.relationships.subscribe_to_events
+ target: DCAE-HELLO-WORLD-SUB-MR_topic
+ - type: ccsdk.relationships.subscribe_to_files
+ target: DCAE-HELLO-WORLD-SUB-DR_feed
+ - type: cloudify.relationships.depends_on
+ target: tca_policy_00
+ - type: cloudify.relationships.depends_on
+ target: tca_policy_11
+ - type: cloudify.relationships.depends_on
+ target: dcaes_pgaasdb
+ - type: cloudify.relationships.depends_on
+ target: dti_pgaasdb
+ - type: cloudify.relationships.depends_on
+ target: repo_pgaasdb
+ dcaes_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: dcaes_database_writerfqdn
+ name:
+ get_input: dcaes_database_name
+ use_existing: true
+ dti_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: dti_database_writerfqdn
+ name:
+ get_input: dti_database_name
+ use_existing: true
+ repo_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: repo_database_writerfqdn
+ name:
+ get_input: repo_database_name
+ use_existing: true
+ tca_policy_00:
+ type: clamp.nodes.policy
+ properties:
+ policy_id:
+ get_input: tca_policy_00_policy_id
+ policy_model_id: onap.policies.monitoring.cdap.tca.hi.lo.app
+ tca_policy_11:
+ type: clamp.nodes.policy
+ properties:
+ policy_id:
+ get_input: tca_policy_11_policy_id
+ policy_model_id: onap.policies.monitoring.cdap.tca.hi.lo.app \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_without_dmaap_yaml.yaml b/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_without_dmaap_yaml.yaml
new file mode 100644
index 0000000..4e1f5b5
--- /dev/null
+++ b/mod/bpgenerator/TestCases/helloworld/blueprint/helloworld_changed_without_dmaap_yaml.yaml
@@ -0,0 +1,330 @@
+# ============LICENSE_START=======================================================
+# org.onap.dcae
+# ================================================================================
+# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+#description: Hello World mS for subscribing the data from local DMaaP, DR or MR, processing them and publishing them as PM files to local DMaaP DR
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.1/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml
+inputs:
+ DCAE-HELLO-WORLD-PUB-DR_delivery_url:
+ type: string
+ DCAE-HELLO-WORLD-PUB-DR_location:
+ type: string
+ DCAE-HELLO-WORLD-PUB-DR_password:
+ type: string
+ DCAE-HELLO-WORLD-PUB-DR_subscriber_id:
+ type: string
+ DCAE-HELLO-WORLD-PUB-DR_username:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_delivery_url:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_location:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_password:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_subscriber_id:
+ type: string
+ DCAE-HELLO-WORLD-SUB-DR_username:
+ type: string
+ DCAE_HELLO_WORLD_PUB_MR_publish_url:
+ type: string
+ DCAE_HELLO_WORLD_SUB_MR_subscribe_url:
+ type: string
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ dcae.collectors.vcc.helloworld.pm_cpu_limit:
+ type: string
+ default: "250m"
+ dcae.collectors.vcc.helloworld.pm_cpu_request:
+ type: string
+ default: "250m"
+ dcae.collectors.vcc.helloworld.pm_memory_limit:
+ type: string
+ default: "128Mi"
+ dcae.collectors.vcc.helloworld.pm_memory_request:
+ type: string
+ default: "128Mi"
+ dcaes_database_name:
+ type: string
+ description: db name
+ default: ""
+ dcaes_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ dti_database_name:
+ type: string
+ description: db name
+ default: ""
+ dti_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ envs:
+ default: &envs {}
+ image:
+ type: string
+ default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ repo_database_name:
+ type: string
+ description: db name
+ default: ""
+ repo_database_writerfqdn:
+ type: string
+ description: db writerfqdn
+ default: ""
+ service_component_name_override:
+ type: string
+ default: ""
+ tca_policy_00_policy_id:
+ type: string
+ description: policy_id
+ default: ""
+ tca_policy_11_policy_id:
+ type: string
+ description: policy_id
+ default: "tca_policy_id_11"
+ use_tls:
+ type: boolean
+ description: flag to indicate tls enable/disable
+ default: true
+ vcc_hello_name:
+ type: string
+ default: "fsdfa"
+node_templates:
+ dcae.collectors.vcc.helloworld.pm:
+ type: dcae.nodes.ContainerizedPlatformComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports: []
+ envs:
+ <<: *envs
+ DCAES_DB_NAME:
+ get_input: dcaes_database_name
+ DCAES_DB_ADMIN_HOST:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - host
+ DCAES_DB_ADMIN_USER:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - user
+ DCAES_DB_ADMIN_PASS:
+ get_attribute:
+ - dcaes_pgaasdb
+ - admin
+ - password
+ DTI_DB_NAME:
+ get_input: dti_database_name
+ DTI_DB_ADMIN_HOST:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - host
+ DTI_DB_ADMIN_USER:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - user
+ DTI_DB_ADMIN_PASS:
+ get_attribute:
+ - dti_pgaasdb
+ - admin
+ - password
+ REPO_DB_NAME:
+ get_input: repo_database_name
+ REPO_DB_ADMIN_HOST:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - host
+ REPO_DB_ADMIN_USER:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - user
+ REPO_DB_ADMIN_PASS:
+ get_attribute:
+ - repo_pgaasdb
+ - admin
+ - password
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes:
+ DCAE-HELLO-WORLD-PUB-DR:
+ dmaap_info:
+ username:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_username
+ password:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_password
+ location:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_location
+ delivery_url:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_delivery_url
+ subscriber_id:
+ get_input: DCAE-HELLO-WORLD-PUB-DR_subscriber_id
+ type: data_router
+ DCAE-HELLO-WORLD-PUB-MR:
+ dmaap_info:
+ topic_url:
+ get_input: DCAE_HELLO_WORLD_PUB_MR_publish_url
+ type: message_router
+ streams_subscribes:
+ DCAE-HELLO-WORLD-SUB-DR:
+ dmaap_info:
+ username:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_username
+ password:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_password
+ location:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_location
+ delivery_url:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_delivery_url
+ subscriber_id:
+ get_input: DCAE-HELLO-WORLD-SUB-DR_subscriber_id
+ type: data_router
+ DCAE-HELLO-WORLD-SUB-MR:
+ dmaap_info:
+ topic_url:
+ get_input: DCAE_HELLO_WORLD_SUB_MR_subscribe_url
+ type: message_router
+ isSelfServeComponent: false
+ service_component_name_override:
+ get_input: service_component_name_override
+ useDtiConfig: false
+ vcc_hello_name:
+ get_input: vcc_hello_name
+ docker_config:
+ healthcheck:
+ interval: 60s
+ timeout: 20s
+ script: /opt/app/vcc/bin/common/HealthCheck_HelloWorld.sh
+ type: docker
+ volumes:
+ - container:
+ bind: /opt/app/dcae-certificate
+ host:
+ path: /opt/app/dcae-certificate
+ - container:
+ bind: /opt/logs/DCAE/dmd/AGENT
+ host:
+ path: /opt/logs/DCAE/helloworldpm/dmd/AGENT
+ - container:
+ bind: /opt/logs/DCAE/dmd/WATCHER
+ host:
+ path: /opt/logs/DCAE/helloworldpm/dmd/WATCHER
+ - container:
+ bind: /opt/app/vcc/logs/DCAE
+ host:
+ path: /opt/logs/DCAE/helloworldpm/vcc-logs
+ - container:
+ bind: /opt/app/vcc/archive/data
+ host:
+ path: /opt/data/DCAE/helloworldpm/vcc-archive
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ log_info:
+ log_directory: /opt/app/VESCollector/logs/ecomp
+ dns_name: dcae.collectors.vcc.helloworld.pm
+ replicas:
+ get_input: replicas
+ name: dcae.collectors.vcc.helloworld.pm
+ tls_info:
+ cert_directory: /opt/app/dh/etc/cert
+ use_tls:
+ get_input: use_tls
+ resource_config:
+ limits:
+ cpu:
+ get_input: dcae.collectors.vcc.helloworld.pm_cpu_limit
+ memory:
+ get_input: dcae.collectors.vcc.helloworld.pm_memory_limit
+ requests:
+ cpu:
+ get_input: dcae.collectors.vcc.helloworld.pm_cpu_request
+ memory:
+ get_input: dcae.collectors.vcc.helloworld.pm_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships:
+ - type: cloudify.relationships.depends_on
+ target: tca_policy_00
+ - type: cloudify.relationships.depends_on
+ target: tca_policy_11
+ - type: cloudify.relationships.depends_on
+ target: dcaes_pgaasdb
+ - type: cloudify.relationships.depends_on
+ target: dti_pgaasdb
+ - type: cloudify.relationships.depends_on
+ target: repo_pgaasdb
+ dcaes_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: dcaes_database_writerfqdn
+ name:
+ get_input: dcaes_database_name
+ use_existing: true
+ dti_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: dti_database_writerfqdn
+ name:
+ get_input: dti_database_name
+ use_existing: true
+ repo_pgaasdb:
+ type: dcae.nodes.pgaas.database
+ properties:
+ writerfqdn:
+ get_input: repo_database_writerfqdn
+ name:
+ get_input: repo_database_name
+ use_existing: true
+ tca_policy_00:
+ type: clamp.nodes.policy
+ properties:
+ policy_id:
+ get_input: tca_policy_00_policy_id
+ policy_model_id: onap.policies.monitoring.cdap.tca.hi.lo.app
+ tca_policy_11:
+ type: clamp.nodes.policy
+ properties:
+ policy_id:
+ get_input: tca_policy_11_policy_id
+ policy_model_id: onap.policies.monitoring.cdap.tca.hi.lo.app \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/helloworld/compspec/hello-changed.json b/mod/bpgenerator/TestCases/helloworld/compspec/hello-changed.json
new file mode 100644
index 0000000..24d8491
--- /dev/null
+++ b/mod/bpgenerator/TestCases/helloworld/compspec/hello-changed.json
@@ -0,0 +1,154 @@
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Hello World mS for subscribing the data from local DMaaP, DR or MR, processing them and publishing them as PM files to local DMaaP DR",
+ "name": "dcae.collectors.vcc.helloworld.pm",
+ "version": "1.0.1"
+ },
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+ "streams": {
+ "publishes": [{
+ "config_key": "DCAE-HELLO-WORLD-PUB-DR",
+ "format": "dataformat_Hello_World_PM",
+ "type": "data_router",
+ "version": "1.0.0"
+ },
+ {
+ "config_key": "DCAE-HELLO-WORLD-PUB-MR",
+ "format": "dataformat_Hello_World_PM",
+ "type": "message_router",
+ "version": "1.0.0"
+ }
+ ],
+ "subscribes": [{
+ "config_key": "DCAE-HELLO-WORLD-SUB-MR",
+ "format": "dataformat_Hello_World_PM",
+ "route": "/DCAE_HELLO_WORLD_SUB_MR",
+ "type": "message_router",
+ "version": "1.0.0"
+ },
+ {
+ "config_key": "DCAE-HELLO-WORLD-SUB-DR",
+ "format": "dataformat_Hello_World_PM",
+ "route": "/DCAE-HELLO-WORLD-SUB-DR",
+ "type": "data_router",
+ "version": "1.0.0"
+ }
+ ]
+ },
+ "parameters":
+ [
+ {
+ "name": "vcc_hello_name",
+ "value": "fsdfa",
+ "description": "the name entered for specific person",
+ "sourced_at_deployment": true,
+ "designer_editable": true,
+ "policy_editable": false,
+ "type": "string"
+ },
+
+ {
+ "name": "useDtiConfig",
+ "value": false,
+ "description": "component depends on configuration from dti.",
+ "sourced_at_deployment": false,
+ "designer_editable": false,
+ "policy_editable": false,
+ "required" : true
+ },
+
+ {
+ "name": "isSelfServeComponent",
+ "value": false,
+ "description": "Is this used as self serve component.",
+ "sourced_at_deployment": false,
+ "designer_editable": false,
+ "policy_editable": false,
+ "required" : true,
+ "type": "string"
+ }
+ ],
+ "auxilary": {
+ "healthcheck": {
+ "interval": "60s",
+ "timeout": "20s",
+ "script": "/opt/app/vcc/bin/common/HealthCheck_HelloWorld.sh",
+ "type": "docker"
+ },
+ "log_info": {
+ "log_directory": "/opt/app/VESCollector/logs/ecomp"
+ },
+ "tls_info":{
+ "cert_directory":"/opt/app/dh/etc/cert",
+ "use_tls":true
+ },
+ "databases": {
+ "dcaes": "PgaaS",
+ "repo": "PgaaS",
+ "dti": "pgaas"
+ },
+ "volumes": [
+ {
+ "container": {
+ "bind": "/opt/app/dcae-certificate"
+ },
+ "host": {
+ "path": "/opt/app/dcae-certificate"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/logs/DCAE/dmd/AGENT"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/helloworldpm/dmd/AGENT"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/logs/DCAE/dmd/WATCHER"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/helloworldpm/dmd/WATCHER"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/vcc/logs/DCAE"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/helloworldpm/vcc-logs"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/vcc/archive/data"
+ },
+ "host": {
+ "path": "/opt/data/DCAE/helloworldpm/vcc-archive"
+ }
+ }
+ ]
+ },
+ "policy_info":{
+ "policy":[
+ {
+ "node_label":"tca_policy_00",
+ "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app"
+ },
+ {
+ "node_label":"tca_policy_11",
+ "policy_id":"tca_policy_id_11",
+ "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app"
+ }
+ ]
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ }]
+} \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/ves/blueprints/ves-no-change_yaml.yaml b/mod/bpgenerator/TestCases/ves/blueprints/ves-no-change_yaml.yaml
new file mode 100644
index 0000000..b93f9c1
--- /dev/null
+++ b/mod/bpgenerator/TestCases/ves/blueprints/ves-no-change_yaml.yaml
@@ -0,0 +1,187 @@
+# ============LICENSE_START=======================================================
+# org.onap.dcae
+# ================================================================================
+# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+#
+#description: Collector for receiving VES events through restful interface
+#blueprint_version: 1.5.0
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.1/k8splugin_types.yaml
+inputs:
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ collector.dmaap.streamid:
+ type: string
+ default: "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary|notification=ves-notification,ves-notification-secondary|pnfRegistration=ves-pnfRegistration,ves-pnfRegistration-secondary"
+ dcae-ves-collector_cpu_limit:
+ type: string
+ default: "250m"
+ dcae-ves-collector_cpu_request:
+ type: string
+ default: "250m"
+ dcae-ves-collector_memory_limit:
+ type: string
+ default: "128Mi"
+ dcae-ves-collector_memory_request:
+ type: string
+ default: "128Mi"
+ envs:
+ default: {}
+ external_port_0:
+ type: string
+ default: "8080"
+ external_port_1:
+ type: string
+ default: "8443"
+ header.authlist:
+ type: string
+ default: "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy"
+ image:
+ type: string
+ default: "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ ves_fault_publish_url:
+ type: string
+ ves_heartbeat_secondary_publish_url:
+ type: string
+ ves_measurement_publish_url:
+ type: string
+ ves_notification_publish_url:
+ type: string
+ ves_other_publish_url:
+ type: string
+ ves_pnfRegistration_publish_url:
+ type: string
+node_templates:
+ dcae-ves-collector:
+ type: dcae.nodes.ContainerizedPlatformComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["8080:", {get_input: external_port_0}]
+ - concat: ["8443:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes:
+ ves-fault:
+ dmaap_info:
+ topic_url:
+ get_input: ves_fault_publish_url
+ type: message router
+ ves-heartbeat-secondary:
+ dmaap_info:
+ topic_url:
+ get_input: ves_heartbeat_secondary_publish_url
+ type: message router
+ ves-measurement:
+ dmaap_info:
+ topic_url:
+ get_input: ves_measurement_publish_url
+ type: message router
+ ves-notification:
+ dmaap_info:
+ topic_url:
+ get_input: ves_notification_publish_url
+ type: message router
+ ves-other:
+ dmaap_info:
+ topic_url:
+ get_input: ves_other_publish_url
+ type: message router
+ ves-pnfRegistration:
+ dmaap_info:
+ topic_url:
+ get_input: ves_pnfRegistration_publish_url
+ type: message router
+ streams_subscribes: {}
+ auth.method: noAuth
+ collector.dmaap.streamid:
+ get_input: collector.dmaap.streamid
+ collector.keystore.file.location: /opt/app/dcae-certificate/keystore.jks
+ collector.keystore.passwordfile: /opt/app/dcae-certificate/.password
+ collector.schema.checkflag: 1
+ collector.schema.file: {"v1":"./etc/CommonEventFormat_27.2.json","v2":"./etc/CommonEventFormat_27.2.json","v3":"./etc/CommonEventFormat_27.2.json","v4":"./etc/CommonEventFormat_27.2.json","v5":"./etc/CommonEventFormat_28.4.1.json","v7":"./etc/CommonEventFormat_30.json"}
+ collector.service.port: 8080
+ collector.service.secure.port: 8443
+ collector.truststore.file.location: /opt/app/dcae-certificate/truststore.jks
+ collector.truststore.passwordfile: /opt/app/dcae-certificate/.trustpassword
+ event.transform.flag: 1
+ header.authlist:
+ get_input: header.authlist
+ service_component_name_override:
+ get_input: service_component_name_override
+ tomcat.maxthreads: 200
+ docker_config:
+ healthcheck:
+ interval: 15s
+ timeout: 1s
+ type: https
+ endpoint: /healthcheck
+ volumes:
+ - container:
+ bind: /opt/app/dcae-certificate
+ host:
+ path: /opt/app/dcae-certificate
+ - container:
+ bind: /opt/app/VESCollector/logs
+ host:
+ path: /opt/logs/DCAE/VESCollector/logs
+ - container:
+ bind: /opt/app/VESCollector/etc
+ host:
+ path: /opt/logs/DCAE/VESCollector/etc
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ dns_name: dcae-ves-collector
+ replicas:
+ get_input: replicas
+ name: dcae-ves-collector
+ resource_config:
+ limits:
+ cpu:
+ get_input: dcae-ves-collector_cpu_limit
+ memory:
+ get_input: dcae-ves-collector_memory_limit
+ requests:
+ cpu:
+ get_input: dcae-ves-collector_cpu_request
+ memory:
+ get_input: dcae-ves-collector_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships: [] \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/ves/blueprints/ves-with-dmaap_yaml.yaml b/mod/bpgenerator/TestCases/ves/blueprints/ves-with-dmaap_yaml.yaml
new file mode 100644
index 0000000..915411e
--- /dev/null
+++ b/mod/bpgenerator/TestCases/ves/blueprints/ves-with-dmaap_yaml.yaml
@@ -0,0 +1,314 @@
+# ============LICENSE_START=======================================================
+# org.onap.dcae
+# ================================================================================
+# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#description: Collector for receiving VES events through restful interface
+#blueprint_version: 1.5.0
+---
+tosca_definitions_version: cloudify_dsl_1_3
+description: Collector for receiving VES events through restful interface
+imports:
+- https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.1/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml
+inputs:
+ collector.dmaap.streamid:
+ type: string
+ default: "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary|notification=ves-notification,ves-notification-secondary|pnfRegistration=ves-pnfRegistration,ves-pnfRegistration-secondary"
+ dcae-ves-collector_cpu_limit:
+ type: string
+ default: "250m"
+ dcae-ves-collector_cpu_request:
+ type: string
+ default: "250m"
+ dcae-ves-collector_memory_limit:
+ type: string
+ default: "128Mi"
+ dcae-ves-collector_memory_request:
+ type: string
+ default: "128Mi"
+ envs:
+ default: {}
+ external_port_0:
+ type: string
+ default: "8080"
+ external_port_1:
+ type: string
+ default: "8443"
+ header.authlist:
+ type: string
+ default: "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy"
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ tag_version:
+ type: string
+ default: "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ topic0_name:
+ type: string
+ topic1_name:
+ type: string
+ topic2_name:
+ type: string
+ topic3_name:
+ type: string
+ topic4_name:
+ type: string
+ topic5_name:
+ type: string
+ ves-fault_topic0_aaf_password:
+ type: string
+ ves-fault_topic0_aaf_username:
+ type: string
+ ves-fault_topic0_client_role:
+ type: string
+ ves-fault_topic0_location:
+ type: string
+ ves-heartbeat-secondary_topic3_aaf_password:
+ type: string
+ ves-heartbeat-secondary_topic3_aaf_username:
+ type: string
+ ves-heartbeat-secondary_topic3_client_role:
+ type: string
+ ves-heartbeat-secondary_topic3_location:
+ type: string
+ ves-measurement_topic1_aaf_password:
+ type: string
+ ves-measurement_topic1_aaf_username:
+ type: string
+ ves-measurement_topic1_client_role:
+ type: string
+ ves-measurement_topic1_location:
+ type: string
+ ves-notification_topic5_aaf_password:
+ type: string
+ ves-notification_topic5_aaf_username:
+ type: string
+ ves-notification_topic5_client_role:
+ type: string
+ ves-notification_topic5_location:
+ type: string
+ ves-other_topic2_aaf_password:
+ type: string
+ ves-other_topic2_aaf_username:
+ type: string
+ ves-other_topic2_client_role:
+ type: string
+ ves-other_topic2_location:
+ type: string
+ ves-pnfRegistration_topic4_aaf_password:
+ type: string
+ ves-pnfRegistration_topic4_aaf_username:
+ type: string
+ ves-pnfRegistration_topic4_client_role:
+ type: string
+ ves-pnfRegistration_topic4_location:
+ type: string
+node_templates:
+ dcae-ves-collector:
+ type: dcae.nodes.ContainerizedServiceComponentUsingDmaap
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["8080:", {get_input: external_port_0}]
+ - concat: ["8443:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes:
+ ves-fault:
+ dmaap_info: <<topic0>>
+ type: message router
+ pass:
+ get_input: ves-fault_topic0_aaf_password
+ user:
+ get_input: ves-fault_topic0_aaf_username
+ ves-heartbeat-secondary:
+ dmaap_info: <<topic3>>
+ type: message router
+ pass:
+ get_input: ves-heartbeat-secondary_topic3_aaf_password
+ user:
+ get_input: ves-heartbeat-secondary_topic3_aaf_username
+ ves-measurement:
+ dmaap_info: <<topic1>>
+ type: message router
+ pass:
+ get_input: ves-measurement_topic1_aaf_password
+ user:
+ get_input: ves-measurement_topic1_aaf_username
+ ves-notification:
+ dmaap_info: <<topic5>>
+ type: message router
+ pass:
+ get_input: ves-notification_topic5_aaf_password
+ user:
+ get_input: ves-notification_topic5_aaf_username
+ ves-other:
+ dmaap_info: <<topic2>>
+ type: message router
+ pass:
+ get_input: ves-other_topic2_aaf_password
+ user:
+ get_input: ves-other_topic2_aaf_username
+ ves-pnfRegistration:
+ dmaap_info: <<topic4>>
+ type: message router
+ pass:
+ get_input: ves-pnfRegistration_topic4_aaf_password
+ user:
+ get_input: ves-pnfRegistration_topic4_aaf_username
+ streams_subscribes: {}
+ auth.method: noAuth
+ collector.dmaap.streamid:
+ get_input: collector.dmaap.streamid
+ collector.keystore.file.location: /opt/app/dcae-certificate/keystore.jks
+ collector.keystore.passwordfile: /opt/app/dcae-certificate/.password
+ collector.schema.checkflag: 1
+ collector.schema.file: {"v1":"./etc/CommonEventFormat_27.2.json","v2":"./etc/CommonEventFormat_27.2.json","v3":"./etc/CommonEventFormat_27.2.json","v4":"./etc/CommonEventFormat_27.2.json","v5":"./etc/CommonEventFormat_28.4.1.json","v7":"./etc/CommonEventFormat_30.json"}
+ collector.service.port: 8080
+ collector.service.secure.port: 8443
+ collector.truststore.file.location: /opt/app/dcae-certificate/truststore.jks
+ collector.truststore.passwordfile: /opt/app/dcae-certificate/.trustpassword
+ event.transform.flag: 1
+ header.authlist:
+ get_input: header.authlist
+ service_component_name_override:
+ get_input: service_component_name_override
+ tomcat.maxthreads: 200
+ docker_config:
+ healthcheck:
+ interval: 15s
+ timeout: 1s
+ type: http
+ endpoint: /healthcheck
+ volumes:
+ - container:
+ bind: /opt/app/dcae-certificate
+ host:
+ path: /opt/app/dcae-certificate
+ - container:
+ bind: /opt/app/VESCollector/logs
+ host:
+ path: /opt/logs/DCAE/VESCollector/logs
+ - container:
+ bind: /opt/app/VESCollector/etc
+ host:
+ path: /opt/logs/DCAE/VESCollector/etc
+ image:
+ get_input: tag_version
+ service_component_type: dcae-ves-collector
+ replicas:
+ get_input: replicas
+ streams_publishes:
+ - name: topic0
+ location:
+ get_input: ves-fault_topic0_location
+ client_role:
+ get_input: ves-fault_topic0_client_role
+ type: message router
+ - name: topic1
+ location:
+ get_input: ves-measurement_topic1_location
+ client_role:
+ get_input: ves-measurement_topic1_client_role
+ type: message router
+ - name: topic2
+ location:
+ get_input: ves-other_topic2_location
+ client_role:
+ get_input: ves-other_topic2_client_role
+ type: message router
+ - name: topic3
+ location:
+ get_input: ves-heartbeat-secondary_topic3_location
+ client_role:
+ get_input: ves-heartbeat-secondary_topic3_client_role
+ type: message router
+ - name: topic4
+ location:
+ get_input: ves-pnfRegistration_topic4_location
+ client_role:
+ get_input: ves-pnfRegistration_topic4_client_role
+ type: message router
+ - name: topic5
+ location:
+ get_input: ves-notification_topic5_location
+ client_role:
+ get_input: ves-notification_topic5_client_role
+ type: message router
+ resource_config:
+ limits:
+ cpu:
+ get_input: dcae-ves-collector_cpu_limit
+ memory:
+ get_input: dcae-ves-collector_memory_limit
+ requests:
+ cpu:
+ get_input: dcae-ves-collector_cpu_request
+ memory:
+ get_input: dcae-ves-collector_memory_request
+ relationships:
+ - type: ccsdk.relationships.publish_events
+ target: topic0
+ - type: ccsdk.relationships.publish_events
+ target: topic1
+ - type: ccsdk.relationships.publish_events
+ target: topic2
+ - type: ccsdk.relationships.publish_events
+ target: topic3
+ - type: ccsdk.relationships.publish_events
+ target: topic4
+ - type: ccsdk.relationships.publish_events
+ target: topic5
+ topic0:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic0_name
+ topic1:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic1_name
+ topic2:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic2_name
+ topic3:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic3_name
+ topic4:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic4_name
+ topic5:
+ type: ccsdk.nodes.Topic
+ properties:
+ topic_name:
+ get_input: topic5_name \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/ves/componentSpecs/ves.json b/mod/bpgenerator/TestCases/ves/componentSpecs/ves.json
new file mode 100644
index 0000000..6812347
--- /dev/null
+++ b/mod/bpgenerator/TestCases/ves/componentSpecs/ves.json
@@ -0,0 +1,276 @@
+{
+ "self": {
+ "version": "1.5.0",
+ "name": "dcae-ves-collector",
+ "description": "Collector for receiving VES events through restful interface",
+ "component_type": "docker"
+ },
+ "streams": {
+ "subscribes": [],
+ "publishes": [
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-fault"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-measurement"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-other"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-heartbeat-secondary"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.0",
+ "type": "message router",
+ "config_key": "ves-pnfRegistration"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.0",
+ "type": "message router",
+ "config_key": "ves-notification"
+ }
+ ]
+ },
+ "services": {
+ "calls": [],
+ "provides": [
+ {
+ "route": "/eventListener/v1",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v2",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v3",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v4",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v5",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "5.28.4"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v7",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "7.30.0"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ }
+ ]
+ },
+ "parameters": [
+ {
+ "name": "collector.service.port",
+ "value": 8080,
+ "description": "standard http port collector will open for listening;",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.service.secure.port",
+ "value": 8443,
+ "description": "secure http port collector will open for listening ",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": true
+ },
+ {
+ "name": "collector.keystore.file.location",
+ "value": "/opt/app/dcae-certificate/keystore.jks",
+ "description": "fs location of keystore file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.keystore.passwordfile",
+ "value": "/opt/app/dcae-certificate/.password",
+ "description": "location of keystore password file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.truststore.file.location",
+ "value": "/opt/app/dcae-certificate/truststore.jks",
+ "description": "fs location of truststore file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.truststore.passwordfile",
+ "value": "/opt/app/dcae-certificate/.trustpassword",
+ "description": "location of truststore password file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.dmaap.streamid",
+ "value": "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary|notification=ves-notification,ves-notification-secondary|pnfRegistration=ves-pnfRegistration,ves-pnfRegistration-secondary",
+ "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed",
+ "sourced_at_deployment": true,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "auth.method",
+ "value": "noAuth",
+ "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "header.authlist",
+ "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy",
+ "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here",
+ "policy_editable": false,
+ "sourced_at_deployment": true,
+ "designer_editable": true
+ },
+ {
+ "name": "collector.schema.checkflag",
+ "value": 1,
+ "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.schema.file",
+ "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.json\"}",
+ "description": "VES schema file name per version used for validation",
+ "designer_editable": true,
+ "sourced_at_deployment": false,
+ "policy_editable": false
+ },
+ {
+ "name": "event.transform.flag",
+ "value": 1,
+ "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "tomcat.maxthreads",
+ "value": "200",
+ "description": "Tomcat control for concurrent request",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ }
+ ],
+ "auxilary": {
+ "healthcheck": {
+ "type": "http",
+ "interval": "15s",
+ "timeout": "1s",
+ "endpoint": "/healthcheck"
+ },
+ "volumes": [
+ {
+ "container": {
+ "bind": "/opt/app/dcae-certificate"
+ },
+ "host": {
+ "path": "/opt/app/dcae-certificate"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/VESCollector/logs"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/VESCollector/logs"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/VESCollector/etc"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/VESCollector/etc"
+ }
+ }
+ ],
+ "ports": [
+ "8080:8080",
+ "8443:8443"
+ ]
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ }
+ ]
+} \ No newline at end of file
diff --git a/mod/bpgenerator/TestCases/ves/inputFiles/ves_nodmaap.json b/mod/bpgenerator/TestCases/ves/inputFiles/ves_nodmaap.json
new file mode 100644
index 0000000..720ce5f
--- /dev/null
+++ b/mod/bpgenerator/TestCases/ves/inputFiles/ves_nodmaap.json
@@ -0,0 +1,11 @@
+{
+ "ves_other_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_OTHER_OUTPUT",
+ "ves_heartbeat_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_HEARTBEAT_OUTPUT",
+ "ves_fault_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_FAULT_OUTPUT",
+ "ves_measurement_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT",
+ "ves_notification_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT",
+ "ves_pnfRegistration_publish_url":"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.VES_PNFREG_OUTPUT",
+ "external_port_0":"30235",
+ "external_port_1": "30417",
+ "image": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1"
+} \ No newline at end of file
diff --git a/mod/bpgenerator/pom.xml b/mod/bpgenerator/pom.xml
index d63b9c9..e1a50b4 100644
--- a/mod/bpgenerator/pom.xml
+++ b/mod/bpgenerator/pom.xml
@@ -23,13 +23,13 @@
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.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>2.0.0</version>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>2.0.0</version>
</parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator</artifactId>
- <version>1.2.1-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/Fixes.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/Fixes.java
index cbff42b..3a4b457 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/Fixes.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/Fixes.java
@@ -29,6 +29,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.List;
public class Fixes {
private static ArrayList<String> lines = new ArrayList<String>();
@@ -40,6 +41,7 @@ public class Fixes {
FileReader fr = new FileReader(translateFile);
BufferedReader br = new BufferedReader(fr);
while((line = br.readLine()) != null) {
+// lines.add(ensureNoSingleQuotes(line));
if(line.contains("'")) {
line = line.replace("'", "");
}
@@ -67,4 +69,36 @@ public class Fixes {
throw new RuntimeException(e);
}
}
+
+ /**
+ * Remove single quotes from a line from a blueprint
+ */
+ private static String ensureNoSingleQuotes(String line) {
+ // TODO: Should probably use regex instead
+ // REVIEW: The condition under which to remove the single quotes
+ if ((line.contains("concat") || line.contains("default: ")) && line.contains("'")) {
+ return line.replace("'", "");
+ } else {
+ return line;
+ }
+ }
+
+ /**
+ * Takes in an entire blueprint (YAML) in a string buffer and post processes it to apply
+ * "fixes" like removing unwanted single quotes.
+ */
+ public static String applyFixes(String bp) {
+ List<String> lines = new ArrayList<String>();
+
+ String[] linesPre = bp.split("\n");
+ System.out.println(String.format("To post-processing #lines: %d", linesPre.length));
+
+ for (String line : linesPre) {
+ lines.add(ensureNoSingleQuotes(line));
+ }
+
+ return String.join("\n", lines);
+ }
+
+
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java
new file mode 100644
index 0000000..a22d588
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java
@@ -0,0 +1,130 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.core;
+
+import org.onap.blueprintgenerator.exception.DatabasesNotFoundException;
+import org.onap.blueprintgenerator.models.GetAttribute;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+import org.onap.blueprintgenerator.models.blueprint.Node;
+import org.onap.blueprintgenerator.models.blueprint.pgaas.PgaasNode;
+import org.onap.blueprintgenerator.models.blueprint.pgaas.PgaasNodeProperties;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+
+import java.util.*;
+
+public class PgaasNodeBuilder {
+
+ private static final String PGAAS_NODE_TYPE = "dcae.nodes.pgaas.database";
+ private static final String PGAAS_NODE_NAME_POSTFIX = "_pgaasdb";
+ private static final String WRITER_FQDN_POSTFIX = "_database_writerfqdn";
+ private static final String NAME_POSTFIX = "_database_name";
+ private static final boolean USE_EXISTING = true;
+ private static final String DB_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on";
+
+
+
+ public static void addPgaasNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ TreeMap<String, String> databases = cs.getAuxilary().getDatabases();
+ if(databases == null){
+ throw new DatabasesNotFoundException("databases section not found in componentspec");
+ }
+ for(Map.Entry<String, String> database : databases.entrySet()){
+ addPgaasNode(database, nodeTemplate);
+ addPgaasInputs(database, inps);
+ }
+ }
+
+ private static void addPgaasInputs(Map.Entry<String, String> database, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ inps.put(database.getKey() + NAME_POSTFIX, getInputValue("string", "db name", ""));
+ inps.put(database.getKey() + WRITER_FQDN_POSTFIX, getInputValue("string", "db writerfqdn", ""));
+ }
+
+ private static LinkedHashMap<String, Object> getInputValue(String type, String description, Object defaultValue) {
+ LinkedHashMap<String, Object> inputValueMap = new LinkedHashMap();
+ inputValueMap.put("type", type);
+ inputValueMap.put("description", description);
+ inputValueMap.put("default", defaultValue);
+ return inputValueMap;
+ }
+
+ private static void addPgaasNode(Map.Entry<String, String> database, TreeMap<String, Node> nodeTemplate) {
+ PgaasNode pgaasNode = new PgaasNode();
+ String dbName = database.getKey();
+ pgaasNode.setType(PGAAS_NODE_TYPE);
+ pgaasNode.setPgaasNodeProperties(buildPgaasNodeProperties(dbName));
+ nodeTemplate.put(dbName + PGAAS_NODE_NAME_POSTFIX , pgaasNode);
+ }
+
+ private static PgaasNodeProperties buildPgaasNodeProperties(String dbName) {
+ PgaasNodeProperties pgaasNodeProperties = new PgaasNodeProperties();
+
+ GetInput nameValue = new GetInput();
+ nameValue.setGet_input(dbName + NAME_POSTFIX);
+ pgaasNodeProperties.setName(nameValue);
+
+ GetInput writerfqdnValue = new GetInput();
+ writerfqdnValue.setGet_input(dbName + WRITER_FQDN_POSTFIX);
+ pgaasNodeProperties.setWriterfqdn(writerfqdnValue);
+
+ pgaasNodeProperties.setUseExisting(USE_EXISTING);
+
+ return pgaasNodeProperties;
+ }
+
+ public static ArrayList<LinkedHashMap<String, String>> getPgaasNodeRelationships(ComponentSpec cs) {
+ ArrayList<LinkedHashMap<String, String>> relationships = new ArrayList<>();
+ for(Map.Entry<String, String> database : cs.getAuxilary().getDatabases().entrySet()){
+ LinkedHashMap<String, String> relationship = new LinkedHashMap<>();
+ relationship.put("type", DB_RELATIONSHIP_TYPE);
+ relationship.put("target", database.getKey() + PGAAS_NODE_NAME_POSTFIX);
+ relationships.add(relationship);
+ }
+ return relationships;
+ }
+
+ public static LinkedHashMap<String, Object> getEnvVariables(TreeMap<String, String> databases) {
+ LinkedHashMap<String, Object> envVariables = new LinkedHashMap<String, Object>();
+ for(Map.Entry<String, String> database : databases.entrySet()){
+ String name = database.getKey().toUpperCase();
+
+ envVariables.put("<<", "*envs");
+
+ GetInput nameValue = new GetInput();
+ nameValue.setGet_input(name.toLowerCase() + NAME_POSTFIX);
+ envVariables.put(name + "_DB_NAME", nameValue);
+
+ GetAttribute adminHostValue = buildGetAttributeValue(name.toLowerCase(), "admin", "host");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
+
+ GetAttribute adminUserValue = buildGetAttributeValue(name.toLowerCase(), "admin", "user");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
+
+ GetAttribute adminPasswordValue = buildGetAttributeValue(name.toLowerCase(), "admin", "password");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
+ }
+ return envVariables;
+ }
+
+ private static GetAttribute buildGetAttributeValue(String dbName, String owner, String type) {
+ GetAttribute attribute = new GetAttribute();
+ attribute.setAttribute(Arrays.asList(dbName + PGAAS_NODE_NAME_POSTFIX, owner, type));
+ return attribute;
+ }
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java
new file mode 100644
index 0000000..a947ab7
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java
@@ -0,0 +1,90 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.core;
+
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+import org.onap.blueprintgenerator.models.blueprint.Node;
+import org.onap.blueprintgenerator.models.blueprint.policy.PolicyNode;
+import org.onap.blueprintgenerator.models.blueprint.policy.PolicyNodeProperties;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+import org.onap.blueprintgenerator.models.componentspec.policy_info.TypePolicy;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.TreeMap;
+
+public class PolicyNodeBuilder {
+
+ private static final String POLICY_NODE_TYPE = "clamp.nodes.policy";
+ private static final String POLICY_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on";
+
+ public static void addPolicyNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ List<TypePolicy> policyList = cs.getPolicyInfo().getTypePolicyList();
+ for(TypePolicy policy: policyList){
+ addPolicyNodesToNodeTemplate(policy, nodeTemplate);
+ addPolicyInputs(policy, inps);
+ }
+ }
+
+ private static void addPolicyInputs(TypePolicy policy, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ String defaultValue = policy.getPolicy_id() != null ? policy.getPolicy_id() : "";
+ inps.put(policy.getNode_label() + "_policy_id", getInputValue("string", "policy_id", defaultValue));
+ }
+
+ private static LinkedHashMap<String, Object> getInputValue(String type, String description, Object defaultValue) {
+ LinkedHashMap<String, Object> inputValueMap = new LinkedHashMap();
+ inputValueMap.put("type", type);
+ inputValueMap.put("description", description);
+ inputValueMap.put("default", defaultValue);
+ return inputValueMap;
+ }
+
+ private static void addPolicyNodesToNodeTemplate(TypePolicy policy, TreeMap<String, Node> nodeTemplate) {
+ PolicyNode policyNode = new PolicyNode();
+ policyNode.setType(POLICY_NODE_TYPE);
+ policyNode.setPolicyNodeProperties(getPolicyNodeProperties(policy));
+ nodeTemplate.put(policy.getNode_label(), policyNode);
+ }
+
+ private static PolicyNodeProperties getPolicyNodeProperties(TypePolicy policy) {
+ PolicyNodeProperties policyNodeProperties = new PolicyNodeProperties();
+
+ GetInput policyIdGetInput = new GetInput();
+ policyIdGetInput.setGet_input(policy.getNode_label() + "_policy_id");
+ policyNodeProperties.setPolicyId(policyIdGetInput);
+
+ policyNodeProperties.setPolicyModelId(policy.getPolicy_model_id());
+
+ return policyNodeProperties;
+ }
+
+ public static ArrayList<LinkedHashMap<String, String>> getPolicyRelationships(ComponentSpec cs) {
+ ArrayList<LinkedHashMap<String, String>> relationships = new ArrayList<>();
+ List<TypePolicy> policyList = cs.getPolicyInfo().getTypePolicyList();
+ for(TypePolicy policy: policyList){
+ LinkedHashMap<String, String> relationship = new LinkedHashMap<>();
+ relationship.put("type", POLICY_RELATIONSHIP_TYPE);
+ relationship.put("target", policy.getNode_label());
+ relationships.add(relationship);
+ }
+ return relationships;
+ }
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java
new file mode 100644
index 0000000..c9b2149
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java
@@ -0,0 +1,24 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.exception;
+
+public class DatabasesNotFoundException extends RuntimeException {
+ public DatabasesNotFoundException(String message) { super(message);}
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/GetAttribute.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/GetAttribute.java
new file mode 100644
index 0000000..56184ff
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/GetAttribute.java
@@ -0,0 +1,34 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class GetAttribute {
+
+ @JsonProperty("get_attribute")
+ private Object attribute;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
index 6d5b7d7..04745dc 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
@@ -48,7 +48,8 @@ public class Appconfig {
return params;
}
- public TreeMap<String, LinkedHashMap<String, Object>> createAppconfig(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
+ public TreeMap<String, LinkedHashMap<String, Object>> createAppconfig(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override,
+ boolean isDmaap) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
retInputs = inps;
@@ -58,26 +59,24 @@ public class Appconfig {
//set the stream publishes
TreeMap<String, DmaapObj> streamPublishes = new TreeMap<String, DmaapObj>();
- int counter = 0;
if(cs.getStreams().getPublishes().length != 0) {
for(Publishes p: cs.getStreams().getPublishes()) {
if(p.getType().equals("data_router") || p.getType().equals("data router")) {
//in this case the data router information gets added to the params so for now leave it alone
String config = p.getConfig_key();
DmaapObj pub = new DmaapObj();
- String name = "feed" + counter;
- retInputs = pub.createOnapDmaapDRObj(retInputs, config, 'p', "feed" + counter, name);
+ String name = p.getConfig_key() +"_feed";
+ retInputs = pub.createOnapDmaapDRObj(retInputs, config, 'p', name, name, isDmaap);
pub.setType(p.getType());
streamPublishes.put(config, pub);
} else if(p.getType().equals("message_router") || p.getType().equals("message router")) {
String config = p.getConfig_key();
DmaapObj pub = new DmaapObj();
- String name = "topic" + counter;
- retInputs = pub.createOnapDmaapMRObj(retInputs, config, 'p', "topic" + counter, name);
+ String name = p.getConfig_key() + "_topic";
+ retInputs = pub.createOnapDmaapMRObj(retInputs, config, 'p', name, name, isDmaap);
pub.setType(p.getType());
streamPublishes.put(config, pub);
}
- counter++;
}
}
@@ -90,19 +89,18 @@ public class Appconfig {
//in this case the data router information gets added to the params so for now leave it alone
String config = s.getConfig_key();
DmaapObj sub = new DmaapObj();
- String name = "feed" + counter;
- retInputs = sub.createOnapDmaapDRObj(retInputs, config, 'p', "feed" + counter, name);
+ String name = s.getConfig_key() + "_feed";
+ retInputs = sub.createOnapDmaapDRObj(retInputs, config, 'p', name, name, isDmaap);
sub.setType(s.getType());
streamSubscribes.put(config, sub);
} else if(s.getType().equals("message_router") || s.getType().equals("message router")) {
String config = s.getConfig_key();
DmaapObj sub = new DmaapObj();
- String name = "topic" + counter;
- retInputs = sub.createOnapDmaapMRObj(retInputs, config, 's', "topic" + counter, name);
+ String name = s.getConfig_key() + "_topic";
+ retInputs = sub.createOnapDmaapMRObj(retInputs, config, 's', name, name, isDmaap);
sub.setType(s.getType());
streamSubscribes.put(config, sub);
}
- counter++;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
index 06c42c5..75c79ba 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
@@ -20,11 +20,7 @@
package org.onap.blueprintgenerator.models.blueprint;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
+import java.io.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
@@ -50,7 +46,7 @@ import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-
+import org.yaml.snakeyaml.Yaml;
@Getter @Setter
@@ -194,7 +190,6 @@ public class Blueprint {
System.out.println("Blueprint created");
}
-
public String blueprintToString() {
String ret = "";
@@ -206,6 +201,6 @@ public class Blueprint {
}
- return ret;
+ return Fixes.applyFixes(ret);
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java
index 10092c8..7d78e3d 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java
@@ -23,8 +23,6 @@ package org.onap.blueprintgenerator.models.blueprint;
import java.util.LinkedHashMap;
import java.util.TreeMap;
-import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -32,12 +30,13 @@ import lombok.Getter; import lombok.Setter;
@JsonInclude(value=Include.NON_NULL)
@Getter @Setter
public class DmaapObj {
- private String dmaap_info;
+ private Object dmaap_info;
private String type;
private GetInput pass;
private GetInput user;
- public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num) {
+ public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRObj(TreeMap<String, LinkedHashMap<String, Object>> inps,
+ String config, char type, String n, String num, boolean isDmaap) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
LinkedHashMap<String, Object> stringType = new LinkedHashMap();
stringType.put("type", "string");
@@ -45,31 +44,41 @@ public class DmaapObj {
//set the dmaapinfo
DmaapInfo info = new DmaapInfo();
- String infoType = "<<" + n + ">>";
- this.setDmaap_info(infoType);
-
- //set username
- GetInput u = new GetInput();
- u.setGet_input(config + "_" + num +"_aaf_username");
- this.setUser(u);
- retInputs.put(config + "_" + num +"_aaf_username", stringType);
-
- //set password
- GetInput p = new GetInput();
- p.setGet_input(config + "_" + num +"_aaf_password");
- this.setPass(p);
- retInputs.put(config + "_" + num +"_aaf_password", stringType);
+ if(!isDmaap){
+ info.createOnapDmaapMRInfo(inps, config, type);
+ this.setDmaap_info(info);
+ }
+ else{
+ String infoType = "<<" + n + ">>";
+ this.setDmaap_info(infoType);
+ //set username
+ GetInput u = new GetInput();
+ u.setGet_input(config + "_" + num +"_aaf_username");
+ this.setUser(u);
+ retInputs.put(config + "_" + num +"_aaf_username", stringType);
+ //set password
+ GetInput p = new GetInput();
+ p.setGet_input(config + "_" + num +"_aaf_password");
+ this.setPass(p);
+ retInputs.put(config + "_" + num +"_aaf_password", stringType);
+ }
return retInputs;
}
- public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num) {
+ public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num, boolean isDmaap) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
retInputs = inps;
//set the dmaapinfo
DmaapInfo info = new DmaapInfo();
- String infoType = "<<" + n + ">>";
- this.setDmaap_info(infoType);
+ if(!isDmaap){
+ info.createOnapDmaapDRInfo(inps, config, type);
+ this.setDmaap_info(info);
+ }
+ else {
+ String infoType = "<<" + n + ">>";
+ this.setDmaap_info(infoType);
+ }
return retInputs;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
index 25c4c53..31df9c3 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
@@ -26,12 +26,9 @@ import java.util.TreeMap;
import org.onap.blueprintgenerator.models.componentspec.Auxilary;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-import org.onap.blueprintgenerator.models.componentspec.HealthCheck;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
-import org.onap.blueprintgenerator.models.componentspec.Volumes;
import org.onap.blueprintgenerator.models.dmaapbp.DmaapStreams;
-import org.onap.blueprintgenerator.models.onapbp.LogDirectory;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -54,8 +51,9 @@ public class Properties {
private GetInput feed_name;
ArrayList<DmaapStreams> streams_publishes;
ArrayList<DmaapStreams> streams_subscribes;
- private TreeMap<String, Object> tls_info;
+ private TlsInfo tls_info;
private ResourceConfig resource_config;
+ private GetInput always_pull_image;
//private boolean useExisting;
public TreeMap<String, LinkedHashMap<String, Object>> createOnapProperties(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
@@ -77,18 +75,11 @@ public class Properties {
this.setLocation_id(location);
LinkedHashMap<String, Object> locMap = new LinkedHashMap();
locMap.put("type", "string");
- locMap.put("default", "central");
+ locMap.put("default", "");
+ retInputs.put("location_id", locMap);
//set the log info
- GetInput logD = new GetInput();
- logD.setGet_input("log_directory");
- TreeMap<String, Object> l = new TreeMap();
- l.put("log_directory", logD);
- this.setLog_info(l);
- LinkedHashMap<String, Object> logMap = new LinkedHashMap();
- logMap.put("type", "string");
- logMap.put("default", "''");
- retInputs.put("log_directory", logMap);
+ this.setLog_info(cs.getAuxilary().getLog_info());
//set the replicas
GetInput replica = new GetInput();
@@ -108,35 +99,29 @@ public class Properties {
//set the docker config
Auxilary aux = cs.getAuxilary();
- if(aux.getPorts() != null) {
- retInputs = aux.createPorts(retInputs);
- }
+// if(aux.getPorts() != null) {
+// retInputs = aux.createPorts(retInputs);
+// }
this.setDocker_config(aux);
//set the app config
Appconfig app = new Appconfig();
- retInputs = app.createAppconfig(retInputs, cs, override);
+ retInputs = app.createAppconfig(retInputs, cs, override, false);
this.setApplication_config(app);
- //set the tls info
- GetInput tls = new GetInput();
- tls.setGet_input("use_tls");
- GetInput cert = new GetInput();
- cert.setGet_input("cert_directory");
- TreeMap<String, Object> tlsInfo = new TreeMap();
- tlsInfo.put("cert_directory", cert);
- tlsInfo.put("use_tls", tls);
- this.setTls_info(tlsInfo);
-
- LinkedHashMap<String, Object> certMap = new LinkedHashMap();
- certMap.put("type", "string");
- certMap.put("default", "''");
- retInputs.put("cert_directory", certMap);
+ // set always_pull_image
+ this.always_pull_image = new GetInput();
+ this.always_pull_image.setGet_input("always_pull_image");
+ LinkedHashMap<String, Object> inputAlwaysPullImage = new LinkedHashMap<String, Object>();
+ inputAlwaysPullImage.put("type", "boolean");
+ inputAlwaysPullImage.put("description", "Set to true if the image should always be pulled");
+ inputAlwaysPullImage.put("default", true);
+ retInputs.put("always_pull_image", inputAlwaysPullImage);
- LinkedHashMap<String, Object> useMap = new LinkedHashMap();
- useMap.put("type", "boolean");
- useMap.put("default", false);
- retInputs.put("use_tls", useMap);
+ //set the tls info
+ if(cs.getAuxilary().getTls_info() != null){
+ addTlsInfo(cs,retInputs);
+ }
//set the reource config
ResourceConfig resource = new ResourceConfig();
@@ -160,15 +145,7 @@ public class Properties {
retInputs.put("tag_version", img);
//set the log info
- GetInput logD = new GetInput();
- logD.setGet_input("log_directory");
- TreeMap<String, Object> l = new TreeMap();
- l.put("log_directory", logD);
- this.setLog_info(l);
- LinkedHashMap<String, Object> logMap = new LinkedHashMap();
- logMap.put("type", "string");
- logMap.put("default", "''");
- retInputs.put("log_directory", logMap);
+ this.setLog_info(cs.getAuxilary().getLog_info());
//set service component type
String sType = cs.getSelf().getName();
@@ -176,24 +153,9 @@ public class Properties {
this.setService_component_type(sType);
//set the tls info
- GetInput tls = new GetInput();
- tls.setGet_input("use_tls");
- GetInput cert = new GetInput();
- cert.setGet_input("cert_directory");
- TreeMap<String, Object> tlsInfo = new TreeMap();
- tlsInfo.put("cert_directory", cert);
- tlsInfo.put("use_tls", tls);
- this.setTls_info(tlsInfo);
-
- LinkedHashMap<String, Object> certMap = new LinkedHashMap();
- certMap.put("type", "string");
- certMap.put("default", "''");
- retInputs.put("cert_directory", certMap);
-
- LinkedHashMap<String, Object> useMap = new LinkedHashMap();
- useMap.put("type", "boolean");
- useMap.put("default", false);
- retInputs.put("use_tls", useMap);
+ if(cs.getAuxilary().getTls_info() != null){
+ addTlsInfo(cs,retInputs);
+ }
//set the replicas
GetInput replica = new GetInput();
@@ -213,34 +175,32 @@ public class Properties {
//set the docker config
Auxilary aux = cs.getAuxilary();
- if(aux.getPorts() != null) {
- retInputs = aux.createPorts(retInputs);
- }
+// if(aux.getPorts() != null) {
+// retInputs = aux.createPorts(retInputs);
+// }
this.setDocker_config(aux);
//set the appconfig
Appconfig app = new Appconfig();
- retInputs = app.createAppconfig(retInputs, cs, override);
+ retInputs = app.createAppconfig(retInputs, cs, override, true);
this.setApplication_config(app);
//set the stream publishes
ArrayList<DmaapStreams> pubStreams = new ArrayList();
- int counter = 0;
if(cs.getStreams().getPublishes() != null) {
for(Publishes p: cs.getStreams().getPublishes()) {
if(p.getType().equals("message_router") || p.getType().equals("message router")) {
- String topic = "topic" + counter;
+ String topic = p.getConfig_key() + "_topic";
DmaapStreams mrStreams = new DmaapStreams();
retInputs = mrStreams.createStreams(inps, cs, topic, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
pubStreams.add(mrStreams);
}
else if(p.getType().equals("data_router") || p.getType().equals("data router")){
- String feed = "feed" + counter;
+ String feed = p.getConfig_key() + "_feed";
DmaapStreams drStreams = new DmaapStreams();
retInputs = drStreams.createStreams(inps, cs, feed, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
pubStreams.add(drStreams);
}
- counter++;
}
}
@@ -249,18 +209,17 @@ public class Properties {
if(cs.getStreams().getSubscribes() != null) {
for(Subscribes s: cs.getStreams().getSubscribes()) {
if(s.getType().equals("message_router") || s.getType().equals("message router")) {
- String topic = "topic" + counter;
+ String topic = s.getConfig_key() + "_topic";
DmaapStreams mrStreams = new DmaapStreams();
retInputs = mrStreams.createStreams(inps, cs, topic, s.getType(), s.getConfig_key(), s.getRoute(), 's');
subStreams.add(mrStreams);
}
else if(s.getType().equals("data_router") || s.getType().equals("data router")){
- String feed = "feed" + counter;
+ String feed = s.getConfig_key() + "_feed";
DmaapStreams drStreams = new DmaapStreams();
retInputs = drStreams.createStreams(inps, cs, feed, s.getType(), s.getConfig_key(), s.getRoute(), 's');
subStreams.add(drStreams);
}
- counter++;
}
}
@@ -279,4 +238,18 @@ public class Properties {
return retInputs;
}
+
+ private void addTlsInfo(ComponentSpec cs, TreeMap<String, LinkedHashMap<String, Object>> retInputs) {
+ TlsInfo tlsInfo = new TlsInfo();
+ tlsInfo.setCertDirectory((String) cs.getAuxilary().getTls_info().get("cert_directory"));
+ GetInput useTLSFlag = new GetInput();
+ useTLSFlag.setGet_input("use_tls");
+ tlsInfo.setUseTls(useTLSFlag);
+ this.setTls_info(tlsInfo);
+ LinkedHashMap<String, Object> useTlsFlagInput = new LinkedHashMap<String, Object>();
+ useTlsFlagInput.put("type", "boolean");
+ useTlsFlagInput.put("description", "flag to indicate tls enable/disable");
+ useTlsFlagInput.put("default", cs.getAuxilary().getTls_info().get("use_tls"));
+ retInputs.put("use_tls", useTlsFlagInput);
+ }
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
index 1c1cf6c..f81bf9a 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.models.componentspec.Auxilary;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -34,14 +36,36 @@ import lombok.Getter; import lombok.Setter;
@Getter @Setter
@JsonInclude(value=Include.NON_NULL)
public class StartInputs {
- //private ArrayList<String> ports;
- private GetInput envs;
+ private ArrayList<String> ports;
+ private Object envs;
public TreeMap<String, LinkedHashMap<String, Object>> createOnapStartInputs(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
+ int count = 0;
+ ArrayList<String> portList = new ArrayList();
+ Auxilary aux = cs.getAuxilary();
+
+ if (aux.getPorts() != null) {
+
+ for(Object p : aux.getPorts()) {
+ String[] ports = p.toString().split(":");
+ String internal
+ = String.format("concat: [\"%s:\", {get_input: external_port_%d}]"
+ , ports[0], count);
+ portList.add(internal);
+
+ LinkedHashMap<String, Object> portType = new LinkedHashMap();
+ portType.put("type", "string");
+ portType.put("default", ports[1]);
+ retInputs.put("external_port_" + count, portType);
+
+ count++;
+ }
+
+ }
+
+ this.setPorts(portList);
// ArrayList<String> port = new ArrayList<String>();
// String external = "";
// if(cs.getAuxilary().getPorts() != null) {
@@ -73,13 +97,22 @@ public class StartInputs {
// }
//set the envs
- GetInput env = new GetInput();
- env.setGet_input("envs");
- this.setEnvs(env);
LinkedHashMap<String, Object> eMap = new LinkedHashMap();
- eMap.put("default", "{}");
+ if(cs.getAuxilary().getDatabases() != null){
+ //set db env variables
+ LinkedHashMap<String, Object> envVars = PgaasNodeBuilder.getEnvVariables(cs.getAuxilary().getDatabases());
+ this.setEnvs(envVars);
+ eMap.put("default", "&envs {}");
+ }
+ else {
+ GetInput env = new GetInput();
+ env.setGet_input("envs");
+ this.setEnvs(env);
+ eMap.put("default", "{}");
+ }
retInputs.put("envs", eMap);
+
return retInputs;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java
new file mode 100644
index 0000000..2130fe3
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java
@@ -0,0 +1,37 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.blueprint;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class TlsInfo {
+
+ @JsonProperty("cert_directory")
+ private String certDirectory;
+
+ @JsonProperty("use_tls")
+ private GetInput useTls;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java
new file mode 100644
index 0000000..35f958e
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java
@@ -0,0 +1,35 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.blueprint.pgaas;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.Node;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class PgaasNode extends Node {
+
+ @JsonProperty("properties")
+ private PgaasNodeProperties pgaasNodeProperties;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java
new file mode 100644
index 0000000..709c66e
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java
@@ -0,0 +1,40 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.blueprint.pgaas;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+@Getter @Setter
+@NoArgsConstructor
+public class PgaasNodeProperties {
+
+ @JsonProperty("writerfqdn")
+ private GetInput writerfqdn;
+
+ @JsonProperty("name")
+ private GetInput name;
+
+ @JsonProperty("use_existing")
+ private boolean useExisting;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java
new file mode 100644
index 0000000..b4740df
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java
@@ -0,0 +1,34 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.blueprint.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.Node;
+
+@Getter @Setter
+@NoArgsConstructor
+public class PolicyNode extends Node {
+
+ @JsonProperty("properties")
+ private PolicyNodeProperties policyNodeProperties;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java
new file mode 100644
index 0000000..6d23b23
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java
@@ -0,0 +1,37 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.blueprint.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+@Getter @Setter
+@NoArgsConstructor
+public class PolicyNodeProperties {
+
+ @JsonProperty("policy_id")
+ private GetInput policyId;
+
+ @JsonProperty("policy_model_id")
+ private String policyModelId;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
index 01844f9..73acda8 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
@@ -67,6 +67,15 @@ public class Auxilary {
/** The healthcheck. */
private HealthCheck healthcheck;
+
+ /**log-directory**/
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private TreeMap<String, Object> log_info;
+
+ /**tls-info**/
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private TreeMap<String, Object> tls_info;
+
/** The volumes. */
private Volumes[] volumes;
@@ -74,6 +83,7 @@ public class Auxilary {
private Policy policy;
/** The ports. */
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private ArrayList<Object> ports;
/** The reconfigs. */
@@ -84,35 +94,35 @@ public class Auxilary {
private TreeMap<String, String> databases;
- public TreeMap<String, LinkedHashMap<String, Object>> createPorts(TreeMap<String, LinkedHashMap<String, Object>> inps) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
- LinkedHashMap<String, Object> portType = new LinkedHashMap();
- portType.put("type", "string");
-
- ArrayList<Object> ports = new ArrayList();
- String external = "";
- boolean foundPort = false;
- for(Object o: this.getPorts()) {
- String internal = "";
- String p = o.toString();
- for(int i = 0; i < p.length(); i++) {
- if(p.charAt(i) == ':') {
- internal = '"' + internal + '"';
- internal = "concat: ['" + internal + "', {get_input: external_port}]";
- ports.add(internal);
- }
- if(p.charAt(i) == ':' && !foundPort) {
- external = p.substring(i);
- portType.put("default", external);
- retInputs.put("external_port", portType);
-
- }
- internal = internal + p.charAt(i);
-
- }
- }
-
- this.setPorts(ports);
- return retInputs;
- }
+// public TreeMap<String, LinkedHashMap<String, Object>> createPorts(TreeMap<String, LinkedHashMap<String, Object>> inps) {
+// TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
+// LinkedHashMap<String, Object> portType = new LinkedHashMap();
+// portType.put("type", "string");
+//
+// ArrayList<Object> ports = new ArrayList();
+// String external = "";
+// boolean foundPort = false;
+// for(Object o: this.getPorts()) {
+// String internal = "";
+// String p = o.toString();
+// for(int i = 0; i < p.length(); i++) {
+// if(p.charAt(i) == ':') {
+// internal = '"' + internal + '"';
+// internal = "concat: ['" + internal + "', {get_input: external_port}]";
+// ports.add(internal);
+// }
+// if(p.charAt(i) == ':' && !foundPort) {
+// external = p.substring(i);
+// portType.put("default", external);
+// retInputs.put("external_port", portType);
+//
+// }
+// internal = internal + p.charAt(i);
+//
+// }
+// }
+//
+// this.setPorts(ports);
+// return retInputs;
+// }
} \ No newline at end of file
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ComponentSpec.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ComponentSpec.java
index b6bc0a1..3876b53 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ComponentSpec.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ComponentSpec.java
@@ -22,23 +22,17 @@ package org.onap.blueprintgenerator.models.componentspec;
import java.io.File;
import java.io.IOException;
-import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Setter;
import lombok.NoArgsConstructor;
+import org.onap.blueprintgenerator.models.componentspec.policy_info.PolicyInfo;
// TODO: Auto-generated Javadoc
/**
@@ -90,6 +84,9 @@ public class ComponentSpec {
/** The auxilary. */
private Auxilary auxilary;
+
+ @JsonProperty("policy_info")
+ private PolicyInfo policyInfo;
/** The artifacts. */
private Artifacts[] artifacts;
@@ -119,6 +116,7 @@ public class ComponentSpec {
this.setParameters(cs.getParameters());
this.setServices(cs.getServices());
this.setStreams(cs.getStreams());
+ this.setPolicyInfo(cs.getPolicyInfo());
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/PolicyInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/PolicyInfo.java
new file mode 100644
index 0000000..da746a7
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/PolicyInfo.java
@@ -0,0 +1,35 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+package org.onap.blueprintgenerator.models.componentspec.policy_info;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter @Setter
+@NoArgsConstructor
+public class PolicyInfo {
+
+ @JsonProperty("policy")
+ private List<TypePolicy> typePolicyList;
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/TypePolicy.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/TypePolicy.java
new file mode 100644
index 0000000..038c601
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/policy_info/TypePolicy.java
@@ -0,0 +1,36 @@
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+
+ */
+
+package org.onap.blueprintgenerator.models.componentspec.policy_info;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter @Setter
+@NoArgsConstructor
+public class TypePolicy {
+
+ private String node_label;
+ private String policy_id;
+ private String policy_model_id;
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
index d3cff67..21eabf0 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
@@ -20,15 +20,14 @@
package org.onap.blueprintgenerator.models.dmaapbp;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
import org.onap.blueprintgenerator.models.blueprint.Blueprint;
import org.onap.blueprintgenerator.models.blueprint.Imports;
-import org.onap.blueprintgenerator.models.blueprint.Interfaces;
import org.onap.blueprintgenerator.models.blueprint.Node;
-import org.onap.blueprintgenerator.models.blueprint.Properties;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
@@ -68,41 +67,48 @@ public class DmaapBlueprint extends Blueprint{
//create and add the topic/feed nodes
//go through the streams publishes
- int counter = 0;
if(cs.getStreams().getPublishes() != null) {
for(Publishes p: cs.getStreams().getPublishes()) {
if(p.getType().equals("message_router") || p.getType().equals("message router")) {
- String topic = "topic" + counter;
+ String topic = p.getConfig_key() + "_topic";
DmaapNode topicNode = new DmaapNode();
inps = topicNode.createTopicNode(cs, inps, topic);
nodeTemplate.put(topic, topicNode);
} else if(p.getType().equals("data_router") || p.getType().equals("data router")) {
- String feed = "feed" + counter;
+ String feed = p.getConfig_key() + "_feed";
DmaapNode feedNode = new DmaapNode();
inps = feedNode.createFeedNode(cs, inps, feed);
nodeTemplate.put(feed, feedNode);
}
- counter++;
}
}
//go through the stream subscribes
if(cs.getStreams().getSubscribes() != null) {
for(Subscribes s: cs.getStreams().getSubscribes()) {
if(s.getType().equals("message_router") || s.getType().equals("message router")) {
- String topic = "topic" + counter;
+ String topic = s.getConfig_key() + "_topic";
DmaapNode topicNode = new DmaapNode();
inps = topicNode.createTopicNode(cs, inps, topic);
nodeTemplate.put(topic, topicNode);
} else if(s.getType().equals("data_router") || s.getType().equals("data router")) {
- String feed = "feed" + counter;
+ String feed = s.getConfig_key() + "_feed";
DmaapNode feedNode = new DmaapNode();
inps = feedNode.createFeedNode(cs, inps, feed);
nodeTemplate.put(feed, feedNode);
}
- counter++;
}
}
+ //if present in component spec, populate policyNodes information in the blueprint
+ if(cs.getPolicyInfo() != null){
+ PolicyNodeBuilder.addPolicyNodesAndInputs(cs, nodeTemplate, inps);
+ }
+
+ //if present in component spec, populate pgaasNodes information in the blueprint
+ if(cs.getAuxilary().getDatabases() != null){
+ PgaasNodeBuilder.addPgaasNodesAndInputs(cs, nodeTemplate, inps);
+ }
+
bp.setNode_templates(nodeTemplate);
bp.setInputs(inps);
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
index bfa7ae9..6c74347 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
import org.onap.blueprintgenerator.models.blueprint.GetInput;
import org.onap.blueprintgenerator.models.blueprint.Interfaces;
import org.onap.blueprintgenerator.models.blueprint.Node;
@@ -71,19 +73,17 @@ public class DmaapNode extends Node{
ArrayList<LinkedHashMap<String, String>> rets = new ArrayList();
//go through the streams publishes
- int counter = 0;
if(cs.getStreams().getPublishes() != null) {
for(Publishes p: cs.getStreams().getPublishes()) {
LinkedHashMap<String, String> pubRelations = new LinkedHashMap();
if(p.getType().equals("message_router") || p.getType().equals("message router")) {
pubRelations.put("type", "ccsdk.relationships.publish_events");
- pubRelations.put("target", "topic" + counter);
+ pubRelations.put("target", p.getConfig_key() + "_topic");
} else if(p.getType().equals("data_router") || p.getType().equals("data router")) {
pubRelations.put("type", "ccsdk.relationships.publish_files");
- pubRelations.put("target", "feed" + counter);
+ pubRelations.put("target", p.getConfig_key() + "_feed");
}
rets.add(pubRelations);
- counter++;
}
}
//go through the stream subscribes
@@ -92,15 +92,26 @@ public class DmaapNode extends Node{
LinkedHashMap<String, String> subRelations = new LinkedHashMap();
if(s.getType().equals("message_router") || s.getType().equals("message router")) {
subRelations.put("type", "ccsdk.relationships.subscribe_to_events");
- subRelations.put("target", "topic" + counter);
+ subRelations.put("target", s.getConfig_key() + "_topic");
} else if(s.getType().equals("data_router") || s.getType().equals("data router")) {
subRelations.put("type", "ccsdk.relationships.subscribe_to_files");
- subRelations.put("target", "feed" + counter);
+ subRelations.put("target", s.getConfig_key() + "_feed");
}
rets.add(subRelations);
- counter++;
}
}
+
+ //add relationship for policy if exist
+ if(cs.getPolicyInfo() != null){
+ ArrayList<LinkedHashMap<String, String>> policyRelationshipsList = PolicyNodeBuilder.getPolicyRelationships(cs);
+ rets.addAll(policyRelationshipsList);
+ }
+
+ //add relationships and env_variables for pgaas dbs if exist
+ if(cs.getAuxilary().getDatabases() != null){
+ ArrayList<LinkedHashMap<String, String>> pgaasRelationshipsList = PgaasNodeBuilder.getPgaasNodeRelationships(cs);
+ rets.addAll(pgaasRelationshipsList);
+ }
this.setRelationships(rets);
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
index 1640a6e..b26d45d 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
@@ -46,6 +46,10 @@ public class DmaapStreams {
private GetInput username;
private GetInput password;
//private GetInput delivery_url;
+
+ private GetInput privileged;
+ private GetInput decompress;
+
private String route;
private String scheme;
@@ -81,6 +85,18 @@ public class DmaapStreams {
this.setPassword(password);
retInputs.put(key + "_" + name + "_password", stringType);
+ //set privileged
+ GetInput priviliged = new GetInput();
+ priviliged.setGet_input(key + "_" + name + "_priviliged");
+ this.setPrivileged(priviliged);
+ retInputs.put(key + "_" + name + "_priviliged", stringType);
+
+ //set decompress
+ GetInput decompress = new GetInput();
+ decompress.setGet_input(key + "_" + name + "_decompress");
+ this.setDecompress(decompress);
+ retInputs.put(key + "_" + name + "_decompress", stringType);
+
this.setRoute(route);
this.setScheme("https");
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapBlueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapBlueprint.java
index 8342020..c0ef8b3 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapBlueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapBlueprint.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
import org.onap.blueprintgenerator.models.blueprint.Blueprint;
import org.onap.blueprintgenerator.models.blueprint.Imports;
import org.onap.blueprintgenerator.models.blueprint.Node;
@@ -69,9 +71,20 @@ public class OnapBlueprint extends Blueprint{
nodeTemplate.put(nodeName, node);
this.setNode_templates(nodeTemplate);
+ //if present in component spec, populate policyNode information in the blueprint
+ if(cs.getPolicyInfo() != null){
+ PolicyNodeBuilder.addPolicyNodesAndInputs(cs, nodeTemplate, inputs);
+ }
+
+ //if present in component spec, populate pgaasNodes information in the blueprint
+ if(cs.getAuxilary().getDatabases() != null){
+ PgaasNodeBuilder.addPgaasNodesAndInputs(cs, nodeTemplate, inputs);
+ }
+
//set the inputs
this.setInputs(inputs);
+
Blueprint bp = new Blueprint();
bp.setImports(this.getImports());
bp.setInputs(this.getInputs());
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapNode.java
index 2b0b8c0..a3d8e3e 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapNode.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/onapbp/OnapNode.java
@@ -20,9 +20,12 @@
package org.onap.blueprintgenerator.models.onapbp;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
import org.onap.blueprintgenerator.models.blueprint.Interfaces;
import org.onap.blueprintgenerator.models.blueprint.Node;
import org.onap.blueprintgenerator.models.blueprint.Properties;
@@ -47,6 +50,8 @@ import lombok.NoArgsConstructor;
public class OnapNode extends Node{
private TreeMap<String, Interfaces> interfaces;
private Properties properties;
+ private ArrayList<LinkedHashMap<String, String>> relationships;
+
public TreeMap<String, LinkedHashMap<String, Object>> createOnapNode(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
retInputs = inps;
@@ -61,6 +66,23 @@ public class OnapNode extends Node{
//set the type
this.setType("dcae.nodes.ContainerizedPlatformComponent");
+ //create and set the relationships
+ ArrayList<LinkedHashMap<String, String>> rets = new ArrayList();
+
+ //add relationship for policy if exist
+ if(cs.getPolicyInfo() != null){
+ ArrayList<LinkedHashMap<String, String>> policyRelationshipsList = PolicyNodeBuilder.getPolicyRelationships(cs);
+ rets.addAll(policyRelationshipsList);
+ }
+
+ //add relationships and env_variables for pgaas dbs if exist
+ if(cs.getAuxilary().getDatabases() != null){
+ ArrayList<LinkedHashMap<String, String>> pgaasRelationshipsList = PgaasNodeBuilder.getPgaasNodeRelationships(cs);
+ rets.addAll(pgaasRelationshipsList);
+ }
+
+ this.setRelationships(rets);
+
//set the properties
Properties props = new Properties();
retInputs = props.createOnapProperties(retInputs, cs, override);
diff --git a/mod/bpgenerator/version.properties b/mod/bpgenerator/version.properties
index 755adf7..7d6815b 100644
--- a/mod/bpgenerator/version.properties
+++ b/mod/bpgenerator/version.properties
@@ -1,6 +1,6 @@
major=1
-minor=2
-patch=1
+minor=3
+patch=0
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT