aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
authorbiniek <lukasz.biniek@nokia.com>2018-10-09 15:05:08 +0200
committerbiniek <lukasz.biniek@nokia.com>2018-10-15 10:24:37 +0200
commit3d32d2b9df968ac7a39440226065ab76d7326eef (patch)
tree6997ff299c5d65aec29c5bd6d4a4bd26cff9e42c /mso-api-handlers/mso-api-handler-infra/src/main
parent16e9937d0b30deb16210cbeec88f4bbd4642d11e (diff)
correlationId is now read from userParams
Change-Id: I92c6caad1370fde7daf067addbf39e45469e08aa Issue-ID: SO-1116 Signed-off-by: biniek <lukasz.biniek@nokia.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index fb6076e1a4..8047893bb4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -111,7 +111,7 @@ public class ServiceInstances {
private static String NAME = "name";
private static String VALUE = "value";
private static final String SAVE_TO_DB = "save instance to db";
-
+
@Autowired
private Environment env;
@@ -738,17 +738,16 @@ public class ServiceInstances {
if(sir.getNetworkInstanceId () != null){
networkId = sir.getNetworkInstanceId ();
}
-
- if (sir.getCorrelationId() != null) {
- correlationId = sir.getCorrelationId();
- }
- try{
- infraActiveRequestsClient.save(currentActiveReq);
- }catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+ correlationId = getCorrelationId(sir);
+
+ try{
+ infraActiveRequestsClient.save(currentActiveReq);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
- }
+ }
if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
aLaCarte = true;
@@ -761,6 +760,14 @@ public class ServiceInstances {
serviceInstanceType,vnfType, vfModuleType,networkType, apiVersion, aLaCarte, requestUri, null, requestScope, sir);
}
+ private String getCorrelationId(ServiceInstancesRequest sir) {
+ return Optional.of(sir)
+ .map(ServiceInstancesRequest::getRequestDetails)
+ .map(RequestDetails::getRequestParameters)
+ .map(parameters -> parameters.getUserParamValue("pnfId"))
+ .orElse("");
+ }
+
private String deriveRequestScope(Actions action, ServiceInstancesRequest sir, String requestUri) {
if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){
return (ModelType.vnf.name());
@@ -1641,9 +1648,9 @@ public class ServiceInstances {
if(sir.getConfigurationId() != null){
configurationId = sir.getConfigurationId();
}
- if (sir.getCorrelationId() != null) {
- correlationId = sir.getCorrelationId();
- }
+
+ correlationId = getCorrelationId(sir);
+
try{
infraActiveRequestsClient.save(currentActiveReq);
}catch(Exception e){