From 4937f56d90371c7a7b5b6c52314c28df716f41ae Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Thu, 7 Feb 2019 14:51:50 -0500 Subject: Refactor components core and resource dict modules Change-Id: I04e9e723d68a38ecefe48206e67fddbe43c55854 Issue-ID: CCSDK-1047 Signed-off-by: Muthuramalingam, Brinda Santh --- .../node_type/source-component-java.json | 31 ---- .../load/model_type/node_type/source-default.json | 18 --- .../load/model_type/node_type/source-input.json | 18 --- .../model_type/node_type/source-primary-db.json | 44 ------ .../load/model_type/node_type/source-rest.json | 61 -------- .../node_type/tosca.nodes.ResourceSource.json | 5 - .../load/resource_dictionary/address.json | 17 --- .../load/resource_dictionary/aic-cloud-region.json | 17 --- .../load/resource_dictionary/aic_clli.json | 17 --- .../resource_dictionary/availability_zone_0.json | 17 --- .../load/resource_dictionary/default-source.json | 16 -- .../load/resource_dictionary/input-source.json | 17 --- .../load/resource_dictionary/mdsal-source.json | 34 ----- .../load/resource_dictionary/name_0.json | 17 --- .../load/resource_dictionary/nf-role.json | 25 ---- .../load/resource_dictionary/nfc-naming-code.json | 25 ---- .../resource_dictionary/onap_private_net_cidr.json | 21 --- .../resource_dictionary/onap_private_net_id.json | 17 --- .../resource_dictionary/primary-db-source.json | 24 --- .../resource_dictionary/private-prefix-id.json | 21 --- .../resource_dictionary/protected-prefix-id.json | 21 --- .../protected_private_net_cidr.json | 21 --- .../load/resource_dictionary/public_net_id.json | 17 --- .../resource_dictionary/service-instance-id.json | 17 --- .../resource_dictionary/unprotected-prefix-id.json | 21 --- .../unprotected_private_net_cidr.json | 21 --- .../load/resource_dictionary/vf-module-id.json | 17 --- .../load/resource_dictionary/vf-module-label.json | 25 ---- .../vf-module-model-customization-uuid.json | 17 --- .../load/resource_dictionary/vf-module-type.json | 25 ---- .../load/resource_dictionary/vf-naming-policy.json | 25 ---- .../load/resource_dictionary/vf-nf-code.json | 25 ---- .../load/resource_dictionary/vf_module_name.json | 17 --- .../resource_dictionary/vfccustomizationuuid.json | 25 ---- .../load/resource_dictionary/vfw_private_ip_0.json | 35 ----- .../load/resource_dictionary/vfw_private_ip_1.json | 35 ----- .../load/resource_dictionary/vfw_private_ip_2.json | 17 --- .../load/resource_dictionary/vm-type.json | 25 ---- .../load/resource_dictionary/vnf-id.json | 17 --- .../vnf-model-customization-uuid.json | 17 --- .../load/resource_dictionary/vnf-name.json | 28 ---- .../load/resource_dictionary/vnf_name.json | 28 ---- .../vnfc-model-invariant-uuid.json | 25 ---- .../resource_dictionary/vnfc-model-version.json | 25 ---- .../load/resource_dictionary/vpg_private_ip_0.json | 35 ----- .../load/resource_dictionary/vpg_private_ip_1.json | 17 --- .../load/resource_dictionary/vsn_private_ip_0.json | 35 ----- .../load/resource_dictionary/vsn_private_ip_1.json | 17 --- components/resource-dict/pom.xml | 44 ------ .../resource/dict/ResourceDefinition.kt | 100 ------------- .../resource/dict/ResourceDictionaryConstants.kt | 38 ----- .../dict/factory/ResourceSourceMappingFactory.kt | 47 ------ .../service/ResourceAssignmentValidationService.kt | 163 --------------------- .../service/ResourceDefinitionValidationService.kt | 113 -------------- .../dict/utils/BulkResourceSequencingUtils.kt | 109 -------------- .../resource/dict/utils/ResourceDictionaryUtils.kt | 94 ------------ .../resource/dict/ResourceDefinitionTest.java | 60 -------- .../factory/ResourceSourceMappingFactoryTest.java | 42 ------ .../ResourceAssignmentValidationServiceTest.kt | 66 --------- .../ResourceDefinitionValidationServiceTest.java | 56 ------- .../utils/BulkResourceSequencingUtilsTest.java | 37 ----- .../dict/utils/ResourceDictionaryUtilsTest.java | 99 ------------- .../dict/utils/ResourceDictionaryTestUtils.kt | 30 ---- .../resources/data/resource-assignment-input.json | 10 -- .../src/test/resources/validation/cyclic.json | 111 -------------- .../src/test/resources/validation/duplicate.json | 110 -------------- .../src/test/resources/validation/success.json | 110 -------------- 67 files changed, 2551 deletions(-) delete mode 100644 components/resource-dict/load/model_type/node_type/source-component-java.json delete mode 100644 components/resource-dict/load/model_type/node_type/source-default.json delete mode 100644 components/resource-dict/load/model_type/node_type/source-input.json delete mode 100644 components/resource-dict/load/model_type/node_type/source-primary-db.json delete mode 100644 components/resource-dict/load/model_type/node_type/source-rest.json delete mode 100644 components/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json delete mode 100644 components/resource-dict/load/resource_dictionary/address.json delete mode 100644 components/resource-dict/load/resource_dictionary/aic-cloud-region.json delete mode 100644 components/resource-dict/load/resource_dictionary/aic_clli.json delete mode 100644 components/resource-dict/load/resource_dictionary/availability_zone_0.json delete mode 100644 components/resource-dict/load/resource_dictionary/default-source.json delete mode 100644 components/resource-dict/load/resource_dictionary/input-source.json delete mode 100644 components/resource-dict/load/resource_dictionary/mdsal-source.json delete mode 100644 components/resource-dict/load/resource_dictionary/name_0.json delete mode 100644 components/resource-dict/load/resource_dictionary/nf-role.json delete mode 100644 components/resource-dict/load/resource_dictionary/nfc-naming-code.json delete mode 100644 components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json delete mode 100644 components/resource-dict/load/resource_dictionary/onap_private_net_id.json delete mode 100644 components/resource-dict/load/resource_dictionary/primary-db-source.json delete mode 100644 components/resource-dict/load/resource_dictionary/private-prefix-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/protected-prefix-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json delete mode 100644 components/resource-dict/load/resource_dictionary/public_net_id.json delete mode 100644 components/resource-dict/load/resource_dictionary/service-instance-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-module-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-module-label.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-module-type.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-naming-policy.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf-nf-code.json delete mode 100644 components/resource-dict/load/resource_dictionary/vf_module_name.json delete mode 100644 components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json delete mode 100644 components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json delete mode 100644 components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json delete mode 100644 components/resource-dict/load/resource_dictionary/vfw_private_ip_2.json delete mode 100644 components/resource-dict/load/resource_dictionary/vm-type.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnf-id.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnf-name.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnf_name.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json delete mode 100644 components/resource-dict/load/resource_dictionary/vnfc-model-version.json delete mode 100644 components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json delete mode 100644 components/resource-dict/load/resource_dictionary/vpg_private_ip_1.json delete mode 100644 components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json delete mode 100644 components/resource-dict/load/resource_dictionary/vsn_private_ip_1.json delete mode 100644 components/resource-dict/pom.xml delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java delete mode 100644 components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt delete mode 100644 components/resource-dict/src/test/resources/data/resource-assignment-input.json delete mode 100644 components/resource-dict/src/test/resources/validation/cyclic.json delete mode 100644 components/resource-dict/src/test/resources/validation/duplicate.json delete mode 100644 components/resource-dict/src/test/resources/validation/success.json (limited to 'components/resource-dict') diff --git a/components/resource-dict/load/model_type/node_type/source-component-java.json b/components/resource-dict/load/model_type/node_type/source-component-java.json deleted file mode 100644 index 95a9801d..00000000 --- a/components/resource-dict/load/model_type/node_type/source-component-java.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "description": "This is Custom Java Component Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": false, - "type": "string", - "default" : "DYNAMIC", - "constraints": [ - { - "validValues": [ - "DYNAMIC" - ] - } - ] - }, - "class-name": { - "required": true, - "type": "string", - "description" : "Fully Qualified Class Name ( + . + )" - }, - "key-dependencies": { - "required": false, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/source-default.json b/components/resource-dict/load/model_type/node_type/source-default.json deleted file mode 100644 index 13e234e1..00000000 --- a/components/resource-dict/load/model_type/node_type/source-default.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "This is Default Resource Source Node Type", - "version": "1.0.0", - "properties": { - "key": { - "required": false, - "type": "string" - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/source-input.json b/components/resource-dict/load/model_type/node_type/source-input.json deleted file mode 100644 index 126ea30b..00000000 --- a/components/resource-dict/load/model_type/node_type/source-input.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "This is Input Resource Source Node Type", - "version": "1.0.0", - "properties": { - "key": { - "required": false, - "type": "string" - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/source-primary-db.json b/components/resource-dict/load/model_type/node_type/source-primary-db.json deleted file mode 100644 index 661a9503..00000000 --- a/components/resource-dict/load/model_type/node_type/source-primary-db.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "description": "This is Database Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": true, - "type": "string", - "constraints": [ - { - "valid_values": [ - "SQL", - "PLSQL" - ] - } - ] - }, - "query": { - "required": true, - "type": "string" - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/source-rest.json b/components/resource-dict/load/model_type/node_type/source-rest.json deleted file mode 100644 index f8dd8b6f..00000000 --- a/components/resource-dict/load/model_type/node_type/source-rest.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "description": "This is Rest Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": false, - "type": "string", - "default": "JSON", - "constraints": [ - { - "valid_values": [ - "JSON" - ] - } - ] - }, - "url-path": { - "required": true, - "type": "string" - }, - "path": { - "required": true, - "type": "string" - }, - "expression-type": { - "required": false, - "type": "string", - "default": "JSON_PATH", - "constraints": [ - { - "valid_values": [ - "JSON_PATH", - "JSON_POINTER" - ] - } - ] - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -} \ No newline at end of file diff --git a/components/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json b/components/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json deleted file mode 100644 index 2ef553e2..00000000 --- a/components/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "TOSCA base type for Resource Sources", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/address.json b/components/resource-dict/load/resource_dictionary/address.json deleted file mode 100644 index e999938c..00000000 --- a/components/resource-dict/load/resource_dictionary/address.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "address", - "tags" : "address", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "address", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "address" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/aic-cloud-region.json b/components/resource-dict/load/resource_dictionary/aic-cloud-region.json deleted file mode 100644 index da2c7440..00000000 --- a/components/resource-dict/load/resource_dictionary/aic-cloud-region.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "aic-cloud-region", - "tags" : "aic-cloud-region", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "aic-cloud-region", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "aic-cloud-region" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/aic_clli.json b/components/resource-dict/load/resource_dictionary/aic_clli.json deleted file mode 100644 index 182d7061..00000000 --- a/components/resource-dict/load/resource_dictionary/aic_clli.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "aic_clli", - "tags" : "aic_clli", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "aic_clli", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "aic_clli" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/availability_zone_0.json b/components/resource-dict/load/resource_dictionary/availability_zone_0.json deleted file mode 100644 index f1cebdb7..00000000 --- a/components/resource-dict/load/resource_dictionary/availability_zone_0.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "availability_zone_0", - "tags" : "availability_zone_0", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "availability_zone_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "availability_zone_0" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/default-source.json b/components/resource-dict/load/resource_dictionary/default-source.json deleted file mode 100644 index 64bfa0cc..00000000 --- a/components/resource-dict/load/resource_dictionary/default-source.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com", - "name": "default-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "sources": { - "default": { - "type": "source-default", - "properties": { - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/input-source.json b/components/resource-dict/load/resource_dictionary/input-source.json deleted file mode 100644 index 152a5eef..00000000 --- a/components/resource-dict/load/resource_dictionary/input-source.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "input-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": null, - "sources": { - "input": { - "type": "source-input", - "properties": { - "key": "action-name" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json deleted file mode 100644 index fa72e5dc..00000000 --- a/components/resource-dict/load/resource_dictionary/mdsal-source.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "tags": "oam-local-ipv4-address", - "name": "mdsal-source", - "property" :{ - "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "sources": { - "primary-config-data": { - "type": "source-rest", - "properties": { - "type": "JSON", - "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type", - "path": "/v4-assigned-ip-list/0/v4-ip-prefix", - "input-key-mapping": { - "service-instance-id": "service-instance-id", - "network-role": "network-role", - "v4-ip-type": "v4-ip-type", - "vm-type": "vm-type" - }, - "output-key-mapping": { - "oam-local-ipv4-address": "v4-ip-prefix" - }, - "key-dependencies": [ - "service-instance-id", - "network-role", - "v4-ip-type", - "vm-type" - ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/name_0.json b/components/resource-dict/load/resource_dictionary/name_0.json deleted file mode 100644 index 2392c3dc..00000000 --- a/components/resource-dict/load/resource_dictionary/name_0.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "name_0", - "tags" : "name_0", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "name_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "name_0" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/nf-role.json b/components/resource-dict/load/resource_dictionary/nf-role.json deleted file mode 100644 index df6b5df4..00000000 --- a/components/resource-dict/load/resource_dictionary/nf-role.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "nf-role", - "tags" : "nf-role", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnf/nf-role", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid", - "input-key-mapping" : { - "vnfmodelcustomizationuuid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "nf-role" : "vf_model_role" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/nfc-naming-code.json b/components/resource-dict/load/resource_dictionary/nfc-naming-code.json deleted file mode 100644 index 7c521a7c..00000000 --- a/components/resource-dict/load/resource_dictionary/nfc-naming-code.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "nfc-naming-code", - "tags" : "nfc-naming-code", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "nfc-naming-code", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "nfc-naming-code" : "nfc_naming_code" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json deleted file mode 100644 index f2067a19..00000000 --- a/components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "onap_private_net_cidr", - "tags" : "onap_private_net_cidr", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "onap_private_net_cidr", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private", - "output-key-mapping" : { - "onap_private_net_cidr" : "prefix" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/onap_private_net_id.json b/components/resource-dict/load/resource_dictionary/onap_private_net_id.json deleted file mode 100644 index 4e430f46..00000000 --- a/components/resource-dict/load/resource_dictionary/onap_private_net_id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "onap_private_net_id", - "tags" : "onap_private_net_id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "onap_private_net_id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "onap_private_net_id" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/primary-db-source.json b/components/resource-dict/load/resource_dictionary/primary-db-source.json deleted file mode 100644 index dfac66ae..00000000 --- a/components/resource-dict/load/resource_dictionary/primary-db-source.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "primary-db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": "bundle-id, brindasanth@onap.com", - "sources": { - "primary-db": { - "type": "source-primary-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/private-prefix-id.json b/components/resource-dict/load/resource_dictionary/private-prefix-id.json deleted file mode 100644 index 309647d7..00000000 --- a/components/resource-dict/load/resource_dictionary/private-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "private-prefix-id", - "tags" : "private-prefix-id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "private-prefix-id", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private", - "output-key-mapping" : { - "private-prefix-id" : "prefix_id" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/protected-prefix-id.json b/components/resource-dict/load/resource_dictionary/protected-prefix-id.json deleted file mode 100644 index 816405b4..00000000 --- a/components/resource-dict/load/resource_dictionary/protected-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "protected-prefix-id", - "tags" : "protected-prefix-id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "protected-prefix-id", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected", - "output-key-mapping" : { - "protected-prefix-id" : "prefix_id" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json deleted file mode 100644 index bf46fb3a..00000000 --- a/components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "protected_private_net_cidr", - "tags" : "protected_private_net_cidr", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "protected_private_net_cidr", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected", - "output-key-mapping" : { - "protected_private_net_cidr" : "prefix" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/public_net_id.json b/components/resource-dict/load/resource_dictionary/public_net_id.json deleted file mode 100644 index 17ad96bd..00000000 --- a/components/resource-dict/load/resource_dictionary/public_net_id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "public_net_id", - "tags" : "public_net_id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "public_net_id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "public_net_id" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/service-instance-id.json b/components/resource-dict/load/resource_dictionary/service-instance-id.json deleted file mode 100644 index ed583be7..00000000 --- a/components/resource-dict/load/resource_dictionary/service-instance-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "service-instance-id", - "tags" : "service-instance-id, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "To be provided", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "service-instance-id" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json b/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json deleted file mode 100644 index 8a09b149..00000000 --- a/components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "unprotected-prefix-id", - "tags" : "unprotected-prefix-id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "unprotected-prefix-id", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected", - "output-key-mapping" : { - "unprotected-prefix-id" : "prefix_id" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json b/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json deleted file mode 100644 index 241147c3..00000000 --- a/components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "unprotected_private_net_cidr", - "tags" : "unprotected_private_net_cidr", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "unprotected_private_net_cidr", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected", - "output-key-mapping" : { - "unprotected_private_net_cidr" : "prefix" - } - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-module-id.json b/components/resource-dict/load/resource_dictionary/vf-module-id.json deleted file mode 100644 index 0e1d771f..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-module-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf-module-id", - "tags" : "vf-module-id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-module-id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf-module-id" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-module-label.json b/components/resource-dict/load/resource_dictionary/vf-module-label.json deleted file mode 100644 index 01355c20..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-module-label.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-module-label", - "tags" : "vf-module-label", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-module-label", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-module-label" : "vf_module_label" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json b/components/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json deleted file mode 100644 index f41c781c..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf-module-model-customization-uuid", - "tags" : "vf-module-model-customization-uuid", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-module-model-customization-uuid", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf-module-model-customization-uuid" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-module-type.json b/components/resource-dict/load/resource_dictionary/vf-module-type.json deleted file mode 100644 index ead69d46..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-module-type.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-module-type", - "tags" : "vf-module-type", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-module-type", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-module-type" : "vf_module_type" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-naming-policy.json b/components/resource-dict/load/resource_dictionary/vf-naming-policy.json deleted file mode 100644 index cde861f8..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-naming-policy.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-naming-policy", - "tags" : "vf-naming-policy", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-naming-policy", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", - "input-key-mapping" : { - "vnf_model_customization_uuid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-naming-policy" : "vf_naming_policy" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf-nf-code.json b/components/resource-dict/load/resource_dictionary/vf-nf-code.json deleted file mode 100644 index adbd22af..00000000 --- a/components/resource-dict/load/resource_dictionary/vf-nf-code.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-nf-code", - "tags" : "vf-nf-code", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf-nf-code", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-nf-code" : "vf_nf_code" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vf_module_name.json b/components/resource-dict/load/resource_dictionary/vf_module_name.json deleted file mode 100644 index b416f529..00000000 --- a/components/resource-dict/load/resource_dictionary/vf_module_name.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf_module_name", - "tags" : "vf_module_name", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vf_module_name", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf_module_name" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json b/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json deleted file mode 100644 index b3485791..00000000 --- a/components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vfccustomizationuuid", - "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vfccustomizationuuid", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid", - "input-key-mapping" : { - "vfmodulecustomizationuuid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vfccustomizationuuid" : "vnf_customid" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json deleted file mode 100644 index 59f51516..00000000 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vfw_private_ip_0", - "tags" : "vfw_private_ip_0", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vfw_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_0" - } - }, - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vfw_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json deleted file mode 100644 index 6dda72f7..00000000 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vfw_private_ip_1", - "tags" : "vfw_private_ip_1", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vfw_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_1" - } - }, - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_1", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vfw_private_ip_1" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_2.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_2.json deleted file mode 100644 index 9e510647..00000000 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_2.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vfw_private_ip_2", - "tags" : "vfw_private_ip_2", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vfw_private_ip_2", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_2" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vm-type.json b/components/resource-dict/load/resource_dictionary/vm-type.json deleted file mode 100644 index e559f9b5..00000000 --- a/components/resource-dict/load/resource_dictionary/vm-type.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vm-type", - "tags" : "vm-type", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vm-type", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vm-type" : "vm_type" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnf-id.json b/components/resource-dict/load/resource_dictionary/vnf-id.json deleted file mode 100644 index 55c24b5f..00000000 --- a/components/resource-dict/load/resource_dictionary/vnf-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vnf-id", - "tags" : "vnf-id", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnf-id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vnf-id" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json b/components/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json deleted file mode 100644 index f6c3b814..00000000 --- a/components/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vnf-model-customization-uuid", - "tags" : "vnf-model-customization-uuid", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnf-model-customization-uuid", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vnf-model-customization-uuid" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnf-name.json b/components/resource-dict/load/resource_dictionary/vnf-name.json deleted file mode 100644 index 708030ee..00000000 --- a/components/resource-dict/load/resource_dictionary/vnf-name.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name" : "vnf-name", - "tags" : "vnf-name, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnf-name", - "type" : "string" - }, - "sources" : { - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id" - }, - "output-key-mapping" : { - "vnf-name" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnf_name.json b/components/resource-dict/load/resource_dictionary/vnf_name.json deleted file mode 100644 index 3164367c..00000000 --- a/components/resource-dict/load/resource_dictionary/vnf_name.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name" : "vnf_name", - "tags" : "vnf_name", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnf_name", - "type" : "string" - }, - "sources" : { - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id" - }, - "output-key-mapping" : { - "vnf_name" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json b/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json deleted file mode 100644 index 9eb94cff..00000000 --- a/components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vnfc-model-invariant-uuid", - "tags" : "vnfc-model-invariant-uuid", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnfc-model-invariant-uuid for vFW template", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vnfc-model-invariant-uuid" : "vfc_invariant_uuid" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vnfc-model-version.json b/components/resource-dict/load/resource_dictionary/vnfc-model-version.json deleted file mode 100644 index e4e66229..00000000 --- a/components/resource-dict/load/resource_dictionary/vnfc-model-version.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vnfc-model-version", - "tags" : "vnfc-model-version", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vnfc-model-version for vFW template", - "type" : "string" - }, - "sources" : { - "primary-db" : { - "type" : "source-primary-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vnfc-model-version" : "vnfc_model_version" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json deleted file mode 100644 index 9bef3c79..00000000 --- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vpg_private_ip_0", - "tags" : "vpg_private_ip_0", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vpg_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vpg_private_ip_0" - } - }, - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vpg_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vpg_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vpg_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vpg_private_ip_1.json deleted file mode 100644 index 23c42e0c..00000000 --- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vpg_private_ip_1", - "tags" : "vpg_private_ip_1", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vpg_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vpg_private_ip_1" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json deleted file mode 100644 index 52a4542c..00000000 --- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vsn_private_ip_0", - "tags" : "vsn_private_ip_0", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vsn_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vsn_private_ip_0" - } - }, - "primary-config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vsn_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vsn_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/load/resource_dictionary/vsn_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vsn_private_ip_1.json deleted file mode 100644 index 88750b25..00000000 --- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vsn_private_ip_1", - "tags" : "vsn_private_ip_1", - "updated-by" : "Singal, Kapil ", - "property" : { - "description" : "vsn_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vsn_private_ip_1" - } - } - } -} \ No newline at end of file diff --git a/components/resource-dict/pom.xml b/components/resource-dict/pom.xml deleted file mode 100644 index a3602ac9..00000000 --- a/components/resource-dict/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - 4.0.0 - - org.onap.ccsdk.apps.components - parent - 0.4.1-SNAPSHOT - ../parent - - org.onap.ccsdk.apps.controllerblueprints - resource-dict - Controller Blueprints Resource Dictionary - - - - org.onap.ccsdk.apps.controllerblueprints - core - - - org.jetbrains.kotlin - kotlin-test-junit - test - - - - - diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt deleted file mode 100644 index d141ed0c..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright © 2018 IBM. - * Modifications Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict - -import com.fasterxml.jackson.annotation.JsonFormat -import com.fasterxml.jackson.annotation.JsonProperty -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate -import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition -import java.io.Serializable -import java.util.* - -open class ResourceDefinition { - - @JsonProperty(value = "name", required = true) - lateinit var name: String - - @JsonProperty(value = "property", required = true) - lateinit var property: PropertyDefinition - - var tags: String? = null - - @JsonProperty(value = "updated-by") - lateinit var updatedBy: String - - @JsonProperty(value = "sources", required = true) - lateinit var sources: MutableMap -} - -open class ResourceAssignment { - - @JsonProperty(value = "name", required = true) - lateinit var name: String - - @JsonProperty(value = "property") - var property: PropertyDefinition? = null - - @JsonProperty("input-param") - var inputParameter: Boolean = false - - @JsonProperty("dictionary-name") - var dictionaryName: String? = null - - @JsonProperty("dictionary-source") - var dictionarySource: String? = null - - @JsonProperty("dependencies") - var dependencies: MutableList? = null - - @JsonProperty("version") - var version: Int = 0 - - @JsonProperty("status") - var status: String? = null - - @JsonProperty("message") - var message: String? = null - - @JsonProperty("updated-date") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - var updatedDate: Date? = null - - @JsonProperty("updated-by") - var updatedBy: String? = null - - override fun toString(): String { - return StringBuilder() - .append("[") - .append("name=", name) - .append(", dictionaryName=", dictionaryName) - .append(", dictionarySource=", dictionarySource) - .append("]") - .toString() - } -} - -/** - * Interface for Source Definitions (ex Input Source, - * Default Source, Database Source, Rest Sources, etc) - */ -interface ResourceSource : Serializable - - -open class ResourceSourceMapping { - lateinit var resourceSourceMappings: MutableMap -} diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt deleted file mode 100644 index aa06c9da..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict - -/** - * ResourceDictionaryConstants - * - * @author Brinda Santh - */ -object ResourceDictionaryConstants { - const val SOURCE_INPUT = "input" - const val SOURCE_DEFAULT = "default" - const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data" - const val SOURCE_PRIMARY_DB = "primary-db" - - const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary" - - const val PROPERTY_TYPE = "type" - const val PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping" - const val PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping" - const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies" - - const val PATH_RESOURCE_DEFINITION_TYPE = "resource_definition_types" -} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt deleted file mode 100644 index 2911ab26..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory - -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.format -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping - -/** - * ResourceSourceMappingFactory. - * - * @author Brinda Santh - */ -object ResourceSourceMappingFactory { - - private val resourceSourceMappings: MutableMap = hashMapOf() - - fun registerSourceMapping(sourceInstance: String, nodeTypeName: String) { - resourceSourceMappings[sourceInstance] = nodeTypeName - } - - fun getRegisterSourceMapping(sourceInstance: String): String { - return resourceSourceMappings[sourceInstance] - ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance)) - } - - fun getRegisterSourceMapping(): ResourceSourceMapping { - val resourceSourceMapping = ResourceSourceMapping() - resourceSourceMapping.resourceSourceMappings = resourceSourceMappings - return resourceSourceMapping - } -} - diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt deleted file mode 100644 index d71fbbf8..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service - -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import org.apache.commons.collections.CollectionUtils -import org.apache.commons.lang3.StringUtils -import org.apache.commons.lang3.text.StrBuilder -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.format -import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory -import java.io.Serializable - -/** - * ResourceAssignmentValidationService. - * - * @author Brinda Santh - */ -interface ResourceAssignmentValidationService : Serializable { - - @Throws(BluePrintException::class) - fun validate(resourceAssignments: List): Boolean -} - -/** - * ResourceAssignmentValidationServiceImpl. - * - * @author Brinda Santh - */ -open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService { - private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceImpl::class.java) - - open var resourceAssignmentMap: Map = hashMapOf() - open val validationMessage = StrBuilder() - - override fun validate(resourceAssignments: List): Boolean { - try { - validateSources(resourceAssignments) - validateTemplateNDictionaryKeys(resourceAssignments) - validateCyclicDependency(resourceAssignments) - if (StringUtils.isNotBlank(validationMessage)) { - throw BluePrintException("Resource Assignment Validation Failure") - } - } catch (e: Exception) { - throw BluePrintException("Resource Assignment Validation :" + validationMessage.toString(), e) - } - return true - } - - open fun validateSources(resourceAssignments: List) { - log.info("validating resource assignment sources") - // Check the Resource Assignment Source(Dynamic Instance) is valid. - resourceAssignments.forEach { resourceAssignment -> - try { - ResourceSourceMappingFactory.getRegisterSourceMapping(resourceAssignment.dictionarySource!!) - } catch (e: BluePrintException) { - validationMessage.appendln(e.message + format(" for resource assignment({})", resourceAssignment.name)) - } - } - } - - open fun validateTemplateNDictionaryKeys(resourceAssignments: List) { - - resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap() - - // Check the Resource Assignment has Duplicate Key Names - val duplicateKeyNames = resourceAssignments.groupBy { it.name } - .filter { it.value.size > 1 } - .map { it.key } - - if (duplicateKeyNames.isNotEmpty()) { - validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames)) - } - - // Check the Resource Assignment has Duplicate Dictionary Names - val duplicateDictionaryKeyNames = resourceAssignments.groupBy { it.dictionaryName } - .filter { it.value.size > 1 } - .map { it.key } - if (duplicateDictionaryKeyNames.isNotEmpty()) { - validationMessage.appendln(String.format("Duplicate Assignment Dictionary Keys (%s) is Present", duplicateDictionaryKeyNames)) - } - - // Collect all the dependencies as a single list - val dependenciesNames = resourceAssignments.mapNotNull { it.dependencies }.flatten() - - // Check all the dependencies keys have Resource Assignment mappings. - val notPresentDictionaries = dependenciesNames.filter { !resourceAssignmentMap.containsKey(it) }.distinct() - if (notPresentDictionaries.isNotEmpty()) { - validationMessage.appendln(String.format("No assignments for Dictionary Keys (%s)", notPresentDictionaries)) - } - - if (StringUtils.isNotBlank(validationMessage)) { - throw BluePrintException("Resource Assignment Validation Failure") - } - } - - open fun validateCyclicDependency(resourceAssignments: List) { - val startResourceAssignment = ResourceAssignment() - startResourceAssignment.name = "*" - - val topologySorting = TopologicalSortingUtils() - - resourceAssignmentMap.map { it.value }.map { resourceAssignment -> - if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { - resourceAssignment.dependencies!!.map { - log.info("Topological Graph link from {} to {}", it, resourceAssignment.name) - topologySorting.add(resourceAssignmentMap[it]!!, resourceAssignment) - } - } else { - topologySorting.add(startResourceAssignment, resourceAssignment) - } - } - - if (!topologySorting.isDag) { - val graph = getTopologicalGraph(topologySorting) - validationMessage.appendln("Cyclic Dependency :$graph") - } - } - - open fun getTopologicalGraph(topologySorting: TopologicalSortingUtils): String { - val s = StringBuilder() - val neighbors = topologySorting.getNeighbors() - - neighbors.forEach { v, vs -> - if (v.name == "*") { - s.append("\n * -> [") - for (resourceAssignment in vs) { - s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name - + "),") - } - s.append("]") - } else { - s.append("\n (" + v.dictionaryName + ":" + v.name + ") -> [") - for (resourceAssignment in vs) { - s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name - + "),") - } - s.append("]") - } - } - return s.toString() - } - - -} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt deleted file mode 100644 index 9541a7b8..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright © 2018 IBM. - * Modifications Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service - -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import com.fasterxml.jackson.databind.JsonNode -import com.google.common.base.Preconditions -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType -import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.apps.controllerblueprints.core.format -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition -import java.io.Serializable - -/** - * ResourceDefinitionValidationService. - * - * @author Brinda Santh - */ -interface ResourceDefinitionValidationService : Serializable { - - @Throws(BluePrintException::class) - fun validate(resourceDefinition: ResourceDefinition) - -} - -/** - * ResourceDefinitionValidationService. - * - * @author Brinda Santh - */ -open class ResourceDefinitionValidationServiceImpl(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService { - - private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDefinitionValidationService::class.java) - - override fun validate(resourceDefinition: ResourceDefinition) { - Preconditions.checkNotNull(resourceDefinition, "Failed to get Resource Definition") - log.trace("Validating Resource Dictionary Definition {}", resourceDefinition.name) - - resourceDefinition.sources.forEach { name, nodeTemplate -> - val sourceType = nodeTemplate.type - - val sourceNodeType = bluePrintRepoService.getNodeType(sourceType) - - // Validate Property Name, expression, values and Data Type - validateNodeTemplateProperties(nodeTemplate, sourceNodeType) - } - } - - - open fun validateNodeTemplateProperties(nodeTemplate: NodeTemplate, nodeType: NodeType) { - nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) } - } - - - open fun validatePropertyAssignments(nodeTypeProperties: MutableMap, - properties: MutableMap) { - properties.forEach { propertyName, propertyAssignment -> - val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName] - ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName)) - // Check and Validate if Expression Node - val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) - if (!expressionData.isExpression) { - checkPropertyValue(propertyDefinition, propertyName, propertyAssignment) - } else { - throw BluePrintException(format("property({}) of expression ({}) is not supported", - propertyName, propertyAssignment)) - } - } - } - - open fun checkPropertyValue(propertyDefinition: PropertyDefinition, propertyName: String, propertyAssignment: JsonNode) { - val propertyType = propertyDefinition.type - val isValid: Boolean - - if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) { - isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment) - - } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) { - - isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment) - } else { - bluePrintRepoService.getDataType(propertyType) - isValid = true - } - - check(isValid) { - throw BluePrintException(format("property({}) defined of type({}) is not compatable with the value ({})", - propertyName, propertyType, propertyAssignment)) - } - } -} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt deleted file mode 100644 index 747639c8..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils - -import com.att.eelf.configuration.EELFLogger -import org.apache.commons.collections.CollectionUtils -import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import com.att.eelf.configuration.EELFManager -import java.util.ArrayList -/** - * BulkResourceSequencingUtils. - * - * @author Brinda Santh - */ -object BulkResourceSequencingUtils { - private val log: EELFLogger = EELFManager.getInstance().getLogger(BulkResourceSequencingUtils::class.java) - - @JvmStatic - fun process(resourceAssignments: MutableList): List> { - val resourceAssignmentMap: MutableMap = hashMapOf() - val sequenceBatchResourceAssignment = ArrayList>() - log.info("Assignments ({})", resourceAssignments) - // Prepare Map - resourceAssignments.forEach { resourceAssignment -> - log.trace("Processing Key ({})", resourceAssignment.name) - resourceAssignmentMap.put(resourceAssignment.name, resourceAssignment) - } - - val startResourceAssignment = ResourceAssignment() - startResourceAssignment.name = "*" - - // Preepare Sorting Map - val topologySorting = TopologicalSortingUtils() - resourceAssignmentMap.forEach { _, resourceAssignment -> - if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { - for (dependency in resourceAssignment.dependencies!!) { - topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment) - } - } else { - topologySorting.add(startResourceAssignment, resourceAssignment) - } - } - - val sequencedResourceAssignments: MutableList = topologySorting.topSort()!! as MutableList - log.info("Sorted Sequenced Assignments ({})", sequencedResourceAssignments) - - var batchResourceAssignment: MutableList? = null - var batchAssignmentName: MutableList? = null - - // Prepare Sorting - sequencedResourceAssignments.forEachIndexed { index, resourceAssignment -> - - var previousResourceAssignment: ResourceAssignment? = null - - if (index > 0) { - previousResourceAssignment = sequencedResourceAssignments[index - 1] - } - - var dependencyPresence = false - if (batchAssignmentName != null && resourceAssignment.dependencies != null) { - dependencyPresence = CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.dependencies) - } - - log.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name, - batchAssignmentName, resourceAssignment.dependencies, dependencyPresence) - - if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null - && resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true) - && !dependencyPresence) { - batchResourceAssignment!!.add(resourceAssignment) - batchAssignmentName!!.add(resourceAssignment.name) - } else { - if (batchResourceAssignment != null) { - sequenceBatchResourceAssignment.add(batchResourceAssignment!!) - log.trace("Created old Set ({})", batchAssignmentName) - } - batchResourceAssignment = arrayListOf() - batchResourceAssignment!!.add(resourceAssignment) - - batchAssignmentName = arrayListOf() - batchAssignmentName!!.add(resourceAssignment.name) - } - - if (index == sequencedResourceAssignments.size - 1) { - log.trace("Created old Set ({})", batchAssignmentName) - sequenceBatchResourceAssignment.add(batchResourceAssignment!!) - } - } - log.info("Batched Sequence : ({})", sequenceBatchResourceAssignment) - - return sequenceBatchResourceAssignment - } - -} \ No newline at end of file diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt deleted file mode 100644 index 1aeda0ba..00000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils - -import com.att.eelf.configuration.EELFLogger -import com.att.eelf.configuration.EELFManager -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.node.NullNode -import org.apache.commons.collections.MapUtils -import org.apache.commons.lang3.StringUtils -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate -import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants -import java.io.File - - -object ResourceDictionaryUtils { - private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDictionaryUtils::class.java) - - @JvmStatic - fun populateSourceMapping(resourceAssignment: ResourceAssignment, - resourceDefinition: ResourceDefinition) { - - if (StringUtils.isBlank(resourceAssignment.dictionarySource)) { - - if (MapUtils.isNotEmpty(resourceDefinition.sources)) { - val source = findFirstSource(resourceDefinition.sources) - - // Populate and Assign First Source - if (StringUtils.isNotBlank(source)) { - // Set Dictionary Source - resourceAssignment.dictionarySource = source - } else { - resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT - } - log.info("auto map resourceAssignment : {}", resourceAssignment) - } else { - resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT - } - } - } - - @JvmStatic - fun findFirstSource(sources: Map): String? { - var source: String? = null - if (MapUtils.isNotEmpty(sources)) { - source = sources.keys.stream().findFirst().get() - } - return source - } - - @JvmStatic - fun assignInputs(data: JsonNode, context: MutableMap) { - log.trace("assignInputs from input JSON ({})", data.toString()) - data.fields().forEach { field -> - val valueNode: JsonNode = data.at("/".plus(field.key)) ?: NullNode.getInstance() - - val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(field.key) - log.trace("setting path ({}), values ({})", path, valueNode) - context[path] = valueNode - } - } - - fun getResourceAssignmentFromFile(filePath: String): List { - return JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java) - ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)") - } - - fun writeResourceDefinitionTypes(basePath: String, resourceDefinitionMap: Map) { - val typePath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) - .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json") - val resourceDefinitionContent = JacksonUtils.getJson(resourceDefinitionMap.toSortedMap(), true) - BluePrintFileUtils.writeDefinitionFile(typePath, resourceDefinitionContent) - } -} \ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java deleted file mode 100644 index 1ed306e2..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -public class ResourceDefinitionTest { - private EELFLogger log = EELFManager.getInstance().getLogger(ResourceDefinitionTest.class); - private String basePath = "load/resource_dictionary"; - - @Test - public void testDictionaryDefinitionInputSource(){ - - String fileName = basePath + "/input-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionDefaultSource(){ - - String fileName = basePath + "/default-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionDBSource(){ - - String fileName = basePath + "/primary-db-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for primary-db type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionMDSALSource(){ - String fileName = basePath + "/mdsal-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition); - } -} diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java deleted file mode 100644 index f11638e3..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory; - -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping; -import org.springframework.util.Assert; - -public class ResourceSourceMappingFactoryTest { - - @Test - public void testRegisterResourceMapping() { - - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest"); - - String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db"); - Assert.notNull(nodeTypeName, "Failed to get primary-db mapping"); - - ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping(); - Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping"); - Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings"); - - } - -} diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt deleted file mode 100644 index 191f568f..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service - -import com.att.eelf.configuration.EELFLogger -import org.junit.Assert -import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment -import com.att.eelf.configuration.EELFManager -import org.junit.Before -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils - -/** - * ResourceAssignmentValidationServiceTest. - * - * @author Brinda Santh - */ -class ResourceAssignmentValidationServiceTest { - private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceTest::class.java) - @Before - fun setUp() { - // Setup dummy Source Instance Mapping - ResourceDictionaryTestUtils.setUpResourceSourceMapping() - } - - @Test - fun testValidateSuccess() { - log.info("**************** testValidateSuccess *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - val result = resourceAssignmentValidator.validate(assignments!!) - Assert.assertTrue("Failed to Validate", result) - } - - @Test(expected = BluePrintException::class) - fun testValidateDuplicate() { - log.info(" **************** testValidateDuplicate *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - resourceAssignmentValidator.validate(assignments!!) - } - - @Test(expected = BluePrintException::class) - fun testValidateCyclic() { - log.info(" **************** testValidateCyclic *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - resourceAssignmentValidator.validate(assignments!!) - } -} \ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java deleted file mode 100644 index 7f040b2e..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService; -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition; - -public class ResourceDefinitionValidationServiceTest { - private String basePath = "load/model_type"; - private String dictionaryPath = "load/resource_dictionary"; - private BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath); - - @Test - public void testValidateSource() throws Exception { - - String inputFileName = dictionaryPath + "/input-source.json"; - testValidate(inputFileName); - - String dbFileName = dictionaryPath + "/primary-db-source.json"; - testValidate(dbFileName); - - String defaultFileName = dictionaryPath + "/default-source.json"; - testValidate(defaultFileName); - - String restFileName = dictionaryPath + "/mdsal-source.json"; - testValidate(restFileName); - } - - private void testValidate(String fileName) throws Exception { - - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); - - ResourceDefinitionValidationService resourceDictionaryValidationService = - new ResourceDefinitionValidationServiceImpl(bluePrintRepoFileService); - resourceDictionaryValidationService.validate(resourceDefinition); - Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition); - } -} diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java deleted file mode 100644 index a2c2310b..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment; -import java.util.List; -/** - * BulkResourceSequencingUtils. - * - * @author Brinda Santh - */ -public class BulkResourceSequencingUtilsTest { - - @Test - public void testProcess(){ - List assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); - Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments); - BulkResourceSequencingUtils.process(assignments); - } -} \ No newline at end of file diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java deleted file mode 100644 index 92bfa730..00000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils; - - -import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants; -import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate; -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.util.HashMap; -import java.util.Map; -/** - * ResourceDictionaryUtilsTest. - * - * @author Brinda Santh - */ -public class ResourceDictionaryUtilsTest { - private static final EELFLogger log = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class); - - @Test - public void testPopulateSourceMapping() { - - ResourceAssignment resourceAssignment = new ResourceAssignment(); - resourceAssignment.setName("sample-assignment"); - ResourceDefinition resourceDefinition = new ResourceDefinition(); - Map sources = new HashMap<>(); - resourceDefinition.setSources(sources); - // To Check Empty Source - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, resourceAssignment.getDictionarySource()); - - // To Check First Source - resourceAssignment.setDictionarySource(null); - sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate()); - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource()); - - // To Check Assigned Source - resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_PRIMARY_DB); - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_PRIMARY_DB, resourceAssignment.getDictionarySource()); - - } - - @Test - public void testFindFirstSource() { - //To check if Empty Source - Map sources = new HashMap<>(); - String firstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertNull("Source populated, which is not expected.", firstSource); - - // TO check the first Source - sources.put(ResourceDictionaryConstants.SOURCE_INPUT, new NodeTemplate()); - String inputFirstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource); - - // TO check the multiple Source - sources.put(ResourceDictionaryConstants.SOURCE_PRIMARY_DB, new NodeTemplate()); - String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource); - - } - - @Test - public void testAssignInputs() { - JsonNode data = JacksonUtils.Companion.jsonNodeFromClassPathFile("data/resource-assignment-input.json"); - Map context = new HashMap<>(); - ResourceDictionaryUtils.assignInputs(data, context); - String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue"); - log.info("populated context {}", context); - Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path)); - - } - - -} diff --git a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt deleted file mode 100644 index 74ef6d6d..00000000 --- a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils - -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory - -object ResourceDictionaryTestUtils { - - @JvmStatic - fun setUpResourceSourceMapping() { - ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db") - ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") - ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") - ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest") - } -} \ No newline at end of file diff --git a/components/resource-dict/src/test/resources/data/resource-assignment-input.json b/components/resource-dict/src/test/resources/data/resource-assignment-input.json deleted file mode 100644 index d79c9068..00000000 --- a/components/resource-dict/src/test/resources/data/resource-assignment-input.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "intValue" : 1, - "floatValue" : 1.34, - "booleanValue" : true, - "stringValue" : "sample-String", - "timeValue" : "2018-09-29", - "arrayStringValue" : ["one", "two"], - "mapValue" : {"profile_name1":"profile_name1", - "profile_name2":"profile_name2"} -} \ No newline at end of file diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json deleted file mode 100644 index 98cd1444..00000000 --- a/components/resource-dict/src/test/resources/validation/cyclic.json +++ /dev/null @@ -1,111 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "managed-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "primary-db", - "dependencies": [ - "bundle-mac", - "managed-ip1" - ] - } -] diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json deleted file mode 100644 index 7581ff64..00000000 --- a/components/resource-dict/src/test/resources/validation/duplicate.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "primary-db", - "dependencies": [ - "bundle-mac" - ] - } -] diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json deleted file mode 100644 index 486251d6..00000000 --- a/components/resource-dict/src/test/resources/validation/success.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "primary-config-data", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "managed-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "primary-config-data", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "primary-db", - "dependencies": [ - "bundle-mac" - ] - } -] -- cgit 1.2.3-korg