diff options
author | Dan Timoney <dtimoney@att.com> | 2019-01-22 14:16:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-22 14:16:21 +0000 |
commit | 3b8508aac9e03dc0c8d870a5c7a76ba08eb80242 (patch) | |
tree | fd748d12d5f34022a23c3fc47fbabdebb0ff84ef | |
parent | fca89f6561e95eea0a499af8b304b8998ff37331 (diff) | |
parent | 664fb6f4ddf9f57baec4a5b27363aef57817b95b (diff) |
Merge "Resource Resolution Service: Source Rest"
40 files changed, 204 insertions, 82 deletions
diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json index f9ef9eee..51db5f51 100644 --- a/components/core/src/test/resources/dictionary/dictionary_schema.json +++ b/components/core/src/test/resources/dictionary/dictionary_schema.json @@ -54,7 +54,7 @@ "aai": {
"type": "any"
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"path": {
@@ -188,7 +188,7 @@ }
}
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"names": {
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json index 13847bbb..4484d550 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json +++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json @@ -667,7 +667,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -982,7 +982,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1007,7 +1007,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1032,7 +1032,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1057,7 +1057,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1082,7 +1082,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1462,7 +1462,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1777,7 +1777,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1802,7 +1802,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1827,7 +1827,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1852,7 +1852,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1877,7 +1877,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1950,7 +1950,7 @@ }, "input-param": false, "dictionary-name": "vfw_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -1975,7 +1975,7 @@ }, "input-param": false, "dictionary-name": "vsn_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2050,7 +2050,7 @@ }, "input-param": false, "dictionary-name": "vpg_private_ip_0", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2284,7 +2284,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2574,7 +2574,7 @@ }, "input-param": false, "dictionary-name": "image_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2625,7 +2625,7 @@ }, "input-param": false, "dictionary-name": "key_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2650,7 +2650,7 @@ }, "input-param": false, "dictionary-name": "pub_key", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2675,7 +2675,7 @@ }, "input-param": false, "dictionary-name": "onap_private_net_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2700,7 +2700,7 @@ }, "input-param": false, "dictionary-name": "onap_private_subnet_id", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -2848,7 +2848,7 @@ }, "input-param": false, "dictionary-name": "vfw_private_ip_1", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" @@ -3250,7 +3250,7 @@ }, "input-param": false, "dictionary-name": "vnf-name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json index c457086c..67d2a914 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -27,7 +27,7 @@ "type": "string" }, "dictionary-name": "vnf_name", - "dictionary-source": "mdsal", + "dictionary-source": "primary-config-data", "dependencies": [ "service-instance-id", "vnf-id" diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json index 557f6efc..c8871214 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -38,7 +38,7 @@ "type": "string" }, "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json index 37ef5ae1..57a0ef39 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json index 1f1b3e65..6eb8d929 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json index 300a71f1..67661ecd 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json @@ -7,7 +7,7 @@ }, "updated-by": "brindasanth@onap.com", "sources": { - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json index bb70fe3c..3dd74f7d 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json index d38ceb49..6cb22c3d 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json index ce6c2f2a..fe172caf 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json @@ -10,7 +10,7 @@ "input": { "type": "source-input" }, - "mdsal": { + "primary-config-data": { "type": "source-rest", "properties": { "type": "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json index 5834dd49..c0f78ac5 100644 --- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json @@ -11,7 +11,7 @@ },
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json index 25464d3f..75d7ca05 100644 --- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json @@ -7,7 +7,7 @@ },
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json index 71a4df2c..4c227f91 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json index 481edae8..0df08c00 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json index 89b3dc1c..4c0320ac 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json index c55f1c18..e9d8a3b4 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json @@ -7,7 +7,7 @@ "type" : "string" }, "sources" : { - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json index 13d89993..586aa0c9 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json index fcd6d8d5..1fe47971 100755 --- a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json +++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json @@ -12,7 +12,7 @@ "properties" : { } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json index b38986a4..fa72e5dc 100644 --- a/components/resource-dict/load/resource_dictionary/mdsal-source.json +++ b/components/resource-dict/load/resource_dictionary/mdsal-source.json @@ -7,7 +7,7 @@ },
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
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 index 7c8d4f4e..59f51516 100644 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vfw_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", 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 index 0553b8c3..6dda72f7 100644 --- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json +++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json @@ -13,7 +13,7 @@ "key" : "vfw_private_ip_1" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", diff --git a/components/resource-dict/load/resource_dictionary/vnf-name.json b/components/resource-dict/load/resource_dictionary/vnf-name.json index 47371d18..708030ee 100644 --- a/components/resource-dict/load/resource_dictionary/vnf-name.json +++ b/components/resource-dict/load/resource_dictionary/vnf-name.json @@ -7,7 +7,7 @@ "type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vnf_name.json b/components/resource-dict/load/resource_dictionary/vnf_name.json index 4617a264..3164367c 100644 --- a/components/resource-dict/load/resource_dictionary/vnf_name.json +++ b/components/resource-dict/load/resource_dictionary/vnf_name.json @@ -7,7 +7,7 @@ "type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
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 index 912cfb9a..9bef3c79 100644 --- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vpg_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", 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 index bf987382..52a4542c 100644 --- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json +++ b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json @@ -13,7 +13,7 @@ "key" : "vsn_private_ip_0" } }, - "mdsal" : { + "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", 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 index 0004b02f..aa06c9da 100644 --- 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 @@ -24,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict object ResourceDictionaryConstants { const val SOURCE_INPUT = "input" const val SOURCE_DEFAULT = "default" - const val SOURCE_MDSAL = "mdsal" + 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" 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 index 3f5aef43..f11638e3 100644 --- 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 @@ -28,7 +28,7 @@ public class ResourceSourceMappingFactoryTest { ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest");
String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");
Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");
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 index 50e5c329..74ef6d6d 100644 --- 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 @@ -25,6 +25,6 @@ object ResourceDictionaryTestUtils { ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db")
ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
- ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")
+ ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest")
}
}
\ 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 index 7e6472f5..98cd1444 100644 --- a/components/resource-dict/src/test/resources/validation/cyclic.json +++ b/components/resource-dict/src/test/resources/validation/cyclic.json @@ -29,7 +29,7 @@ "required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@ "required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@ "type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@ "type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@ "type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json index 28ab71fc..7581ff64 100644 --- a/components/resource-dict/src/test/resources/validation/duplicate.json +++ b/components/resource-dict/src/test/resources/validation/duplicate.json @@ -29,7 +29,7 @@ "required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@ "required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@ "type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@ "type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@ "type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json index 5d0e8980..486251d6 100644 --- a/components/resource-dict/src/test/resources/validation/success.json +++ b/components/resource-dict/src/test/resources/validation/success.json @@ -29,7 +29,7 @@ "required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@ "required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@ "type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@ "type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@ "type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt index e05261d8..f1a4dbb0 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt @@ -17,24 +17,146 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor +import com.fasterxml.jackson.databind.node.ArrayNode +import com.fasterxml.jackson.databind.node.JsonNodeFactory +import com.fasterxml.jackson.databind.node.NullNode +import com.fasterxml.jackson.databind.node.ObjectNode +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.RestResourceSource +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService +import org.onap.ccsdk.apps.controllerblueprints.core.* +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.ResourceDictionaryConstants +import org.slf4j.LoggerFactory import org.springframework.stereotype.Service /** * SimpleRestResourceAssignmentProcessor * - * @author Brinda Santh + * @author Kapil Singal */ -@Service("resource-assignment-processor-mdsal") -open class SimpleRestResourceAssignmentProcessor : ResourceAssignmentProcessor() { +@Service("resource-assignment-processor-primary-config-data") +open class SimpleRestResourceAssignmentProcessor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService) + : ResourceAssignmentProcessor() { + + private val logger = LoggerFactory.getLogger(SimpleRestResourceAssignmentProcessor::class.java) override fun getName(): String { - return "resource-assignment-processor-mdsal" + return "resource-assignment-processor-primary-config-data" } - override fun process(executionRequest: ResourceAssignment) { + override fun process(resourceAssignment: ResourceAssignment) { + try { + validate(resourceAssignment) + + // Check if It has Input + val value = raRuntimeService.getInputValue(resourceAssignment.name) + if (value != null && value !is NullNode) { + logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)") + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value) + } else { + val dName = resourceAssignment.dictionaryName + val dSource = resourceAssignment.dictionarySource + val resourceDefinition = resourceDictionaries[dName] + ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName") + val resourceSource = resourceDefinition.sources[dSource] + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") + val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " } + val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, RestResourceSource::class.java) + + val urlPath = checkNotNull(sourceProperties.urlPath) { "failed to get request urlPath for $dName under $dSource properties" } + val path = nullToEmpty(sourceProperties.path) + val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" } + + logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})") + + val restClientService = blueprintRestLibPropertyService.blueprintWebClientService("primary-config-data") + val response = restClientService.getResource(urlPath, String::class.java) + if (response.isNotBlank()) { + logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)") + } else { + populateResource(resourceAssignment, sourceProperties, response, path) + } + } + // Check the value has populated for mandatory case + ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) + } catch (e: Exception) { + ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) + } } - override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { + @Throws(BluePrintProcessorException::class) + private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource, restResponse: String, path: String) { + val dName = resourceAssignment.dictionaryName + val dSource = resourceAssignment.dictionarySource + val type = nullToEmpty(resourceAssignment.property?.type) + lateinit var entrySchemaType: String + + val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) { "failed to get output-key-mappings for $dName under $dSource properties" } + logger.info("Response processing type($type)") + + val responseNode = checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) { "Failed to find path ($path) in response ($restResponse)" } + logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)") + + + when (type) { + in BluePrintTypes.validPrimitiveTypes() -> { + logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)") + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, responseNode) + } + in BluePrintTypes.validCollectionTypes() -> { + // Array Types + entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" } + val arrayNode = responseNode as ArrayNode + + if (entrySchemaType !in BluePrintTypes.validPrimitiveTypes()) { + val responseArrayNode = responseNode.toList() + for (responseSingleJsonNode in responseArrayNode) { + val arrayChildNode = JsonNodeFactory.instance.objectNode() + outputKeyMapping.map { + val responseKeyValue = responseSingleJsonNode.get(it.key) + val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key) + logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})") + JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, arrayChildNode) + } + arrayNode.add(arrayChildNode) + } + } + logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)") + // Set the List of Complex Values + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode) + } + else -> { + // Complex Types + val objectNode = responseNode as ObjectNode + outputKeyMapping.map { + val responseKeyValue = responseNode.get(it.key) + val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key) + logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})") + JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode) + } + + logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)") + // Set the List of Complex Values + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode) + } + } + } + + @Throws(BluePrintProcessorException::class) + private fun validate(resourceAssignment: ResourceAssignment) { + checkNotEmptyOrThrow(resourceAssignment.name, "resource assignment template key is not defined") + checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})") + checkEqualsOrThrow(ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA, resourceAssignment.dictionarySource) { + "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA} but it is ${resourceAssignment.dictionarySource}" + } + checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})") } + + override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + } + + }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index 9a846d69..ef69eb51 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -65,7 +65,7 @@ class ResourceResolutionServiceTest { fun testRegisteredSource() { val sources = resourceResolutionService.registeredResourceSources() assertNotNull(sources, "failed to get registered sources") - assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "mdsal")), "failed to get registered sources") + assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "primary-config-data")), "failed to get registered sources") } @Test diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties index e574778e..1a90df28 100755 --- a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties +++ b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties @@ -49,7 +49,7 @@ spring.jpa.hibernate.ddl-auto=none spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect # Load Resource Source Mappings -resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability +resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability # Controller Blueprints Core Configuration controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy controllerblueprints.blueprintArchivePath=/etc/blueprints/archive diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties index 91792394..8d4dd581 100755 --- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties +++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties @@ -51,7 +51,7 @@ spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect # Load Resource Source Mappings -resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability +resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability # Controller Blueprints Core Configuration controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties index 1fafd8bc..13b2aa75 100755 --- a/ms/controllerblueprints/application/src/test/resources/application.properties +++ b/ms/controllerblueprints/application/src/test/resources/application.properties @@ -33,7 +33,7 @@ swagger.contact.url=www.onap.com swagger.contact.email=brindasanth@onap.com
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index 24cb23a1..1c2c1c08 100755 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO logging.level.org.hibernate.SQL=warn logging.level.org.hibernate.type.descriptor.sql=debug # Load Resource Source Mappings -resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability +resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability # Controller Blueprints Core Configuration controllerblueprints.blueprintDeployPath=./target/blueprints/deploy controllerblueprints.blueprintArchivePath=./target/blueprints/archive diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json index 1c81b74d..3ed188b9 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json @@ -56,7 +56,7 @@ "required": true
},
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": []
}
]
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json index 42978f84..2e48b6d8 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -243,7 +243,7 @@ },
"input-param": false,
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
@@ -314,7 +314,7 @@ },
"input-param": false,
"dictionary-name": "sample-licenses",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index 66f18f89..6937c719 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -242,7 +242,7 @@ }, "input-param" : false, "dictionary-name" : "sample-mdsal-source", - "dictionary-source" : "mdsal", + "dictionary-source" : "primary-config-data", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { @@ -304,7 +304,7 @@ }, "input-param" : false, "dictionary-name" : "sample-licenses", - "dictionary-source" : "mdsal", + "dictionary-source" : "primary-config-data", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { |