summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
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){