diff options
Diffstat (limited to 'adapters')
5 files changed, 25 insertions, 19 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)); } |