aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
authormarcinrzepeckiwroc <marcin.rzepecki@nokia.com>2020-12-03 15:14:55 +0100
committerIkram Ikramullah <ikram@research.att.com>2020-12-21 17:32:52 +0000
commitf3821edf3122600c99658c5e6c11234199f04173 (patch)
tree2192fa2578d12095a58619aab1d51c412d3ecdb9 /vid-app-common
parenteb2b6b31d0e90c359a63befe1a23ba066df62d1c (diff)
Fix for VID-927: Generated service instance name is not visible in Instantiation status table.
If user not provide Instance Name during set a new service instance, vid generate name base on service model name (if the name is not unique, it will append the suffix) Issue-ID: VID-927 Signed-off-by: marcinrzepeckiwroc <marcin.rzepecki@nokia.com> Change-Id: I7d51c0d4b0b2c0765ba9f3a7302c591f19438dc4
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt12
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json4
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json4
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json4
4 files changed, 16 insertions, 8 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
index 17948d4b6..b69f76dfe 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
@@ -189,11 +189,13 @@ class MsoRequestBuilder
}
private fun generateServiceName(jobId: UUID?, payload: ServiceInstantiation, optimisticUniqueServiceInstanceName: String): String? {
- var serviceInstanceName: String? = null
- if (StringUtils.isNotEmpty(optimisticUniqueServiceInstanceName)) {
- serviceInstanceName = peekServiceName(jobId, payload, optimisticUniqueServiceInstanceName)
+ var serviceInstanceName: String
+ if (StringUtils.isEmpty(optimisticUniqueServiceInstanceName)) {
+ serviceInstanceName = payload.modelInfo.modelName
+ } else {
+ serviceInstanceName = optimisticUniqueServiceInstanceName
}
- return serviceInstanceName
+ return peekServiceName(jobId, payload, serviceInstanceName)
}
private fun peekServiceName(jobId: UUID?, payload: ServiceInstantiation, optimisticUniqueServiceInstanceName: String): String {
@@ -202,7 +204,7 @@ class MsoRequestBuilder
if (isNameFreeInAai(optimisticUniqueServiceInstanceName, ResourceType.SERVICE_INSTANCE)) {
serviceInstanceName = optimisticUniqueServiceInstanceName
} else {
- serviceInstanceName = asyncInstantiationBL.getUniqueName(payload.instanceName, ResourceType.SERVICE_INSTANCE)
+ serviceInstanceName = asyncInstantiationBL.getUniqueName(optimisticUniqueServiceInstanceName, ResourceType.SERVICE_INSTANCE)
}//otherwise we used the original service instance name (from payload) to get a new unique name from DB and AAI
//update serviceInfo with new name if needed
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json
index 4c8b4cd96..967a464c3 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json
@@ -18,6 +18,7 @@
"globalSubscriberId": "{some subscriber id}"
},
"requestInfo": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"source": "VID",
"suppressRollback": false,
@@ -28,6 +29,7 @@
"aLaCarte": false,
"userParams": [{
"service": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"modelInfo": {
"modelType": "service",
"modelName": "MOW AVPN vMX BV vPE 1 Service",
@@ -97,4 +99,4 @@
]
}
}
-} \ No newline at end of file
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
index 8676d53d2..1d5188eca 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
@@ -18,6 +18,7 @@
"globalSubscriberId": "{some subscriber id}"
},
"requestInfo": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"source": "VID",
"suppressRollback": false,
@@ -28,6 +29,7 @@
"aLaCarte": false,
"userParams": [{
"service": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"modelInfo": {
"modelType": "service",
"modelName": "MOW AVPN vMX BV vPE 1 Service",
@@ -95,4 +97,4 @@
}]
}
}
-} \ No newline at end of file
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
index 22ac8951c..8345efa18 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
@@ -18,6 +18,7 @@
"globalSubscriberId": "{some subscriber id}"
},
"requestInfo": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"source": "VID",
"suppressRollback": false,
@@ -28,6 +29,7 @@
"aLaCarte": false,
"userParams": [{
"service": {
+ "instanceName": "MOW AVPN vMX BV vPE 1 Service",
"modelInfo": {
"modelType": "service",
"modelName": "MOW AVPN vMX BV vPE 1 Service",
@@ -66,4 +68,4 @@
}]
}
}
-} \ No newline at end of file
+}