aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java31
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java65
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java53
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java6
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java5
17 files changed, 186 insertions, 134 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index 486b53cf8a..13d736e747 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -813,3 +813,5 @@ VALUES
('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
+
+UPDATE rainy_day_handler_macro SET SERVICE_ROLE = '*' WHERE SERVICE_ROLE IS null;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
new file mode 100644
index 0000000000..8fe3caf88f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS SERVICE_ROLE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index f65f521605..a955a2c3ce 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -87,7 +87,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetRainyDayHandler_Regex() {
RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
- "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.");
+ "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.", "*");
Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@@ -95,7 +95,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetRainyDayHandler__Encoding_Regex() {
RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
"*", "*", "*",
- "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found");
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found",
+ "*");
Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 58b2983f82..32c51293c2 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -184,8 +184,8 @@ VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
'testVnfcCustomizationDescription',
'2018-07-17 14:05:08');
-INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`)
-VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.');
+INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`, `SERVICE_ROLE`)
+VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.','*');
INSERT INTO `cvnfc_customization`
(`id`,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 999d27335b..6a42456715 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -40,6 +40,10 @@ public class AuditStackService {
private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
+ private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
+
+ private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
+
@Autowired
public Environment env;
@@ -53,41 +57,40 @@ public class AuditStackService {
private AuditQueryStackService auditQueryStack;
@PostConstruct
- public void auditAddAAIInventory() throws Exception {
+ public void auditAddAAIInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditCreateStack::executeExternalTask).open();
}
}
@PostConstruct
- public void auditDeleteAAIInventory() throws Exception {
+ public void auditDeleteAAIInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditDeleteStack::executeExternalTask).open();
}
}
@PostConstruct
- public void auditQueryInventory() throws Exception {
+ public void auditQueryInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditQueryStack::executeExternalTask).open();
}
}
- protected ExternalTaskClient createExternalTaskClient() throws Exception {
+ protected ExternalTaskClient createExternalTaskClient() {
ClientRequestInterceptor interceptor = createClientRequestInterceptor();
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- return client;
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000)
+ .backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
}
protected ClientRequestInterceptor createClientRequestInterceptor() {
@@ -97,13 +100,11 @@ public class AuditStackService {
} catch (IllegalStateException | GeneralSecurityException e) {
logger.error("Error Decrypting Password", e);
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- return interceptor;
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
}
protected int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC));
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index fd2054c3d0..09a5424d47 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -144,9 +144,20 @@ public class ExecuteBuildingBlockRainyDay {
// keep default workStep value
}
+ String serviceRole = ASTERISK;
+ try {
+ serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
+ .getModelInfoServiceInstance().getServiceRole();
+ if (serviceRole == null || serviceRole.isEmpty()) {
+ serviceRole = ASTERISK;
+ }
+ } catch (Exception ex) {
+ // keep default serviceRole value
+ }
+
RainyDayHandlerStatus rainyDayHandlerStatus;
rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType,
- errorCode, workStep, errorMessage);
+ errorCode, workStep, errorMessage, serviceRole);
if (rainyDayHandlerStatus == null) {
handlingCode = "Abort";
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 80373eb760..18e08917ed 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -105,7 +105,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
@@ -128,7 +128,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage");
+ "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
assertEquals(5, delegateExecution.getVariable("maxRetries"));
@@ -141,7 +141,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
vnf.setVnfType("vnft1");
delegateExecution.setVariable("aLaCarte", true);
doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
delegateExecution.setVariable("suppressRollback", false);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -152,7 +152,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void queryRainyDayTableExceptionTest() {
doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class),
+ isA(String.class));
delegateExecution.setVariable("aLaCarte", true);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
delegateExecution.setVariable("suppressRollback", false);
@@ -178,7 +179,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
@@ -203,7 +204,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -229,7 +230,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -255,7 +256,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -272,4 +273,52 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
}
+ @Test
+ public void queryRainyDayTableServiceRoleNotDefined() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("sr1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Rollback");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "sr1");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableServiceRoleNC() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("NETWORK-COLLECTION");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("ActivateServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Abort");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "NETWORK-COLLECTION");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index 554c794e3e..15572f2b39 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -216,7 +216,7 @@ public class InstanceManagement {
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
- } catch (IOException e) {
+ } catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -243,7 +243,7 @@ public class InstanceManagement {
return recipeLookupResult;
}
- private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) throws IOException {
+ private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 7bd7f95286..3c4c90cc37 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -91,7 +91,7 @@ public class TasksHandler {
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId, @PathParam("version") String version)
throws ApiException {
- Response responseBack = null;
+
String apiVersion = version.substring(1);
// Prepare the query string to /task interface
@@ -159,60 +159,49 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
TasksGetResponse trr = new TasksGetResponse();
List<TaskList> taskList = new ArrayList<>();
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
- String respBody = respHandler.getResponseBody();
- if (respBody != null) {
- JSONArray data = new JSONArray(respBody);
+ String respBody = respHandler.getResponseBody();
+ if ((bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) && (null != respBody)) {
- for (int i = 0; i < data.length(); i++) {
- JSONObject taskEntry = data.getJSONObject(i);
- String id = taskEntry.getString("id");
- if (taskId != null && !taskId.equals(id)) {
- continue;
- }
- // Get variables info for each task ID
- TaskList taskListEntry = null;
- taskListEntry = getTaskInfo(id);
-
- taskList.add(taskListEntry);
+ JSONArray data = new JSONArray(respBody);
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
}
- trr.setTaskList(taskList);
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ taskListEntry = getTaskInfo(id);
+
+ taskList.add(taskListEntry);
+
}
+ trr.setTaskList(taskList);
} else {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
String jsonResponse = null;
@@ -223,14 +212,10 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
}
return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
@@ -250,10 +235,8 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException validateException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw validateException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
ResponseHandler respHandler = new ResponseHandler(getResponse, requestClient.getType());
int bpelStatus = respHandler.getStatus();
@@ -264,14 +247,10 @@ public class TasksHandler {
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
ErrorCode.AvailabilityError).build();
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo)
+ .build();
-
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
- throw bpmnFailureException;
}
} else {
@@ -279,20 +258,15 @@ public class TasksHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
}
return taskList;
}
- private TaskList buildTaskList(String taskId, String respBody) throws JSONException {
+ private TaskList buildTaskList(String taskId, String respBody) {
TaskList taskList = new TaskList();
JSONObject variables = new JSONObject(respBody);
@@ -317,7 +291,7 @@ public class TasksHandler {
return taskList;
}
- private String getOptVariableValue(JSONObject variables, String name) throws JSONException {
+ private String getOptVariableValue(JSONObject variables, String name) {
String variableEntry = variables.optString(name);
String value = "";
if (!variableEntry.isEmpty()) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index b5b548a266..e11732ddc4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.infra.rest.handler;
import java.io.IOException;
import java.net.URL;
import java.sql.Timestamp;
-import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import javax.ws.rs.container.ContainerRequestContext;
import org.apache.http.HttpStatus;
@@ -63,7 +63,7 @@ public abstract class AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(AbstractRestHandler.class);
- public static final String conflictFailMessage = "Error: Locked instance - This %s (%s) "
+ public static final String CONFLICT_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
@@ -95,22 +95,19 @@ public abstract class AbstractRestHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- ValidateException validateException =
- new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
- HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
+ throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
}
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq)
throws ApiException {
return duplicateCheck(action, instanceIdMap, startTime, instanceName, requestScope, currentActiveReq);
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
@@ -134,19 +131,19 @@ public abstract class AbstractRestHandler {
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
throws RequestDbFailureException {
- if (aq != null) {
- if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
- aq.setStatusMessage(errorMessage);
- aq.setProgress(100L);
- aq.setRequestStatus(status.toString());
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- aq.setEndTime(endTimeStamp);
- try {
- infraActiveRequestsClient.updateInfraActiveRequests(aq);
- } catch (Exception e) {
- logger.error("Error updating status", e);
- }
+ if ((aq != null) && ((status == Status.FAILED) || (status == Status.COMPLETE))) {
+
+ aq.setStatusMessage(errorMessage);
+ aq.setProgress(100L);
+ aq.setRequestStatus(status.toString());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setEndTime(endTimeStamp);
+ try {
+ infraActiveRequestsClient.updateInfraActiveRequests(aq);
+ } catch (Exception e) {
+ logger.error("Error updating status", e);
}
+
}
}
@@ -178,15 +175,15 @@ public abstract class AbstractRestHandler {
selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
} catch (Exception e) {
selfLinkUrl = Optional.empty(); // ignore
- logger.info(e.getMessage());
+ logger.error(e.getMessage());
}
return selfLinkUrl;
}
/**
- * @param vfmoduleInstanceId
+ * @param instanceId
* @param requestId
- * @param response
+ * @param requestContext
*/
public ServiceInstancesResponse createResponse(String instanceId, String requestId,
ContainerRequestContext requestContext) {
@@ -202,13 +199,13 @@ public abstract class AbstractRestHandler {
return response;
}
- public void checkDuplicateRequest(HashMap<String, String> instanceIdMap, ModelType modelType, String instanceName,
+ public void checkDuplicateRequest(Map<String, String> instanceIdMap, ModelType modelType, String instanceName,
String requestId) throws RequestConflictedException {
InfraActiveRequests conflictedRequest =
infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, modelType.toString());
if (conflictedRequest != null && !conflictedRequest.getRequestId().equals(requestId)) {
- throw new RequestConflictedException(String.format(conflictFailMessage, modelType.toString(), instanceName,
- conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
+ throw new RequestConflictedException(String.format(CONFLICT_FAIL_MESSAGE, modelType.toString(),
+ instanceName, conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
}
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
index 47f8c6b50e..5a8e2e2f6c 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -33,7 +33,7 @@ public interface InfraActiveRequestsRepositoryCustom {
public InfraActiveRequests getRequestFromInfraActive(String requestId);
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope);
public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index d8c7c8f971..13ca33c2cf 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -152,7 +152,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
* java.lang.String, java.lang.String)
*/
@Override
- public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap,
+ public InfraActiveRequests checkInstanceNameDuplicate(final Map<String, String> instanceIdMap,
final String instanceName, final String requestScope) {
final List<Predicate> predicates = new LinkedList<>();
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 4d16d9c272..9be92ad93a 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -217,7 +217,7 @@ public class RequestsDbClient {
return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
}
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(checkInstanceNameDuplicate);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
index 548bc25815..169d2353ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
@@ -20,28 +20,28 @@
package org.onap.so.db.request.data.controller;
-import java.util.HashMap;
+import java.util.Map;
public class InstanceNameDuplicateCheckRequest {
- private HashMap<String, String> instanceIdMap;
+ private Map<String, String> instanceIdMap;
private String instanceName;
private String requestScope;
public InstanceNameDuplicateCheckRequest() {}
- public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName,
+ public InstanceNameDuplicateCheckRequest(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
this.instanceIdMap = instanceIdMap;
this.instanceName = instanceName;
this.requestScope = requestScope;
}
- public HashMap<String, String> getInstanceIdMap() {
+ public Map<String, String> getInstanceIdMap() {
return instanceIdMap;
}
- public void setInstanceIdMap(HashMap<String, String> instanceIdMap) {
+ public void setInstanceIdMap(Map<String, String> instanceIdMap) {
this.instanceIdMap = instanceIdMap;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
index 1882ad5964..39217c75fa 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
@@ -77,12 +77,16 @@ public class RainyDayHandlerStatus implements Serializable {
@Column(name = "SECONDARY_POLICY")
private String secondaryPolicy;
+ @BusinessKey
+ @Column(name = "SERVICE_ROLE")
+ private String serviceRole;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("id", id).append("flowName", flowName)
.append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode)
.append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy)
- .append("secondaryPolicy", secondaryPolicy).toString();
+ .append("secondaryPolicy", secondaryPolicy).append("serviceRole", serviceRole).toString();
}
@Override
@@ -93,13 +97,14 @@ public class RainyDayHandlerStatus implements Serializable {
RainyDayHandlerStatus castOther = (RainyDayHandlerStatus) other;
return new EqualsBuilder().append(flowName, castOther.flowName).append(serviceType, castOther.serviceType)
.append(vnfType, castOther.vnfType).append(errorCode, castOther.errorCode)
- .append(workStep, castOther.workStep).append(policy, castOther.policy).isEquals();
+ .append(workStep, castOther.workStep).append(policy, castOther.policy)
+ .append(serviceRole, castOther.serviceRole).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(flowName).append(serviceType).append(vnfType).append(errorCode)
- .append(workStep).append(policy).toHashCode();
+ .append(workStep).append(policy).append(serviceRole).toHashCode();
}
public Integer getId() {
@@ -174,5 +179,12 @@ public class RainyDayHandlerStatus implements Serializable {
this.errorMessage = errorMessage;
}
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index a18f870970..a959f2f5a1 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -137,6 +137,7 @@ public class CatalogDbClient {
private static final String CLOUD_OWNER = "cloudOwner";
private static final String FLOW_NAME = "flowName";
private static final String ERROR_MESSAGE = "errorMessage";
+ private static final String SERVICE_ROLE = "serviceRole";
private static final String SERVICE_TYPE = "serviceType";
private static final String VNF_TYPE = "vnfType";
private static final String ERROR_CODE = "errorCode";
@@ -638,7 +639,7 @@ public class CatalogDbClient {
}
public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType,
- String errorCode, String workStep, String errorMessage) {
+ String errorCode, String workStep, String errorMessage, String serviceRole) {
logger.debug(
"Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}",
flowName, serviceType, vnfType, errorCode, workStep, errorMessage);
@@ -646,7 +647,8 @@ public class CatalogDbClient {
UriComponentsBuilder.fromUriString(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
.queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
.queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .queryParam(ERROR_MESSAGE, errorMessage).build().encode().toUri());
+ .queryParam(ERROR_MESSAGE, errorMessage).queryParam(SERVICE_ROLE, serviceRole).build().encode()
+ .toUri());
}
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
index 6819657b78..efe078bbfc 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
@@ -32,10 +32,11 @@ public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayH
@Query(value = "SELECT * FROM rainy_day_handler_macro WHERE (FLOW_NAME = :flowName ) AND SERVICE_TYPE IN (:serviceType ,'*') "
+ " AND VNF_TYPE IN ( :vnfType , '*') AND ERROR_CODE IN (:errorCode ,'*') AND WORK_STEP IN (:workStep , '*' ) "
+ " AND ( :errorMessage REGEXP rainy_day_handler_macro.REG_EX_ERROR_MESSAGE OR REG_EX_ERROR_MESSAGE = '*') "
- + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 ELSE 4 END LIMIT 1;",
+ + " AND SERVICE_ROLE IN ( :serviceRole , '*') "
+ + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 WHEN SERVICE_ROLE != '*' THEN 4 ELSE 5 END LIMIT 1;",
nativeQuery = true)
RainyDayHandlerStatus findRainyDayHandler(@Param("flowName") String flowName,
@Param("serviceType") String serviceType, @Param("vnfType") String vnfType,
@Param("errorCode") String errorCode, @Param("workStep") String workStep,
- @Param("errorMessage") String errorMessage);
+ @Param("errorMessage") String errorMessage, @Param("serviceRole") String serviceRole);
}