diff options
250 files changed, 6644 insertions, 4270 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index c75aa9a67e..1701cda98e 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -51,7 +51,7 @@ import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.mappers.StackInfoMapper; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -821,7 +821,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { private RestClient getMulticloudClient(String endpoint, String tenantId) { HttpClient client = null; try { - client = httpClientFactory.newJsonClient(new URL(endpoint), TargetEntity.MULTICLOUD); + client = httpClientFactory.newJsonClient(new URL(endpoint), ONAPComponents.MULTICLOUD); if (tenantId != null && !tenantId.isEmpty()) { client.addAdditionalHeader("Project", tenantId); } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java index aa19aed515..6fb65ca87e 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java @@ -28,7 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client", "org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client", - "org.onap.so.configuration", "org.onap.so.db"}) + "org.onap.so.configuration", "org.onap.so.db", "org.onap.logging.filter"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog.beans") @EnableScheduling diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java index b43447f5c4..699347015b 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java @@ -23,10 +23,12 @@ package org.onap.so.adapters.catalogdb; import javax.annotation.PostConstruct; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest; import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl; import org.onap.so.adapters.catalogdb.rest.VnfRestImpl; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.context.annotation.Configuration; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.listing.ApiListingResource; @@ -38,10 +40,11 @@ public class JerseyConfiguration extends ResourceConfig { @PostConstruct public void setUp() { + System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.CATALOG_DB.toString()); register(CatalogDbAdapterRest.class); register(ApiListingResource.class); register(SwaggerSerializers.class); - register(JaxRsFilterLogging.class); + register(SOAuditLogContainerFilter.class); register(ServiceRestImpl.class); register(VnfRestImpl.class); BeanConfig beanConfig = new BeanConfig(); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java index 4dabb58f7d..ff0f8dc432 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java @@ -21,14 +21,16 @@ package org.onap.so.adapters.catalogdb; -import org.onap.so.logging.spring.interceptor.LoggingInterceptor; +import org.onap.logging.filter.spring.LoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.handler.MappedInterceptor; @Configuration +@ComponentScan(basePackages = {"org.onap.logging.filter"}) public class WebMvcConfig extends WebMvcConfigurerAdapter { @Autowired diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java index 4353526872..a3e3a8ee53 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java @@ -72,7 +72,7 @@ public class VnfRestImpl { List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream() .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID)) .collect(Collectors.toList()); - if (vnfCustom.isEmpty() || vnfCustom == null) { + if (vnfCustom.isEmpty()) { return null; } else if (vnfCustom.size() > 1) { throw new RuntimeException( @@ -92,7 +92,7 @@ public class VnfRestImpl { List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream() .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID)) .collect(Collectors.toList()); - if (vnfCustom.isEmpty() || vnfCustom == null) { + if (vnfCustom.isEmpty()) { throw new RuntimeException("No Vnf Found"); } else if (vnfCustom.size() > 1) { throw new RuntimeException( diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql index 5d940fb9ea..8e52fbeeaf 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql @@ -30,3 +30,8 @@ resources: INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` ) VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0'); +INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) +VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'network_name', 0, 'String', NULL); + +INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) +VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, 'Boolean', NULL); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql new file mode 100644 index 0000000000..30b5010c7c --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql @@ -0,0 +1,47 @@ +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES + +('CONFIGURATION', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('CONFIGURATION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('CONFIGURATION', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), + +('NETWORK', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('NETWORK', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), +('NETWORK', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVATED', 'DELETE', 'FAIL'), +('NETWORK', 'ACTIVATED', 'UPDATE', 'CONTINUE'), +('NETWORK_COLLECTION', 'ACTIVATED', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'ACTIVATED', 'DELETE', 'CONTINUE'), +('NETWORK_COLLECTION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), + +('NO_VALIDATE', 'ACTIVATED', 'CUSTOM', 'CONTINUE'), + +('SERVICE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('SERVICE', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('SERVICE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('SERVICE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), +('SERVICE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'), + +('VF_MODULE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), +('VF_MODULE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVATED', 'DELETE', 'FAIL'), + +('VNF', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('VNF', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), +('VNF', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'), + +('VOLUME_GROUP', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVATED', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVATED', 'DELETE', 'FAIL');
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index 145ba50583..e1cca8901e 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -22,13 +22,13 @@ package org.onap.so.adapters.catalogdb.catalogrest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.onap.so.logger.MdcConstants.ENDTIME; -import static org.onap.so.logger.MdcConstants.INVOCATION_ID; -import static org.onap.so.logger.MdcConstants.PARTNERNAME; -import static org.onap.so.logger.MdcConstants.RESPONSECODE; -import static org.onap.so.logger.MdcConstants.RESPONSEDESC; -import static org.onap.so.logger.MdcConstants.SERVICE_NAME; -import static org.onap.so.logger.MdcConstants.STATUSCODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME; import java.io.IOException; import java.util.Map; import javax.ws.rs.core.MediaType; @@ -815,27 +815,27 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker().getName().equals("ENTRY")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("v2/vfModules", mdc.get(SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(STATUSCODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE)); + } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker().getName().equals("EXIT")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ENDTIME)); + assertNotNull(mdc.get(LOG_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("500", mdc.get(RESPONSECODE)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("500", mdc.get(RESPONSE_CODE)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("v2/vfModules", mdc.get(SERVICE_NAME)); - assertEquals("ERROR", mdc.get(STATUSCODE)); - assertNotNull(mdc.get(RESPONSEDESC)); + assertEquals("ERROR", mdc.get(RESPONSE_STATUS_CODE)); + assertNotNull(mdc.get(RESPONSE_DESCRIPTION)); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java index 8edce124ec..0c05df959f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java @@ -22,19 +22,18 @@ package org.onap.so.adapters.audit; import java.util.Optional; -import org.camunda.bpm.client.task.ExternalTask; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; +import org.onap.so.utils.ExternalTaskUtils; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public abstract class AbstractAuditService { +public abstract class AbstractAuditService extends ExternalTaskUtils { private static final Logger logger = LoggerFactory.getLogger(AbstractAuditService.class); @@ -81,23 +80,4 @@ public abstract class AbstractAuditService { return false; } } - - protected String[] getRetrySequence() { - return env.getProperty("mso.workflow.topics.retrySequence", String[].class); - } - - protected void setupMDC(ExternalTask externalTask) { - logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); - String msoRequestId = externalTask.getVariable("mso-request-id"); - if (msoRequestId != null && !msoRequestId.isEmpty()) { - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); - } - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName()); - } - - protected long calculateRetryDelay(int currentRetries) { - int retrySequence = getRetrySequence().length - currentRetries; - long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000")); - return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier; - } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java index 1e5b6de857..54ffc597f4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java @@ -30,11 +30,11 @@ import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component @@ -46,16 +46,16 @@ public class AuditCreateStackService extends AbstractAuditService { public HeatStackAudit heatStackAudit; @Autowired - public Environment environment; + private AuditMDCSetup mdcSetup; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { - setupMDC(externalTask); + mdcSetup.setupMDC(externalTask); AuditInventory auditInventory = externalTask.getVariable("auditInventory"); Map<String, Object> variables = new HashMap<>(); boolean success = false; try { - logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, - externalTask.getRetries()); + Integer retryCount = externalTask.getRetries(); + logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, retryCount); Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); if (auditListOpt.isPresent()) { @@ -69,29 +69,35 @@ public class AuditCreateStackService extends AbstractAuditService { logger.error("Error during audit of stack", e); } variables.put("auditIsSuccessful", success); + mdcSetup.setElapsedTime(); + String externalTaskId = externalTask.getId(); if (success) { externalTaskService.complete(externalTask, variables); - logger.debug("The External Task Id: {} Successful", externalTask.getId()); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString()); + logger.debug("The External Task Id: {} Successful", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { - if (externalTask.getRetries() == null) { + Integer retryCount = externalTask.getRetries(); + if (retryCount == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", - externalTask.getId(), getRetrySequence().length); + externalTaskId, getRetrySequence().length); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000); - } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { - logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); + } else if (retryCount != null && retryCount - 1 == 0) { externalTaskService.complete(externalTask, variables); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); + logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", - externalTask.getId(), externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + externalTaskId, retryCount - 1, calculateRetryDelay(retryCount)); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, - UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1, + calculateRetryDelay(retryCount)); } - logger.debug("The External Task Id: {} Failed", externalTask.getId()); + logger.debug("The External Task Id: {} Failed", externalTaskId); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java index 0aa4f9bdc3..9a4f154347 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java @@ -28,6 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +45,9 @@ public class AuditDeleteStackService extends AbstractAuditService { protected HeatStackAudit heatStackAudit; @Autowired + private AuditMDCSetup mdcSetup; + + @Autowired protected AuditVServer auditVservers; @Autowired @@ -53,12 +57,13 @@ public class AuditDeleteStackService extends AbstractAuditService { protected Environment env; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { - setupMDC(externalTask); + mdcSetup.setupMDC(externalTask); AuditInventory auditInventory = externalTask.getVariable("auditInventory"); Map<String, Object> variables = new HashMap<>(); boolean success = false; try { - logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries()); + Integer retryCount = externalTask.getRetries(); + logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", retryCount); Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory); if (auditListOpt.isPresent()) { auditVservers.auditVservers(auditListOpt.get()); @@ -77,29 +82,35 @@ public class AuditDeleteStackService extends AbstractAuditService { logger.error("Error during audit of stack", e); } variables.put("auditIsSuccessful", success); + mdcSetup.setElapsedTime(); + String externalTaskId = externalTask.getId(); if (success) { externalTaskService.complete(externalTask, variables); - logger.debug("The External Task Id: {} Successful", externalTask.getId()); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString()); + logger.debug("The External Task Id: {} Successful", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { - if (externalTask.getRetries() == null) { + Integer retryCount = externalTask.getRetries(); + if (retryCount == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", - externalTask.getId(), getRetrySequence().length); + externalTaskId, getRetrySequence().length); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000); - } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { - logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); + } else if (retryCount != null && retryCount - 1 == 0) { externalTaskService.complete(externalTask, variables); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); + logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", - externalTask.getId(), externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + externalTaskId, retryCount - 1, calculateRetryDelay(retryCount)); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, - UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1, + calculateRetryDelay(retryCount)); } - logger.debug("The External Task Id: {} Failed", externalTask.getId()); + logger.debug("The External Task Id: {} Failed", externalTaskId); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java index 2ef7d5b325..dc672ff017 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java @@ -7,6 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,47 +23,56 @@ public class AuditQueryStackService extends AbstractAuditService { protected HeatStackAudit heatStackAudit; @Autowired + private AuditMDCSetup mdcSetup; + + @Autowired protected AuditDataService auditDataService; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { - setupMDC(externalTask); + mdcSetup.setupMDC(externalTask); AuditInventory auditInventory = externalTask.getVariable("auditInventory"); boolean success = false; Map<String, Object> variables = new HashMap<>(); try { + Integer retryCount = externalTask.getRetries(); logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}", - auditInventory.toString(), externalTask.getRetries()); + auditInventory.toString(), retryCount); Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(), auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); if (auditList.isPresent()) { + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString()); success = true; auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get()); } + mdcSetup.setElapsedTime(); + String externalTaskId = externalTask.getId(); if (success) { externalTaskService.complete(externalTask, variables); - logger.debug("The External Task {} was Successful", externalTask.getId()); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString()); + logger.debug("The External Task {} was Successful", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { - if (externalTask.getRetries() == null) { + if (retryCount == null) { logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}", - externalTask.getId(), getRetrySequence().length); + externalTaskId, getRetrySequence().length); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000); - } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { - logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId()); + } else if (retryCount != null && retryCount - 1 == 0) { externalTaskService.complete(externalTask, variables); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); + logger.debug("The External Task {} Failed. All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else { logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ", - externalTask.getId(), externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + externalTaskId, retryCount - 1, calculateRetryDelay(retryCount)); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, - UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, retryCount - 1, calculateRetryDelay(retryCount)); } - logger.debug("The External Task {} Failed", externalTask.getId()); + logger.debug("The External Task {} Failed", externalTaskId); } } catch (Exception e) { logger.error("Error during audit query of stack", e); 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 6a42456715..fb7e925d88 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 @@ -20,13 +20,9 @@ package org.onap.so.adapters.audit; -import java.security.GeneralSecurityException; import javax.annotation.PostConstruct; import org.camunda.bpm.client.ExternalTaskClient; -import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy; -import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; -import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; -import org.onap.so.utils.CryptoUtils; +import org.onap.so.utils.ExternalTaskServiceUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -56,10 +52,13 @@ public class AuditStackService { @Autowired private AuditQueryStackService auditQueryStack; + @Autowired + private ExternalTaskServiceUtils externalTaskServiceUtils; + @PostConstruct - public void auditAddAAIInventory() { - for (int i = 0; i < getMaxClients(); i++) { - ExternalTaskClient client = createExternalTaskClient(); + public void auditAddAAIInventory() throws Exception { + for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); client.subscribe("InventoryAddAudit") .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME))) .handler(auditCreateStack::executeExternalTask).open(); @@ -67,9 +66,9 @@ public class AuditStackService { } @PostConstruct - public void auditDeleteAAIInventory() { - for (int i = 0; i < getMaxClients(); i++) { - ExternalTaskClient client = createExternalTaskClient(); + public void auditDeleteAAIInventory() throws Exception { + for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); client.subscribe("InventoryDeleteAudit") .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME))) .handler(auditDeleteStack::executeExternalTask).open(); @@ -77,35 +76,13 @@ public class AuditStackService { } @PostConstruct - public void auditQueryInventory() { - for (int i = 0; i < getMaxClients(); i++) { - ExternalTaskClient client = createExternalTaskClient(); + public void auditQueryInventory() throws Exception { + for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); client.subscribe("InventoryQueryAudit") .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME))) .handler(auditQueryStack::executeExternalTask).open(); } } - protected ExternalTaskClient createExternalTaskClient() { - ClientRequestInterceptor interceptor = createClientRequestInterceptor(); - 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() { - String auth = ""; - try { - auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey")); - } catch (IllegalStateException | GeneralSecurityException e) { - logger.error("Error Decrypting Password", e); - } - return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth); - } - - protected int getMaxClients() { - return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC)); - } - - } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java index 14d83b3b06..35008b6120 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java @@ -84,7 +84,7 @@ public class AuditVServer extends AbstractAudit { try { logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver)); } catch (JsonProcessingException e) { - logger.error("Json parse exception: {}", e.getMessage()); + logger.error("Json parse exception: ", e); } }); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java index 49a9e7e171..c1cc7428ee 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java @@ -20,13 +20,9 @@ package org.onap.so.adapters.inventory.create; -import java.security.GeneralSecurityException; import javax.annotation.PostConstruct; import org.camunda.bpm.client.ExternalTaskClient; -import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy; -import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; -import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; -import org.onap.so.utils.CryptoUtils; +import org.onap.so.utils.ExternalTaskServiceUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -46,19 +42,13 @@ public class CreateInventoryService { @Autowired private CreateInventoryTask createInventory; + @Autowired + private ExternalTaskServiceUtils externalTaskServiceUtils; + @PostConstruct - public void auditAAIInventory() { - String auth = ""; - try { - auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey")); - } catch (IllegalStateException | GeneralSecurityException e) { - logger.error("Error Decrypting Password", e); - } - ClientRequestInterceptor interceptor = - new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth); - ExternalTaskClient client = ExternalTaskClient.create() - .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor) - .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build(); + public void auditAAIInventory() throws Exception { + + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); client.subscribe("InventoryCreate") .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000"))) .handler(createInventory::executeExternalTask).open(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java index a6c61704ad..3d2d1d2aa3 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java @@ -26,16 +26,16 @@ import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; +import org.onap.so.utils.ExternalTaskUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -public class CreateInventoryTask { +public class CreateInventoryTask extends ExternalTaskUtils { private static final String UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI = "Unable to write all inventory to A&AI"; @@ -47,24 +47,28 @@ public class CreateInventoryTask { CreateAAIInventory createInventory; @Autowired - public Environment env; + private AuditMDCSetup mdcSetup; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { - setupMDC(externalTask); + mdcSetup.setupMDC(externalTask); boolean success = true; boolean inventoryException = false; String auditInventoryString = externalTask.getVariable("auditInventoryResult"); AAIObjectAuditList auditInventory = null; + String externalTaskId = externalTask.getId(); try { GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class); } catch (Exception e) { + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); logger.error("Error Parsing Audit Results", e); } + mdcSetup.setElapsedTime(); if (auditInventory != null) { + Integer retryCount = externalTask.getRetries(); try { logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory, - externalTask.getRetries()); + retryCount); createInventory.createInventory(auditInventory); } catch (InventoryException e) { logger.error("Error during inventory of stack", e); @@ -74,58 +78,39 @@ public class CreateInventoryTask { logger.error("Error during inventory of stack", e); success = false; } + mdcSetup.setElapsedTime(); if (success) { externalTaskService.complete(externalTask); - logger.debug("The External Task Id: {} Successful", externalTask.getId()); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString()); + logger.debug("The External Task Id: {} Successful", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + mdcSetup.clearClientMDCs(); } else if (inventoryException) { - logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId()); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); + logger.debug("The External Task Id: {} Failed, Retry not needed", externalTaskId); externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { - if (externalTask.getRetries() == null) { + if (retryCount == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", - externalTask.getId(), getRetrySequence().length); + externalTaskId, getRetrySequence().length); externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); - } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { - logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); + } else if (retryCount != null && retryCount - 1 == 0) { externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString()); + logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId); logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", - externalTask.getId(), externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + externalTaskId, retryCount - 1, calculateRetryDelay(retryCount)); externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, - UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, externalTask.getRetries() - 1, - calculateRetryDelay(externalTask.getRetries())); + UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount)); } - logger.debug("The External Task Id: {} Failed", externalTask.getId()); + logger.debug("The External Task Id: {} Failed", externalTaskId); } } else { - logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId()); + logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTaskId); externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } } - - private void setupMDC(ExternalTask externalTask) { - try { - logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName()); - String msoRequestId = externalTask.getVariable("mso-request-id"); - if (msoRequestId != null && !msoRequestId.isEmpty()) - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); - } catch (Exception e) { - logger.error("Error in setting up MDC", e); - } - } - - protected long calculateRetryDelay(int currentRetries) { - int retrySequence = getRetrySequence().length - currentRetries; - long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000")); - return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier; - } - - public String[] getRetrySequence() { - return env.getProperty("mso.workflow.topics.retrySequence", String[].class); - } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index be4cc5a05d..013c7f8a84 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -91,6 +91,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork"; private static final String NEUTRON_MODE = "NEUTRON"; private static final String CLOUD_OWNER = "CloudOwner"; + private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}"; private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @@ -292,7 +293,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); + logger.debug("Got HEAT Template from DB: {}", heatTemplate); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate(); @@ -462,13 +463,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } } + networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID)); } subnetIdMap.value = sMap; rollback.value = networkRollback; // Populate remaining rollback info and response parameters. networkRollback.setNetworkStackId(heatStack.getCanonicalName()); - networkRollback.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID)); networkRollback.setNetworkCreated(true); networkRollback.setNetworkType(networkType); @@ -656,7 +657,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); + logger.debug("Got HEAT Template from DB: {}", heatTemplate); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate(); @@ -798,12 +799,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } if (networkCust != null) { - logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString()); + logger.debug("Got Network Customization definition from Catalog: {}", networkCust); networkResource = networkCust.getNetworkResource(); } else if (collectionNetworkCust != null) { - logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", - collectionNetworkCust.toString()); + logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", collectionNetworkCust); networkResource = collectionNetworkCust.getNetworkResource(); } if (networkResource == null) { @@ -814,7 +814,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.USERDATA); } - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); String mode = networkResource.getOrchestrationMode(); NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType()); @@ -915,7 +915,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Use MsoNeutronUtils for all NEUTRON commands String mode; - String neutronId; + String neutronId = null; // Try Heat first, since networks may be named the same as the Heat stack StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis(); @@ -931,12 +931,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Populate the outputs based on the returned Stack information if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) { // Found it. Get the neutronNetworkId for further query + Map<String, String> sMap = new HashMap<>(); Map<String, Object> outputs = heatStack.getOutputs(); - neutronId = (String) outputs.get(NETWORK_ID); mode = "HEAT"; - - Map<String, String> sMap = new HashMap<>(); if (outputs != null) { + neutronId = (String) outputs.get(NETWORK_ID); + for (String key : outputs.keySet()) { if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs { @@ -1045,7 +1045,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } String mode = ""; if (networkResource != null) { - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); mode = networkResource.getOrchestrationMode(); } @@ -1132,7 +1132,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String mode = ""; if (networkResource != null) { - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); mode = networkResource.getOrchestrationMode(); } @@ -1388,9 +1388,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Resource Property List<ContrailSubnet> cslist = new ArrayList<>(); for (Subnet subnet : subnets) { - logger.debug("Input Subnet:{}", subnet.toString()); + logger.debug("Input Subnet:{}", subnet); ContrailSubnet cs = new ContrailSubnetMapper(subnet).map(); - logger.debug("Contrail Subnet:{}", cs.toString()); + logger.debug("Contrail Subnet:{}", cs); cslist.add(cs); } @@ -1523,18 +1523,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { JsonNode rootNode = mapper.readTree(jStr); if (rootNode != null) { for (JsonNode sNode : rootNode.path("ipam_subnets")) { - logger.debug("Output Subnet Node {}", sNode.toString()); + logger.debug("Output Subnet Node {}", sNode); String name = sNode.path("subnet_name").textValue(); String uuid = sNode.path("subnet_uuid").textValue(); String aaiId = name; // default // try to find aaiId for name in input subnetList if (subnets != null) { for (Subnet subnet : subnets) { - if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) { - if (subnet.getSubnetName().equals(name)) { - aaiId = subnet.getSubnetId(); - break; - } + if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName()) + && subnet.getSubnetName().equals(name)) { + aaiId = subnet.getSubnetId(); + break; } } } @@ -1549,7 +1548,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { ErrorCode.DataError.getValue(), e); } - logger.debug("Return sMap {}", sMap.toString()); + logger.debug("Return sMap {}", sMap); return sMap; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java index 436836491d..d9a83e6a9a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java @@ -21,7 +21,7 @@ package org.onap.so.adapters.openstack; import java.util.concurrent.Executor; -import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.onap.logging.filter.spring.MDCTaskDecorator; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java index 3c073af6ba..d75824357f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java @@ -50,7 +50,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import org.onap.so.client.RestTemplateConfig; import javax.inject.Provider; @Component diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java index 3432e4a8b6..cff4d5f994 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java @@ -37,6 +37,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.core.env.Environment; import com.fasterxml.jackson.core.JsonParseException; @@ -67,6 +68,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService { @Mock private AuditDataService auditDataService; + @Mock + private AuditMDCSetup mdcSetup; + private ObjectMapper objectMapper = new ObjectMapper(); private AuditInventory auditInventory = new AuditInventory(); @@ -170,47 +174,6 @@ public class AuditStackServiceDataTest extends AuditCreateStackService { } @Test - public void retry_sequence_calculation_Test() { - long firstRetry = auditStackService.calculateRetryDelay(8); - assertEquals(6000L, firstRetry); - long secondRetry = auditStackService.calculateRetryDelay(7); - assertEquals(6000L, secondRetry); - long thirdRetry = auditStackService.calculateRetryDelay(6); - assertEquals(12000L, thirdRetry); - long fourthRetry = auditStackService.calculateRetryDelay(5); - assertEquals(18000L, fourthRetry); - long fifthRetry = auditStackService.calculateRetryDelay(4); - assertEquals(30000L, fifthRetry); - long sixRetry = auditStackService.calculateRetryDelay(3); - assertEquals(48000L, sixRetry); - long seventhRetry = auditStackService.calculateRetryDelay(2); - assertEquals(78000L, seventhRetry); - long eigthRetry = auditStackService.calculateRetryDelay(1); - assertEquals(120000L, eigthRetry); - } - - @Test - public void retry_sequence_Test() { - long firstRetry = auditStackService.calculateRetryDelay(8); - assertEquals(6000L, firstRetry); - long secondRetry = auditStackService.calculateRetryDelay(7); - assertEquals(6000L, secondRetry); - long thirdRetry = auditStackService.calculateRetryDelay(6); - assertEquals(12000L, thirdRetry); - long fourthRetry = auditStackService.calculateRetryDelay(5); - assertEquals(18000L, fourthRetry); - long fifthRetry = auditStackService.calculateRetryDelay(4); - assertEquals(30000L, fifthRetry); - long sixRetry = auditStackService.calculateRetryDelay(3); - assertEquals(48000L, sixRetry); - long seventhRetry = auditStackService.calculateRetryDelay(2); - assertEquals(78000L, seventhRetry); - long eigthRetry = auditStackService.calculateRetryDelay(1); - assertEquals(120000L, eigthRetry); - } - - - @Test public void determineAuditResult_Test() throws Exception { boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess); assertEquals(false, actual); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java deleted file mode 100644 index c9aef950f7..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.audit; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.camunda.bpm.client.ExternalTaskClient; -import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; -import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.utils.CryptoUtils; -import org.springframework.core.env.Environment; - -@RunWith(MockitoJUnitRunner.class) -public class AuditStackServiceTest { - - @Spy - @InjectMocks - AuditStackService auditStackService; - - @Mock - Environment mockEnvironment; - - - @Before - public void before() { - Mockito.doReturn("5").when(mockEnvironment).getProperty("workflow.topics.maxClients", "10"); - Mockito.doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436") - .when(mockEnvironment).getRequiredProperty("mso.auth"); - Mockito.doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnvironment).getRequiredProperty("mso.msoKey"); - Mockito.doReturn("something").when(mockEnvironment).getRequiredProperty("mso.config.cadi.aafId"); - Mockito.doReturn("host.com").when(mockEnvironment).getRequiredProperty("mso.workflow.endpoint"); - } - - @Test - public void testGetMaxClients() throws Exception { - int actual = auditStackService.getMaxClients(); - assertEquals(5, actual); - } - - @Test - public void testCreateClientRequestInterceptor() throws Exception { - String auth = CryptoUtils.decrypt( - "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436", - "07a7159d3bf51a0e53be7a8f89699be7"); - ClientRequestInterceptor expected = new BasicAuthProvider("something", auth); - ClientRequestInterceptor actual = auditStackService.createClientRequestInterceptor(); - assertThat(actual, sameBeanAs(expected)); - - } - - @Test - public void testCreateExternalTaskClient() throws Exception { - String auth = CryptoUtils.decrypt( - "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436", - "07a7159d3bf51a0e53be7a8f89699be7"); - ClientRequestInterceptor inter = new BasicAuthProvider("something", auth); - Mockito.doReturn(inter).when(auditStackService).createClientRequestInterceptor(); - ExternalTaskClient actual = auditStackService.createExternalTaskClient(); - assertNotNull(actual); - Mockito.verify(auditStackService, Mockito.times(1)).createClientRequestInterceptor(); - - } -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java index 8dc9d7fe5c..c4fa9ee2c5 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java @@ -31,6 +31,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.externaltasks.logging.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import com.fasterxml.jackson.core.JsonProcessingException; @@ -46,6 +47,9 @@ public class CreateInventoryTaskTest { @Mock ExternalTaskService externalTaskService; + @Mock + private AuditMDCSetup mdcSetup; + @InjectMocks CreateInventoryTask inventoryTask; diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java index 85c05decb1..e1dc4cab66 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java @@ -24,6 +24,8 @@ package org.onap.so.adapters.requestsdb.application; import java.time.Duration; import javax.sql.DataSource; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @@ -40,7 +42,7 @@ import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder; * */ -@SpringBootApplication(scanBasePackages = {"org.onap.so"}) +@SpringBootApplication(scanBasePackages = {"org.onap.so", "org.onap.logging.filter"}) @EnableScheduling @EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING) public class MSORequestDBApplication { @@ -54,6 +56,7 @@ public class MSORequestDBApplication { } public static void main(String... args) { + System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.REQUEST_DB.toString()); SpringApplication.run(MSORequestDBApplication.class, args); java.security.Security.setProperty("networkaddress.cache.ttl", "10"); setLogsDir(); diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java index 579afe9243..c0dfbe08ef 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java @@ -21,14 +21,16 @@ package org.onap.so.adapters.requestsdb.application; -import org.onap.so.logging.spring.interceptor.LoggingInterceptor; +import org.onap.logging.filter.spring.LoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.handler.MappedInterceptor; @Configuration +@ComponentScan(basePackages = {"org.onap.logging.filter"}) public class WebMvcConfig extends WebMvcConfigurerAdapter { @Autowired diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql new file mode 100644 index 0000000000..eac9a65f65 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql @@ -0,0 +1,12 @@ +use requestdb; + +DROP INDEX `infra_active_requests__aic_cloud_region_idx` on `infra_active_requests`; + +ALTER TABLE + `infra_active_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION varchar(50) DEFAULT NULL; + +ALTER TABLE + `archived_infra_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION VARCHAR(50) NULL DEFAULT NULL; + +ALTER TABLE `infra_active_requests` + ADD INDEX IF NOT EXISTS `infra_active_requests__cloud_region_idx` (`CLOUD_REGION` ASC); diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql new file mode 100644 index 0000000000..2f7438c1d3 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql @@ -0,0 +1,21 @@ +ALTER TABLE `requestdb`.`infra_active_requests` +ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_id_idx` (`SERVICE_INSTANCE_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_name_idx` (`SERVICE_INSTANCE_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_id_idx` (`VNF_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_name_name_idx` (`VNF_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_id_idx` (`VF_MODULE_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_name_idx` (`VF_MODULE_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_id_idx` (`VOLUME_GROUP_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_name_idx` (`VOLUME_GROUP_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__network_id_idx` (`NETWORK_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__network_name_idx` (`NETWORK_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_id_idx` (`CONFIGURATION_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_name_idx` (`CONFIGURATION_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_id_idx` (`INSTANCE_GROUP_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_name_idx` (`INSTANCE_GROUP_NAME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__aic_cloud_region_idx` (`AIC_CLOUD_REGION` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__tenant_id_idx` (`TENANT_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__request_scope_idx` (`REQUEST_SCOPE` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__requestor_id_idx` (`REQUESTOR_ID` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__start_time_idx` (`START_TIME` ASC), +ADD INDEX IF NOT EXISTS `infra_active_requests__end_time_idx` (`END_TIME` ASC);
\ No newline at end of file diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index e53b957210..fa2acbc0ca 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -449,7 +449,7 @@ public class MSORequestDBImplTest extends RequestsAdapterBase { assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); } else if (logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") @@ -458,9 +458,9 @@ public class MSORequestDBImplTest extends RequestsAdapterBase { assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); assertEquals(null, mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); - assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 9c2ea6d3bf..65fac11d41 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re ('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10'); -insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values +insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values ('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java index 6149f7ed25..dd1da98dd8 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java @@ -32,7 +32,7 @@ import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -51,7 +51,7 @@ public class CXFConfiguration { private Bus bus; @Autowired - private JaxRsFilterLogging jaxRsFilterLogging; + private SOAuditLogContainerFilter soAuditLogContainerFilter; @Autowired private SDNCAdapterPortType sdncAdapterPortImpl; @@ -70,7 +70,7 @@ public class CXFConfiguration { endpoint.setServiceBeans(Arrays.<Object>asList(sniroResponse)); endpoint.setAddress("/rest"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging)); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); return endpoint.create(); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java index 55023088bc..fc6d0a6fc9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java @@ -23,7 +23,7 @@ package org.onap.so.adapters.sdnc; import java.util.concurrent.Executor; -import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.onap.logging.filter.spring.MDCTaskDecorator; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java index 5ea68f08a2..dd875c573e 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java @@ -28,7 +28,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; import org.apache.cxf.jaxrs.swagger.Swagger2Feature; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.vfc.rest.VfcAdapterRest; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -47,7 +47,7 @@ public class CXFConfiguration { private VfcAdapterRest vfcAdapterRest; @Autowired - private JaxRsFilterLogging jaxRsFilterLogging; + private SOAuditLogContainerFilter soAuditLogContainerFilter; @Autowired private ObjectMapper mapper; @@ -64,7 +64,7 @@ public class CXFConfiguration { endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest)); endpoint.setAddress("/"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging)); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); return endpoint.create(); } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java index 93312cfa64..b621759b59 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java @@ -30,6 +30,7 @@ import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.Iterator; +import java.util.ListIterator; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -43,6 +44,7 @@ import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.aai.domain.yang.EsrVnfm; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON; import org.onap.so.configuration.rest.BasicHttpHeadersProvider; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.onap.so.rest.service.HttpRestServiceProvider; import org.onap.so.rest.service.HttpRestServiceProviderImpl; import org.slf4j.Logger; @@ -53,6 +55,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.GsonHttpMessageConverter; @@ -167,4 +170,13 @@ public class VnfmServiceProviderConfiguration { } } + private void removeSpringClientFilter(final RestTemplate restTemplate) { + ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator(); + while (interceptorIterator.hasNext()) { + if (interceptorIterator.next() instanceof SOSpringClientFilter) { + interceptorIterator.remove(); + } + } + } + } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java index c37eccf594..06887f1253 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java @@ -29,7 +29,8 @@ import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; +import org.onap.so.logger.LoggingAnchor; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -62,7 +63,7 @@ public class ActivitySpecsActions { String urlString = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString(); URL url = new URL(urlString); - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC); httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString()); Response response = httpClient.post(payload); @@ -104,7 +105,7 @@ public class ActivitySpecsActions { String urlString = UriBuilder.fromUri(hostname).path(path).build().toString(); URL url = new URL(urlString); - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC); httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString()); Response response = httpClient.put(CERTIFY_ACTIVITY_PAYLOAD); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java index 0fc94c8bd6..7f1c1968c1 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java @@ -20,6 +20,8 @@ package org.onap.so.asdc.activity; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.ArrayList; import java.util.List; import org.onap.so.logger.LoggingAnchor; @@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.apache.http.HttpStatus; import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.Input; import org.onap.so.asdc.activity.beans.Output; @@ -59,6 +62,11 @@ public class DeployActivitySpecs { String hostname = env.getProperty(SDC_ENDPOINT); logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname); if (hostname == null || hostname.isEmpty()) { + logger.warn("The hostname for SDC activities deployment is not configured in SO"); + return; + } + if (!checkHttpOk(hostname)) { + logger.warn("The sdc end point is not alive"); return; } List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll(); @@ -135,4 +143,22 @@ public class DeployActivitySpecs { activitySpec.setOutputs(outputs); return; } + + public boolean checkHttpOk(String host) { + URL url = null; + boolean isOk = false; + + int responseCode = 0; + try { + url = new URL(host); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + responseCode = connection.getResponseCode(); + } catch (Exception e) { + logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage()); + } + if (responseCode == HttpStatus.SC_OK) { + isOk = true; + } + return isOk; + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 9ffc38d34b..0080ed543c 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -741,8 +741,7 @@ public class ASDCController { logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + if ("VF".equals(resourceType)) { resourceStructure = new VfResourceStructure(iNotif, resource); } else if ("PNF".equals(resourceType)) { resourceStructure = new PnfResourceStructure(iNotif, resource); @@ -760,8 +759,8 @@ public class ASDCController { logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + + if ("VF".equals(resourceType)) { hasVFResource = true; for (IArtifactInfo artifact : resource.getArtifacts()) { IDistributionClientDownloadResult resultArtifact = diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index bcb81ba87c..e8e068a71a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -434,17 +435,26 @@ public class ToscaResourceInstaller { Service service = toscaResourceStruct.getCatalogService(); List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList(); - for (NodeTemplate nodeTemplate : vfNodeTemplatesList) { - Metadata metadata = nodeTemplate.getMetaData(); - String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper() - .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY); - processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata, - vfCustomizationCategory); + List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + List<IEntityDetails> arEntityDetails = new ArrayList<IEntityDetails>(); + + for (IEntityDetails vfEntityDetails : vfEntityList) { + + Metadata metadata = vfEntityDetails.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + + if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { + arEntityDetails.add(vfEntityDetails); + } + + processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure, + service, metadata); } processResourceSequence(toscaResourceStruct, service); - List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources(); - processAllottedResources(toscaResourceStruct, service, allottedResourceList); + processAllottedResources(arEntityDetails, toscaResourceStruct, service); processNetworks(toscaResourceStruct, service); // process Network Collections processNetworkCollections(toscaResourceStruct, service); @@ -571,7 +581,8 @@ public class ToscaResourceInstaller { String outInput; String defaultValue = null; if (value instanceof Map) { - outInput = ((LinkedHashMap) value).values().toArray()[0].toString(); + Collection values = ((LinkedHashMap) value).values(); + outInput = (values.size() > 0) ? values.toArray()[0].toString() : ""; } else if (value instanceof GetInput) { String inputName = ((GetInput) value).getInputName(); Optional<Input> inputOptional = @@ -631,7 +642,8 @@ public class ToscaResourceInstaller { protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { - List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE, false); + List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VL), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); if (vlEntityList != null) { for (IEntityDetails vlEntity : vlEntityList) { @@ -647,7 +659,10 @@ public class ToscaResourceInstaller { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, heatTemplate, tempNetworkLookUp.getAicVersionMax(), tempNetworkLookUp.getAicVersionMin(), service); - service.getNetworkCustomizations().add(networkCustomization); + // only insert unique entries + if (!service.getNetworkCustomizations().contains(networkCustomization)) { + service.getNetworkCustomizations().add(networkCustomization); + } } else { throw new ArtifactInstallerException("No HeatTemplate found for artifactUUID: " + tempNetworkLookUp.getHeatTemplateArtifactUuid()); @@ -655,6 +670,8 @@ public class ToscaResourceInstaller { } else { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, null, null, null, service); + networkCustomization.setResourceInput( + getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID())); service.getNetworkCustomizations().add(networkCustomization); logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " + networkResourceModelName); @@ -664,12 +681,32 @@ public class ToscaResourceInstaller { } } - protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service, - List<NodeTemplate> allottedResourceList) { - if (allottedResourceList != null) { - for (NodeTemplate allottedNode : allottedResourceList) { - service.getAllottedCustomizations() - .add(createAllottedResource(allottedNode, toscaResourceStruct, service)); + protected void processAllottedResources(List<IEntityDetails> arEntityDetails, + ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { + + List<IEntityDetails> pnfAREntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + for (IEntityDetails pnfEntity : pnfAREntityList) { + + Metadata metadata = pnfEntity.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { + arEntityDetails.add(pnfEntity); + } + + } + + if (arEntityDetails != null) { + for (IEntityDetails arEntity : arEntityDetails) { + AllottedResourceCustomization allottedResource = + createAllottedResource(arEntity, toscaResourceStruct, service); + String resourceInput = + getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID()); + if (!"{}".equals(resourceInput)) { + allottedResource.setResourceInput(resourceInput); + } + service.getAllottedCustomizations().add(allottedResource); } } } @@ -804,13 +841,13 @@ public class ToscaResourceInstaller { protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { - List<NodeTemplate> networkCollectionList = - toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR); + List<IEntityDetails> crEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.CR), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - if (networkCollectionList != null) { - for (NodeTemplate crNode : networkCollectionList) { + if (crEntityList != null) { + for (IEntityDetails ncEntity : crEntityList) { - createNetworkCollection(crNode, toscaResourceStruct, service); + createNetworkCollection(ncEntity, toscaResourceStruct, service); collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource()); List<NetworkInstanceGroup> networkInstanceGroupList = @@ -954,34 +991,37 @@ public class ToscaResourceInstaller { return String.valueOf(value); } - protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, - Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) - throws Exception { + protected void processVfModules(IEntityDetails vfEntityDetails, NodeTemplate nodeTemplate, + ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, Service service, + Metadata metadata) throws Exception { + + String vfCustomizationCategory = + vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); logger.debug("VF Category is : " + vfCustomizationCategory); - if (vfResourceStructure.getVfModuleStructure() != null - && !vfResourceStructure.getVfModuleStructure().isEmpty()) { + String vfCustomizationUUID = + vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata, - SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - logger.debug("VFCustomizationUUID=" + vfCustomizationUUID); + logger.debug("VFCustomizationUUID=" + vfCustomizationUUID); - IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance(); + IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance(); - // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before - // comparing their VF Modules UUID's - logger.debug("Checking if Notification VF ResourceCustomizationUUID: " - + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: " - + vfCustomizationUUID); + // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before + // comparing their VF Modules UUID's + logger.debug("Checking if Notification VF ResourceCustomizationUUID: " + + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: " + + vfCustomizationUUID); - if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) { + if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) { - logger.debug("vfCustomizationUUID: " + vfCustomizationUUID - + " matches vfNotificationResource CustomizationUUID"); + logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + + " matches vfNotificationResource CustomizationUUID"); - VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); + VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service); + if (vfResourceStructure.getVfModuleStructure() != null + && !vfResourceStructure.getVfModuleStructure().isEmpty()) { Set<CvnfcCustomization> existingCvnfcSet = new HashSet<>(); Set<VnfcCustomization> existingVnfcSet = new HashSet<>(); List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom = new ArrayList<>(); @@ -989,14 +1029,19 @@ public class ToscaResourceInstaller { for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { logger.debug("vfModuleStructure:" + vfModuleStructure.toString()); - List<org.onap.sdc.toscaparser.api.Group> vfGroups = - toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); + + List<IEntityDetails> vfModuleEntityList = + getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder("org.openecomp.groups.VfModule"), TopologyTemplateQuery + .newBuilder(SdcTypes.SERVICE).customizationUUID(vfCustomizationUUID), + false); + IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID()); - Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream() + Optional<IEntityDetails> matchingObject = vfModuleEntityList.stream() .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID") @@ -1004,7 +1049,7 @@ public class ToscaResourceInstaller { .findFirst(); if (matchingObject.isPresent()) { VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), - nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, + toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet, existingCvnfcConfigurationCustom); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); } else @@ -1013,34 +1058,33 @@ public class ToscaResourceInstaller { + vfMetadata.getVfModuleModelCustomizationUUID()); } + } - // Check for VNFC Instance Group info and add it if there is - List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStruct, - "org.openecomp.groups.VfcInstanceGroup", - TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false); + // Check for VNFC Instance Group info and add it if there is + List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"), + TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false); - for (IEntityDetails groupEntity : vfcEntityList) { - VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = - createVNFCInstanceGroup(groupEntity, nodeTemplate, vnfResource, toscaResourceStruct); - vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); - } + for (IEntityDetails groupEntity : vfcEntityList) { + VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = + createVNFCInstanceGroup(groupEntity, nodeTemplate, vnfResource, toscaResourceStruct); + vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); + } - List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, vfcEntityList); - if (!CollectionUtils.isEmpty(seqResult)) { - String resultStr = seqResult.stream().collect(Collectors.joining(",")); - vnfResource.setVnfcInstanceGroupOrder(resultStr); - logger.debug( - "vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr); - } - // add this vnfResource with existing vnfResource for this service - addVnfCustomization(service, vnfResource); - } else { - logger.debug("Notification VF ResourceCustomizationUUID: " - + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " - + "Tosca VF Customization UUID: " + vfCustomizationUUID); + List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, vfcEntityList); + if (!CollectionUtils.isEmpty(seqResult)) { + String resultStr = seqResult.stream().collect(Collectors.joining(",")); + vnfResource.setVnfcInstanceGroupOrder(resultStr); + logger.debug("vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr); } + // add this vnfResource with existing vnfResource for this service + addVnfCustomization(service, vnfResource); + } else { + logger.debug("Notification VF ResourceCustomizationUUID: " + + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " + + "Tosca VF Customization UUID: " + vfCustomizationUUID); } } @@ -1349,7 +1393,14 @@ public class ToscaResourceInstaller { Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata(); - Service service = new Service(); + List<Service> services = + serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + Service service; + if (!services.isEmpty() && services.size() > 0) { + service = services.get(0); + } else { + service = new Service(); + } if (serviceMetadata != null) { @@ -1461,13 +1512,20 @@ public class ToscaResourceInstaller { } protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) { - ToscaCsar toscaCsar = new ToscaCsar(); + Optional<ToscaCsar> toscaCsarOpt = + toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); + ToscaCsar toscaCsar; + if (!toscaCsarOpt.isPresent()) { + toscaCsar = new ToscaCsar(); + toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); + } else { + toscaCsar = toscaCsarOpt.get(); + } if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) { toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum()); } else { toscaCsar.setArtifactChecksum(MANUAL_RECORD); } - toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName()); toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion()); toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription()); @@ -1620,7 +1678,7 @@ public class ToscaResourceInstaller { return networkResource; } - protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate, + protected CollectionNetworkResourceCustomization createNetworkCollection(IEntityDetails cnrEntity, ToscaResourceStructure toscaResourceStructure, Service service) { CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = @@ -1629,33 +1687,26 @@ public class ToscaResourceInstaller { // **** Build Object to populate Collection_Resource table CollectionResource collectionResource = new CollectionResource(); + collectionResource.setModelName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); collectionResource - .setModelName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - collectionResource.setModelInvariantUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - collectionResource - .setModelUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - collectionResource - .setModelVersion(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - collectionResource - .setDescription(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - collectionResource.setToscaNodeType(networkNodeTemplate.getType()); + .setModelInvariantUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + collectionResource.setModelUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + collectionResource.setModelVersion(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + collectionResource.setDescription(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + collectionResource.setToscaNodeType(cnrEntity.getToscaType()); toscaResourceStructure.setCatalogCollectionResource(collectionResource); // **** Build object to populate Collection_Resource_Customization table NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization(); - ncfc.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_function")); - ncfc.setRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_role")); - ncfc.setType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_type")); + ncfc.setFunction(getLeafPropertyValue(cnrEntity, "cr_function")); + ncfc.setRole(getLeafPropertyValue(cnrEntity, "cr_role")); + ncfc.setType(getLeafPropertyValue(cnrEntity, "cr_type")); - ncfc.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + ncfc.setModelInstanceName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); ncfc.setModelCustomizationUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>(); networkResourceCustomizationSet.add(collectionNetworkResourceCustomization); @@ -1666,25 +1717,28 @@ public class ToscaResourceInstaller { toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc); // *** Build object to populate the Instance_Group table - List<Group> groupList = - toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType( - networkNodeTemplate, "org.openecomp.groups.NetworkCollection"); + List<IEntityDetails> ncEntityList = + getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>(); List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<>(); - for (Group group : groupList) { + for (IEntityDetails ncGroupEntity : ncEntityList) { NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup(); - Metadata instanceMetadata = group.getMetadata(); + Metadata instanceMetadata = ncGroupEntity.getMetadata(); networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); networkInstanceGroup .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - networkInstanceGroup.setToscaNodeType(group.getType()); + networkInstanceGroup.setToscaNodeType(ncGroupEntity.getToscaType()); networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString()); // Set // Role networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set @@ -1698,27 +1752,26 @@ public class ToscaResourceInstaller { crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup); crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); crInstanceGroupCustomization.setModelCustomizationUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); // Loop through the template policy to find the subinterface_network_quantity property name. Then extract // the value for it. - List<Policy> policyList = - toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType( - networkNodeTemplate, "org.openecomp.policies.scaling.Fixed"); + List<IEntityDetails> policyEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.policies.scaling.Fixed"), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), true); - if (policyList != null) { - for (Policy policy : policyList) { - for (String policyNetworkCollection : policy.getTargets()) { + if (policyEntityList != null) { + for (IEntityDetails policyEntity : policyEntityList) { + for (String policyNetworkCollection : policyEntity.getTargets()) { - if (policyNetworkCollection.equalsIgnoreCase(group.getName())) { + if (policyNetworkCollection.equalsIgnoreCase(ncGroupEntity.getName())) { - Map<String, Object> propMap = policy.getPolicyProperties(); + Map<String, Property> propMap = policyEntity.getProperties(); if (propMap.get("quantity") != null) { - String quantity = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(networkNodeTemplate, - getPropertyInput(propMap.get("quantity").toString())); + String quantity = getLeafPropertyValue(cnrEntity, + getPropertyInput(propMap.get("quantity").toString())); if (quantity != null) { crInstanceGroupCustomization @@ -1733,13 +1786,12 @@ public class ToscaResourceInstaller { } crInstanceGroupCustomization.setDescription( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) - + "_network_collection_description")); - crInstanceGroupCustomization.setFunction( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) - + "_network_collection_function")); + getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + + "_network_collection_description")); + + crInstanceGroupCustomization.setFunction(getLeafPropertyValue(cnrEntity, + instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_function")); + crInstanceGroupCustomization.setCollectionResourceCust(ncfc); collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization); @@ -1751,18 +1803,21 @@ public class ToscaResourceInstaller { toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList); - List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL); + List<IEntityDetails> networkEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VL), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>(); // *****Build object to populate the NetworkResource table NetworkResource networkResource = new NetworkResource(); - for (NodeTemplate vlNodeTemplate : vlNodeList) { + for (IEntityDetails networkEntity : networkEntityList) { - String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); + String providerNetwork = getLeafPropertyValue(networkEntity, + SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); if ("true".equalsIgnoreCase(providerNetwork)) { networkResource.setNeutronNetworkType(PROVIDER); @@ -1770,22 +1825,20 @@ public class ToscaResourceInstaller { networkResource.setNeutronNetworkType(BASIC); } - networkResource - .setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + networkResource.setModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); networkResource.setModelInvariantUUID( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - networkResource - .setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + networkResource.setModelUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); networkResource - .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + .setModelVersion(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); networkResource.setAicVersionMax( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); if (tempNetworkLookUp != null) { @@ -1797,29 +1850,28 @@ public class ToscaResourceInstaller { } - networkResource.setToscaNodeType(vlNodeTemplate.getType()); + networkResource.setToscaNodeType(networkEntity.getToscaType()); networkResource.setDescription( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); networkResource.setOrchestrationMode(HEAT); // Build object to populate the // Collection_Network_Resource_Customization table - for (NodeTemplate memberNode : group.getMemberNodes()) { - collectionNetworkResourceCustomization.setModelInstanceName(memberNode.getName()); + for (IEntityDetails networkMemberEntity : ncGroupEntity.getMemberNodes()) { + collectionNetworkResourceCustomization.setModelInstanceName(networkMemberEntity.getName()); } collectionNetworkResourceCustomization.setModelCustomizationUUID( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); collectionNetworkResourceCustomization.setNetworkTechnology( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); - collectionNetworkResourceCustomization.setNetworkType(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); - collectionNetworkResourceCustomization.setNetworkRole(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); - collectionNetworkResourceCustomization.setNetworkScope(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + collectionNetworkResourceCustomization.setNetworkType( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + collectionNetworkResourceCustomization.setNetworkRole( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + collectionNetworkResourceCustomization.setNetworkScope( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup); collectionNetworkResourceCustomization.setNetworkResource(networkResource); collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc); @@ -1841,10 +1893,11 @@ public class ToscaResourceInstaller { InstanceGroup existingInstanceGroup = instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup(); + VFCInstanceGroup vfcInstanceGroup; if (existingInstanceGroup == null) { // Populate InstanceGroup + vfcInstanceGroup = new VFCInstanceGroup(); vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); vfcInstanceGroup .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); @@ -1891,9 +1944,10 @@ public class ToscaResourceInstaller { } - List<IEntityDetails> serviceEntityList = - getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VF).customizationUUID( - vnfResourceCustomization.getModelCustomizationUUID()), SdcTypes.SERVICE, false); + List<IEntityDetails> serviceEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vnfResourceCustomization.getModelCustomizationUUID()), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); if (serviceEntityList != null && !serviceEntityList.isEmpty()) { vfcInstanceGroupCustom.setFunction(getLeafPropertyValue(serviceEntityList.get(0), getInputName)); @@ -1966,22 +2020,26 @@ public class ToscaResourceInstaller { return jsonStr; } - protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate, + protected VfModuleCustomization createVFModuleResource(IEntityDetails vfModuleEntityDetails, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, - IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Set<CvnfcCustomization> existingCvnfcSet, - Set<VnfcCustomization> existingVnfcSet, + IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, + Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet, List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom) { VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID()); + if (vfModuleCustomization == null) { + VfModule vfModule = findExistingVfModule(vnfResource, - vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); - Metadata vfMetadata = group.getMetadata(); + vfModuleEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + + Metadata vfMetadata = vfModuleEntityDetails.getMetadata(); if (vfModule == null) - vfModule = createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata); + vfModule = createVfModule(vfModuleEntityDetails, toscaResourceStructure, vfModuleData, vfMetadata); - vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData); + vfModuleCustomization = + createVfModuleCustomization(vfModuleEntityDetails, toscaResourceStructure, vfModule, vfModuleData); vfModuleCustomization.setVnfCustomization(vnfResource); setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization, vfMetadata); @@ -2001,38 +2059,48 @@ public class ToscaResourceInstaller { Set<VnfcCustomization> vnfcCustomizations = new HashSet<>(); // Only set the CVNFC if this vfModule group is a member of it. - List<NodeTemplate> groupMembers = - toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfTemplate, group); - String vfModuleMemberName = null; - for (NodeTemplate node : groupMembers) { - vfModuleMemberName = node.getName(); - } + List<IEntityDetails> groupMembers = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.VfModule") + .uUID(vfModuleCustomization.getVfModule().getModelUUID()), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); + + String vfModuleMemberName = null; // Extract CVFC lists - List<IEntityDetails> cvnfcEntityList = - getEntityDetails(toscaResourceStructure, SdcTypes.CVFC, SdcTypes.VF, false); + List<IEntityDetails> cvnfcEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); + for (IEntityDetails cvfcEntity : cvnfcEntityList) { boolean cvnfcVfModuleNameMatch = false; - for (NodeTemplate node : groupMembers) { - vfModuleMemberName = node.getName(); + for (IEntityDetails entity : groupMembers) { + + List<IEntityDetails> groupMembersNodes = entity.getMemberNodes(); + for (IEntityDetails groupMember : groupMembersNodes) { + + vfModuleMemberName = groupMember.getName(); + + if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) { + cvnfcVfModuleNameMatch = true; + break; + } - if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) { - cvnfcVfModuleNameMatch = true; - break; } } + if (vfModuleMemberName != null && cvnfcVfModuleNameMatch) { // Extract associated VFC - Should always be just one - List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure, SdcTypes.VFC, + List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VFC), TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID( cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), false); + for (IEntityDetails vfcEntity : vfcEntityList) { VnfcCustomization vnfcCustomization = new VnfcCustomization(); @@ -2102,37 +2170,48 @@ public class ToscaResourceInstaller { cvnfcCustomization.setNfcNamingCode(getLeafPropertyValue(cvfcEntity, "nfc_naming_code")); cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + // ***************************************************************************************************************************************** // * Extract Fabric Configuration // ***************************************************************************************************************************************** List<IEntityDetails> fabricEntityList = - getEntityDetails(toscaResourceStructure, SdcTypes.CONFIGURATION, SdcTypes.VF, false); + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.CONFIGURATION), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); for (IEntityDetails fabricEntity : fabricEntityList) { - ConfigurationResource fabricConfig = null; + Map<String, RequirementAssignment> requirements = fabricEntity.getRequirements(); - ConfigurationResource existingConfig = - findExistingConfiguration(existingCvnfcConfigurationCustom, + for (RequirementAssignment requirement : requirements.values()) { + + if (requirement.getNodeTemplateName().equals(cvfcEntity.getName())) { + + ConfigurationResource fabricConfig = null; + + ConfigurationResource existingConfig = findExistingConfiguration( + existingCvnfcConfigurationCustom, fabricEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - if (existingConfig == null) { + if (existingConfig == null) { - fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure); + fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure); - } else { - fabricConfig = existingConfig; - } + } else { + fabricConfig = existingConfig; + } - CvnfcConfigurationCustomization cvnfcConfigurationCustomization = - createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure, - vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, - vfTemplate, vfModuleMemberName); + CvnfcConfigurationCustomization cvnfcConfigurationCustomization = + createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure, + vnfResource, vfModuleCustomization, cvnfcCustomization, + fabricConfig, vfModuleMemberName); - cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); + cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); - existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization); + existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization); + + } + } } cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); @@ -2153,7 +2232,7 @@ public class ToscaResourceInstaller { protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(IEntityDetails fabricEntity, ToscaResourceStructure toscaResourceStruct, VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization, - ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) { + ConfigurationResource configResource, String vfModuleMemberName) { Metadata fabricMetadata = fabricEntity.getMetadata(); @@ -2168,7 +2247,9 @@ public class ToscaResourceInstaller { cvnfcConfigurationCustomization.setModelInstanceName(fabricEntity.getName()); List<IEntityDetails> policyList = - getEntityDetails(toscaResourceStruct, "org.openecomp.policies.External", SdcTypes.VF, true); + getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder("org.openecomp.policies.External"), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), true); + if (policyList != null) { for (IEntityDetails policyEntity : policyList) { @@ -2245,7 +2326,7 @@ public class ToscaResourceInstaller { return vfModule; } - protected VfModuleCustomization createVfModuleCustomization(Group group, + protected VfModuleCustomization createVfModuleCustomization(IEntityDetails vfModuleEntityDetails, ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) { VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); @@ -2253,62 +2334,64 @@ public class ToscaResourceInstaller { vfModuleCustomization.setVfModule(vfModule); - String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); + String initialCount = getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); + + if (initialCount != null && initialCount.length() > 0) { vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount)); } - vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper() - .getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT))); + String availabilityZoneCount = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT); - String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT); if (availabilityZoneCount != null && availabilityZoneCount.length() > 0) { vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount)); } - vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL)); + vfModuleCustomization + .setLabel(getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL)); + + String maxInstances = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES); - String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES); if (maxInstances != null && maxInstances.length() > 0) { vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances)); } - String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES); + String minInstances = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES); + if (minInstances != null && minInstances.length() > 0) { vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances)); } return vfModuleCustomization; } - protected VfModule createVfModule(Group group, ToscaResourceStructure toscaResourceStructure, + protected VfModule createVfModule(IEntityDetails groupEntityDetails, ToscaResourceStructure toscaResourceStructure, IVfModuleData vfModuleData, Metadata vfMetadata) { VfModule vfModule = new VfModule(); String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID(); if (vfModuleModelUUID == null) { - vfModuleModelUUID = testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + + vfModuleModelUUID = testNull( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + } else if (vfModuleModelUUID.indexOf('.') > -1) { vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf('.')); } - vfModule.setModelInvariantUUID(testNull(toscaResourceStructure.getSdcCsarHelper() - .getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID))); - vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME))); + vfModule.setModelInvariantUUID( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); + vfModule.setModelName( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)); vfModule.setModelUUID(vfModuleModelUUID); - vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION))); - vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + vfModule.setModelVersion( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)); + vfModule.setDescription(groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + + String vfModuleType = getLeafPropertyValue(groupEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE); - String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE); if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) { vfModule.setIsBase(true); } else { @@ -2413,26 +2496,26 @@ public class ToscaResourceInstaller { } } - protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate, + protected VnfResourceCustomization createVnfResource(IEntityDetails entityDetails, ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException { VnfResourceCustomization vnfResourceCustomization = null; if (vnfResourceCustomization == null) { + VnfResource vnfResource = findExistingVnfResource(service, - vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (vnfResource == null) { - vnfResource = createVnfResource(vfNodeTemplate); + vnfResource = createVnfResource(entityDetails); } vnfResourceCustomization = - createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure, vnfResource); + createVnfResourceCustomization(entityDetails, toscaResourceStructure, vnfResource); vnfResourceCustomization.setVnfResources(vnfResource); vnfResourceCustomization.setService(service); // setting resource input for vnf customization vnfResourceCustomization.setResourceInput( getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID())); - service.getVnfCustomizations().add(vnfResourceCustomization); } return vnfResourceCustomization; @@ -2452,61 +2535,56 @@ public class ToscaResourceInstaller { return vnfResource; } - protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate, + protected VnfResourceCustomization createVnfResourceCustomization(IEntityDetails entityDetails, ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) { VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); vnfResourceCustomization.setModelCustomizationUUID( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName()); - - vnfResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION))); - vnfResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, "nf_naming_code"))); - vnfResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE))); - vnfResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE))); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN)); + vnfResourceCustomization.setModelInstanceName(entityDetails.getName()); + vnfResourceCustomization + .setNfFunction(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + vnfResourceCustomization.setNfNamingCode(getLeafPropertyValue(entityDetails, "nf_naming_code")); + vnfResourceCustomization.setNfRole(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + vnfResourceCustomization.setNfType(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); - vnfResourceCustomization.setBlueprintName(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_NAME))); + vnfResourceCustomization.setMultiStageDesign(getLeafPropertyValue(entityDetails, MULTI_STAGE_DESIGN)); + vnfResourceCustomization.setBlueprintName(getLeafPropertyValue(entityDetails, SDNC_MODEL_NAME)); + vnfResourceCustomization.setBlueprintVersion(getLeafPropertyValue(entityDetails, SDNC_MODEL_VERSION)); - vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION))); + String skipPostInstConfText = getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF); - String skipPostInstConfText = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SKIP_POST_INST_CONF); if (skipPostInstConfText != null) { - vnfResourceCustomization.setSkipPostInstConf(Boolean.parseBoolean(skipPostInstConfText)); + vnfResourceCustomization.setSkipPostInstConf( + Boolean.parseBoolean(getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF))); } + vnfResourceCustomization.setVnfResources(vnfResource); vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger( - vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT))); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT))); + + entityDetails.getCapabilities().get(SCALABLE); - CapabilityAssignments vnfCustomizationCapability = - toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(vfNodeTemplate); - if (vnfCustomizationCapability != null) { - CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(SCALABLE); + if (entityDetails.getCapabilities() != null) { + + CapabilityAssignment capAssign = entityDetails.getCapabilities().get(SCALABLE); if (capAssign != null) { - vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + vnfResourceCustomization.setMinInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResourceCustomization.setMaxInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); } } if (vnfResourceCustomization.getMinInstances() == null && vnfResourceCustomization.getMaxInstances() == null) { - vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + vnfResourceCustomization.setMinInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResourceCustomization.setMaxInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); } toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization); @@ -2514,44 +2592,44 @@ public class ToscaResourceInstaller { return vnfResourceCustomization; } - protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) { + protected VnfResource createVnfResource(IEntityDetails entityDetails) { VnfResource vnfResource = new VnfResource(); vnfResource.setModelInvariantUUID( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); - vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); - vnfResource.setModelUUID(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + vnfResource.setModelName(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + vnfResource.setModelUUID(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); vnfResource.setModelVersion( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); vnfResource.setDescription( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); vnfResource.setOrchestrationMode(HEAT); - vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType())); + vnfResource.setToscaNodeType(testNull(entityDetails.getToscaType())); vnfResource.setAicVersionMax( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); vnfResource.setAicVersionMin( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); - vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResource.setCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + vnfResource.setSubCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); return vnfResource; } - protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate, + protected AllottedResourceCustomization createAllottedResource(IEntityDetails arEntity, ToscaResourceStructure toscaResourceStructure, Service service) { AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo.findOneByModelCustomizationUUID( - nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); if (allottedResourceCustomization == null) { AllottedResource allottedResource = findExistingAllottedResource(service, - nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (allottedResource == null) - allottedResource = createAR(nodeTemplate); + allottedResource = createAR(arEntity); toscaResourceStructure.setAllottedResource(allottedResource); - allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure); + allottedResourceCustomization = createAllottedResourceCustomization(arEntity, toscaResourceStructure); allottedResourceCustomization.setAllottedResource(allottedResource); allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization); } @@ -2572,73 +2650,81 @@ public class ToscaResourceInstaller { return allottedResource; } - protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate, + protected AllottedResourceCustomization createAllottedResourceCustomization(IEntityDetails arEntity, ToscaResourceStructure toscaResourceStructure) { AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization(); allottedResourceCustomization.setModelCustomizationUUID( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName()); + testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + allottedResourceCustomization.setModelInstanceName(arEntity.getName()); + + allottedResourceCustomization + .setNfFunction(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + allottedResourceCustomization.setNfNamingCode(getLeafPropertyValue(arEntity, "nf_naming_code")); + allottedResourceCustomization.setNfRole(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + allottedResourceCustomization.setNfType(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build(); - allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION))); - allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code"))); - allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE))); - allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE))); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(allottedResourceCustomization.getModelCustomizationUUID()).build(); - List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper() - .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID()); + List<IEntityDetails> vfcEntities = + toscaResourceStructure.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false); - if (vfcNodes != null) { - for (NodeTemplate vfcNode : vfcNodes) { - allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid")); + if (vfcEntities != null) { + for (IEntityDetails vfcEntity : vfcEntities) { + + allottedResourceCustomization + .setProvidingServiceModelUUID(getLeafPropertyValue(vfcEntity, "providing_service_uuid")); + allottedResourceCustomization.setProvidingServiceModelInvariantUUID( + getLeafPropertyValue(vfcEntity, "providing_service_invariant_uuid")); allottedResourceCustomization - .setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid")); - allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name")); + .setProvidingServiceModelName(getLeafPropertyValue(vfcEntity, "providing_service_name")); } } + Map<String, CapabilityAssignment> capAssignmentList = arEntity.getCapabilities(); - CapabilityAssignments arCustomizationCapability = - toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(nodeTemplate); + if (capAssignmentList != null) { - if (arCustomizationCapability != null) { - CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE); + for (Map.Entry<String, CapabilityAssignment> entry : capAssignmentList.entrySet()) { + CapabilityAssignment arCapability = entry.getValue(); + + if (arCapability != null) { + + String capabilityName = arCapability.getName(); + + if (capabilityName.equals(SCALABLE)) { + + allottedResourceCustomization + .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability, + SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + allottedResourceCustomization + .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability, + SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + + } + } - if (capAssign != null) { - allottedResourceCustomization.setMinInstances( - Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue( - capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - allottedResourceCustomization.setMaxInstances( - Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue( - capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); } } + return allottedResourceCustomization; } - protected AllottedResource createAR(NodeTemplate nodeTemplate) { + protected AllottedResource createAR(IEntityDetails arEntity) { AllottedResource allottedResource = new AllottedResource(); - allottedResource - .setModelUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + allottedResource.setModelUUID(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); allottedResource.setModelInvariantUUID( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + allottedResource.setModelName(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); allottedResource - .setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + .setModelVersion(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + allottedResource.setToscaNodeType(testNull(arEntity.getToscaType())); allottedResource - .setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - allottedResource.setToscaNodeType(testNull(nodeTemplate.getType())); - allottedResource.setSubcategory( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); - allottedResource - .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + .setSubcategory(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); + allottedResource.setDescription(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); return allottedResource; } @@ -2707,46 +2793,10 @@ public class ToscaResourceInstaller { + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName(); } - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, - SdcTypes topologyTemplate, boolean nestedSearch) { - - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); - - return entityDetails; - - } - - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType, - SdcTypes topologyTemplate, boolean nestedSearch) { - - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); - - return entityDetails; - - } - - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType, - TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { - - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); - - return entityDetails; - - } - - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, - TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { + protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, + EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); + EntityQuery entityQuery = entityType.build(); TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build(); List<IEntityDetails> entityDetails = toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); @@ -2755,21 +2805,20 @@ public class ToscaResourceInstaller { } - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, - EntityQueryBuilder entityType, SdcTypes topologyTemplate, boolean nestedSearch) { + protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) { - EntityQuery entityQuery = entityType.build(); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); + Property leafProperty = entityDetails.getProperties().get(propName); - return entityDetails; + if (leafProperty != null && leafProperty.getValue() != null) { + return leafProperty.getValue().toString(); + } + return null; } - protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) { + protected String getCapabilityLeafPropertyValue(CapabilityAssignment capAssign, String propName) { - Property leafProperty = entityDetails.getProperties().get(propName); + Property leafProperty = capAssign.getProperties().get(propName); if (leafProperty != null && leafProperty.getValue() != null) { return leafProperty.getValue().toString(); @@ -2784,8 +2833,9 @@ public class ToscaResourceInstaller { if (propertyName != null) { int getInputIndex = propertyName.indexOf("{get_input="); + int getClosingIndex = propertyName.indexOf("}"); if (getInputIndex > -1) { - inputName = propertyName.substring(getInputIndex + 11, propertyName.length() - 1); + inputName = propertyName.substring(getInputIndex + 11, getClosingIndex); } } @@ -2799,10 +2849,18 @@ public class ToscaResourceInstaller { if (!services.isEmpty()) { // service exist in db Service existingService = services.get(0); - List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations(); - vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e)); + List<VnfResourceCustomization> existingVnfCustomizations = existingService.getVnfCustomizations(); + if (existingService != null) { + // it is duplicating entries, so added a check + for (VnfResourceCustomization existingVnfResourceCustomization : existingVnfCustomizations) { + if (!service.getVnfCustomizations().contains(existingVnfResourceCustomization)) { + service.getVnfCustomizations().add(existingVnfResourceCustomization); + } + } + } } service.getVnfCustomizations().add(vnfResourceCustomization); + } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index a154734690..4b069e6ac7 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -724,6 +724,9 @@ public class ASDCNotificationLogging { buffer.append("Model Subcategory:"); buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); buffer.append(System.lineSeparator()); + buffer.append("Model Category:"); + buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + buffer.append(System.lineSeparator()); buffer.append("Model Description:"); buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java index 81977da278..b41fbaf658 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java @@ -22,7 +22,10 @@ package org.onap.asdc.activity; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import org.junit.Test; @@ -73,4 +76,32 @@ public class DeployActivitySpecsITTest extends BaseTest { deployActivitySpecs.deployActivities(); assertTrue(activitySpecCreateResponse.getId().equals("testActivityId")); } + + @Test + public void deployActivitySpecsIT_SDCEndpointDown_Test() throws Exception { + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090"); + + String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + deployActivitySpecs.deployActivities(); + verify(0, putRequestedFor(urlEqualTo(urlPath))); + } + } diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java index aae5e5dc53..7a876a67a2 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java @@ -30,6 +30,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.asdc.activity.ActivitySpecsActions; import org.onap.so.asdc.activity.DeployActivitySpecs; @@ -54,6 +55,7 @@ public class DeployActivitySpecsTest { protected ActivitySpecsActions activitySpecsActions; @InjectMocks + @Spy private DeployActivitySpecs deployActivitySpecs; @Test @@ -68,7 +70,8 @@ public class DeployActivitySpecsTest { List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList = new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>(); catalogActivitySpecList.add(catalogActivitySpec); - when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint"); + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://testEndpoint"); + doReturn(true).when(deployActivitySpecs).checkHttpOk("http://testEndpoint"); when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList); doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any()); doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 2c520a3bba..e1b124775b 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -43,17 +43,21 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.mockito.ArgumentMatchers; +import org.mockito.Mockito; import org.mockito.Spy; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.Workflow; +import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; @@ -67,6 +71,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.test.util.ReflectionTestUtils; public class ASDCRestInterfaceTest extends BaseTest { @@ -74,6 +79,9 @@ public class ASDCRestInterfaceTest extends BaseTest { private AllottedResourceRepository allottedRepo; @Autowired + private AllottedResourceCustomizationRepository allottedCustomRepo; + + @Autowired private ServiceRepository serviceRepo; @Autowired @@ -107,6 +115,7 @@ public class ASDCRestInterfaceTest extends BaseTest { public void setUp() { // ASDC Controller writes to this path System.setProperty("mso.config.path", folder.getRoot().toString()); + ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo); } @Test @@ -164,7 +173,7 @@ public class ASDCRestInterfaceTest extends BaseTest { @Test @Transactional - public void test_VFW_Distrobution() throws Exception { + public void test_VFW_Distribution() throws Exception { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); @@ -290,6 +299,54 @@ public class ASDCRestInterfaceTest extends BaseTest { assertEquals("Generic NeutronNet", networkResource.get().getModelName()); } + @Test + public void test_CCVPN_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/ccvpn/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-ccvpn-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("317887d3-a4e4-45cb-8971-2a78426fefac"); + assertTrue(service.isPresent()); + assertEquals("CCVPNService", service.get().getModelName()); + } + + @Test + public void test_PublicNS_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/public-ns/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-public-ns-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("da28696e-d4c9-4df4-9f91-465c6c09a81e"); + assertTrue(service.isPresent()); + assertEquals("PublicNS", service.get().getModelName()); + } + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index 7534ea645a..ffad137ad7 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -25,16 +25,19 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; @@ -54,26 +57,38 @@ import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.RequirementAssignments; +import org.onap.sdc.toscaparser.api.SubstitutionMappings; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; +import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.sdc.utils.DistributionStatusEnum; import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.client.ResourceInstance; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; +import org.onap.so.asdc.installer.IVfModuleData; import org.onap.so.asdc.installer.ResourceStructure; import org.onap.so.asdc.installer.ToscaResourceStructure; +import org.onap.so.asdc.installer.VfModuleStructure; +import org.onap.so.asdc.installer.VfResourceStructure; +import org.onap.so.asdc.installer.bpmn.WorkflowResource; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.beans.ToscaCsar; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; +import org.onap.so.db.catalog.data.repository.VFModuleRepository; +import org.onap.so.db.catalog.data.repository.VnfResourceRepository; +import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -111,6 +126,8 @@ public class ToscaResourceInstallerTest extends BaseTest { @Mock private ToscaResourceStructure toscaResourceStructure; @Mock + private VfResourceStructure vfResourceStruct; + @Mock private ServiceProxyResourceCustomization spResourceCustomization; @Mock private ISdcCsarHelper csarHelper; @@ -258,6 +275,206 @@ public class ToscaResourceInstallerTest extends BaseTest { } @Test + public void installTheResourceWithGroupAndVFModulesTest() throws Exception { + ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller(); + ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(true, toscaInstaller); + + toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct); + assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully()); + } + + @Test + public void installTheResourceGroupWithoutVFModulesTest() throws Exception { + ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller(); + ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(false, toscaInstaller); + + toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct); + assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully()); + } + + private ToscaResourceStructure prepareToscaResourceStructure(boolean prepareVFModuleStructures, + ToscaResourceInstaller toscaInstaller) throws ArtifactInstallerException { + + Metadata metadata = mock(Metadata.class); + IResourceInstance resourceInstance = mock(ResourceInstance.class); + NodeTemplate nodeTemplate = mock(NodeTemplate.class); + ISdcCsarHelper csarHelper = mock(SdcCsarHelperImpl.class); + + IArtifactInfo inputCsar = mock(IArtifactInfo.class); + String artifactUuid = "0122c05e-e13a-4c63-b5d2-475ccf23aa74"; + String checkSum = "MGUzNjJjMzk3OTBkYzExYzQ0MDg2ZDc2M2E3ZjZiZmY="; + + doReturn(checkSum).when(inputCsar).getArtifactChecksum(); + doReturn(artifactUuid).when(inputCsar).getArtifactUUID(); + doReturn("1.0").when(inputCsar).getArtifactVersion(); + doReturn("TestCsarWithGroupAndVFModule").when(inputCsar).getArtifactName(); + doReturn("Test Csar data with Group and VF module inputs").when(inputCsar).getArtifactDescription(); + doReturn("http://localhost/dummy/url/test.csar").when(inputCsar).getArtifactURL(); + + ToscaResourceStructure toscaResourceStructObj = new ToscaResourceStructure(); + toscaResourceStructObj.setToscaArtifact(inputCsar); + + ToscaCsarRepository toscaCsarRepo = spy(ToscaCsarRepository.class); + + + ToscaCsar toscaCsar = mock(ToscaCsar.class); + Optional<ToscaCsar> returnValue = Optional.of(toscaCsar); + doReturn(artifactUuid).when(toscaCsar).getArtifactUUID(); + doReturn(checkSum).when(toscaCsar).getArtifactChecksum(); + doReturn(returnValue).when(toscaCsarRepo).findById(artifactUuid); + + ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setDistributionID("testStatusSuccessfulTosca"); + notificationData.setServiceVersion("1234567"); + notificationData.setServiceUUID("serviceUUID1"); + notificationData.setWorkloadContext("workloadContext1"); + + + + String serviceType = "test-type1"; + String serviceRole = "test-role1"; + String category = "Network L3+"; + String description = "Customer Orderable service description"; + String name = "Customer_Orderable_Service"; + String uuid = "72db5868-4575-4804-b546-0b0d3c3b5ac6"; + String invariantUUID = "6f30bbe3-4590-4185-a7e0-4f9610926c6f"; + String namingPolicy = "naming Policy1"; + String ecompGeneratedNaming = "true"; + String environmentContext = "General_Revenue-Bearing1"; + String resourceCustomizationUUID = "0177ba22-5547-4e4e-bcf8-178f7f71de3a"; + + doReturn(serviceType).when(metadata).getValue("serviceType"); + doReturn(serviceRole).when(metadata).getValue("serviceRole"); + + doReturn(category).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + doReturn(description).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION); + doReturn("1.0").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION); + doReturn(name).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + + doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + + doReturn(environmentContext).when(metadata).getValue(metadata.getValue("environmentContext")); + doReturn(invariantUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + doReturn(namingPolicy).when(metadata).getValue("namingPolicy"); + doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming"); + doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID"); + + ServiceRepository serviceRepo = spy(ServiceRepository.class); + + VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class); + doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid); + + VFModuleRepository vfModuleRepo = spy(VFModuleRepository.class); + InstanceGroupRepository instanceGroupRepo = spy(InstanceGroupRepository.class); + + WorkflowResource workflowResource = spy(WorkflowResource.class); + + ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo); + ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo); + ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo); + ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo); + ReflectionTestUtils.setField(toscaInstaller, "workflowResource", workflowResource); + + // doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); + toscaResourceStructObj.setSdcCsarHelper(csarHelper); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFROLE); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, + SdcPropertyNames.PROPERTY_NAME_NFTYPE); + doReturn(resourceCustomizationUUID).when(csarHelper).getMetadataPropertyValue(metadata, + SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + doReturn(uuid).when(csarHelper).getMetadataPropertyValue(metadata, + SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID); + + + // vnfc instance group list + List<Group> vnfcInstanceGroupList = new ArrayList<>(); + Group vnfcG1 = mock(Group.class); + Map<String, Object> metaProperties = new HashMap<>(); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_UUID, "vnfc_group1_uuid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_NAME, "vnfc_group1_uuid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID, "vnfc_group1_invariantid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_VERSION, "1.0"); + Metadata vnfcmetadata = new Metadata(metaProperties); + + doReturn(vnfcmetadata).when(vnfcG1).getMetadata(); + ArrayList<NodeTemplate> memberList = new ArrayList(); + doReturn(memberList).when(vnfcG1).getMemberNodes(); + vnfcInstanceGroupList.add(vnfcG1); + SubstitutionMappings submappings = mock(SubstitutionMappings.class); + doReturn(new ArrayList<Input>()).when(submappings).getInputs(); + doReturn(submappings).when(nodeTemplate).getSubMappingToscaTemplate(); + + doReturn(vnfcInstanceGroupList).when(csarHelper).getGroupsOfOriginOfNodeTemplateByToscaGroupType(nodeTemplate, + "org.openecomp.groups.VfcInstanceGroup"); + + + doReturn(notificationData).when(vfResourceStruct).getNotification(); + doReturn(resourceInstance).when(vfResourceStruct).getResourceInstance(); + + if (prepareVFModuleStructures) { + + // VfModule list + List<Group> vfModuleGroups = new ArrayList<>(); + Group g1 = mock(Group.class); + doReturn(metadata).when(g1).getMetadata(); + vfModuleGroups.add(g1); + + doReturn(vfModuleGroups).when(csarHelper).getVfModulesByVf(resourceCustomizationUUID); + doReturn("1").when(csarHelper).getGroupPropertyLeafValue(g1, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); + + doReturn(metadata).when(nodeTemplate).getMetaData(); + List<NodeTemplate> nodeList = new ArrayList<>(); + nodeList.add(nodeTemplate); + doReturn(nodeList).when(csarHelper).getServiceVfList(); + + IVfModuleData moduleMetadata = mock(IVfModuleData.class); + doReturn(name).when(moduleMetadata).getVfModuleModelName(); + doReturn(invariantUUID).when(moduleMetadata).getVfModuleModelInvariantUUID(); + doReturn(Collections.<String>emptyList()).when(moduleMetadata).getArtifacts(); + doReturn(resourceCustomizationUUID).when(moduleMetadata).getVfModuleModelCustomizationUUID(); + doReturn(uuid).when(moduleMetadata).getVfModuleModelUUID(); + doReturn("1.0").when(moduleMetadata).getVfModuleModelVersion(); + + VfModuleStructure moduleStructure = new VfModuleStructure(vfResourceStruct, moduleMetadata); + + List<VfModuleStructure> moduleStructures = new ArrayList<>(); + moduleStructures.add(moduleStructure); + doReturn(moduleStructures).when(vfResourceStruct).getVfModuleStructure(); + } + + toscaResourceStructObj.setServiceMetadata(metadata); + doReturn("resourceInstanceName1").when(resourceInstance).getResourceInstanceName(); + doReturn(resourceCustomizationUUID).when(resourceInstance).getResourceCustomizationUUID(); + doReturn("resourceName1").when(resourceInstance).getResourceName(); + + Service service = toscaInstaller.createService(toscaResourceStructObj, vfResourceStruct); + + assertNotNull(service); + service.setModelVersion("1.0"); + + doReturn(service).when(serviceRepo).save(service); + + WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository = + spy(WatchdogComponentDistributionStatusRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "watchdogCDStatusRepository", watchdogCDStatusRepository); + doReturn(null).when(watchdogCDStatusRepository).save(any(WatchdogComponentDistributionStatus.class)); + + VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo = + spy(VnfcInstanceGroupCustomizationRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "vnfcInstanceGroupCustomizationRepo", + vnfcInstanceGroupCustomizationRepo); + doReturn(null).when(vnfcInstanceGroupCustomizationRepo).save(any(VnfcInstanceGroupCustomization.class)); + return toscaResourceStructObj; + } + + + + @Test public void installTheResourceExceptionTest() throws Exception { expectedException.expect(ArtifactInstallerException.class); diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json new file mode 100644 index 0000000000..1ca96f7dc9 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json @@ -0,0 +1,47 @@ +{ + "distributionID": "8a01603d-606d-4e40-8bc4-37107ad97897", + "serviceName": "CCVPNService", + "serviceVersion": "1.0", + "serviceUUID": "317887d3-a4e4-45cb-8971-2a78426fefac", + "serviceDescription": "CCVPN", + "serviceInvariantUUID": "e43f9b81-3035-44df-b618-a787e1c49427", + "resources": [ + { + "resourceInstanceName": "siteResource", + "resourceCustomizationUUID": "e9e01777-bb2f-42f0-b825-aef0f4c37ccf", + "resourceName": "siteResource", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5a641276-443b-45ca-ac9c-a0ee84f5007b", + "resourceInvariantUUID": "5338673f-df81-483a-afa4-b9766442ebf1", + "category": "Configuration", + "subcategory": "Configuration", + "artifacts": [] + }, + { + "resourceInstanceName": "SDWANVPNResource", + "resourceCustomizationUUID": "7815f32c-bdbf-41f7-9a18-6f0e6d5a0d0e", + "resourceName": "SDWANVPNResource", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5f9f2164-f7e4-461d-b8de-3470297ce2b3", + "resourceInvariantUUID": "5ca15886-9990-419c-a4bb-f0229eac0926", + "category": "Configuration", + "subcategory": "Configuration", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Ccvpnservice-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Ccvpnservice-csar.csar", + "artifactChecksum": "NTZlNGU4YTQwNzVkZWMwYWZkODE5M2MwYzcyNzM3M2U\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "2", + "artifactUUID": "59f34dcf-ec33-4a88-8dbe-aa7f4571ef59" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar Binary files differnew file mode 100644 index 0000000000..ce2ac5e0c9 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json new file mode 100644 index 0000000000..f829bf0246 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json @@ -0,0 +1,173 @@ +{ + "distributionID": "2d6c5aa8-b644-4f30-a632-5577801ef954", + "serviceName": "PublicNS", + "serviceVersion": "1.0", + "serviceUUID": "da28696e-d4c9-4df4-9f91-465c6c09a81e", + "serviceDescription": "PUblic NS", + "serviceInvariantUUID": "e907ce73-7e4d-4bf8-b94a-21bd1a7c7592", + "resources": [ + { + "resourceInstanceName": "vCPE 0", + "resourceName": "vCPE", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "a67562cf-1bf3-4450-8b69-3bb1cff43089", + "resourceInvariantUUID": "e0b3088d-9ca8-482a-aa5a-a1e6906b2d22", + "resourceCustomizationUUID": "ae70c293-8db3-40cd-8cd0-30cde194bea5", + "category": "Generic", + "subcategory": "Infrastructure", + "artifacts": [ + { + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/vcpe0/vf-license-model.xml", + "artifactChecksum": "YjYyYWNiMzUxM2YzMWYxYWVhN2Y5MTM3N2E5YzNhNmU\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "5c29e823-7114-4988-824f-f670ba9d7b21", + "artifactVersion": "1" + }, + { + "artifactName": "vcpe0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/vcpe0/vcpe0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "128e4e77-21a4-49c3-ac7a-7ca3b187bddc", + "artifactVersion": "1" + }, + { + "artifactName": "ar1000v.yaml", + "artifactType": "HEAT", + "artifactURL": "/vcpe0/ar1000v.yaml", + "artifactChecksum": "NWU2NGUwNmNkMGEzYjAxMTAyODkzNTc5YzFmZDBmMzM\u003d", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910", + "artifactVersion": "2" + }, + { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/vcpe0/vendor-license-model.xml", + "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "74c4d1bd-1779-421f-8c9d-774ac4567031", + "artifactVersion": "1" + }, + { + "artifactName": "ar1000v.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/vcpe0/ar1000v.env", + "artifactChecksum": "YzI4MjlkODk4YzcyOTgzZTg2YjAyM2ZiNWU1N2FmMjI\u003d", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "5821b043-ba50-49ef-b739-61b0896050f2", + "artifactVersion": "2", + "generatedFromUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910" + } + ] + }, + { + "resourceInstanceName": "vGW 0", + "resourceName": "vGW", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "cd82e255-56cf-4644-858e-36cfc45ef754", + "resourceInvariantUUID": "52905e03-0632-43f9-93f2-2ab7d959f633", + "resourceCustomizationUUID": "fd8595de-1081-4e39-a401-24ffebaa9ed8", + "category": "Generic", + "subcategory": "Infrastructure", + "artifacts": [ + { + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/vgw0/vf-license-model.xml", + "artifactChecksum": "YTdlMDhmYjMzODg5NmI3ODgwNjA0MmUyOWU2N2I2MGM\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "f2db3ba5-190f-4214-90fd-93407caf10c1", + "artifactVersion": "1" + }, + { + "artifactName": "vgw0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/vgw0/vgw0_modules.json", + "artifactChecksum": "OTQwY2ZlZThjMjNlYjAyNzU4NDUyZDVhY2VjNTIwZTk\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8730baa0-1b8c-4ac3-bc5c-d49c5b88f111", + "artifactVersion": "1" + }, + { + "artifactName": "gateway.yaml", + "artifactType": "HEAT", + "artifactURL": "/vgw0/gateway.yaml", + "artifactChecksum": "NGNiMGRjMWViNGRkMGQzM2ZjNDNjMjQ5OGMwMjI2MjM\u003d", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "60d55796-212c-4c66-8af5-63964d636ae4", + "artifactVersion": "2" + }, + { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/vgw0/vendor-license-model.xml", + "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "019bdcbf-03fc-4ec2-8d39-c09f808722e9", + "artifactVersion": "1" + }, + { + "artifactName": "gateway.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/vgw0/gateway.env", + "artifactChecksum": "Y2Y4ZDgzMDg3NDBiMDhkODZiMmE1MGUyYjU2ZGFlZDU\u003d", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "9df0452f-826c-4287-9a2d-ca0095339866", + "artifactVersion": "2", + "generatedFromUUID": "60d55796-212c-4c66-8af5-63964d636ae4" + } + ] + }, + { + "resourceInstanceName": "Generic NeutronNet 0", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "4069be99-5d9a-427b-a427-04fe16ccbf38", + "resourceInvariantUUID": "f3ed1133-c1bb-4735-82d4-8e041265fad6", + "resourceCustomizationUUID": "c8a1a81d-d836-4f33-9d0e-91e9417f812a", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Publicns-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/service-Publicns-template.yml", + "artifactChecksum": "NTUzMDU5YzM3MTk4OGNiNjQ2OGRlMWY2YjU3MjE2YjM\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "2617d0ca-54f0-4222-b659-c12e292d94dd", + "artifactVersion": "1" + }, + { + "artifactName": "service-Publicns-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Publicns-csar.csar", + "artifactChecksum": "ZTRhOGI0M2UxN2ZhYjQ0ODI5ZDZhZTExZTFkMGU3N2Y\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "26a323ff-b97b-4b86-96b1-25a80c0876e5", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar Binary files differnew file mode 100644 index 0000000000..d5ea949cdc --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml new file mode 100644 index 0000000000..2e6f29360f --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml @@ -0,0 +1,1186 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +metadata: + invariantUUID: e907ce73-7e4d-4bf8-b94a-21bd1a7c7592 + UUID: da28696e-d4c9-4df4-9f91-465c6c09a81e + name: PublicNS + description: PUblic NS + type: Service + category: E2E Service + serviceType: '' + serviceRole: '' + instantiationType: A-la-carte + serviceEcompNaming: true + ecompGeneratedNaming: true + namingPolicy: '' + environmentContext: General_Revenue-Bearing +imports: +- nodes: + file: nodes.yml +- datatypes: + file: data.yml +- capabilities: + file: capabilities.yml +- relationships: + file: relationships.yml +- groups: + file: groups.yml +- policies: + file: policies.yml +- annotations: + file: annotations.yml +- service-PublicNS-interface: + file: service-Publicns-template-interface.yml +- resource-vCPE: + file: resource-Vcpe-template.yml +- resource-vCPE-interface: + file: resource-Vcpe-template-interface.yml +- resource-vGW: + file: resource-Vgw-template.yml +- resource-vGW-interface: + file: resource-Vgw-template-interface.yml +- resource-Generic NeutronNet: + file: resource-GenericNeutronnet-template.yml +topology_template: + node_templates: + vCPE 0: + type: org.openecomp.resource.vf.Vcpe + metadata: + invariantUUID: e0b3088d-9ca8-482a-aa5a-a1e6906b2d22 + UUID: 32edc5e6-34f7-4d62-92f8-c38817280eb9 + customizationUUID: ae70c293-8db3-40cd-8cd0-30cde194bea5 + version: '1.0' + name: vCPE + description: vCPE + type: VF + category: Generic + subcategory: Infrastructure + resourceVendor: huawei + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vf_module_id: vCPEAR1000V + private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1 + vcpe_image_name: vCPE_images + skip_post_instantiation_configuration: true + nf_naming: + ecomp_generated_naming: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d + vcpe_name: ar1000v + private_subnet_wan_id: 86048e4e-861e-47c9-ae55-a5531b747e36 + vnf_id: vCPE_huaweicloud + vcpe_flavor_name: vCPE_flavor + vcpe_private_ip_lan: 192.168.10.250 + requirements: + - abstract_vcpe.link_vcpe_vcpe_private_lan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + - abstract_vcpe.link_vcpe_vcpe_private_wan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + capabilities: + abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vcpe.scalable_vcpe: + properties: + max_instances: 1 + min_instances: 1 + abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vcpe.disk.read.requests_vcpe: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: compute + abstract_vcpe.disk.device.write.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: disk + abstract_vcpe.disk.read.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: compute + abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vcpe.disk.device.read.requests_vcpe: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: disk + abstract_vcpe.disk.device.capacity_vcpe: + properties: + unit: B + description: The amount of disk per device that the instance can see + type: Gauge + category: disk + abstract_vcpe.cpu.delta_vcpe: + properties: + unit: ns + description: CPU time used since previous datapoint + type: Delta + category: compute + abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port: + properties: + connection_point: + network_role: + get_input: port_vcpe_private_lan_port_network_role + nfc_naming_code: vcpe + abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port: + properties: + connection_point: + network_role: + get_input: port_vcpe_private_wan_port_network_role + nfc_naming_code: vcpe + abstract_vcpe.cpu_vcpe: + properties: + unit: ns + description: CPU time used + type: Cumulative + category: compute + abstract_vcpe.disk.latency_vcpe: + properties: + unit: ms + description: Average disk latency + type: Gauge + category: disk + abstract_vcpe.disk.device.read.bytes_vcpe: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: disk + abstract_vcpe.disk.write.bytes_vcpe: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: compute + abstract_vcpe.disk.device.read.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of read requests + type: Gauge + category: disk + abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vcpe.disk.root.size_vcpe: + properties: + unit: GB + description: Size of root disk + type: Gauge + category: compute + abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vcpe.disk.iops_vcpe: + properties: + unit: count/s + description: Average disk iops + type: Gauge + category: disk + abstract_vcpe.endpoint_vcpe: + properties: + secure: true + abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vcpe.disk.device.write.requests_vcpe: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: disk + abstract_vcpe.disk.write.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: compute + abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_vcpe.disk.capacity_vcpe: + properties: + unit: B + description: The amount of disk that the instance can see + type: Gauge + category: disk + abstract_vcpe.cpu_util_vcpe: + properties: + unit: '%' + description: Average CPU utilization + type: Gauge + category: compute + abstract_vcpe.disk.write.requests_vcpe: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: compute + abstract_vcpe.disk.read.bytes_vcpe: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: compute + abstract_vcpe.disk.device.write.bytes_vcpe: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: disk + abstract_vcpe.disk.device.write.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: disk + abstract_vcpe.vcpus_vcpe: + properties: + unit: vcpu + description: Number of virtual CPUs allocated to the instance + type: Gauge + category: compute + abstract_vcpe.disk.allocation_vcpe: + properties: + unit: B + description: The amount of disk occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vcpe.memory_vcpe: + properties: + unit: MB + description: Volume of RAM allocated to the instance + type: Gauge + category: compute + abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vcpe.disk.device.read.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: disk + abstract_vcpe.memory.usage_vcpe: + properties: + unit: MB + description: Volume of RAM used by the instance from the amount of its allocated memory + type: Gauge + category: compute + abstract_vcpe.disk.device.iops_vcpe: + properties: + unit: count/s + description: Average disk iops per device + type: Gauge + category: disk + abstract_vcpe.disk.device.allocation_vcpe: + properties: + unit: B + description: The amount of disk per device occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vcpe.disk.usage_vcpe: + properties: + unit: B + description: The physical size in bytes of the image container on the host + type: Gauge + category: disk + abstract_vcpe.disk.device.latency_vcpe: + properties: + unit: ms + description: Average disk latency per device + type: Gauge + category: disk + abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vcpe.disk.write.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: compute + abstract_vcpe.instance_vcpe: + properties: + unit: instance + description: Existence of instance + type: Gauge + category: compute + abstract_vcpe.disk.device.usage_vcpe: + properties: + unit: B + description: The physical size in bytes of the image container on the host per device + type: Gauge + category: disk + abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vcpe.disk.ephemeral.size_vcpe: + properties: + unit: GB + description: Size of ephemeral disk + type: Gauge + category: compute + abstract_vcpe.memory.resident_vcpe: + properties: + unit: MB + description: Volume of RAM used by the instance on the physical machine + type: Gauge + category: compute + abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + Generic NeutronNet 0: + type: org.openecomp.resource.vl.GenericNeutronNet + metadata: + invariantUUID: f3ed1133-c1bb-4735-82d4-8e041265fad6 + UUID: 24ec2ed8-a072-4f86-9a58-3a4fe220862e + customizationUUID: c8a1a81d-d836-4f33-9d0e-91e9417f812a + version: '1.0' + name: Generic NeutronNet + description: Generic NeutronNet + type: VL + category: Generic + subcategory: Network Elements + resourceVendor: ONAP (Tosca) + resourceVendorRelease: 1.0.0.wd03 + resourceVendorModelNumber: '' + properties: + network_assignments: + is_external_network: false + is_trunked: false + ipv4_subnet_default_assignment: + min_subnets_count: 1 + ecomp_generated_network_assignment: false + ipv6_subnet_default_assignment: + min_subnets_count: 1 + exVL_naming: + ecomp_generated_naming: true + network_flows: + is_network_policy: false + is_bound_to_vpn: false + network_ecomp_naming: + ecomp_generated_naming: true + network_type: NEUTRON + network_technology: NEUTRON + network_homing: + ecomp_selected_instance_node_target: false + vGW 0: + type: org.openecomp.resource.vf.Vgw + metadata: + invariantUUID: 52905e03-0632-43f9-93f2-2ab7d959f633 + UUID: 4f442b9c-237d-4d2d-b549-ee1bdb9842b3 + customizationUUID: fd8595de-1081-4e39-a401-24ffebaa9ed8 + version: '1.0' + name: vGW + description: vGW + type: VF + category: Generic + subcategory: Infrastructure + resourceVendor: huawei + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vf_module_id: CCVPNvGW + gateway_image_name: gateway_image + private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1 + skip_post_instantiation_configuration: true + nf_naming: + ecomp_generated_naming: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + vnf_id: vGW_huaweicloud + private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d + gateway_flavor_name: s3.large.4 + gateway_private_ip_lan: 192.168.10.200 + gateway_name: gateway-vm + requirements: + - abstract_gateway.link_gateway_gateway_private_lan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + capabilities: + abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_gateway.disk.device.read.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: disk + abstract_gateway.disk.capacity_gateway: + properties: + unit: B + description: The amount of disk that the instance can see + type: Gauge + category: disk + abstract_gateway.scalable_gateway: + properties: + max_instances: 1 + min_instances: 1 + abstract_gateway.disk.read.bytes_gateway: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: compute + abstract_gateway.disk.allocation_gateway: + properties: + unit: B + description: The amount of disk occupied by the instance on the host machine + type: Gauge + category: disk + abstract_gateway.disk.device.write.requests_gateway: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: disk + abstract_gateway.disk.device.read.bytes_gateway: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: disk + abstract_gateway.cpu.delta_gateway: + properties: + unit: ns + description: CPU time used since previous datapoint + type: Delta + category: compute + abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_gateway.cpu_gateway: + properties: + unit: ns + description: CPU time used + type: Cumulative + category: compute + abstract_gateway.disk.device.allocation_gateway: + properties: + unit: B + description: The amount of disk per device occupied by the instance on the host machine + type: Gauge + category: disk + abstract_gateway.disk.latency_gateway: + properties: + unit: ms + description: Average disk latency + type: Gauge + category: disk + abstract_gateway.disk.device.read.requests_gateway: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: disk + abstract_gateway.disk.device.read.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of read requests + type: Gauge + category: disk + abstract_gateway.disk.write.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: compute + abstract_gateway.disk.device.write.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: disk + abstract_gateway.cpu_util_gateway: + properties: + unit: '%' + description: Average CPU utilization + type: Gauge + category: compute + abstract_gateway.instance_gateway: + properties: + unit: instance + description: Existence of instance + type: Gauge + category: compute + abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_gateway.disk.root.size_gateway: + properties: + unit: GB + description: Size of root disk + type: Gauge + category: compute + abstract_gateway.memory.usage_gateway: + properties: + unit: MB + description: Volume of RAM used by the instance from the amount of its allocated memory + type: Gauge + category: compute + abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_gateway.disk.device.capacity_gateway: + properties: + unit: B + description: The amount of disk per device that the instance can see + type: Gauge + category: disk + abstract_gateway.disk.iops_gateway: + properties: + unit: count/s + description: Average disk iops + type: Gauge + category: disk + abstract_gateway.disk.write.requests_gateway: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: compute + abstract_gateway.disk.device.write.bytes_gateway: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: disk + abstract_gateway.disk.ephemeral.size_gateway: + properties: + unit: GB + description: Size of ephemeral disk + type: Gauge + category: compute + abstract_gateway.disk.device.write.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: disk + abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_gateway.disk.device.iops_gateway: + properties: + unit: count/s + description: Average disk iops per device + type: Gauge + category: disk + abstract_gateway.endpoint_gateway: + properties: + secure: true + abstract_gateway.disk.device.latency_gateway: + properties: + unit: ms + description: Average disk latency per device + type: Gauge + category: disk + abstract_gateway.vcpus_gateway: + properties: + unit: vcpu + description: Number of virtual CPUs allocated to the instance + type: Gauge + category: compute + abstract_gateway.memory_gateway: + properties: + unit: MB + description: Volume of RAM allocated to the instance + type: Gauge + category: compute + abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_gateway.disk.read.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: compute + abstract_gateway.disk.read.requests_gateway: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: compute + abstract_gateway.port_mirroring_gateway_gateway_private_lan_port: + properties: + connection_point: + network_role: + get_input: port_gateway_private_lan_port_network_role + nfc_naming_code: gateway + abstract_gateway.disk.device.usage_gateway: + properties: + unit: B + description: The physical size in bytes of the image container on the host per device + type: Gauge + category: disk + abstract_gateway.disk.write.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: compute + abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_gateway.memory.resident_gateway: + properties: + unit: MB + description: Volume of RAM used by the instance on the physical machine + type: Gauge + category: compute + abstract_gateway.disk.usage_gateway: + properties: + unit: B + description: The physical size in bytes of the image container on the host + type: Gauge + category: disk + abstract_gateway.disk.write.bytes_gateway: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: compute + groups: + vcpe0..Vcpe..ar1000v..module-0: + type: org.openecomp.groups.VfModule + metadata: + vfModuleModelName: Vcpe..ar1000v..module-0 + vfModuleModelInvariantUUID: d7719964-c045-4ed3-84d6-20a01db7612f + vfModuleModelUUID: c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd + vfModuleModelVersion: '1' + vfModuleModelCustomizationUUID: 8caeefbd-ab71-40c9-9387-8729d7d9c2de + properties: + min_vf_module_instances: 1 + vf_module_label: ar1000v + max_vf_module_instances: 1 + vf_module_type: Base + isBase: true + initial_count: 1 + volume_group: false + vgw0..Vgw..gateway..module-0: + type: org.openecomp.groups.VfModule + metadata: + vfModuleModelName: Vgw..gateway..module-0 + vfModuleModelInvariantUUID: 8c8c936c-e71c-4bc4-94f7-c5680c9dbc00 + vfModuleModelUUID: ddda7e87-8113-463f-aa27-a60112a4e438 + vfModuleModelVersion: '1' + vfModuleModelCustomizationUUID: ea551d60-f9c9-48f2-9757-b01eb2d26d13 + properties: + min_vf_module_instances: 1 + vf_module_label: gateway + max_vf_module_instances: 1 + vf_module_type: Base + isBase: true + initial_count: 1 + volume_group: false + substitution_mappings: + node_type: org.openecomp.service.Publicns + capabilities: + vgw0.abstract_gateway.disk.allocation_gateway: + - vGW 0 + - abstract_gateway.disk.allocation_gateway + vgw0.abstract_gateway.memory.usage_gateway: + - vGW 0 + - abstract_gateway.memory.usage_gateway + vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.device.write.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.bytes.rate_gateway + vgw0.abstract_gateway.disk.device.latency_gateway: + - vGW 0 + - abstract_gateway.disk.device.latency_gateway + vgw0.abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.scalable_gateway: + - vGW 0 + - abstract_gateway.scalable_gateway + vcpe0.abstract_vcpe.host_vcpe: + - vCPE 0 + - abstract_vcpe.host_vcpe + vcpe0.abstract_vcpe.disk.latency_vcpe: + - vCPE 0 + - abstract_vcpe.disk.latency_vcpe + vcpe0.abstract_vcpe.scalable_vcpe: + - vCPE 0 + - abstract_vcpe.scalable_vcpe + vcpe0.abstract_vcpe.disk.device.write.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.bytes.rate_vcpe + vgw0.abstract_gateway.disk.write.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.write.requests.rate_gateway + vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.feature_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.iops_vcpe: + - vCPE 0 + - abstract_vcpe.disk.iops_vcpe + vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.feature_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.host_gateway: + - vGW 0 + - abstract_gateway.host_gateway + vgw0.abstract_gateway.disk.device.write.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.requests.rate_gateway + vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.device.capacity_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.capacity_vcpe + vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.os_vcpe: + - vCPE 0 + - abstract_vcpe.os_vcpe + vgw0.abstract_gateway.disk.usage_gateway: + - vGW 0 + - abstract_gateway.disk.usage_gateway + vcpe0.abstract_vcpe.binding_vcpe: + - vCPE 0 + - abstract_vcpe.binding_vcpe + vgw0.abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.binding_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.memory.resident_vcpe: + - vCPE 0 + - abstract_vcpe.memory.resident_vcpe + vgw0.abstract_gateway.disk.write.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.write.bytes_gateway + vgw0.abstract_gateway.disk.read.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.read.bytes.rate_gateway + vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.disk.root.size_gateway: + - vGW 0 + - abstract_gateway.disk.root.size_gateway + vcpe0.abstract_vcpe.disk.write.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.requests_vcpe + vcpe0.abstract_vcpe.disk.device.write.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.bytes_vcpe + vcpe0.abstract_vcpe.feature_vcpe: + - vCPE 0 + - abstract_vcpe.feature_vcpe + vcpe0.abstract_vcpe.disk.device.latency_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.latency_vcpe + vgw0.abstract_gateway.cpu_util_gateway: + - vGW 0 + - abstract_gateway.cpu_util_gateway + vgw0.abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.device.read.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.requests.rate_gateway + vgw0.abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.write.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.bytes_vcpe + vgw0.abstract_gateway.disk.capacity_gateway: + - vGW 0 + - abstract_gateway.disk.capacity_gateway + vgw0.abstract_gateway.memory_gateway: + - vGW 0 + - abstract_gateway.memory_gateway + vcpe0.abstract_vcpe.cpu_util_vcpe: + - vCPE 0 + - abstract_vcpe.cpu_util_vcpe + vgw0.abstract_gateway.disk.device.write.requests_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.requests_gateway + vgw0.abstract_gateway.vcpus_gateway: + - vGW 0 + - abstract_gateway.vcpus_gateway + vcpe0.abstract_vcpe.disk.ephemeral.size_vcpe: + - vCPE 0 + - abstract_vcpe.disk.ephemeral.size_vcpe + vgw0.abstract_gateway.disk.device.read.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.bytes_gateway + vgw0.abstract_gateway.disk.device.allocation_gateway: + - vGW 0 + - abstract_gateway.disk.device.allocation_gateway + vgw0.abstract_gateway.disk.device.capacity_gateway: + - vGW 0 + - abstract_gateway.disk.device.capacity_gateway + vcpe0.abstract_vcpe.disk.write.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.requests.rate_vcpe + vcpe0.abstract_vcpe.disk.usage_vcpe: + - vCPE 0 + - abstract_vcpe.disk.usage_vcpe + vgw0.abstract_gateway.disk.device.iops_gateway: + - vGW 0 + - abstract_gateway.disk.device.iops_gateway + vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.endpoint_gateway: + - vGW 0 + - abstract_gateway.endpoint_gateway + vcpe0.abstract_vcpe.disk.device.read.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.bytes.rate_vcpe + vcpe0.abstract_vcpe.disk.read.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.requests_vcpe + vcpe0.abstract_vcpe.disk.read.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.bytes.rate_vcpe + vcpe0.abstract_vcpe.disk.device.read.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.bytes_vcpe + vgw0.abstract_gateway.binding_gateway: + - vGW 0 + - abstract_gateway.binding_gateway + vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.cpu.delta_vcpe: + - vCPE 0 + - abstract_vcpe.cpu.delta_vcpe + vcpe0.abstract_vcpe.disk.device.write.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.requests.rate_vcpe + vgw0.abstract_gateway.instance_gateway: + - vGW 0 + - abstract_gateway.instance_gateway + vgw0.abstract_gateway.memory.resident_gateway: + - vGW 0 + - abstract_gateway.memory.resident_gateway + vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.read.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.read.bytes_gateway + vcpe0.abstract_vcpe.disk.device.iops_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.iops_vcpe + vgw0.abstract_gateway.binding_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.binding_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.ephemeral.size_gateway: + - vGW 0 + - abstract_gateway.disk.ephemeral.size_gateway + vgw0.abstract_gateway.feature_gateway: + - vGW 0 + - abstract_gateway.feature_gateway + vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.device.allocation_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.allocation_vcpe + vgw0.abstract_gateway.disk.read.requests_gateway: + - vGW 0 + - abstract_gateway.disk.read.requests_gateway + vcpe0.abstract_vcpe.disk.device.write.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.requests_vcpe + vgw0.abstract_gateway.disk.device.usage_gateway: + - vGW 0 + - abstract_gateway.disk.device.usage_gateway + vgw0.abstract_gateway.cpu.delta_gateway: + - vGW 0 + - abstract_gateway.cpu.delta_gateway + vgw0.abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.port_mirroring_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.port_mirroring_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.disk.latency_gateway: + - vGW 0 + - abstract_gateway.disk.latency_gateway + vcpe0.abstract_vcpe.disk.read.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.bytes_vcpe + vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.attachment_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.cpu_gateway: + - vGW 0 + - abstract_gateway.cpu_gateway + vcpe0.abstract_vcpe.instance_vcpe: + - vCPE 0 + - abstract_vcpe.instance_vcpe + vcpe0.abstract_vcpe.memory_vcpe: + - vCPE 0 + - abstract_vcpe.memory_vcpe + vgw0.abstract_gateway.feature_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.feature_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.device.write.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.bytes_gateway + vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.device.read.requests_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.requests_gateway + vgw0.abstract_gateway.disk.write.requests_gateway: + - vGW 0 + - abstract_gateway.disk.write.requests_gateway + vgw0.abstract_gateway.os_gateway: + - vGW 0 + - abstract_gateway.os_gateway + vgw0.abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.disk.write.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.bytes.rate_vcpe + vgw0.abstract_gateway.disk.write.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.write.bytes.rate_gateway + vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.cpu_vcpe: + - vCPE 0 + - abstract_vcpe.cpu_vcpe + vcpe0.abstract_vcpe.disk.allocation_vcpe: + - vCPE 0 + - abstract_vcpe.disk.allocation_vcpe + vcpe0.abstract_vcpe.disk.device.read.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.requests.rate_vcpe + vgw0.abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.disk.device.read.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.requests_vcpe + vgw0.abstract_gateway.disk.device.read.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.bytes.rate_gateway + vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.binding_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.forwarder_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.forwarder_gateway_gateway_private_lan_port + genericneutronnet0.virtual_linkable: + - Generic NeutronNet 0 + - virtual_linkable + vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.device.usage_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.usage_vcpe + genericneutronnet0.feature: + - Generic NeutronNet 0 + - feature + vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.root.size_vcpe: + - vCPE 0 + - abstract_vcpe.disk.root.size_vcpe + vcpe0.abstract_vcpe.vcpus_vcpe: + - vCPE 0 + - abstract_vcpe.vcpus_vcpe + vcpe0.abstract_vcpe.endpoint_vcpe: + - vCPE 0 + - abstract_vcpe.endpoint_vcpe + vgw0.abstract_gateway.attachment_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.attachment_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.attachment_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.memory.usage_vcpe: + - vCPE 0 + - abstract_vcpe.memory.usage_vcpe + vcpe0.abstract_vcpe.disk.capacity_vcpe: + - vCPE 0 + - abstract_vcpe.disk.capacity_vcpe + vgw0.abstract_gateway.disk.iops_gateway: + - vGW 0 + - abstract_gateway.disk.iops_gateway + requirements: + vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.dependency_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.link_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.link_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.local_storage_gateway: + - vGW 0 + - abstract_gateway.local_storage_gateway + genericneutronnet0.dependency: + - Generic NeutronNet 0 + - dependency + vcpe0.abstract_vcpe.local_storage_vcpe: + - vCPE 0 + - abstract_vcpe.local_storage_vcpe + vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.dependency_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.dependency_gateway: + - vGW 0 + - abstract_gateway.dependency_gateway + vcpe0.abstract_vcpe.dependency_vcpe: + - vCPE 0 + - abstract_vcpe.dependency_vcpe + vgw0.abstract_gateway.dependency_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.dependency_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.link_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.link_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.link_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.link_gateway_gateway_private_lan_port diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env new file mode 100644 index 0000000000..f0cc985078 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env @@ -0,0 +1,10 @@ +parameters: + private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d" + private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1" + private_subnet_wan_id: "86048e4e-861e-47c9-ae55-a5531b747e36" + vcpe_flavor_name: "vCPE_flavor" + vcpe_image_name: "vCPE_images" + vcpe_name: "ar1000v" + vcpe_private_ip_lan: "192.168.10.250" + vf_module_id: "vCPEAR1000V" + vnf_id: "vCPE_huaweicloud" diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml new file mode 100644 index 0000000000..b4d0fa7a6b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml @@ -0,0 +1,103 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 Huawei Technologies Co., Ltd. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==================LICENSE_END============================================ + +heat_template_version: 2013-05-23 + +description: Heat template to deploy Huawei AR1000V vCPE + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_name: + type: string + label: name + description: name to be used for compute instance + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + private_net_id: + type: string + label: Private oam network name or ID + description: Private network that enables remote connection to VNF + private_subnet_wan_id: + type: string + label: Private wan sub-network name or ID + description: Private wan sub-network that enables remote connection to VNF + private_subnet_lan_id: + type: string + label: Private lan sub-network name or ID + description: Private lan sub-network that enables remote connection to VNF + vcpe_private_ip_lan: + type: string + label: vCPE lan private IP address + description: Private IP address that is assigned to the vCPE lan port + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ECOMP + vf_module_id: + type: string + label: VF module id + description: the vf module id is provided by ECOMP +############# +# # +# RESOURCES # +# # +############# + +resources: +# For the floating IP in Public cloud , floating_network_id is not needed + vCPE_oam_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: private_net_id} + port_id: { get_resource: vcpe_private_wan_port} + + vcpe_private_wan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}] + + vcpe_private_lan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: vcpe_private_ip_lan }}] + + ar_1000v: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vcpe_name } + networks: + - port: { get_resource: vcpe_private_wan_port } + - port: { get_resource: vcpe_private_lan_port } + metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json new file mode 100644 index 0000000000..3376b1bf40 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "Vcpe..ar1000v..module-0", + "vfModuleModelInvariantUUID": "d7719964-c045-4ed3-84d6-20a01db7612f", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd", + "vfModuleModelCustomizationUUID": "8caeefbd-ab71-40c9-9387-8729d7d9c2de", + "isBase": true, + "artifacts": [ + "12dcc618-20f2-4f15-ab00-c549b96b3910", + "5821b043-ba50-49ef-b739-61b0896050f2" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "ar1000v", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml new file mode 100644 index 0000000000..a10a5b2bb1 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml new file mode 100644 index 0000000000..ed1575b7f5 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>c1aad4e55922438f956ff97b91c5446d</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env new file mode 100644 index 0000000000..a995d16b31 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env @@ -0,0 +1,9 @@ +parameters: + gateway_flavor_name: "s3.large.4" + gateway_image_name: "gateway_image" + gateway_name: "gateway-vm" + gateway_private_ip_lan: "192.168.10.200" + private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d" + private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1" + vf_module_id: "CCVPNvGW" + vnf_id: "vGW_huaweicloud" diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml new file mode 100644 index 0000000000..2d72a1c183 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml @@ -0,0 +1,109 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 Huawei Technologies Co., Ltd. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==================LICENSE_END============================================ + +heat_template_version: 2013-05-23 + +description: Heat template to deploy CCVPN gateway instance + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + gateway_name: + type: string + label: name + description: name to be used for compute instance + gateway_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + gateway_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + private_net_id: + type: string + label: Private oam network name or ID + description: Private network that enables remote connection to VNF +# private_subnet_wan_id: +# type: string +# label: Private wan sub-network name or ID +# description: Private wan sub-network that enables remote connection to VNF + private_subnet_lan_id: + type: string + label: Private lan sub-network name or ID + description: Private lan sub-network that enables remote connection to VNF + gateway_private_ip_lan: + type: string + label: gateway lan private IP address + description: Private IP address that is assigned to the gateway lan port + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ECOMP + vf_module_id: + type: string + label: VF module id + description: the vf module id is provided by ECOMP +############# +# # +# RESOURCES # +# # +############# + +resources: +# For the floating IP in Public cloud , floating_network_id is not needed + gateway_oam_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: private_net_id} + port_id: { get_resource: gateway_private_lan_port} + + #gateway_private_wan_port: + # type: OS::Neutron::Port + # properties: + # network: { get_param: private_net_id } + # fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}] + + gateway_private_lan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: gateway_private_ip_lan }}] + + gateway_instacne: + type: OS::Nova::Server + properties: + image: { get_param: gateway_image_name } + flavor: { get_param: gateway_flavor_name } + name: { get_param: gateway_name } + networks: + #- port: { get_resource: gateway_private_wan_port } + - port: { get_resource: gateway_private_lan_port } + metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data: | + #!/bin/bash + docker start msb_consul + docker start msb_discovery + docker start msb_internal_apigateway + #user_data_format: HEAT_CFNTOOLS/RAW
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml new file mode 100644 index 0000000000..a10a5b2bb1 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml new file mode 100644 index 0000000000..a4a84cc4c0 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>8c1c2b40525942aca038a4528ce3bb4e</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json new file mode 100644 index 0000000000..1a1badec5e --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "Vgw..gateway..module-0", + "vfModuleModelInvariantUUID": "8c8c936c-e71c-4bc4-94f7-c5680c9dbc00", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "ddda7e87-8113-463f-aa27-a60112a4e438", + "vfModuleModelCustomizationUUID": "ea551d60-f9c9-48f2-9757-b01eb2d26d13", + "isBase": true, + "artifacts": [ + "60d55796-212c-4c66-8af5-63964d636ae4", + "9df0452f-826c-4287-9a2d-ca0095339866" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "gateway", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index ad6b156956..f2c04802a5 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -1447,7 +1447,7 @@ CREATE TABLE `infra_active_requests` ( `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, @@ -1500,7 +1500,7 @@ CREATE TABLE `archived_infra_requests` ( `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index f14e3dcc42..ee70dcc89c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.openpojo.rules.HasToStringRule -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @Deprecated class AaiUtil { @@ -96,7 +96,7 @@ class AaiUtil { String regionId = "" try{ URL Url = new URL(url) - HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 2bf7298584..83784e1960 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.web.util.UriUtils import javax.ws.rs.core.MediaType @@ -442,7 +442,7 @@ class CatalogDbUtils { String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint def responseData = '' - HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB) + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB) client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', "BPMN") client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index c23150384e..195b1fc0d6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -34,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.utils.TargetEntities +import org.onap.logging.filter.base.ONAPComponentsList import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("Outgoing WorkflowException is " + exception) } - public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) { + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) { MsoUtils utils = new MsoUtils() String processKey = getProcessKey(execution); logger.debug("Building a WorkflowException for " + processKey) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 5525c2642b..a5111a62d3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -145,7 +145,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL) + HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL) client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid) @@ -183,7 +183,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI) + HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") httpClient.addAdditionalHeader("X-TransactionId", uuid) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 3008f77b62..6d4b50f690 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -42,7 +42,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ logger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 6583ded413..b082c1830e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.db.catalog.beans.ServerType -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor { URL url = new URL(urlString) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(oofRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 4bfb29bc45..606b97bec2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpEntity import org.springframework.http.HttpHeaders import org.springframework.http.HttpMethod diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index c30d807bf3..52d6758b2b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy index 8c2da2c112..08c032fba3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray @@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{ logger.debug("Sniro Url is: " + urlString) URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(sniroRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 866229f6b8..803a3f71de 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import java.util.UUID +import org.onap.so.utils.Components @@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no messageId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable('VNFAResponse_CORRELATOR', messageId) @@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'notificationUrl', notificationUrl) @@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } while (vnfAdapterEndpoint.endsWith('/')) { @@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'POST' @@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') @@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') @@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) @@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(vnfAdapterUrl); - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) @@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) @@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } } catch (Exception e) { logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO) } } @@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String rolledBack = getChildText(root, "rolledBack") rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + - " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK); + " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK); } catch (Exception e) { response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK) + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK) } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 2c1d36273d..8efb6a3e1c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -383,7 +383,7 @@ public class ResourceRequestBuilder { HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint) .path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), - TargetEntity.CATALOG_DB); + ONAPComponents.CATALOG_DB); client.addAdditionalHeader("Accept", "application/json"); client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 433aa0c11a..3cf5a60de7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -389,8 +389,11 @@ public class BBInputSetup implements JavaDelegate { String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) { Configuration configuration = null; for (Configuration configurationTemp : serviceInstance.getConfigurations()) { - if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId() - .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + if ((bbName.contains("Fabric") && configurationTemp.getConfigurationSubType() != null + && configurationTemp.getConfigurationSubType().equalsIgnoreCase("Fabric Config")) + || (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID)))) { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationTemp.getConfigurationId()); configuration = configurationTemp; org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); 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 be53e505ac..ae7addcc57 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 @@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.Map; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.logging.filter.base.ONAPComponentsList; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; @@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay { } } catch (Exception ex) { // keep default serviceType value - logger.error("Exception in serviceType retrivel", ex); + logger.error("Exception in serviceType retrieval", ex); } String vnfType = ASTERISK; try { @@ -116,22 +116,21 @@ public class ExecuteBuildingBlockRainyDay { } } catch (Exception ex) { // keep default vnfType value - logger.error("Exception in vnfType retrivel", ex); + logger.error("Exception in vnfType retrieval", ex); } String errorCode = ASTERISK; - try { + if (workflowException != null) { errorCode = "" + workflowException.getErrorCode(); - } catch (Exception ex) { - // keep default errorCode value - logger.error("Exception in errorCode retrivel", ex); + } else { + logger.debug("WorkflowException is null, unable to get error code"); } try { errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode"); } catch (Exception ex) { // keep default errorCode value - logger.error("Exception in errorCode retrivel", ex); + logger.error("Exception in errorCode retrieval", ex); } String workStep = ASTERISK; @@ -139,7 +138,7 @@ public class ExecuteBuildingBlockRainyDay { workStep = workflowException.getWorkStep(); } catch (Exception ex) { // keep default workStep value - logger.error("Exception in workStep retrivel", ex); + logger.error("Exception in workStep retrieval", ex); } String errorMessage = ASTERISK; @@ -147,7 +146,7 @@ public class ExecuteBuildingBlockRainyDay { errorMessage = workflowException.getErrorMessage(); } catch (Exception ex) { // keep default workStep value - logger.error("Exception in errorMessage retrivel", ex); + logger.error("Exception in errorMessage retrieval", ex); } String serviceRole = ASTERISK; @@ -223,7 +222,7 @@ public class ExecuteBuildingBlockRainyDay { try { String requestId = (String) execution.getVariable("mso-request-id"); WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); - TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource(); + ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource(); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback"); if (isRollbackFailure == null) { @@ -244,10 +243,10 @@ public class ExecuteBuildingBlockRainyDay { } else if (isRollbackFailure) { logger.debug( "rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN"); - request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString()); } else { logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN"); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); } request.setLastModifiedBy("CamundaBPMN"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index aee28cae00..aa71ee540f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -5,6 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (c) 2019 Samsung + * Modifications Copyright (c) 2019 Nokia * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,26 +45,15 @@ public class ExtractPojosForBB { private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException { - return extractByKey(execution, key, execution.getLookupMap().get(key)); - } - - protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) - throws BBObjectNotFoundException { - Optional<T> result = Optional.empty(); GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + String value = execution.getLookupMap().get(key); try { ServiceInstance serviceInstance; GenericVnf vnf; switch (key) { case SERVICE_INSTANCE_ID: - if (gBBInput.getCustomer().getServiceSubscription() == null - && gBBInput.getServiceInstance() != null) { - result = Optional.of((T) gBBInput.getServiceInstance()); - } else if (gBBInput.getCustomer().getServiceSubscription() != null) { - result = lookupObjectInList( - gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); - } + result = getServiceInstance(gBBInput, value); break; case GENERIC_VNF_ID: serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); @@ -100,26 +90,26 @@ public class ExtractPojosForBB { serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getInstanceGroups(), value); break; - default: - throw new BBObjectNotFoundException(key, value); } - } catch (BBObjectNotFoundException e) { // re-throw parent object not found - throw e; } catch (Exception e) { // convert all other exceptions to object not found logger.warn( "BBObjectNotFoundException in ExtractPojosForBB, BBObject {} was not found in gBBInput using reference value: {} {}", key, value, e); throw new BBObjectNotFoundException(key, value); } + return result.orElseThrow(() -> new BBObjectNotFoundException(key, value)); + } - if (result.isPresent()) { - return result.get(); - } else { - throw new BBObjectNotFoundException(key, value); + private <T> Optional<T> getServiceInstance(GeneralBuildingBlock gBBInput, String value) throws Exception { + if (gBBInput.getCustomer().getServiceSubscription() == null && gBBInput.getServiceInstance() != null) { + return Optional.of((T) gBBInput.getServiceInstance()); + } else if (gBBInput.getCustomer().getServiceSubscription() != null) { + return lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); } + return Optional.empty(); } - protected <T> Optional<T> lookupObjectInList(List<?> list, String value) + private <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Optional<T> result = Optional.empty(); for (Object obj : list) { @@ -129,10 +119,9 @@ public class ExtractPojosForBB { } } return result; - } - protected <T> Optional<T> findValue(Object obj, String value) + private <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { for (Field field : obj.getClass().getDeclaredFields()) { if (field.isAnnotationPresent(Id.class)) { @@ -144,7 +133,6 @@ public class ExtractPojosForBB { } } } - return Optional.empty(); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 100887dbbc..c26a1cfecc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -43,8 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -92,7 +92,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -156,7 +156,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -195,7 +195,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { if (execution instanceof DelegateExecutionImpl) { buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage, extSystemErrorSource); @@ -215,7 +215,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String processKey = getProcessKey(execution); logger.info("Building a WorkflowException for Subflow"); @@ -244,9 +244,9 @@ public class ExceptionBuilder { public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { logger.debug("Processing Audit Results"); String auditListString = (String) execution.getVariable("auditInventoryResult"); + String processKey = getProcessKey(execution.getDelegateExecution()); if (auditListString != null) { StringBuilder errorMessage = new StringBuilder(); - String processKey = getProcessKey(execution.getDelegateExecution()); try { ExtractPojosForBB extractPojosForBB = getExtractPojosForBB(); VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -293,7 +293,7 @@ public class ExceptionBuilder { execution.setVariable("StatusMessage", errorMessage.toString()); } else { WorkflowException exception = - new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO); + new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); logger.info("Outgoing WorkflowException is {}", exception); @@ -302,7 +302,13 @@ public class ExceptionBuilder { } } else { - logger.debug("Unable to process audit results due to auditInventoryResult being null"); + String errorMessage = "Unable to process audit results due to auditInventoryResult being null"; + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy index d7438f80f9..fda6b8e6e3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.skyscreamer.jsonassert.JSONAssert import org.skyscreamer.jsonassert.JSONCompareMode import org.springframework.core.env.Environment @@ -127,7 +127,7 @@ class CatalogDbUtilsTest { private void mockGetResponseFromCatalogDb(String queryEndpoint) { Environment environmentMock = createEnvironmentMock() when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl") - when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock) + when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock) Response responseMock = mock(Response.class) when(httpClientMock.get()).thenReturn(responseMock) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy index 837bc77f19..7abfcffb13 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -26,7 +26,7 @@ import org.junit.Test import org.onap.logging.ref.slf4j.ONAPLogConstants import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpStatus import javax.ws.rs.core.MediaType @@ -53,7 +53,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.get()).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) @@ -75,7 +75,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).get() HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -97,7 +97,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -120,7 +120,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index de44caa120..525307a5df 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -1,22 +1,22 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ package org.onap.so.bpmn.common.scripts @@ -32,6 +32,7 @@ import org.junit.runner.RunWith import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.HttpClient import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient @@ -47,54 +48,56 @@ abstract class MsoGroovyTest { @Rule public ExpectedException thrown = ExpectedException.none() - protected ExecutionEntity mockExecution - protected AAIResourcesClient client + protected ExecutionEntity mockExecution + protected AAIResourcesClient client protected AllottedResourceUtils allottedResourceUtils_MOCK - protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA = - FileUtil.readResourceFile("__files/aai/searchResults.json") - protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); - - protected void init(String procName){ - mockExecution = setupMock(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - client = mock(AAIResourcesClient.class) - } - - protected ExecutionEntity setupMock(String procName) { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn(procName) - - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - - return mockExecution - } - - protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("prefix")).thenReturn(prefix) - - ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) - RepositoryService repositoryService = mock(RepositoryService.class) - ProcessDefinition processDefinition = mock(ProcessDefinition.class) - - when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) - when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) - when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) - when(processDefinition.getKey()).thenReturn(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - return mockExecution - } - + protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA = + FileUtil.readResourceFile("__files/aai/searchResults.json") + protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); + + protected void init(String procName){ + mockExecution = setupMock(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + client = mock(AAIResourcesClient.class) + } + + protected ExecutionEntity setupMock(String procName) { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(procName) + + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + + HttpClient httpClient = mock(HttpClient.class) + + return mockExecution + } + + protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) + RepositoryService repositoryService = mock(RepositoryService.class) + ProcessDefinition processDefinition = mock(ProcessDefinition.class) + + when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) + when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) + when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) + when(processDefinition.getKey()).thenReturn(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + return mockExecution + } + protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){ String json = FileUtil.readResourceFile(file) AAIResultWrapper resultWrapper = new AAIResultWrapper(json) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index c90ebfb973..7c136cdee9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -1294,6 +1294,7 @@ public class BBInputSetupTest { Configuration configuration = new Configuration(); configuration.setConfigurationId("configurationId"); configuration.setConfigurationName("configurationName"); + configuration.setConfigurationSubType("Fabric Config"); serviceInstance.getConfigurations().add(configuration); String resourceId = "configurationId"; String vnfcName = "vnfcName"; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java index 6a48558d11..6d5ce622d9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java @@ -33,10 +33,11 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; @RunWith(MockitoJUnitRunner.class) public class ExecuteBuildingBlockRainyDayUnitTest { @@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { @Before public void setup() { - exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC); + exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC); noExtSystemErrorSourceException = new WorkflowException("Test exception without extsystemErrorSource", 7000, "", ""); @@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() { + public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityNullTest() { + public void updateExtSystemErrorSourceONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() { + public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); executionNullisRollback.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java index b109ae258d..5baafbba67 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java @@ -39,7 +39,7 @@ import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; @RunWith(MockitoJUnitRunner.class) public class ExceptionBuilderUnitTest { @@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); } @Test @@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); } @Test @@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest { doReturn("Process key").when(exceptionBuilder).getProcessKey(execution); thrown.expect(BpmnError.class); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java index 7d5bb0dcf1..f8dfad61f2 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.core; import java.io.Serializable; -import org.onap.so.utils.TargetEntities; +import org.onap.logging.filter.base.ONAPComponentsList; /** * An object that represents a workflow exception. @@ -33,7 +33,7 @@ public class WorkflowException implements Serializable { private final int errorCode; private final String errorMessage; private final String workStep; - private TargetEntities extSystemErrorSource; + private ONAPComponentsList extSystemErrorSource; /** * Constructor @@ -50,7 +50,7 @@ public class WorkflowException implements Serializable { } public WorkflowException(String processKey, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { this.processKey = processKey; this.errorCode = errorCode; this.errorMessage = errorMessage; @@ -66,7 +66,7 @@ public class WorkflowException implements Serializable { } public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { this.processKey = processKey; this.errorCode = errorCode; this.errorMessage = errorMessage; @@ -102,7 +102,7 @@ public class WorkflowException implements Serializable { return workStep; } - public TargetEntities getExtSystemErrorSource() { + public ONAPComponentsList getExtSystemErrorSource() { return extSystemErrorSource; } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 251464a34d..6de22825b7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -37,8 +37,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; import org.camunda.bpm.engine.impl.util.xml.Element; import org.camunda.bpm.engine.impl.variable.VariableDeclaration; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -50,6 +52,9 @@ import org.springframework.stereotype.Component; @Component public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { + public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; + public static final String SERVICE_NAME = "ServiceName"; + @Autowired private LoggingParseListener loggingParseListener; @@ -294,6 +299,13 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); + try { + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); + MDC.put(SERVICE_INSTANCE_ID, svcid); + MDC.put(SERVICE_NAME, processName); + } catch (Exception e) { + logger.error("Error trying to add variables to MDC", e); + } } } catch (Exception e) { logger.error("Exception occurred", e); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index a049f81906..03feda6d0f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -38,9 +38,7 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -65,7 +63,7 @@ public class CXFConfiguration { private WorkflowAsyncResource workflowAsyncResource; @Autowired - private JaxRsFilterLogging jaxRsFilterLogging; + private SOAuditLogContainerFilter soAuditLogContainerFilter; @Autowired private ObjectMapper mapper; @@ -108,7 +106,7 @@ public class CXFConfiguration { endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource)); endpoint.setAddress("/"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging)); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); return endpoint.create(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index a4fc6e54b0..29fc4e93fc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -33,7 +33,7 @@ import org.camunda.bpm.engine.repository.DeploymentBuilder; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.onap.logging.filter.spring.MDCTaskDecorator;; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index e71404a2ff..93f98a34a6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1384,172 +1384,6 @@ public abstract class WorkflowTest { } /** - * Runs a program to inject sniro workflow messages into the test environment. A program is essentially just a list - * of keys that identify event data to be injected, in sequence. For more details, see injectSNIROCallbacks(String - * contentType, String messageType, String content, long timeout) - * - * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a - * workflow message type associated with it. - * - * @param callbacks an object containing event data for the program - * @param program the program to execute - */ - protected void injectSNIROCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String messageType = null; - String content = null; - String contentType = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No '" + action + "' workflow message callback is defined"; - logger.debug(msg); - fail(msg); - } - - messageType = callbackData.getMessageType(); - - if (messageType == null || messageType.trim().equals("")) { - String msg = "No workflow message type is defined in the '" + action + "' callback"; - logger.debug(msg); - fail(msg); - } - - content = callbackData.getContent(); - contentType = callbackData.getContentType(); - } else { - String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - logger.debug(msg); - fail(msg); - } - - if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) { - fail("Failed to inject '" + action + "' workflow message"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of '" + action + "' workflow message"); - } - } - } - - /** - * Injects a sniro workflow message. The specified callback response may contain the placeholder strings - * ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) The ((CORRELATOR)) is replaced with the actual correlator value from - * the request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId value from the sniro - * request. Currently this only works with sniro request that contain only 1 resource. - * - * @param contentType the HTTP contentType for the message (possibly null) - * @param messageType the message type - * @param content the message content (possibly null) - * @param timeout the timeout in milliseconds - * @return true if the message could be injected, false otherwise - */ - protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) { - String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout); - - if (correlator == null) { - return false; - } - if (content != null) { - content = content.replace("((CORRELATOR))", correlator); - if (messageType.equalsIgnoreCase("SNIROResponse")) { - ServiceDecomposition decomp = - (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout); - List<Resource> resourceList = decomp.getServiceResources(); - if (resourceList.size() == 1) { - String resourceId = ""; - for (Resource resource : resourceList) { - resourceId = resource.getResourceId(); - } - String homingList = getJsonValue(content, "solutionInfo.placementInfo"); - JSONArray placementArr = null; - try { - placementArr = new JSONArray(homingList); - } catch (Exception e) { - return false; - } - if (placementArr.length() == 1) { - content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); - } - String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); - JSONArray licenseArr = null; - try { - licenseArr = new JSONArray(licenseInfoList); - } catch (Exception e) { - return false; - } - if (licenseArr.length() == 1) { - content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); - } - } else { - try { - String homingList = getJsonValue(content, "solutionInfo.placementInfo"); - String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); - JSONArray placementArr = new JSONArray(homingList); - JSONArray licenseArr = new JSONArray(licenseInfoList); - for (Resource resource : resourceList) { - String resourceModuleName = resource.getModelInfo().getModelInstanceName(); - String resourceId = resource.getResourceId(); - - for (int i = 0; i < placementArr.length(); i++) { - JSONObject placementObj = placementArr.getJSONObject(i); - String placementModuleName = placementObj.getString("resourceModuleName"); - if (placementModuleName.equalsIgnoreCase(resourceModuleName)) { - String placementString = placementObj.toString(); - placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId); - JSONObject newPlacementObj = new JSONObject(placementString); - placementArr.put(i, newPlacementObj); - } - } - - for (int i = 0; i < licenseArr.length(); i++) { - JSONObject licenseObj = licenseArr.getJSONObject(i); - String licenseModuleName = licenseObj.getString("resourceModuleName"); - if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) { - String licenseString = licenseObj.toString(); - licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId); - JSONObject newLicenseObj = new JSONObject(licenseString); - licenseArr.put(i, newLicenseObj); - } - } - } - String newPlacementInfos = placementArr.toString(); - String newLicenseInfos = licenseArr.toString(); - content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos); - content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos); - } catch (Exception e) { - return false; - } - - } - } - } - logger.debug("Injecting " + messageType + " message"); - - Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - logger.debug("Workflow response to {} message: {}", messageType, response); - return true; - } - - - /** * Wait for the process to end. * * @param businessKey the process business key diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index dd993bca51..078317885c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -20,9 +20,8 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import java.util.HashMap; +import java.util.Map; import java.util.Objects; -import java.util.Optional; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @@ -35,8 +34,7 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, - Optional<HashMap<String, String>> updateInfo) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 901964f465..2e664d90da 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -273,7 +273,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 7abdd49d1d..1d3b2757e7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -52,7 +52,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import javax.ws.rs.core.MediaType import org.apache.commons.codec.binary.Base64 -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index 41a302f5f1..e34e505e55 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -35,7 +35,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError @@ -199,7 +199,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) URL url = new URL(urlRollbackPoNetwork) - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(rollbackNetworkRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 1517a335d9..2def9e2d06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -39,7 +39,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.Response @@ -258,7 +258,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 731c5b8dc5..dafc4b5470 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -67,7 +67,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.NamedNodeMap @@ -698,7 +698,7 @@ public class DoCreateVfModule extends VfModuleBase { String endPoint = aaiUriUtil.createAaiUri(uri) try { - HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) @@ -781,7 +781,7 @@ public class DoCreateVfModule extends VfModuleBase { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName) String endPoint = aaiUriUtil.createAaiUri(uri) - HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 34ea20ba62..a24bc4411e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -54,7 +54,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.web.util.UriUtils import javax.ws.rs.NotFoundException @@ -388,7 +388,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceAaiPath = "${aai_endpoint}${urlLink}" URL url = new URL(serviceAaiPath) - HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(url, ONAPComponents.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index df8735aaaa..09eb7994a8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -51,7 +51,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import groovy.json.JsonOutput import javax.ws.rs.core.Response @@ -455,7 +455,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") URL url = new URL(vnfAdapterUrl) - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER) httpClient.accept = "application/xml" httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(vnfAdapterRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 00244aded0..28f4460d71 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response @@ -226,7 +226,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) @@ -257,7 +257,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) httpClient.addAdditionalHeader("Content-Type", "application/json") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 2a8cc08cdf..367975e003 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -51,7 +51,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @@ -209,7 +209,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try{ URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") apiResponse = httpClient.post(requestBody) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 75ac6900fa..cfdba89db7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** * This class supports the VID Flow @@ -164,7 +164,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', 'application/xml') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java index d401522800..ce53044052 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,13 +25,15 @@ import java.util.Map; import java.util.Optional; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AAICreateResources extends AAIResource { + private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); public void createAAIProject(String projectName, String serviceInstance) { AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); @@ -89,6 +91,7 @@ public class AAICreateResources extends AAIResource { Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class); return vnf; } catch (Exception ex) { + logger.error("Exception in getVnfInstance", ex); return Optional.empty(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java index 2526ca5c25..c489ef29ce 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,13 +24,19 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate { + private static final Logger logger = LoggerFactory.getLogger(AAIDeleteServiceInstance.class); + + private static final String ERROR_MESSAGE = + "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."; + ExceptionUtil exceptionUtil = new ExceptionUtil(); public void execute(DelegateExecution execution) throws Exception { @@ -41,9 +47,8 @@ public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegat getAaiClient().delete(serviceInstanceURI); execution.setVariable("GENDS_SuccessIndicator", true); } catch (Exception ex) { - String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." - + ex.getMessage(); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + logger.error(ERROR_MESSAGE, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ERROR_MESSAGE + ex.getMessage()); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java index 493340c9ef..216f426ec0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java @@ -62,6 +62,7 @@ public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate { logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry); execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry); } catch (IOException e) { + logger.error("Exception in check AAI for pnf_correlation_id execution", e); new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java index a011346756..ee86ca4292 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java @@ -65,7 +65,7 @@ public class ConfigCheckerDelegate implements JavaDelegate { delegateExecution.setVariable(MODEL_UUID, serviceModelUuid); List<PnfResourceCustomization> pnfCustomizations = catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid); - if (pnfCustomizations != null && pnfCustomizations.size() >= 1) { + if (pnfCustomizations != null && !pnfCustomizations.isEmpty()) { PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0); boolean skipPostInstantiationConfiguration = pnfResourceCustomization.isSkipPostInstConf(); delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java index 6d73b61ab2..781ee5cda4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java @@ -48,6 +48,7 @@ public class CreateRelation implements JavaDelegate { try { pnfManagementImpl.createRelation(serviceInstanceId, pnfName); } catch (Exception e) { + logger.error("An exception occurred when making service and pnf relation. Exception:", e); new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999, "An exception occurred when making service and pnf relation. Exception: " + e.getMessage()); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 2ababac7e3..a55f32aaaa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +21,12 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import java.util.Map; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.camunda.bpm.engine.runtime.Execution; -import org.onap.aai.domain.yang.v13.Metadatum; import org.onap.so.bpmn.common.recipe.ResourceInput; import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; -import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +38,7 @@ import java.util.Optional; @Component public class InformDmaapClient implements JavaDelegate { - private Logger logger = LoggerFactory.getLogger(getClass()); + private static final Logger LOGGER = LoggerFactory.getLogger(InformDmaapClient.class); private DmaapClient dmaapClient; @Override @@ -47,25 +46,34 @@ public class InformDmaapClient implements JavaDelegate { String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); String processBusinessKey = execution.getProcessBusinessKey(); - HashMap<String, String> updateInfo = createUpdateInfo(execution); - updateInfo.put("pnfCorrelationId", pnfCorrelationId); - dmaapClient - .registerForUpdate(pnfCorrelationId, - () -> runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey(processBusinessKey).correlateWithResult(), - Optional.of(updateInfo)); + dmaapClient.registerForUpdate(pnfCorrelationId, + () -> runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(processBusinessKey).correlateWithResult(), + createUpdateInfoMap(execution)); } - private HashMap<String, String> createUpdateInfo(DelegateExecution execution) { - HashMap<String, String> map = new HashMap(); - - ResourceInput resourceInputObj = ResourceRequestBuilder + private Map<String, String> createUpdateInfoMap(DelegateExecution execution) { + Map<String, String> updateInfoMap = new HashMap<>(); + updateInfoMap.put("pnfCorrelationId", + (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID)); + getResourceInput(execution).ifPresent(resourceInput -> { + updateInfoMap.put("globalSubscriberID", resourceInput.getGlobalSubscriberId()); + updateInfoMap.put("serviceType", resourceInput.getServiceType()); + updateInfoMap.put("serviceInstanceId", resourceInput.getServiceInstanceId()); + }); + return updateInfoMap; + } - .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class); - map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId()); - map.put("serviceType", resourceInputObj.getServiceType()); - map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId()); - return map; + private Optional<ResourceInput> getResourceInput(DelegateExecution execution) { + ResourceInput resourceInput = null; + if (execution.getVariable("resourceInput") != null) { + resourceInput = ResourceRequestBuilder.getJsonObject((String) execution.getVariable("resourceInput"), + ResourceInput.class); + } else { + LOGGER.warn("resourceInput value is null for correlation id: {}", + execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID)); + } + return Optional.ofNullable(resourceInput); } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java index d513684659..bafb749e15 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,13 +21,11 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; -import java.util.HashMap; -import java.util.Optional; +import java.util.Map; public interface DmaapClient { - void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, - Optional<HashMap<String, String>> updateInfo); + void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo); Runnable unregister(String pnfCorrelationId); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 48061db887..02303a6b23 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -54,8 +54,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { private int topicListenerDelayInSeconds; private volatile ScheduledThreadPoolExecutor executor; private volatile boolean dmaapThreadListenerIsRunning; - - public volatile List<HashMap<String, String>> updateInfoMap; + private volatile List<Map<String, String>> listOfUpdateInfoMap; @Autowired public PnfEventReadyDmaapClient(Environment env) { @@ -68,18 +67,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient { .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName")) .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId")) .build()); - updateInfoMap = new ArrayList<>(); + listOfUpdateInfoMap = new ArrayList<>(); } @Override public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, - Optional<HashMap<String, String>> updateInfo) { + Map<String, String> updateInfo) { logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); - HashMap<String, String> map = updateInfo.get(); - if (map != null && map.size() > 0) { - synchronized (updateInfoMap) { - updateInfoMap.add(map); - } + synchronized (listOfUpdateInfoMap) { + listOfUpdateInfoMap.add(updateInfo); } pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer); if (!dmaapThreadListenerIsRunning) { @@ -91,14 +87,14 @@ public class PnfEventReadyDmaapClient implements DmaapClient { public synchronized Runnable unregister(String pnfCorrelationId) { logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); - synchronized (updateInfoMap) { - for (int i = updateInfoMap.size() - 1; i >= 0; i--) { - if (!updateInfoMap.get(i).containsKey("pnfCorrelationId")) + synchronized (listOfUpdateInfoMap) { + for (int i = listOfUpdateInfoMap.size() - 1; i >= 0; i--) { + if (!listOfUpdateInfoMap.get(i).containsKey("pnfCorrelationId")) continue; - String id = updateInfoMap.get(i).get("pnfCorrelationId"); + String id = listOfUpdateInfoMap.get(i).get("pnfCorrelationId"); if (id != pnfCorrelationId) continue; - updateInfoMap.remove(i); + listOfUpdateInfoMap.remove(i); } } if (pnfCorrelationIdToThreadMap.isEmpty()) { @@ -174,8 +170,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient { String customerId = null; String serviceType = null; String serId = null; - synchronized (updateInfoMap) { - for (HashMap<String, String> map : updateInfoMap) { + synchronized (listOfUpdateInfoMap) { + for (Map<String, String> map : listOfUpdateInfoMap) { if (!map.containsKey("pnfCorrelationId")) continue; if (pnfCorrelationId != map.get("pnfCorrelationId")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index 2634f03d4b..598582bfd8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +21,9 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import java.util.Map; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; -import java.util.HashMap; import java.util.Objects; -import java.util.Optional; public class DmaapClientTestImpl implements DmaapClient { @@ -31,8 +31,7 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, - Optional<HashMap<String, String>> updateInfo) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index f1fd23fe82..f10b503ed3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -162,14 +162,14 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, - "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO); + "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO); } } @@ -214,15 +214,15 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(), - TargetEntity.SO); + ONAPComponents.SO); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 18ba91263b..15f8c5e4ef 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -80,6 +80,16 @@ public class AAIDeleteTasks { @Autowired private AAIInstanceGroupResources aaiInstanceGroupResources; + /** + * BPMN access method to delete the VfModule from A&AI. + * + * It will extract the genericVnf & VfModule from the BBObject. + * + * Before deleting it set the aaiVfModuleRollback as false & then it will delete the VfModule. + * + * @param execution + * @throws Exception + */ public void deleteVfModule(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -89,10 +99,21 @@ public class AAIDeleteTasks { aaiVfModuleResources.deleteVfModule(vfModule, genericVnf); execution.setVariable("aaiVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVfModule process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Vnf from A&AI. + * + * It will extract the genericVnf from the BBObject. + * + * Before deleting it set the aaiVnfRollback as false & then it will delete the Vnf. + * + * @param execution + * @throws Exception + */ public void deleteVnf(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -101,79 +122,154 @@ public class AAIDeleteTasks { aaiVnfResources.deleteVnf(genericVnf); execution.setVariable("aaiVnfRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the ServiceInstance from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * @param execution + * @throws Exception + */ public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiSIResources.deleteServiceInstance(serviceInstance); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteServiceInstance process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the l3network from A&AI. + * + * It will extract the l3network from the BBObject. + * + * After deleting the l3network it set the isRollbackNeeded as true. + * + * @param execution + * @throws Exception + */ public void deleteNetwork(BuildingBlockExecution execution) throws Exception { try { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.deleteNetwork(l3network); execution.setVariable("isRollbackNeeded", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteNetwork process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Collection from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * Then it will get the collection from serviceinstance. + * + * @param execution + * @throws Exception + */ public void deleteCollection(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteCollection(serviceInstance.getCollection()); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteCollection process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the InstanceGroup from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * Then it will get the Instance group from serviceInstance. + * + * @param execution + * @throws Exception + */ public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroup process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the VolumeGroup from A&AI. + * + * It will extract the volumeGroup from the BBObject and cloudRegion from execution object . + * + * Then it will delete from A&AI. + * + * @param execution + * @throws Exception + */ public void deleteVolumeGroup(BuildingBlockExecution execution) { try { VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion(); aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVolumeGroup process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Configuration from A&AI. + * + * It will extract the configuration from the BBObject. + * + * Then it will delete from A&AI. + * + * @param execution + */ public void deleteConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.deleteConfiguration(configuration); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the InstanceGroupVnf from A&AI. + * + * It will extract the instanceGroup from the BBObject. + * + * Then it will delete from A&AI. + * + * @param execution + */ public void deleteInstanceGroupVnf(BuildingBlockExecution execution) { try { InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void deleteNetworkPolicies(BuildingBlockExecution execution) { try { String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 20f4443291..86645391b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -92,6 +92,7 @@ public class AAIUpdateTasks { OrchestrationStatus.ASSIGNED); execution.setVariable("aaiServiceInstanceRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -108,6 +109,7 @@ public class AAIUpdateTasks { aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -122,6 +124,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -136,6 +139,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -155,6 +159,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -174,6 +179,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -193,6 +199,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -215,6 +222,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -231,6 +239,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -247,6 +256,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.PENDING_ACTIVATION); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -273,6 +283,9 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); } } catch (Exception ex) { + logger.error( + "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -281,7 +294,7 @@ public class AAIUpdateTasks { * BPMN access method to update status of VfModule to Created in AAI * * @param execution - * + * */ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { try { @@ -289,6 +302,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -307,6 +321,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED); execution.setVariable("aaiDeactivateVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -346,6 +361,7 @@ public class AAIUpdateTasks { L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); updateNetworkAAI(l3Network, status); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -386,6 +402,7 @@ public class AAIUpdateTasks { aaiCollectionResources.updateCollection(copiedNetworkCollection); execution.setVariable("aaiNetworkCollectionActivateRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveNetworkCollection", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -403,6 +420,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); execution.setVariable("aaiActivateVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -423,6 +441,7 @@ public class AAIUpdateTasks { vfModule.setHeatStackId(heatStackId); aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -466,6 +485,7 @@ public class AAIUpdateTasks { execution.setVariable("aaiNetworkActivateRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetworkCreated", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -495,6 +515,7 @@ public class AAIUpdateTasks { } } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetworkUpdated", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -509,6 +530,7 @@ public class AAIUpdateTasks { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.updateNetwork(l3network); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateObjectNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -524,6 +546,7 @@ public class AAIUpdateTasks { extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiServiceInstanceResources.updateServiceInstance(serviceInstance); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -538,6 +561,7 @@ public class AAIUpdateTasks { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateObjectVnf(genericVnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateObjectVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -559,6 +583,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); execution.setVariable("aaiDeleteVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeleteVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -574,6 +599,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateModelVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -589,6 +615,7 @@ public class AAIUpdateTasks { aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignFabricConfiguration", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -603,6 +630,8 @@ public class AAIUpdateTasks { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateFabricConfiguration", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -618,6 +647,8 @@ public class AAIUpdateTasks { aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateFabricConfiguration", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -640,6 +671,7 @@ public class AAIUpdateTasks { aaiVnfResources.updateObjectVnf(copiedGenericVnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateIpv4OamAddressVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -662,6 +694,7 @@ public class AAIUpdateTasks { aaiVnfResources.updateObjectVnf(copiedGenericVnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateManagementV6AddressVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -681,6 +714,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateContrailServiceInstanceFqdnVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -695,6 +729,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigAssignedVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -704,12 +739,13 @@ public class AAIUpdateTasks { * * @param execution */ - public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) { + public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -720,12 +756,13 @@ public class AAIUpdateTasks { * * @param execution */ - public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) { + public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 9340609ffc..d9c6857ef1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -33,6 +33,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate; import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables; import org.camunda.bpm.engine.variable.VariableMap; import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; @@ -79,6 +80,8 @@ public class ExecuteActivity implements JavaDelegate { @Autowired private ExceptionBuilder exceptionBuilder; @Autowired + private WorkflowActionBBFailure workflowActionBBFailure; + @Autowired private WorkflowActionBBTasks workflowActionBBTasks; @Override @@ -178,13 +181,15 @@ public class ExecuteActivity implements JavaDelegate { protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg, ex); - execution.setVariable("ExecuteActivityErrorMessage", msg); + execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg); + workflowActionBBFailure.updateRequestStatusToFailed(execution); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } protected void buildAndThrowException(DelegateExecution execution, String msg) { logger.error(msg); execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg); + workflowActionBBFailure.updateRequestStatusToFailed(execution); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index e9d33f46ab..2705d00d6b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.NetworkAdapterResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.onap.so.utils.Components; @Component public class NetworkAdapterRestV1 { @@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 { throw new Exception("No Network Request was created. networkAdapterRequest was null."); } } catch (Exception ex) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 { } } catch (Exception e) { logger.error("Error in Openstack Adapter callback", e); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK); } } @@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 { public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on Openstack Async-Response", TargetEntity.SO); + "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO); } public void handleSyncError(DelegateExecution execution) { @@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 { String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE); String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString; - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 127d21c0ed..9c72d229b2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -60,6 +60,8 @@ public class AppcRunTasks { public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop"; public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock"; public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic"; + public static final String CONTROLLER_TYPE_DEFAULT = "APPC"; + public static final String GENERIC_APPC_ERROR_CODE = "1002"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -139,7 +141,12 @@ public class AppcRunTasks { ControllerSelectionReference controllerSelectionReference = catalogDbClient .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); - String controllerType = controllerSelectionReference.getControllerName(); + String controllerType = null; + if (controllerSelectionReference != null) { + controllerType = controllerSelectionReference.getControllerName(); + } else { + controllerType = CONTROLLER_TYPE_DEFAULT; + } String vfModuleId = null; VfModule vfModule = null; @@ -153,7 +160,7 @@ public class AppcRunTasks { HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList, identityUrl, vfModuleId); - Optional<String> payload = null; + Optional<String> payload = Optional.empty(); RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters(); if (requestParameters != null) { String pay = requestParameters.getPayload(); @@ -169,7 +176,9 @@ public class AppcRunTasks { mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), - "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); + "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), + "Error on request to APPC", e); + appcCode = GENERIC_APPC_ERROR_CODE; appcMessage = e.getMessage(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index bc71fc6f67..9413e8ef2e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -3,13 +3,14 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2019 TechMahindra. + * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,8 +21,10 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.UUID; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -33,15 +36,15 @@ import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf; import org.onap.so.client.cds.beans.ConfigAssignRequestVnf; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.Vnfs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * * Get vnf related data and config assign - * */ @Component public class ConfigAssignVnf { @@ -51,48 +54,42 @@ public class ConfigAssignVnf { private static final String ACTION_NAME = "config-assign"; private static final String MODE = "sync"; + private final ExtractPojosForBB extractPojosForBB; + private final ExceptionBuilder exceptionBuilder; + @Autowired - private ExceptionBuilder exceptionUtil; - @Autowired - private ExtractPojosForBB extractPojosForBB; + public ConfigAssignVnf(ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) { + this.extractPojosForBB = extractPojosForBB; + this.exceptionBuilder = exceptionBuilder; + } /** * Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the * subprocess. - * - * @param execution */ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) { logger.info("Start preProcessAbstractCDSProcessing "); try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - - List<Map<String, Object>> userParams = - execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(); - ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf(); configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId()); configAssignPropertiesForVnf .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid()); configAssignPropertiesForVnf - .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid()); - configAssignPropertiesForVnf.setVnfId(vnf.getVnfId()); - configAssignPropertiesForVnf.setVnfName(vnf.getVnfName()); - - for (Map<String, Object> params : userParams) { - for (Map.Entry<String, Object> entry : params.entrySet()) { - configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue()); - } - } - + .setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid()); + configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId()); + configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName()); + setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf, + execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(), + genericVnf); ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf(); - configAssignRequestVnf.setResolutionKey(vnf.getVnfName()); + configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName()); configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf); - String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName(); - String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion(); + String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); + String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion); AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); @@ -109,9 +106,48 @@ public class ConfigAssignVnf { abstractCDSPropertiesBean.setActionName(ACTION_NAME); abstractCDSPropertiesBean.setMode(MODE); execution.setVariable("executionObject", abstractCDSPropertiesBean); - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private void setUserParamsInConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignProperties, + List<Map<String, Object>> userParamsFromRequest, GenericVnf vnf) throws Exception { + Service service = getServiceFromRequestUserParams(userParamsFromRequest); + List<Map<String, String>> instanceParamsList = + getInstanceParamForVnf(service, vnf.getModelInfoGenericVnf().getModelCustomizationUuid()); + instanceParamsList + .forEach(instanceParamsMap -> instanceParamsMap.forEach(configAssignProperties::setUserParam)); + } + + private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception { + Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst() + .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock")); + return convertServiceFromJsonToServiceObject((String) serviceMap.get("service")); + } + + private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception { + try { + return new ObjectMapper().readValue(serviceFromJson, Service.class); + } catch (Exception e) { + logger.error(String.format( + "An exception occurred while converting json object to Service object. The json is: %s", + serviceFromJson), e); + throw e; + } + } + + private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid) + throws Exception { + Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream() + .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid)) + .findFirst(); + if (foundedVnf.isPresent()) { + return foundedVnf.get().getInstanceParams(); + } else { + throw new Exception(String.format("Can not find vnf for genericVnfModelCustomizationUuid: %s", + genericVnfModelCustomizationUuid)); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java index cdbe0db57c..6a8058938f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java @@ -62,7 +62,7 @@ public class ConfigDeployVnf { * @param execution */ public void updateAAIConfigure(BuildingBlockExecution execution) { - aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution); + aaiUpdateTask.updateOrchestrationStatusConfigDeployConfigureVnf(execution); } @@ -129,7 +129,7 @@ public class ConfigDeployVnf { * @param execution */ public void updateAAIConfigured(BuildingBlockExecution execution) { - aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution); + aaiUpdateTask.updateOrchestrationStatusConfigDeployConfiguredVnf(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java index e51774c12c..0afca71b99 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java @@ -30,12 +30,15 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component() public class UnassignVnf { + private static final Logger logger = LoggerFactory.getLogger(UnassignVnf.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -45,6 +48,17 @@ public class UnassignVnf { @Autowired private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator; + /** + * BPMN access method to deleting instanceGroup in AAI. + * + * It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list. + * + * Then iterate that list and check the ModelInfoInstanceGroup type. + * + * Then it will delete that. + * + * @param execution + */ public void deleteInstanceGroups(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -56,6 +70,7 @@ public class UnassignVnf { } } } catch (Exception ex) { + logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index b85e33144f..f61b40ad23 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -52,6 +52,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCVnfResources sdncVnfResources; @@ -66,6 +67,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for activate the vnf. + * + * @param execution + */ public void activateVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -82,13 +90,14 @@ public class SDNCActivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCActivateTasks activateVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to perform Assign action on SDNC for L3Network - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -112,6 +121,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask { } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for activate the activateVfModule. + * + * @param execution + */ public void activateVfModule(BuildingBlockExecution execution) { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); @@ -131,6 +147,7 @@ public class SDNCActivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 3c42f76d73..96b656ff95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -53,6 +53,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @@ -69,6 +70,12 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate + * VfModule. + * + * @param execution + */ public void deactivateVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -86,13 +93,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf - * + * * @param execution * @throws Exception */ @@ -113,15 +121,16 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /* * BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance - * + * * @param execution - * + * * @throws Exception */ public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception { @@ -138,13 +147,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.SERVICE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to invoke deactivate on a L3Network object - * + * * @param execution */ public void deactivateNetwork(BuildingBlockExecution execution) { @@ -163,6 +173,7 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.NETWORK); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 080d6d34b1..192cb3fc90 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNCVnfResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,13 +80,13 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -121,9 +121,9 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred for BadResponse ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); @@ -158,18 +158,18 @@ public class SDNCQueryTasks { // module id, then we should throw // the error as normal if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO); } } catch (BadResponseException ex) { logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index 03714db943..3383fde0a8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -80,19 +80,19 @@ public class SDNCRequestTasks { } catch (PathNotFoundException e) { logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO); + "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO); } catch (MapperException e) { logger.error("Failed to map SDNC object to JSON prior to POST.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO); + "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO); } catch (BadResponseException e) { logger.error("Did not receive a successful response from SDNC.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(), - TargetEntity.SDNC); + ONAPComponents.SDNC); } catch (HttpClientErrorException e) { logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.", - TargetEntity.SO); + ONAPComponents.SO); } } @@ -123,17 +123,17 @@ public class SDNCRequestTasks { } } catch (SDNCErrorResponseException e) { logger.error("SDNC error response - " + e.getMessage()); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } catch (Exception e) { logger.error("Error processing SDNC callback", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback", - TargetEntity.SO); + ONAPComponents.SO); } } public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on SDNC Async-Response", TargetEntity.SO); + "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO); } protected boolean convertIndicatorToBoolean(String finalMessageIndicator) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index e3c9785ab2..4817ba8b61 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -53,6 +53,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @@ -69,6 +70,13 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the ServiceInstance. + * + * @param execution + */ public void unassignServiceInstance(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -83,10 +91,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.SERVICE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the VfModule. + * + * @param execution + */ public void unassignVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -102,10 +118,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the Vnf. + * + * @param execution + */ public void unassignVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -122,10 +146,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the Network. + * + * @param execution + */ public void unassignNetwork(BuildingBlockExecution execution) throws Exception { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -144,6 +176,7 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.NETWORK); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index 8822bc39dd..64f0072991 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -153,16 +153,6 @@ public class OrchestrationStatusValidator { .getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction()); - if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) - && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) - && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) { - org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = - extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, - previousOrchestrationStatusValidationResult, genericVnf, - orchestrationStatusStateTransitionDirective); - } - if (orchestrationStatusStateTransitionDirective .getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) { throw new OrchestrationStatusValidationException( @@ -187,23 +177,4 @@ public class OrchestrationStatusValidator { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e); } } - - private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate( - BuildingBlockExecution execution, - OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult, - org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf, - OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) { - if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult - .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) { - String multiStageDesign = MULTI_STAGE_DESIGN_OFF; - if (genericVnf.getModelInfoGenericVnf() != null) { - multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign(); - } - if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { - orchestrationStatusStateTransitionDirective - .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); - } - } - return orchestrationStatusStateTransitionDirective; - } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index e6dd38ee1e..1f07166b60 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -93,6 +93,7 @@ public class WorkflowAction { private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; private static final String SERVICE_INSTANCES = "serviceInstances"; + private static final String SERVICE_INSTANCE = "serviceInstance"; private static final String VF_MODULES = "vfModules"; private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI."; @@ -107,7 +108,7 @@ public class WorkflowAction { private static final String ASSIGNINSTANCE = "assignInstance"; private static final String CREATEINSTANCE = "createInstance"; private static final String USERPARAMSERVICE = "service"; - private static final String supportedTypes = + private static final String SUPPORTEDTYPES = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups"; private static final String HOMINGSOLUTION = "Homing_Solution"; private static final String FABRIC_CONFIGURATION = "FabricConfiguration"; @@ -123,6 +124,8 @@ public class WorkflowAction { private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID = "(%s), same parent and different customization id (%s)"; private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship"; + private static final String CREATENETWORKBB = "CreateNetworkBB"; + private static final String ACTIVATENETWORKBB = "ActivateNetworkBB"; @Autowired protected BBInputSetup bbInputSetup; @@ -183,12 +186,14 @@ public class WorkflowAction { try { cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner(); } catch (Exception ex) { + logger.error("Exception in getCloundOwner", ex); cloudOwner = environment.getProperty(defaultCloudOwner); } boolean suppressRollback = false; try { suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); } catch (Exception ex) { + logger.error("Exception in getSuppressRollback", ex); suppressRollback = false; } execution.setVariable("suppressRollback", suppressRollback); @@ -209,7 +214,7 @@ public class WorkflowAction { } else { resourceId = resource.getResourceId(); } - if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) { + if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) { serviceInstanceId = resourceId; } execution.setVariable("resourceId", resourceId); @@ -300,9 +305,9 @@ public class WorkflowAction { traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds); } } else if (resourceType == WorkflowType.SERVICE - && (requestAction.equalsIgnoreCase("activateInstance") - || requestAction.equalsIgnoreCase("unassignInstance") - || requestAction.equalsIgnoreCase("deleteInstance") + && ("activateInstance".equalsIgnoreCase(requestAction) + || "unassignInstance".equalsIgnoreCase(requestAction) + || "deleteInstance".equalsIgnoreCase(requestAction) || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) { // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and // SERVICE-MACRO-DELETE @@ -310,10 +315,10 @@ public class WorkflowAction { // to query the SI in AAI to find related instances. traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds); } else if (resourceType == WorkflowType.SERVICE - && requestAction.equalsIgnoreCase("deactivateInstance")) { + && "deactivateInstance".equalsIgnoreCase(requestAction)) { resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false)); - } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance") - || (requestAction.equalsIgnoreCase("recreateInstance")))) { + } else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction) + || ("recreateInstance".equalsIgnoreCase(requestAction)))) { traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds); } else { @@ -363,7 +368,7 @@ public class WorkflowAction { sIRequest.getRequestDetails().getRequestParameters().getUserParams(); for (Map<String, Object> params : userParams) { if (params.containsKey(HOMINGSOLUTION)) { - if (params.get(HOMINGSOLUTION).equals("none")) { + if ("none".equals(params.get(HOMINGSOLUTION))) { execution.setVariable("homing", false); } else { execution.setVariable("homing", true); @@ -447,7 +452,7 @@ public class WorkflowAction { protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) { for (OrchestrationFlow flow : orchFlows) { - if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) { + if (flow.getFlowName().contains(CONFIGURATION) && !"ConfigurationScaleOutBB".equals(flow.getFlowName())) { return true; } } @@ -715,7 +720,7 @@ public class WorkflowAction { protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration, AAIResultWrapper configWrapper) throws VrfBondingServiceException { - if (vrfConfiguration.getConfigurationType().equalsIgnoreCase("VRF-ENTRY")) { + if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) { Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships(); if (relationshipsConfigOp.isPresent()) { Optional<VpnBinding> relatedInfraVpnBindingOp = @@ -752,7 +757,7 @@ public class WorkflowAction { if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) { String toscaNodeType = collectionResourceCustomization.getCollectionResource() .getInstanceGroup().getToscaNodeType(); - if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) { + if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) { int minNetworks = 0; org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); @@ -885,6 +890,7 @@ public class WorkflowAction { } } } catch (Exception ex) { + logger.error("Exception in traverseAAIService", ex); buildAndThrowException(execution, "Could not find existing Service Instance or related Instances to execute the request on."); } @@ -926,6 +932,7 @@ public class WorkflowAction { } } } catch (Exception ex) { + logger.error("Exception in traverseAAIVnf", ex); buildAndThrowException(execution, "Could not find existing Vnf or related Instances to execute the request on."); } @@ -953,6 +960,7 @@ public class WorkflowAction { } } } catch (Exception ex) { + logger.error("Exception in findConfigurationsInsideVfModule", ex); buildAndThrowException(execution, "Failed to find Configuration object from the vfModule."); } } @@ -1015,8 +1023,8 @@ public class WorkflowAction { vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid(); } - if (!vnfCustomizationUUID.equals("") - && !vfModuleCustomizationUUID.equals("")) { + if (!vnfCustomizationUUID.isEmpty() + && !vfModuleCustomizationUUID.isEmpty()) { List<CvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration( validate.getModelInfo().getModelVersionId(), @@ -1110,7 +1118,7 @@ public class WorkflowAction { protected Resource extractResourceIdAndTypeFromUri(String uri) { Pattern patt = Pattern.compile( - "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$"); + "[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$"); Matcher m = patt.matcher(uri); Boolean generated = false; @@ -1123,15 +1131,15 @@ public class WorkflowAction { throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); } if (action == null) { - if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) { + if (type.equals(SERVICE_INSTANCES) && (id == null || "assign".equals(id))) { id = UUID.randomUUID().toString(); generated = true; - } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) { + } else if (type.equals(VF_MODULES) && "scaleOut".equals(id)) { id = UUID.randomUUID().toString(); generated = true; } } else { - if (action.matches(supportedTypes)) { + if (action.matches(SUPPORTEDTYPES)) { id = UUID.randomUUID().toString(); generated = true; type = action; @@ -1159,7 +1167,7 @@ public class WorkflowAction { .equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) { return serviceInstanceAAI.get().getServiceInstanceId(); } else { - throw new DuplicateNameException("serviceInstance", + throw new DuplicateNameException(SERVICE_INSTANCE, String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, instanceName, reqDetails.getModelInfo().getModelVersionId())); } @@ -1170,7 +1178,7 @@ public class WorkflowAction { if (aaiServiceInstances.getServiceInstance() != null && !aaiServiceInstances.getServiceInstance().isEmpty()) { if (aaiServiceInstances.getServiceInstance().size() > 1) { - throw new DuplicateNameException("serviceInstance", + throw new DuplicateNameException(SERVICE_INSTANCE, String.format(NAME_EXISTS_MULTIPLE, instanceName)); } else { ServiceInstance si = @@ -1178,7 +1186,7 @@ public class WorkflowAction { Map<String, String> keys = bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId()); - throw new DuplicateNameException("serviceInstance", + throw new DuplicateNameException(SERVICE_INSTANCE, String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, keys.get("global-customer-id"), keys.get("service-type"), si.getModelVersionId())); @@ -1295,7 +1303,7 @@ public class WorkflowAction { } protected String convertTypeFromPlural(String type) { - if (!type.matches(supportedTypes)) { + if (!type.matches(SUPPORTEDTYPES)) { return type; } else { if (type.equals(SERVICE_INSTANCES)) { @@ -1317,31 +1325,31 @@ public class WorkflowAction { String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey(); sortedOrchFlows.add(ebb); for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB) && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } - if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB) && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { sortedOrchFlows.add(ebb2); break; } } for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB) && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } - if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB) && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { sortedOrchFlows.add(ebb2); break; } } - } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") - || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) { + } else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB) + || ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) { continue; } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) { sortedOrchFlows.add(ebb); @@ -1424,7 +1432,7 @@ public class WorkflowAction { } } else if (orchFlow.getFlowName().contains(VFMODULE)) { List<Resource> vfModuleResourcesSorted = null; - if (requestAction.equals("createInstance") || requestAction.equals("assignInstance") + if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE) || requestAction.equals("activateInstance")) { vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream() .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 073dead8b3..d5798150d1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -65,6 +64,9 @@ public class WorkflowActionBBTasks { private static final String FABRIC_CONFIGURATION = "FabricConfiguration"; private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB"; private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB"; + private static final String COMPLETED = "completed"; + private static final String HANDLINGCODE = "handlingCode"; + private static final String ROLLBACKTOCREATED = "RollbackToCreated"; protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @@ -98,9 +100,9 @@ public class WorkflowActionBBTasks { execution.setVariable("buildingBlock", ebb); currentSequence++; if (currentSequence >= flowsToExecute.size()) { - execution.setVariable("completed", true); + execution.setVariable(COMPLETED, true); } else { - execution.setVariable("completed", false); + execution.setVariable(COMPLETED, false); } execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); } @@ -114,7 +116,8 @@ public class WorkflowActionBBTasks { } } catch (Exception ex) { logger.warn( - "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid."); + "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.", + ex); } } @@ -236,7 +239,7 @@ public class WorkflowActionBBTasks { } public void checkRetryStatus(DelegateExecution execution) { - String handlingCode = (String) execution.getVariable("handlingCode"); + String handlingCode = (String) execution.getVariable(HANDLINGCODE); String requestId = (String) execution.getVariable(G_REQUEST_ID); String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); @@ -244,11 +247,11 @@ public class WorkflowActionBBTasks { try { envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); } catch (Exception ex) { - logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex); envMaxRetries = 5; } int nextCount = retryCount + 1; - if (handlingCode.equals("Retry")) { + if ("Retry".equals(handlingCode)) { workflowActionBBFailure.updateRequestErrorStatusMessage(execution); try { InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); @@ -259,8 +262,8 @@ public class WorkflowActionBBTasks { logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex); } if (retryCount < envMaxRetries) { - int currSequence = (int) execution.getVariable("gCurrentSequence"); - execution.setVariable("gCurrentSequence", currSequence - 1); + int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1); execution.setVariable(RETRY_COUNT, nextCount); } else { workflowAction.buildAndThrowException(execution, @@ -287,12 +290,12 @@ public class WorkflowActionBBTasks { flowsToExecute.remove(i); } else { String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); - if (flowName.contains("Assign")) { - flowName = "Unassign" + flowName.substring(6, flowName.length()); - } else if (flowName.contains("Create")) { - flowName = "Delete" + flowName.substring(6, flowName.length()); - } else if (flowName.contains("Activate")) { - flowName = "Deactivate" + flowName.substring(8, flowName.length()); + if (flowName.startsWith("Assign")) { + flowName = flowName.replaceFirst("Assign", "Unassign"); + } else if (flowName.startsWith("Create")) { + flowName = flowName.replaceFirst("Create", "Delete"); + } else if (flowName.startsWith("Activate")) { + flowName = flowName.replaceFirst("Activate", "Deactivate"); } else { continue; } @@ -301,15 +304,15 @@ public class WorkflowActionBBTasks { } } - String handlingCode = (String) execution.getVariable("handlingCode"); + String handlingCode = (String) execution.getVariable(HANDLINGCODE); List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(); rollbackFlowsFiltered.addAll(rollbackFlows); - if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) { + if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) { for (int i = 0; i < rollbackFlows.size(); i++) { if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) { rollbackFlowsFiltered.remove(rollbackFlows.get(i)); } else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") - && handlingCode.equals("RollbackToCreated")) { + && ROLLBACKTOCREATED.equals(handlingCode)) { rollbackFlowsFiltered.remove(rollbackFlows.get(i)); } } @@ -321,9 +324,9 @@ public class WorkflowActionBBTasks { else execution.setVariable("isRollbackNeeded", true); execution.setVariable("flowsToExecute", rollbackFlowsFiltered); - execution.setVariable("handlingCode", "PreformingRollback"); + execution.setVariable(HANDLINGCODE, "PreformingRollback"); execution.setVariable("isRollback", true); - execution.setVariable("gCurrentSequence", 0); + execution.setVariable(G_CURRENT_SEQUENCE, 0); execution.setVariable(RETRY_COUNT, 0); } else { workflowAction.buildAndThrowException(execution, @@ -354,6 +357,7 @@ public class WorkflowActionBBTasks { } requestDbclient.updateInfraActiveRequests(request); } catch (Exception ex) { + logger.error("Exception in updateInstanceId", ex); workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId"); } } @@ -361,12 +365,12 @@ public class WorkflowActionBBTasks { public void postProcessingExecuteBB(DelegateExecution execution) { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - String handlingCode = (String) execution.getVariable("handlingCode"); + String handlingCode = (String) execution.getVariable(HANDLINGCODE); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) { + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); } } @@ -410,16 +414,16 @@ public class WorkflowActionBBTasks { .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", executeBB.getBuildingBlock().getBpmnFlowName())); execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("completed", false); + execution.setVariable(COMPLETED, false); } else { - logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId); + logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId); } } } catch (EntityNotFoundException e) { - logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks"); + logger.debug("Will not be running Fabric Config Building Blocks", e); } catch (Exception e) { String errorMessage = "Error occurred in post processing of Vf Module create"; - execution.setVariable("handlingCode", "RollbackToCreated"); + execution.setVariable(HANDLINGCODE, ROLLBACKTOCREATED); execution.setVariable("WorkflowActionErrorMessage", errorMessage); logger.error(errorMessage, e); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java index e24e86285c..9af2128f63 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,11 +33,16 @@ import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse; import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class VnfAdapterClientImpl implements VnfAdapterClient { + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterClientImpl.class); + private static final String VF_MODULES = "/vf-modules/"; private VnfAdapterRestProperties props; @@ -57,6 +62,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient { return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, CreateVfModuleResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in createVfModule", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -69,6 +75,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient { this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, RollbackVfModuleResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in rollbackVfModule", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -80,6 +87,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient { return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) .delete(req, DeleteVfModuleResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in deleteVfModule", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -91,6 +99,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient { return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) .put(req, UpdateVfModuleResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in updateVfModule", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -122,6 +131,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient { return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get(); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in queryVfModule", e); throw new VnfAdapterClientException(e.getMessage()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java index 2af4d5f1fa..c5e8bf7416 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,11 +34,15 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.client.RestClient; import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { + private static final Logger logger = LoggerFactory.getLogger(VnfVolumeAdapterClientImpl.class); + private final VnfVolumeAdapterRestProperties props; public VnfVolumeAdapterClientImpl() { @@ -50,6 +54,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { try { return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in createVNFVolumes", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -60,6 +65,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { try { return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in deleteVNFVolumes", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -71,6 +77,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req, RollbackVolumeGroupResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in rollbackVNFVolumes", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -81,6 +88,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { try { return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in updateVNFVolumes", e); throw new VnfAdapterClientException(e.getMessage()); } } @@ -94,6 +102,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { requestId, serviceInstanceId); return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get(); } catch (InternalServerErrorException e) { + logger.error("InternalServerErrorException in queryVNFVolumes", e); throw new VnfAdapterClientException(e.getMessage()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java index 6daed56675..6278d48e03 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java @@ -23,10 +23,10 @@ package org.onap.so.client.adapter.vnf.mapper; import java.io.Serializable; public class AttributeNameValue implements Serializable { - private final static long serialVersionUID = -5215028275587848311L; + private static final long serialVersionUID = -5215028275587848311L; private String attributeName; - private Object attributeValue; + private transient Object attributeValue; public AttributeNameValue(String attributeName, Object attributeValue) { this.attributeName = attributeName; @@ -51,7 +51,7 @@ public class AttributeNameValue implements Serializable { @Override public String toString() { - return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString()) + return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName) .append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString(); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 5c69987a54..8c13c9be97 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -33,7 +33,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Optional; import javax.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; @@ -76,10 +75,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException; import org.onap.so.entity.MsoRequest; import org.onap.so.jsonpath.JsonPathUtil; import org.onap.so.openstack.utils.MsoMulticloudUtils; -import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -481,7 +480,7 @@ public class VnfAdapterVfModuleObjectMapper { } } sbInterfaceRoutePrefixes.append("]"); - if (interfaceRoutePrefixesList.size() > 0) { + if (!interfaceRoutePrefixesList.isEmpty()) { paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes", sbInterfaceRoutePrefixes.toString()); } @@ -508,7 +507,7 @@ public class VnfAdapterVfModuleObjectMapper { sriovFilterBuf.append(heatVlanFilterValue); } } - if (heatVlanFiltersList.size() > 0) { + if (!heatVlanFiltersList.isEmpty()) { paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString()); } } @@ -540,7 +539,7 @@ public class VnfAdapterVfModuleObjectMapper { String ipVersion = ipAddress.getIpVersion(); for (int b = 0; b < ipsList.size(); b++) { String ipAddressValue = ipsList.get(b); - if (ipVersion.equals("ipv4")) { + if ("ipv4".equals(ipVersion)) { if (b != ipsList.size() - 1) { sbIpv4Ips.append(ipAddressValue + ","); } else { @@ -548,7 +547,7 @@ public class VnfAdapterVfModuleObjectMapper { } paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b, ipAddressValue); - } else if (ipVersion.equals("ipv6")) { + } else if ("ipv6".equals(ipVersion)) { if (b != ipsList.size() - 1) { sbIpv6Ips.append(ipAddressValue + ","); } else { @@ -897,6 +896,7 @@ public class VnfAdapterVfModuleObjectMapper { try { json = mapper.writeValueAsString(obj); } catch (JsonProcessingException e) { + logger.error("JsonProcessingException in convertToString", e); json = "{}"; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 867d80a4ea..8b939940fa 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -52,7 +52,7 @@ public class AAIConfigurationResources { AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); - injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); + injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration)); } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index 63bde79b3f..7ad74a6d86 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -33,6 +33,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIRestClientImpl; import org.onap.so.client.aai.AAIValidatorImpl; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; @@ -151,6 +152,8 @@ public class AAIVnfResources { .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) .orElse(new org.onap.aai.domain.yang.GenericVnf()); + AAIRestClientImpl client = new AAIRestClientImpl(); + aaiValidatorImpl.setClient(client); return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId()); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java index d4a4cfbd8a..0123eb67be 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java @@ -32,8 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java index b3ea18df58..01511eaccc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -37,14 +37,11 @@ import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCVfModuleResources { - private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class); @Autowired private VfModuleTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index 6434bfb176..27edeed02a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -36,8 +36,6 @@ import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index 62d6a110f6..6a15ca321a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -34,8 +34,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 2e7877fe3b..07f448e5e1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -29,8 +29,6 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCProperties; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java index b8146b5504..2c8bdd931c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java @@ -36,7 +36,7 @@ public class SDNCRequest implements Serializable { private SDNCTopology topology; private String correlationValue = UUID.randomUUID().toString(); private String correlationName = "SDNCCallback"; - private Object sdncPayload; + private transient Object sdncPayload; public String getTimeOut() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index d07574a1ad..c63cbc0b68 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -37,7 +37,6 @@ import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; @Component diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 905f244278..c337f7f1b5 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -733,7 +733,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE); - aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution); + aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfigureVnf(execution); } @Test @@ -741,6 +741,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED); - aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution); + aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfiguredVnf(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java index 56ff813e73..c0056291ef 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java @@ -22,22 +22,41 @@ package org.onap.so.bpmn.infrastructure.activity; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; import java.nio.file.Files; import java.nio.file.Paths; +import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.client.exception.ExceptionBuilder; public class ExecuteActivityTest extends BaseTaskTest { @InjectMocks protected ExecuteActivity executeActivity = new ExecuteActivity(); + @InjectMocks + @Spy + private ExceptionBuilder exceptionBuilder; + + @Mock + private WorkflowActionBBFailure workflowActionBBFailure; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + private DelegateExecution execution; @Before @@ -72,4 +91,17 @@ public class ExecuteActivityTest extends BaseTaskTest { assertEquals(ebb.getBuildingBlock(), bb); } + @Test + public void buildAndThrowException_Test() throws Exception { + doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution); + doReturn("Process key").when(exceptionBuilder).getProcessKey(execution); + thrown.expect(BpmnError.class); + executeActivity.buildAndThrowException(execution, "TEST EXCEPTION MSG"); + String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage"); + assertEquals(errorMessage, "TEST EXCEPTION MSG"); + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + assertEquals(workflowException.getErrorMessage(), "TEST EXCEPTION MSG"); + assertEquals(workflowException.getErrorCode(), 7000); + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java index 8aea2d2650..3994208d23 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java @@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; +import org.onap.logging.filter.base.ONAPComponents; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; @@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString()); doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException( - any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class)); + any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class)); try { networkAdapterRestV1Tasks.processCallback(delegateExecution); @@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { } assertNull(delegateExecution.getVariable("updateNetworkResponse")); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000), - eq("test error message"), eq(TargetEntity.OPENSTACK)); + eq("test error message"), eq(Components.OPENSTACK)); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java index 7d96a18305..468bc7d8f6 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java @@ -3,13 +3,14 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2019 TechMahindra. + * Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,57 +21,139 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doThrow; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Before; import org.junit.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.InjectMocks; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.exception.ExceptionBuilder; -public class ConfigAssignVnfTest extends BaseTaskTest { - @InjectMocks - private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf(); +public class ConfigAssignVnfTest { - private GenericVnf genericVnf; - private ServiceInstance serviceInstance; - private RequestContext requestContext; - private String msoRequestId; + private static final String GENERIC_VNF_ID = "vnfId_configVnfTest"; + private static final String GENERIC_VNF_NAME = "vnfName_configVnfTest"; + private static final String VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad"; + private static final String SERVICE_INSTANCE_ID = "serviceInst_configTest"; + private static final String SERVICE_MODEL_UUID = "5af91c26-8418-4d3f-944c-965842deda94"; + private static final String TARGET_VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad"; + private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput"; + private static final int THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES = 8; + + private static final String USER_PARAMS_FROM_REQUEST = "{\"resources\":{\"vnfs\":[" + + "{\"modelInfo\":{\"modelCustomizationId\":\"" + VNF_MODEL_CUSTOMIZATION_UUID + "\"}," + + "\"instanceParams\":[{\"paramName1\":\"paramValue1\",\"paramName2\":\"paramValue2\"},{\"paramName3\":\"paramValue3\"}]}," + + "{\"modelInfo\":{\"modelCustomizationId\":\"2d1ac656-377e-467b-be50-6ce65f66a7ca\"}," + + "\"instanceParams\":[{\"parName4\":\"parValue4\",\"parName5\":\"parValue5\"}]}]}}\n"; + + + private ConfigAssignVnf testedObject; + + private BuildingBlockExecution buildingBlockExecution; + private ExtractPojosForBB extractPojosForBB; @Before - public void before() throws BBObjectNotFoundException { - genericVnf = setGenericVnf(); - serviceInstance = setServiceInstance(); - msoRequestId = UUID.randomUUID().toString(); - requestContext = setRequestContext(); - requestContext.setMsoRequestId(msoRequestId); - gBBInput.setRequestContext(requestContext); - - doThrow(new BpmnError("BPMN Error")).when(exceptionUtil) - .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))) - .thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) - .thenReturn(serviceInstance); + public void setup() { + buildingBlockExecution = createBuildingBlockExecution(); + extractPojosForBB = mock(ExtractPojosForBB.class); + testedObject = new ConfigAssignVnf(extractPojosForBB, new ExceptionBuilder()); } @Test - public void preProcessAbstractCDSProcessingTest() throws Exception { + public void prepareAbstractCDSPropertiesBean_success() throws Exception { + // given + when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID)) + .thenReturn(createGenericVnf()); + when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID)) + .thenReturn(createServiceInstance()); + // when + testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); + // then + verifyConfigAssignPropertiesJsonContent(); + } - configAssignVnf.preProcessAbstractCDSProcessing(execution); + private void verifyConfigAssignPropertiesJsonContent() throws Exception { + AbstractCDSPropertiesBean abstractCDSPropertiesBean = buildingBlockExecution.getVariable("executionObject"); + String payload = abstractCDSPropertiesBean.getRequestObject(); + ObjectMapper mapper = new ObjectMapper(); + JsonNode payloadJson = mapper.readTree(payload); + JsonNode configAssignPropertiesNode = payloadJson.findValue("config-assign-properties"); + assertThat(configAssignPropertiesNode.size()).isEqualTo(THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES); + assertThat(configAssignPropertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID); + assertThat(configAssignPropertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID); + assertThat(configAssignPropertiesNode.get("vnf-name").asText()).isEqualTo(GENERIC_VNF_NAME); + assertThat(configAssignPropertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID); + assertThat(configAssignPropertiesNode.get("vnf-customization-uuid").asText()) + .isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID); + assertThat(configAssignPropertiesNode.has("paramName1")).isTrue(); + assertThat(configAssignPropertiesNode.get("paramName1").asText()).isEqualTo("paramValue1"); + assertThat(configAssignPropertiesNode.has("paramName2")).isTrue(); + assertThat(configAssignPropertiesNode.get("paramName2").asText()).isEqualTo("paramValue2"); + assertThat(configAssignPropertiesNode.has("paramName3")).isTrue(); + assertThat(configAssignPropertiesNode.get("paramName3").asText()).isEqualTo("paramValue3"); + } - assertTrue(true); + private BuildingBlockExecution createBuildingBlockExecution() { + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock()); + return new DelegateExecutionImpl(execution); } + private ServiceInstance createServiceInstance() { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + return serviceInstance; + } + + private GenericVnf createGenericVnf() { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(GENERIC_VNF_ID); + genericVnf.setVnfName(GENERIC_VNF_NAME); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelCustomizationUuid(TARGET_VNF_MODEL_CUSTOMIZATION_UUID); + modelInfoGenericVnf.setBlueprintName("blueprintTest"); + modelInfoGenericVnf.setBlueprintVersion("blueprintVerTest"); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + return genericVnf; + } + + private GeneralBuildingBlock createGeneralBuildingBlock() { + GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock(); + RequestContext requestContext = new RequestContext(); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(createRequestUserParams()); + requestContext.setRequestParameters(requestParameters); + generalBuildingBlock.setRequestContext(requestContext); + return generalBuildingBlock; + } + + private List<Map<String, Object>> createRequestUserParams() { + List<Map<String, Object>> userParams = new ArrayList<>(); + Map<String, Object> userParamMap = new HashMap<>(); + userParamMap.put("service", USER_PARAMS_FROM_REQUEST); + userParams.add(userParamMap); + return userParams; + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java index 0ba9237aaf..e158925568 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; public class SDNCQueryTasksTest extends BaseTaskTest { @InjectMocks @@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { vfModule = setVfModule(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException( - any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class)); + any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class)); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); @@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index 0fc33fe5ce..e435909f59 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.w3c.dom.Document; import org.xml.sax.InputSource; import com.fasterxml.jackson.core.JsonParseException; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java index b371e3a48a..ffe48876c4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; import org.onap.so.db.catalog.beans.ResourceType; import org.springframework.beans.factory.annotation.Autowired; -@Ignore public class OrchestrationStatusValidatorTest extends BaseTaskTest { @InjectMocks protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator(); @@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = + new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) + .thenReturn(serviceInstance); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); @@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = + new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration(); + configuration.setConfigurationId("configurationId"); + configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))) + .thenReturn(configuration); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective @@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { execution.getVariable("orchestrationStatusValidationResult")); } + @Ignore @Test public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception { expectedException.expect(BpmnError.class); @@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { orchestrationStatusValidator.validateOrchestrationStatus(execution); } + @Ignore @Test public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception { expectedException.expect(BpmnError.class); @@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { orchestrationStatusValidator.validateOrchestrationStatus(execution); } + @Ignore @Test public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception { expectedException.expect(BpmnError.class); @@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { orchestrationStatusValidator.validateOrchestrationStatus(execution); - assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, - execution.getVariable("orchestrationStatusValidationResult")); + assertNull(execution.getVariable("orchestrationStatusValidationResult")); } @Test @@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf); setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB"); buildingBlockDetail.setId(1); @@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); - orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); orchestrationStatusStateTransitionDirective.setId(1); orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE); @@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf); setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB"); buildingBlockDetail.setId(1); @@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective @@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective @@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective @@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); orchestrationStatusStateTransitionDirective @@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult")); } + + @Test + public void continueValidationActivatedTest() throws Exception { + String flowToBeCalled = "DeactivateVnfBB"; + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName(flowToBeCalled); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.VF_MODULE); + buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE); + when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = + new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = + new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE); + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient) + .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED, + OrchestrationAction.DEACTIVATE); + + execution.setVariable("aLaCarte", true); + execution.setVariable("flowToBeCalled", flowToBeCalled); + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.CONTINUE, + execution.getVariable("orchestrationStatusValidationResult")); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 68f3d20c82..9855c8587a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -96,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { public void createConfigurationTest() { doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper) .mapConfiguration(configuration); - doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), - isA(org.onap.aai.domain.yang.Configuration.class)); - + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + any(Optional.class)); aaiConfigurationResources.createConfiguration(configuration); assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); - verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), - isA(org.onap.aai.domain.yang.Configuration.class)); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java index 3680eaac81..425b595686 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -53,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.AAIRestClientImpl; import org.onap.so.client.aai.AAIValidatorImpl; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; @@ -234,6 +235,7 @@ public class AAIVnfResourcesTest extends TestDataSetup { boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId"); verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class), isA(AAIResourceUri.class)); + verify(MOCK_aaiValidatorImpl, times(1)).setClient(isA(AAIRestClientImpl.class)); verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class)); assertTrue(isVnfPserversLockedFlag); } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java index f031f10bb5..652df6ff0d 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ package org.onap.so.cloudify.base.client; - +@FunctionalInterface public interface CloudifyClientConnector { public <T> CloudifyResponse request(CloudifyRequest<T> request); diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java index 966cc8f144..0ca3212238 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,11 @@ public class CloudifyResponseException extends CloudifyBaseException { private static final long serialVersionUID = 7294957362769575271L; - protected String message; - protected int status; + private final String message; + private final int status; // Make the response available for exception handling (includes body) - protected CloudifyResponse response; + private final CloudifyResponse response; public CloudifyResponseException(String message, int status) { this.message = message; diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java index ba6a5911b7..54519bac72 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ public class HttpClientConnector implements CloudifyClientConnector { public <T> CloudifyResponse request(CloudifyRequest<T> request) { - CloseableHttpClient httpClient = null; // HttpClients.createDefault(); + CloseableHttpClient httpClient = null; if (request.isBasicAuth()) { // Use Basic Auth for this request. @@ -211,11 +211,14 @@ public class HttpClientConnector implements CloudifyClientConnector { } catch (HttpResponseException e) { // What exactly does this mean? It does not appear to get thrown for // non-2XX responses as documented. + logger.error("Client HttpResponseException", e); throw new CloudifyResponseException(e.getMessage(), e.getStatusCode()); } catch (UnknownHostException e) { + logger.error("Client UnknownHostException", e); throw new CloudifyConnectException("Unknown Host: " + e.getMessage()); } catch (IOException e) { // Catch all other IOExceptions and throw as OpenStackConnectException + logger.error("Client IOException", e); throw new CloudifyConnectException(e.getMessage()); } catch (Exception e) { // Catchall for anything else, must throw as a RuntimeException @@ -227,7 +230,7 @@ public class HttpClientConnector implements CloudifyClientConnector { try { httpResponse.close(); } catch (IOException e) { - logger.debug("Unable to close HTTP Response: " + e); + logger.debug("Unable to close HTTP Response: ", e); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java index a96fdb6b50..f1aa06cb39 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ public class HttpClientResponse implements CloudifyResponse { private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class); - private HttpResponse response = null; + private transient HttpResponse response = null; private String entityBody = null; public HttpClientResponse(HttpResponse response) { diff --git a/common/pom.xml b/common/pom.xml index 2553038e6b..9e4382621a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -118,11 +118,6 @@ <artifactId>spring-security-web</artifactId> </dependency> <dependency> - <groupId>org.onap.logging-analytics</groupId> - <artifactId>logging-slf4j</artifactId> - <version>1.2.2</version> - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> </dependency> @@ -191,7 +186,11 @@ <artifactId>javatuples</artifactId> <version>1.2</version> </dependency> - + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-external-task-client</artifactId> + <version>1.1.1</version> + </dependency> </dependencies> <dependencyManagement> <dependencies> diff --git a/common/src/main/java/org/onap/so/client/BaseClient.java b/common/src/main/java/org/onap/so/client/BaseClient.java index d939a33358..d1523a1f96 100644 --- a/common/src/main/java/org/onap/so/client/BaseClient.java +++ b/common/src/main/java/org/onap/so/client/BaseClient.java @@ -22,7 +22,7 @@ package org.onap.so.client; import java.util.ArrayList; import java.util.List; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -80,7 +80,7 @@ public class BaseClient<I, O> { RestTemplate restTemplate = new RestTemplate(); restTemplate .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - restTemplate.getInterceptors().add(new SpringClientFilter()); + restTemplate.getInterceptors().add(new SOSpringClientFilter()); ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); return responseEntity.getBody(); diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java index 715ba32831..63a4b1cd65 100644 --- a/common/src/main/java/org/onap/so/client/HttpClient.java +++ b/common/src/main/java/org/onap/so/client/HttpClient.java @@ -24,22 +24,22 @@ import java.net.URL; import java.util.Map; import java.util.Optional; import static org.apache.commons.lang3.StringUtils.*; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HttpClient extends RestClient { protected final Logger log = LoggerFactory.getLogger(HttpClient.class); - private TargetEntity targetEntity; + private ONAPComponents targetEntity; - HttpClient(URL host, String contentType, TargetEntity targetEntity) { + HttpClient(URL host, String contentType, ONAPComponents targetEntity) { super(host, contentType); this.targetEntity = targetEntity; } @Override - public TargetEntity getTargetEntity() { + public ONAPComponents getTargetEntity() { return targetEntity; } diff --git a/common/src/main/java/org/onap/so/client/HttpClientFactory.java b/common/src/main/java/org/onap/so/client/HttpClientFactory.java index d02c18ff56..3a8a9ee1bd 100644 --- a/common/src/main/java/org/onap/so/client/HttpClientFactory.java +++ b/common/src/main/java/org/onap/so/client/HttpClientFactory.java @@ -21,19 +21,19 @@ package org.onap.so.client; import java.net.URL; import javax.ws.rs.core.MediaType; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class HttpClientFactory { - public HttpClient newJsonClient(URL host, TargetEntity targetEntity) { + public HttpClient newJsonClient(URL host, ONAPComponents targetEntity) { return new HttpClient(host, MediaType.APPLICATION_JSON, targetEntity); } - public HttpClient newXmlClient(URL host, TargetEntity targetEntity) { + public HttpClient newXmlClient(URL host, ONAPComponents targetEntity) { return new HttpClient(host, MediaType.APPLICATION_XML, targetEntity); } - public HttpClient newTextXmlClient(URL host, TargetEntity targetEntity) { + public HttpClient newTextXmlClient(URL host, ONAPComponents targetEntity) { return new HttpClient(host, MediaType.TEXT_XML, targetEntity); } } diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index d3a4d444f7..c8d7dc9f5c 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -44,11 +44,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriBuilder; +import org.onap.logging.filter.base.MDCSetup; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.PayloadLoggingClientFilter; import org.onap.so.client.policy.CommonObjectMapperProvider; -import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging; -import org.onap.so.logging.jaxrs.filter.PayloadLoggingFilter; +import org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter; import org.onap.so.utils.CryptoUtils; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @@ -71,7 +73,8 @@ public abstract class RestClient { protected String accept; protected String contentType; protected String requestId = ""; - protected JaxRsClientLogging jaxRsClientLogging; + protected SOMetricLogClientFilter metricLogClientFilter; + protected MDCSetup mdcSetup = new MDCSetup(); protected RestProperties props; protected RestClient(RestProperties props, Optional<URI> path) { @@ -179,18 +182,18 @@ public abstract class RestClient { return ClientBuilder.newBuilder().build(); } - protected abstract TargetEntity getTargetEntity(); + protected abstract ONAPComponentsList getTargetEntity(); protected void initializeClient(Client client) { if (this.enableLogging()) { - client.register(new PayloadLoggingFilter(this.getMaxPayloadSize())); + client.register(new PayloadLoggingClientFilter(this.getMaxPayloadSize())); } CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider(); client.register(new JacksonJsonProvider(provider.getMapper())); - jaxRsClientLogging = new JaxRsClientLogging(); - jaxRsClientLogging.setTargetService(getTargetEntity()); - client.register(jaxRsClientLogging); + metricLogClientFilter = new SOMetricLogClientFilter(); + mdcSetup.setTargetEntity(getTargetEntity()); + client.register(metricLogClientFilter); if (!path.isPresent()) { webTarget = client.target(host.toString()); diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java index 0633ae74c9..5fbc9126cf 100644 --- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java +++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java @@ -21,7 +21,7 @@ package org.onap.so.client; import org.onap.so.configuration.rest.HttpComponentsClientConfiguration; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; @@ -45,7 +45,7 @@ public class RestTemplateConfig { final RestTemplate restTemplate = new RestTemplate(); restTemplate .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - restTemplate.getInterceptors().add(new SpringClientFilter()); + restTemplate.getInterceptors().add(new SOSpringClientFilter()); return restTemplate; } @@ -56,7 +56,7 @@ public class RestTemplateConfig { httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory(); final RestTemplate restTemplate = new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory)); - restTemplate.getInterceptors().add(new SpringClientFilter()); + restTemplate.getInterceptors().add(new SOSpringClientFilter()); return restTemplate; } } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java index 2fe3910486..e255b297ed 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java @@ -50,6 +50,8 @@ public class AAIErrorFormatter { } protected String format(String s, List<String> variables) { - return String.format(s.replaceAll("%(\\d+)", "%$1\\$s"), variables.toArray()); + s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s"); + s = s.replaceAll("%(\\d{2})", "%%$1"); + return String.format(s, variables.toArray()); } } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java index b546aaa23e..610ff728e9 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java @@ -26,7 +26,7 @@ import java.util.Optional; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.onap.so.client.graphinventory.GraphInventoryRestClient; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class AAIRestClient extends GraphInventoryRestClient { @@ -38,8 +38,8 @@ public class AAIRestClient extends GraphInventoryRestClient { } @Override - public TargetEntity getTargetEntity() { - return TargetEntity.AAI; + public ONAPComponents getTargetEntity() { + return ONAPComponents.AAI; } @Override diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java index f2f99050db..1fe9da984f 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java @@ -21,6 +21,7 @@ package org.onap.so.client.aai.entities.uri; import java.net.URI; +import java.util.regex.Pattern; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; @@ -138,4 +139,9 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri { public AAISimpleUri format(Format format) { return (AAISimpleUri) super.format(format); } + + @Override + protected Pattern getPrefixPattern() { + return Pattern.compile("/aai/v\\d+"); + } } diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java index d6c7072c14..88899a7097 100644 --- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java +++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java @@ -29,7 +29,7 @@ import org.onap.so.client.RestClient; import org.onap.so.client.policy.CommonObjectMapperProvider; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.utils.CryptoUtils; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class AdapterRestClient extends RestClient { @@ -46,8 +46,8 @@ public class AdapterRestClient extends RestClient { } @Override - public TargetEntity getTargetEntity() { - return TargetEntity.OPENSTACK_ADAPTER; + public ONAPComponents getTargetEntity() { + return ONAPComponents.OPENSTACK_ADAPTER; } @Override diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java index 68b4e84448..b0ffb9358c 100644 --- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java +++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java @@ -22,11 +22,15 @@ package org.onap.so.client.dmaap.rest; import java.net.URL; import java.util.Map; +import java.util.UUID; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.RestClient; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; +import org.slf4j.MDC; public class DMaaPRestClient extends RestClient { + private static final String SO = "SO"; private final String auth; private final String key; @@ -37,8 +41,8 @@ public class DMaaPRestClient extends RestClient { } @Override - public TargetEntity getTargetEntity() { - return TargetEntity.DMAAP; + public ONAPComponents getTargetEntity() { + return ONAPComponents.DMAAP; } @Override @@ -46,6 +50,8 @@ public class DMaaPRestClient extends RestClient { if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) { addBasicAuthHeader(auth, key); } + String onapRequestId = UUID.randomUUID().toString(); + headerMap.put(ONAPLogConstants.Headers.REQUEST_ID, onapRequestId); + headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); } - } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java index 434c65da46..babfa14d71 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java @@ -28,7 +28,8 @@ import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.RestClientSSL; import org.onap.so.client.RestProperties; import org.onap.so.client.policy.CommonObjectMapperProvider; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; +import org.onap.logging.filter.base.ONAPComponentsList; public abstract class GraphInventoryRestClient extends RestClientSSL { @@ -42,7 +43,7 @@ public abstract class GraphInventoryRestClient extends RestClientSSL { } @Override - public abstract TargetEntity getTargetEntity(); + public abstract ONAPComponentsList getTargetEntity(); @Override protected abstract void initializeHeaderMap(Map<String, String> headerMap); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java index ffbb86f023..540472a88d 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java @@ -20,12 +20,15 @@ package org.onap.so.client.graphinventory.entities; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import org.onap.so.client.aai.entities.QueryStep; import org.onap.so.client.graphinventory.GraphInventoryObjectName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.base.Joiner; @@ -33,6 +36,7 @@ public class DSLQueryBuilder<S, E> implements QueryStep { private List<QueryStep> steps = new ArrayList<>(); private String suffix = ""; + private static final Logger logger = LoggerFactory.getLogger(DSLQueryBuilder.class); public DSLQueryBuilder() { @@ -49,8 +53,25 @@ public class DSLQueryBuilder<S, E> implements QueryStep { } public DSLQueryBuilder<S, E> output() { - if (steps.get(steps.size() - 1) instanceof DSLNode) { + Object obj = steps.get(steps.size() - 1); + if (obj instanceof DSLNode) { ((DSLNode) steps.get(steps.size() - 1)).output(); + } else if (obj.getClass().getName().contains("$$Lambda$")) { + // process lambda expressions + for (Field f : obj.getClass().getDeclaredFields()) { + f.setAccessible(true); + Object o; + try { + o = f.get(obj); + if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNode) { + ((DSLNode) ((DSLQueryBuilder) o).steps.get(0)).output(); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + logger.error("Exception occured", e); + } + f.setAccessible(false); + break; + } } return this; } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java index 41ba07ad6c..ffe47c5c51 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java @@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.regex.Pattern; import javax.ws.rs.core.UriBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.client.graphinventory.Format; @@ -61,7 +62,7 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable { protected SimpleUri(GraphInventoryObjectType type, URI uri) { this.type = type; this.pluralType = null; - this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", "")); + this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")); this.values = new Object[0]; } @@ -174,6 +175,10 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable { return build(this.values); } + protected Pattern getPrefixPattern() { + return Pattern.compile("/.*?/v\\d+"); + } + protected URI build(Object... values) { // This is a workaround because resteasy does not encode URIs correctly final String[] encoded = new String[values.length]; diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java index 507f1130b5..147f688ea8 100644 --- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java +++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java @@ -25,7 +25,7 @@ import java.net.URI; import java.util.Map; import java.util.Optional; import org.onap.so.client.RestClient; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class GRMRestClient extends RestClient { @@ -37,8 +37,8 @@ public class GRMRestClient extends RestClient { } @Override - public TargetEntity getTargetEntity() { - return TargetEntity.GRM; + public ONAPComponents getTargetEntity() { + return ONAPComponents.GRM; } @Override diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java index 95bc4282ae..33ece07e3d 100644 --- a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java +++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java @@ -26,7 +26,7 @@ import java.util.Optional; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.RestClient; import org.onap.so.client.policy.entities.PolicyServiceType; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class PolicyRestClient extends RestClient { @@ -38,8 +38,8 @@ public class PolicyRestClient extends RestClient { } @Override - public TargetEntity getTargetEntity() { - return TargetEntity.POLICY; + public ONAPComponents getTargetEntity() { + return ONAPComponents.POLICY; } @Override diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java new file mode 100644 index 0000000000..8d30ad35ff --- /dev/null +++ b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java @@ -0,0 +1,56 @@ +package org.onap.so.externaltasks.logging; + +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import org.camunda.bpm.client.task.ExternalTask; +import org.onap.logging.filter.base.MDCSetup; +import org.onap.logging.filter.base.ONAPComponents; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.MdcConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; + +@Component +public class AuditMDCSetup { + + private MDCSetup mdcSetup = new MDCSetup(); + + private static final Logger logger = LoggerFactory.getLogger(AuditMDCSetup.class); + + public void setupMDC(ExternalTask externalTask) { + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, + ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + String msoRequestId = externalTask.getVariable("mso-request-id"); + if (msoRequestId != null && !msoRequestId.isEmpty()) { + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); + } + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName()); + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, ONAPComponents.OPENSTACK_ADAPTER.toString()); + setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + setElapsedTime(); + mdcSetup.setServerFQDN(); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); + } + + public void setElapsedTime() { + DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; + MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, Long.toString(System.currentTimeMillis() - ZonedDateTime + .parse(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP), timeFormatter).toInstant().toEpochMilli())); + } + + public void setResponseCode(String code) { + MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, code); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, code); + } + + public void clearClientMDCs() { + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); + MDC.remove(MdcConstants.OPENSTACK_STATUS_CODE); + MDC.remove(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP); + MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME); + MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); + } +} diff --git a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java index 83b860ff01..2010bc1988 100644 --- a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java +++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java @@ -21,13 +21,5 @@ package org.onap.so.logger; public class HttpHeadersConstants { - public static final String HEADER_FROM_APP_ID = "X-FromAppId"; - public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName"; - public static final String HEADER_REQUEST_ID = "X-RequestId"; - public static final String TRANSACTION_ID = "X-TransactionID"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; - public static final String CLIENT_ID = "X-ClientID"; - public static final String INVOCATION_ID_HEADER = "X-InvocationID"; public static final String REQUESTOR_ID = "X-RequestorID"; } diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java index 30915c6171..3dc0c062c6 100644 --- a/common/src/main/java/org/onap/so/logger/LogConstants.java +++ b/common/src/main/java/org/onap/so/logger/LogConstants.java @@ -21,8 +21,6 @@ package org.onap.so.logger; public class LogConstants { - public static final String TARGET_ENTITY_HEADER = "X-Target-Entity"; - public static final String UNKNOWN_TARGET_ENTITY = "Unknown-Target-Entity"; public static final String HTTP_URL = "Http-Url"; public static final String URI_BASE = "Uri-Base"; } diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java index 33fceb2f0f..4c6672e59f 100644 --- a/common/src/main/java/org/onap/so/logger/MdcConstants.java +++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java @@ -21,14 +21,6 @@ package org.onap.so.logger; public class MdcConstants { - public static final String INVOCATION_ID = "InvocationID"; - public static final String RESPONSECODE = "ResponseCode"; - public static final String RESPONSEDESC = "ResponseDesc"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String CLIENT_ID = "X-ClientID"; - public static final String PARTNERNAME = "PartnerName"; - public static final String SERVICE_NAME = "ServiceName"; - public static final String STATUSCODE = "StatusCode"; - public static final String ENDTIME = "EndTimestamp"; public static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName"; + public static final String OPENSTACK_STATUS_CODE = "OpenstackStatusCode"; } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java deleted file mode 100644 index 5dbf88d346..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - - -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.utils.TargetEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.stereotype.Component; -import javax.annotation.Priority; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Providers; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.UUID; - -@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") -@Component -@Priority(0) -public class JaxRsClientLogging implements ClientRequestFilter, ClientResponseFilter { - - @Context - private Providers providers; - - private static final String TRACE = "trace-#"; - private static final String SO = "SO"; - private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class); - - public void setTargetService(TargetEntity targetEntity) { - MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString()); - } - - @Override - public void filter(ClientRequestContext clientRequest) { - try { - setupMDC(clientRequest); - setupHeaders(clientRequest); - logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke"); - } catch (Exception e) { - logger.warn("Error in incoming JAX-RS Inteceptor", e); - } - } - - private void setupHeaders(ClientRequestContext clientRequest) { - MultivaluedMap<String, Object> headers = clientRequest.getHeaders(); - headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest)); - headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO); - } - - private void setupMDC(ClientRequestContext clientRequest) { - MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); - MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString()); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); - setInvocationId(); - MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY)); - } - - private String extractRequestID(ClientRequestContext clientRequest) { - String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); - if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) { - requestId = UUID.randomUUID().toString(); - logger.warn("Could not Find Request ID Generating New One: {}", clientRequest.getUri().getPath()); - } - return requestId; - } - - private void setInvocationId() { - String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID); - if (invocationId == null || invocationId.isEmpty()) - invocationId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); - } - - - @Override - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) { - - try { - String statusCode; - if (Response.Status.Family.familyOf(responseContext.getStatus()) - .equals(Response.Status.Family.SUCCESSFUL)) { - statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString(); - } else { - statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); - } - MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus())); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - logger.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn"); - clearClientMDCs(); - } catch (Exception e) { - logger.warn("Error in outgoing JAX-RS Inteceptor", e); - } - } - - private void clearClientMDCs() { - MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); - MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); - MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); - MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); - MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP); - } - -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java deleted file mode 100644 index 7e2b603ba6..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java +++ /dev/null @@ -1,173 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.UUID; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import javax.ws.rs.ext.Providers; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logger.HttpHeadersConstants; -import org.onap.so.logger.LogConstants; -import org.onap.so.logger.MdcConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Priority(1) -@Provider -@Component -public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResponseFilter { - - protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); - - @Context - private HttpServletRequest httpServletRequest; - - @Context - private Providers providers; - - @Autowired - private MDCSetup mdcSetup; - - @Override - public void filter(ContainerRequestContext containerRequest) { - try { - MultivaluedMap<String, String> headers = containerRequest.getHeaders(); - setRequestId(headers); - containerRequest.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); - setInvocationId(headers); - setServiceName(containerRequest); - setMDCPartnerName(headers); - mdcSetup.setServerFQDN(); - mdcSetup.setClientIPAddress(httpServletRequest); - mdcSetup.setInstanceUUID(); - mdcSetup.setEntryTimeStamp(); - MDC.put(HttpHeadersConstants.REQUESTOR_ID, headers.getFirst("X-RequestorID")); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); - MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString()); - MDC.put(MdcConstants.ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); - } catch (Exception e) { - logger.warn("Error in incoming JAX-RS Inteceptor", e); - } - } - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { - try { - setResponseStatusCode(responseContext); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, payloadMessage(responseContext)); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus())); - logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); - MDC.clear(); - } catch (Exception e) { - MDC.clear(); - logger.warn("Error in outgoing JAX-RS Inteceptor", e); - } - } - - private void setResponseStatusCode(ContainerResponseContext responseContext) { - String statusCode; - if (Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) { - statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString(); - } else { - statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); - } - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - } - - private String payloadMessage(ContainerResponseContext responseContext) throws IOException { - String message = ""; - if (responseContext.hasEntity()) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Class<?> entityClass = responseContext.getEntityClass(); - Type entityType = responseContext.getEntityType(); - Annotation[] entityAnnotations = responseContext.getEntityAnnotations(); - MediaType mediaType = responseContext.getMediaType(); - @SuppressWarnings("unchecked") - MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers - .getMessageBodyWriter(entityClass, entityType, entityAnnotations, mediaType); - bodyWriter.writeTo(responseContext.getEntity(), entityClass, entityType, entityAnnotations, mediaType, - responseContext.getHeaders(), baos); - message = message.concat(new String(baos.toByteArray())); - } - return message; - } - - private void setRequestId(MultivaluedMap<String, String> headers) { - String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID); - if (requestId == null || requestId.isEmpty()) - requestId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); - } - - private void setInvocationId(MultivaluedMap<String, String> headers) { - MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers)); - } - - private void setMDCPartnerName(MultivaluedMap<String, String> headers) { - String partnerName = headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME); - if (partnerName == null || partnerName.isEmpty()) - partnerName = ""; - MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); - } - - private String findInvocationId(MultivaluedMap<String, String> headers) { - String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID); - if (invocationId == null || invocationId.isEmpty()) - invocationId = UUID.randomUUID().toString(); - return invocationId; - } - - private void setServiceName(ContainerRequestContext containerRequest) { - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath()); - } - - private void clearClientMDCs() { - MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); - MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); - MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); - MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); - } - -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java deleted file mode 100644 index 607f067ec4..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Map; -import java.util.UUID; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.Response; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.stereotype.Component; - -@Component -public class MDCSetup { - - protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class); - - private static final String INSTANCE_UUID = UUID.randomUUID().toString(); - - public void setInstanceUUID() { - MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID); - } - - public void setServerFQDN() { - String serverFQDN = ""; - InetAddress addr = null; - try { - addr = InetAddress.getLocalHost(); - serverFQDN = addr.toString(); - } catch (UnknownHostException e) { - logger.warn("Cannot Resolve Host Name"); - serverFQDN = ""; - } - MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN); - } - - public void setClientIPAddress(HttpServletRequest httpServletRequest) { - String remoteIpAddress = ""; - if (httpServletRequest != null) { - remoteIpAddress = httpServletRequest.getRemoteAddr(); - } - MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress); - } - - public void setEntryTimeStamp() { - MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); - } - - public void setServiceName(HttpServletRequest request) { - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); - } - - public void setRequestId(Map<String, String> headers) { - String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID); - if (requestId == null || requestId.isEmpty()) - requestId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); - } - - public void setInvocationId(Map<String, String> headers) { - String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); - if (invocationId == null || invocationId.isEmpty()) - invocationId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); - } - - public void setMDCPartnerName(Map<String, String> headers) { - String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME); - if (partnerName == null || partnerName.isEmpty()) - partnerName = ""; - MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); - } - - - public void setResponseStatusCode(HttpServletResponse response) { - String statusCode; - if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) { - statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString(); - } else { - statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); - } - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - } -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java deleted file mode 100644 index e644f9e030..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - -import java.util.Map; -import org.slf4j.MDC; -import org.springframework.core.task.TaskDecorator; - -public class MDCTaskDecorator implements TaskDecorator { - - @Override - public Runnable decorate(Runnable runnable) { - Map<String, String> contextMap = MDC.getCopyOfContextMap(); - return () -> { - try { - if (contextMap != null) { - MDC.setContextMap(contextMap); - runnable.run(); - } - } finally { - MDC.clear(); - } - }; - } -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java deleted file mode 100644 index 21c0b52a91..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import javax.annotation.Priority; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.Provider; -import javax.ws.rs.ext.WriterInterceptor; -import javax.ws.rs.ext.WriterInterceptorContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -@Provider -@Priority(1) -public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor { - - private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class); - private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream"; - private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - private final int maxEntitySize; - - public PayloadLoggingFilter() { - maxEntitySize = 1024 * 1024; - } - - public PayloadLoggingFilter(int maxPayloadSize) { - this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024); - } - - private void log(StringBuilder sb) { - logger.debug(sb.toString()); - } - - protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset) - throws IOException { - if (!stream.markSupported()) { - stream = new BufferedInputStream(stream); - } - stream.mark(maxEntitySize + 1); - final byte[] entity = new byte[maxEntitySize + 1]; - final int entitySize = stream.read(entity); - if (entitySize != -1) { - b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset)); - } - if (entitySize > maxEntitySize) { - b.append("...more..."); - } - b.append('\n'); - stream.reset(); - return stream; - } - - @Override - public void filter(ClientRequestContext requestContext) throws IOException { - if (requestContext.hasEntity()) { - final OutputStream stream = new LoggingStream(requestContext.getEntityStream()); - requestContext.setEntityStream(stream); - requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream); - } - String method = formatMethod(requestContext); - log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: " - + requestContext.getHeaders().toString())); - - } - - @Override - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { - final StringBuilder sb = new StringBuilder(); - if (responseContext.hasEntity()) { - responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET)); - String method = formatMethod(requestContext); - log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: " - + responseContext.getHeaders().toString())); - } - } - - @Override - public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { - final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY); - context.proceed(); - if (stream != null) { - log(stream.getStringBuilder(DEFAULT_CHARSET)); - } - } - - private class LoggingStream extends FilterOutputStream { - - private final StringBuilder sb = new StringBuilder(); - private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - LoggingStream(OutputStream out) { - super(out); - } - - StringBuilder getStringBuilder(Charset charset) { - // write entity to the builder - final byte[] entity = baos.toByteArray(); - - sb.append(new String(entity, 0, entity.length, charset)); - if (entity.length > maxEntitySize) { - sb.append("...more..."); - } - sb.append('\n'); - - return sb; - } - - @Override - public void write(final int i) throws IOException { - if (baos.size() <= maxEntitySize) { - baos.write(i); - } - out.write(i); - } - } - - private String formatMethod(ClientRequestContext requestContext) { - String method = requestContext.getHeaderString("X-HTTP-Method-Override"); - if (method == null) { - method = requestContext.getMethod(); - } else { - method = requestContext.getMethod() + " (overridden to " + method + ")"; - } - - return method; - } -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java new file mode 100644 index 0000000000..5ae1082464 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java @@ -0,0 +1,34 @@ +package org.onap.so.logging.jaxrs.filter; + +import javax.annotation.Priority; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerResponseContext; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.HttpHeadersConstants; +import org.onap.so.logger.LogConstants; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; +import org.onap.logging.filter.base.AuditLogContainerFilter; + +@Priority(1) +@Component +public class SOAuditLogContainerFilter extends AuditLogContainerFilter { + + private static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName"; + + @Override + protected void additionalPreHandling(ContainerRequestContext request) { + request.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + MDC.put(ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + String requestorId = request.getHeaders().getFirst("X-RequestorID"); + if (requestorId != null) { + MDC.put(HttpHeadersConstants.REQUESTOR_ID, requestorId); + } + MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString()); + } + + @Override + protected void additionalPostHandling(ContainerResponseContext response) { + // override to add additional post handling + } +} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java new file mode 100644 index 0000000000..248e2f00bf --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java @@ -0,0 +1,44 @@ +package org.onap.so.logging.jaxrs.filter; + +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientResponseContext; +import org.onap.logging.filter.base.MDCSetup; +import org.onap.logging.filter.base.MetricLogClientFilter; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.MdcConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; + + +public class SOMetricLogClientFilter extends MetricLogClientFilter { + + protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class); + private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN"); + + private MDCSetup mdcSetup = new MDCSetup(); + + @Override + public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) { + try { + mdcSetup.setLogTimestamp(); + mdcSetup.setElapsedTimeInvokeTimestamp(); + mdcSetup.setResponseStatusCode(responseContext.getStatus()); + mdcSetup.setResponseDescription(responseContext.getStatus()); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus())); + logger.info(INVOKE_RETURN, "InvokeReturn"); + mdcSetup.clearClientMDCs(); + setOpenStackResponseCode(); + } catch (Exception e) { + logger.warn("Error in JAX-RS request,response client filter", e); + } + } + + protected void setOpenStackResponseCode() { + if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) { + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE)); + } + } +} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java new file mode 100644 index 0000000000..c2b8df37c2 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java @@ -0,0 +1,52 @@ +package org.onap.so.logging.jaxrs.filter; + +import java.io.IOException; +import java.nio.charset.Charset; +import org.onap.logging.filter.base.MDCSetup; +import org.onap.logging.filter.spring.SpringClientFilter; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.MdcConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.util.StreamUtils; + +@Component +public class SOSpringClientFilter extends SpringClientFilter implements ClientHttpRequestInterceptor { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private MDCSetup mdcSetup = new MDCSetup(); + private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN"); + + + protected void processResponse(ClientHttpResponse response) throws IOException { + if (logger.isDebugEnabled()) { + logger.debug("============================response begin=========================================="); + logger.debug("Status code : {}", response.getStatusCode()); + logger.debug("Status text : {}", response.getStatusText()); + logger.debug("Headers : {}", response.getHeaders()); + logger.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset())); + logger.debug("=======================response end================================================="); + } + mdcSetup.setLogTimestamp(); + mdcSetup.setElapsedTimeInvokeTimestamp(); + mdcSetup.setResponseStatusCode(response.getRawStatusCode()); + int statusCode = response.getRawStatusCode(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(statusCode)); + mdcSetup.setResponseDescription(statusCode); + logger.info(INVOKE_RETURN, "InvokeReturn"); + mdcSetup.clearClientMDCs(); + setOpenStackResponseCode(); + } + + protected void setOpenStackResponseCode() { + if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) { + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE)); + } + } +} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java deleted file mode 100644 index c763dd4374..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter; - -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logger.LogConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpRequest; -import org.springframework.http.client.ClientHttpRequestExecution; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.util.StreamUtils; -import java.io.IOException; -import java.nio.charset.Charset; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.UUID; -import javax.ws.rs.core.Response; - -public class SpringClientFilter implements ClientHttpRequestInterceptor { - - private final Logger log = LoggerFactory.getLogger(this.getClass()); - - private static final String TRACE = "trace-#"; - private static final String SO = "SO"; - - @Override - public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) - throws IOException { - processRequest(request, body); - ClientHttpResponse response = execution.execute(request, body); - processResponse(response); - return response; - } - - private void processRequest(HttpRequest request, byte[] body) throws IOException { - setInvocationId(); - setupHeaders(request); - setupMDC(request); - if (log.isDebugEnabled()) { - log.debug("===========================request begin================================================"); - log.debug("URI : {}", request.getURI()); - log.debug("Method : {}", request.getMethod()); - log.debug("Headers : {}", request.getHeaders()); - log.debug("Request body: {}", new String(body, "UTF-8")); - log.debug("==========================request end================================================"); - } - } - - private void setupHeaders(HttpRequest clientRequest) { - HttpHeaders headers = clientRequest.getHeaders(); - headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest)); - headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO); - } - - private String extractRequestID(HttpRequest clientRequest) { - String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); - if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) { - requestId = UUID.randomUUID().toString(); - log.warn("Could not Find Request ID Generating New One: {}", clientRequest.getURI()); - } - return requestId; - } - - private void setupMDC(HttpRequest clientRequest) { - MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); - MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString()); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); - MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, extractTargetEntity(clientRequest)); - } - - private String extractTargetEntity(HttpRequest clientRequest) { - HttpHeaders headers = clientRequest.getHeaders(); - String headerTargetEntity = null; - List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER); - if (headerTargetEntityList != null && !headerTargetEntityList.isEmpty()) - headerTargetEntity = headerTargetEntityList.get(0); - String targetEntity = MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY); - if (targetEntity != null && !targetEntity.isEmpty()) { - return targetEntity; - } else if (headerTargetEntity != null && !headerTargetEntity.isEmpty()) { - targetEntity = headerTargetEntity; - } else { - targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY; - log.warn("Could not Target Entity: {}", clientRequest.getURI()); - } - return targetEntity; - } - - private void setInvocationId() { - String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID); - if (invocationId == null || invocationId.isEmpty()) - invocationId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); - } - - - private void processResponse(ClientHttpResponse response) throws IOException { - if (log.isDebugEnabled()) { - log.debug("============================response begin=========================================="); - log.debug("Status code : {}", response.getStatusCode()); - log.debug("Status text : {}", response.getStatusText()); - log.debug("Headers : {}", response.getHeaders()); - log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset())); - log.debug("=======================response end================================================="); - } - String statusCode; - if (Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)) { - statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString(); - } else { - statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); - } - MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getRawStatusCode())); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, ""); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - log.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn"); - clearClientMDCs(); - } - - private void clearClientMDCs() { - MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); - MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); - MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); - MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); - MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); - MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP); - } -} diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java deleted file mode 100644 index fa5a5d5da4..0000000000 --- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.spring.interceptor; - -import java.util.Collections; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Providers; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logging.jaxrs.filter.MDCSetup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -@Component -public class LoggingInterceptor extends HandlerInterceptorAdapter { - - Logger logger = LoggerFactory.getLogger(LoggingInterceptor.class); - - @Autowired - private MDCSetup mdcSetup; - - @Context - private Providers providers; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) - throws Exception { - - Map<String, String> headers = Collections.list((request).getHeaderNames()).stream() - .collect(Collectors.toMap(h -> h, request::getHeader)); - setRequestId(headers); - setInvocationId(headers); - setServiceName(request); - setMDCPartnerName(headers); - mdcSetup.setClientIPAddress(request); - mdcSetup.setEntryTimeStamp(); - mdcSetup.setInstanceUUID(); - mdcSetup.setServerFQDN(); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); - logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); - if (logger.isDebugEnabled()) - logRequestInformation(request); - return true; - } - - protected void logRequestInformation(HttpServletRequest request) { - Map<String, String> headers = Collections.list((request).getHeaderNames()).stream() - .collect(Collectors.toMap(h -> h, request::getHeader)); - - logger.debug("===========================request begin================================================"); - logger.debug("URI : {}", request.getRequestURI()); - logger.debug("Method : {}", request.getMethod()); - logger.debug("Headers : {}", headers); - logger.debug("==========================request end================================================"); - - } - - @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, - ModelAndView modelAndView) throws Exception { - setResponseStatusCode(response); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, ""); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getStatus())); - logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); - MDC.clear(); - } - - protected void setResponseStatusCode(HttpServletResponse response) { - String statusCode; - if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) { - statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString(); - } else { - statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); - } - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - } - - protected void setServiceName(HttpServletRequest request) { - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); - } - - protected void setRequestId(Map<String, String> headers) { - String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase()); - if (requestId == null || requestId.isEmpty()) - requestId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); - } - - protected void setInvocationId(Map<String, String> headers) { - String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase()); - if (invocationId == null || invocationId.isEmpty()) - invocationId = UUID.randomUUID().toString(); - MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); - } - - protected void setMDCPartnerName(Map<String, String> headers) { - String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase()); - if (partnerName == null || partnerName.isEmpty()) - partnerName = ""; - MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); - } - - -} diff --git a/common/src/main/java/org/onap/so/utils/Components.java b/common/src/main/java/org/onap/so/utils/Components.java new file mode 100644 index 0000000000..0713723264 --- /dev/null +++ b/common/src/main/java/org/onap/so/utils/Components.java @@ -0,0 +1,7 @@ +package org.onap.so.utils; + +import org.onap.logging.filter.base.ONAPComponentsList; + +public enum Components implements ONAPComponentsList { + OPENSTACK, UNKNOWN; +} diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java new file mode 100644 index 0000000000..e43b431821 --- /dev/null +++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java @@ -0,0 +1,46 @@ +package org.onap.so.utils; + +import java.security.GeneralSecurityException; +import org.camunda.bpm.client.ExternalTaskClient; +import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; +import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class ExternalTaskServiceUtils { + + @Autowired + public Environment env; + + private static final Logger logger = LoggerFactory.getLogger(ExternalTaskServiceUtils.class); + + public ExternalTaskClient createExternalTaskClient() throws Exception { + String auth = getAuth(); + ClientRequestInterceptor interceptor = createClientInterceptor(auth); + return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1) + .addInterceptor(interceptor).asyncResponseTimeout(120000).build(); + } + + protected ClientRequestInterceptor createClientInterceptor(String auth) { + return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth); + } + + protected String getAuth() throws Exception { + try { + return CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey")); + } catch (IllegalStateException | GeneralSecurityException e) { + logger.error("Error Decrypting Password", e); + throw new Exception("Cannot load password"); + } + } + + public int getMaxClients() { + return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3")); + } + + +} diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java new file mode 100644 index 0000000000..a2aed638fe --- /dev/null +++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java @@ -0,0 +1,36 @@ +package org.onap.so.utils; + +import org.camunda.bpm.client.task.ExternalTask; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public abstract class ExternalTaskUtils { + + @Autowired + Environment env; + + private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class); + + public long calculateRetryDelay(int currentRetries) { + int retrySequence = getRetrySequence().length - currentRetries; + return Integer.parseInt(getRetrySequence()[retrySequence]) * getRetryMutiplier(); + } + + protected Long getRetryMutiplier() { + return Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000")); + } + + protected String[] getRetrySequence() { + String[] seq = {"1", "1", "2", "3", "5", "8", "13", "20"}; + if (env.getProperty("mso.workflow.topics.retrySequence") != null) { + seq = env.getProperty("mso.workflow.topics.retrySequence", String[].class); + } + return seq; + } +} diff --git a/common/src/main/java/org/onap/so/utils/TargetEntities.java b/common/src/main/java/org/onap/so/utils/TargetEntities.java deleted file mode 100644 index 67016a1fa9..0000000000 --- a/common/src/main/java/org/onap/so/utils/TargetEntities.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.utils; - -import java.io.Serializable; - -public interface TargetEntities extends Serializable { - -} diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java deleted file mode 100644 index 3a3ec91d2f..0000000000 --- a/common/src/main/java/org/onap/so/utils/TargetEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.utils; - -import java.util.EnumSet; - -public enum TargetEntity implements TargetEntities { - OPENSTACK_ADAPTER, - BPMN, - GRM, - AAI, - DMAAP, - POLICY, - CATALOG_DB, - REQUEST_DB, - VNF_ADAPTER, - SDNC_ADAPTER, - SNIRO, - SDC, - EXTERNAL, - MULTICLOUD, - OOF, - SDNC, - SO, - UNKNOWN, - OPENSTACK; - - private static final String PREFIX = "SO"; - - public static EnumSet<TargetEntity> getSOInternalComponents() { - return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER); - } - - @Override - public String toString() { - if (getSOInternalComponents().contains(this)) - return TargetEntity.PREFIX + "." + this.name(); - else - return this.name(); - } -} diff --git a/common/src/test/java/org/onap/so/client/HttpClientTest.java b/common/src/test/java/org/onap/so/client/HttpClientTest.java index b12ed5956a..a01e2bb812 100644 --- a/common/src/test/java/org/onap/so/client/HttpClientTest.java +++ b/common/src/test/java/org/onap/so/client/HttpClientTest.java @@ -32,7 +32,7 @@ import java.net.MalformedURLException; import java.net.URL; import org.junit.Rule; import org.junit.Test; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import com.github.tomakehurst.wiremock.junit.WireMockRule; public class HttpClientTest { @@ -49,7 +49,7 @@ public class HttpClientTest { .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(""))); URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post"); - HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN); + HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN); client.addBasicAuthHeader( "97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF", @@ -68,7 +68,7 @@ public class HttpClientTest { .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(""))); URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post"); - HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN); + HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN); client.addAdditionalHeader("Accept", "application/json"); client.addAdditionalHeader("id", null); @@ -86,7 +86,7 @@ public class HttpClientTest { .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(""))); URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post"); - HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN); + HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN); client.addBasicAuthHeader("", "12345"); client.addAdditionalHeader("Accept", "application/json"); diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java index 745dee23e8..cd00a9e4de 100644 --- a/common/src/test/java/org/onap/so/client/RestClientTest.java +++ b/common/src/test/java/org/onap/so/client/RestClientTest.java @@ -39,7 +39,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; @RunWith(MockitoJUnitRunner.class) public class RestClientTest { @@ -82,7 +82,7 @@ public class RestClientTest { private RestClient buildSpy() throws MalformedURLException, IllegalArgumentException, UriBuilderException { RestClient client = httpClientFactory.newJsonClient(UriBuilder.fromUri("http://localhost/test").build().toURL(), - TargetEntity.BPMN); + ONAPComponents.BPMN); return spy(client); } diff --git a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java index 2ef50dd77b..3587c71de0 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java @@ -79,6 +79,22 @@ public class AAIErrorFormatterTest { } @Test + public void errorMessageOnPercentEncodedTest() { + ServiceException svcException = new ServiceException(); + svcException.setText("test my%20Test %1 message - %2"); + svcException.setVariables(Arrays.asList("error", "service exception %1 test")); + + RequestError requestError = new RequestError(); + requestError.setServiceException(svcException); + + doReturn(requestError).when(errorObj).getRequestError(); + + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.getMessage(); + assertEquals("equal", "test my%20Test error message - service exception error test", result); + } + + @Test public void testGetMessageNoParsable() { errorObj.setRequestError(null); AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java index 590e83827b..fb45652d53 100644 --- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java +++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.so.client.graphinventory.entities.DSLNode; +import org.onap.so.client.graphinventory.entities.DSLNodeKey; import org.onap.so.client.graphinventory.entities.DSLQueryBuilder; import org.onap.so.client.graphinventory.entities.__; @@ -118,4 +119,30 @@ public class DSLQueryBuilderTest { assertTrue(builder.equals( "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)")); } + + @Test + public void outputOnNodeLambdasTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = + new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId"))); + + builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE) + .output(); + assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*", + builder.build()); + } + + @Test + public void skipOutputOnUnionTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = + new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); + + builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), + __.node(AAIObjectType.VSERVER) + .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))) + .output(); + + assertEquals( + "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", + builder.build()); + } } diff --git a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java index bc600310b3..5075da3b7a 100644 --- a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java +++ b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java @@ -34,7 +34,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.utils.CryptoUtils; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; public class AdapterRestClientTest { @@ -88,9 +88,9 @@ public class AdapterRestClientTest { } @Test - public void getTargetEntity_success() throws URISyntaxException { + public void getONAPComponents_success() throws URISyntaxException { AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI("")); - assertThat(testedObject.getTargetEntity()).isEqualTo(TargetEntity.OPENSTACK_ADAPTER); + assertThat(testedObject.getTargetEntity()).isEqualTo(ONAPComponents.OPENSTACK_ADAPTER); } @Test diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java new file mode 100644 index 0000000000..5e2a51a56f --- /dev/null +++ b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java @@ -0,0 +1,89 @@ +package org.onap.so.externaltasks.logging; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.doReturn; +import org.camunda.bpm.client.task.ExternalTask; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.MdcConstants; +import org.slf4j.MDC; + +@RunWith(MockitoJUnitRunner.class) +public class AuditMDCSetupTest { + + @Mock + private ExternalTask externalTask; + + @Spy + @InjectMocks + private AuditMDCSetup mdcSetup; + + private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009"; + private String serviceName = "testServiceName"; + + @After + public void tearDown() { + MDC.clear(); + } + + @Test + public void setupMDCTest() { + doReturn(requestId).when(externalTask).getVariable("mso-request-id"); + doReturn(serviceName).when(externalTask).getTopicName(); + + mdcSetup.setupMDC(externalTask); + + assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); + assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertEquals(serviceName, MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("SO.OPENSTACK_ADAPTER", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(), + MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } + + @Test + public void setElapsedTimeTest() { + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z"); + + mdcSetup.setElapsedTime(); + + assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME)); + } + + @Test + public void setResponseCodeTest() { + mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + + assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(), + MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(), + MDC.get(MdcConstants.OPENSTACK_STATUS_CODE)); + } + + @Test + public void clearClientMDCsTest() { + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z"); + MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318"); + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER"); + + mdcSetup.clearClientMDCs(); + + assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE)); + assertNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); + assertNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME)); + assertNull(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + + } + +} diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java new file mode 100644 index 0000000000..b2db986d02 --- /dev/null +++ b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java @@ -0,0 +1,61 @@ +package org.onap.so.utils; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import org.camunda.bpm.client.ExternalTaskClient; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.core.env.Environment; + +@RunWith(MockitoJUnitRunner.class) +public class ExternalTaskServiceUtilsTest { + + @Spy + @InjectMocks + private ExternalTaskServiceUtils utils = new ExternalTaskServiceUtils(); + + @Mock + private Environment mockEnv; + + @Mock + private ExternalTaskClient mockClient; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + doReturn("3").when(mockEnv).getProperty("workflow.topics.maxClients", "3"); + doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnv).getRequiredProperty("mso.msoKey"); + doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436").when(mockEnv) + .getRequiredProperty("mso.auth"); + doReturn("someid").when(mockEnv).getRequiredProperty("mso.config.cadi.aafId"); + doReturn("http://camunda.com").when(mockEnv).getRequiredProperty("mso.workflow.endpoint"); + } + + @Test + public void testCreateExternalTaskClient() throws Exception { + ExternalTaskClient actualClient = utils.createExternalTaskClient(); + Assert.assertNotNull(actualClient); + } + + @Test + public void testGetAuth() throws Exception { + String actual = utils.getAuth(); + String expected = "Att32054Life!@"; + assertEquals(expected, actual); + } + + @Test + public void testGetMaxClients() throws Exception { + int actual = utils.getMaxClients(); + int expected = 3; + assertEquals(expected, actual); + } + +} diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java new file mode 100644 index 0000000000..f918781b39 --- /dev/null +++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java @@ -0,0 +1,65 @@ +package org.onap.so.utils; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.core.env.Environment; + +@RunWith(MockitoJUnitRunner.class) +public class ExternalTaskUtilsTest { + + @Mock + private Environment mockenv; + + @InjectMocks + private ExternalTaskUtils externalTaskUtilsAnony = new ExternalTaskUtils() { + + }; + + @Test + public void retry_sequence_calculation_Test() { + Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000"); + long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8); + assertEquals(6000L, firstRetry); + long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7); + assertEquals(6000L, secondRetry); + long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6); + assertEquals(12000L, thirdRetry); + long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5); + assertEquals(18000L, fourthRetry); + long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4); + assertEquals(30000L, fifthRetry); + long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3); + assertEquals(48000L, sixRetry); + long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2); + assertEquals(78000L, seventhRetry); + long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1); + assertEquals(120000L, eigthRetry); + } + + @Test + public void retry_sequence_Test() { + Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000"); + long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8); + assertEquals(6000L, firstRetry); + long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7); + assertEquals(6000L, secondRetry); + long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6); + assertEquals(12000L, thirdRetry); + long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5); + assertEquals(18000L, fourthRetry); + long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4); + assertEquals(30000L, fifthRetry); + long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3); + assertEquals(48000L, sixRetry); + long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2); + assertEquals(78000L, seventhRetry); + long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1); + assertEquals(120000L, eigthRetry); + } + +} diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml index 2c891f2c4a..f0c969aeb1 100644 --- a/cxf-logging/pom.xml +++ b/cxf-logging/pom.xml @@ -37,11 +37,6 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - <dependency> - <groupId>org.onap.logging-analytics</groupId> - <artifactId>logging-slf4j</artifactId> - <version>1.2.2</version> - </dependency> </dependencies> <build> <resources> diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java index a6cce27f91..f6ac449057 100644 --- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java +++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java @@ -75,7 +75,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor { // CXF Appears to flatten headers to lower case private void setMDCPartnerName(Map<String, List<String>> headers) { - String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), ""); + String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "UNKNOWN"); MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); } diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java index 92b266870c..3785d3165f 100644 --- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java +++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java @@ -51,7 +51,7 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor { Exception ex = message.getContent(Exception.class); if (ex == null) { MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, - ONAPLogConstants.ResponseStatus.COMPLETED.toString()); + ONAPLogConstants.ResponseStatus.COMPLETE.toString()); } else { int responseCode = 0; responseCode = (int) message.get(Message.RESPONSE_CODE); diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml new file mode 100644 index 0000000000..607d7b1f74 --- /dev/null +++ b/deployment-configs/src/main/resources/logger/logback-spring.xml @@ -0,0 +1,231 @@ +<!-- ============LICENSE_START======================================================= + ECOMP MSO ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> + +<configuration scan="false" debug="false"> + <contextListener class="org.onap.so.logger.LoggerStartupListener" /> + + <property name="queueSize" value="256" /> + <property name="maxFileSize" value="200MB" /> + <property name="maxHistory" value="30" /> + <property name="totalSizeCap" value="10GB" /> + + <!-- log file names --> + <property name="errorLogName" value="error" /> + <property name="metricsLogName" value="metrics" /> + <property name="auditLogName" value="audit" /> + <property name="debugLogName" value="debug" /> + <property name="cadiLogName" value="cadi" /> + + <property name="currentTimeStamp" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",UTC}"/> + + <property name="errorPattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> + + <property name="debugPattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" /> + + <property name="auditPattern" + value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" /> + + <property name="metricPattern" + value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" /> + + <property name="defaultPattern" + value="%nopexception%logger + \t%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC} + \t%level + \t%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'} + \t%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'} + \t%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'} + \t%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'} + \t%thread + \t%n" /> + + <appender name="Audit" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>EXIT</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + <file>${logs_dir:-.}/${auditLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${auditPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Audit" /> + </appender> + + <appender name="Metric" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>INVOKE-RETURN</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + <file>${logs_dir:-.}/${metricsLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${metricPattern}</pattern> + </encoder> + </appender> + + + <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Metric" /> + </appender> + + <appender name="Error" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>ERROR</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logs_dir:-.}/${errorLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${errorPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Error" /> + </appender> + + <appender name="Debug" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>INVOKE</marker> + <marker>INVOKE-RETURN</marker> + <marker>ENTRY</marker> + <marker>EXIT</marker> + </evaluator> + <onMismatch>ACCEPT</onMismatch> + <onMatch>DENY</onMatch> + </filter> + <file>${logs_dir:-.}/${debugLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Debug" /> + <includeCallerData>true</includeCallerData> + </appender> + + <appender name="Cadi" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logs_dir:-.}/${cadiLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${cadiLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncCadi" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Cadi" /> + <includeCallerData>true</includeCallerData> + </appender> + + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN" /> + <logger + name="org.springframework.security.authentication.dao.DaoAuthenticationProvider" + level="DEBUG" /> + + <!-- Camunda related loggers --> + <logger name="org.camunda.bpm.engine.jobexecutor.level" level="DEBUG" /> + <logger + name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level" + level="DEBUG" /> + + <logger name="org.flywaydb" level="DEBUG"/> + <logger name="org.apache.wire" level="DEBUG" /> + <logger name="org.onap" level="DEBUG" /> + <logger name="org.apache.cxf.interceptor" level="DEBUG" /> + <logger name="com.woorea.openstack.connector" level="DEBUG" /> + + <!-- AAF Logs go here--> + <logger name="org.apache.catalina.core.ContainerBase" level="INFO" additivity="false"> + <appender-ref ref="asyncCadi" /> + </logger> + + <logger name="org.reflections.Reflections" level="ERROR" additivity="false"> + <appender-ref ref="asyncCadi" /> + </logger> + + <logger name="AUDIT" level="INFO" additivity="false"> + <appender-ref ref="asyncAudit" /> + </logger> + + <logger name="METRIC" level="INFO" additivity="false"> + <appender-ref ref="asyncMetric" /> + </logger> + + <root level="INFO"> + <appender-ref ref="asyncDebug" /> + <appender-ref ref="asyncError" /> + <appender-ref ref="asyncAudit" /> + <appender-ref ref="asyncMetric" /> + </root> + +</configuration> diff --git a/docs/api/apis/SO_Interface.rst b/docs/api/apis/consumed-apis.rst index d1586eb5d0..0ef69c4da1 100644 --- a/docs/api/apis/SO_Interface.rst +++ b/docs/api/apis/consumed-apis.rst @@ -2,1154 +2,11 @@ .. http://creativecommons.org/licenses/by/4.0 .. Copyright 2018 Huawei Technologies Co., Ltd. -SO Interfaces -============= +API consumed by SO +================== .. image:: ../../images/SO_1.png -SO APIs ----------------- - -North Bound APIs ----------------- -Create service instance -+++++++++++++++++++++++ - -+--------------------+------------------------------------------------------------+ -|Interface Definition|Description | -+====================+============================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6 | -+--------------------+------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+--------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+==========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+-------------------+--------------------------+-------------------------------------------------+ -|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | -+-------------------+--------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | -+-------------------+--------------------------+-------------------------------------------------+ -|project |project Object |Content of project object. | -+-------------------+--------------------------+-------------------------------------------------+ -|owningEntity |owningEntity Object |Content of owningEntity object. | -+-------------------+--------------------------+-------------------------------------------------+ -|platform |platform Object |Content of platform object. | -+-------------------+--------------------------+-------------------------------------------------+ -|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | -+-------------------+--------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ -|modelCustomizationUuid |String |The Model Customization UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelVersionId |String |The Model version id | -+-------------------------+------------------+-------------------------------------------------+ -|modelUuid |String |The Model UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInvariantUuid |String |The Model Invariant UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInstanceName |String |The Model Instance name | -+-------------------------+------------------+-------------------------------------------------+ - - -SubscriberInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|GlobalSubscriberId |String |Global customer Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|SubscriberName |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|billingAccountNumber |String |billingAccountNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|callbackUrl |String |callbackUrl of the request | -+-------------------------+------------------+-------------------------------------------------+ -|correlator |String |correlator of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderNumber |String |orderNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|productFamilyId |String |productFamilyId of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderVersion |String |orderVersion of the request | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |instanceName of the request | -+-------------------------+------------------+-------------------------------------------------+ -|suppressRollback |String |suppressRollback of the request | -+-------------------------+------------------+-------------------------------------------------+ -|requestorId |String |requestorId of the request | -+-------------------------+------------------+-------------------------------------------------+ - -RequestParameters Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|SubscriptionServiceType |String |The service type of the Subscription | -+-------------------------+------------------+-------------------------------------------------+ -|UserParams |Array |The product family Id. | -+-------------------------+------------------+-------------------------------------------------+ -|aLaCarte |Boolean | aLaCarte | -+-------------------------+------------------+-------------------------------------------------+ -|autoBuildVfModules |Boolean |autoBuildVfModules | -+-------------------------+------------------+-------------------------------------------------+ -|cascadeDelete |Boolean |cascadeDelete | -+-------------------------+------------------+-------------------------------------------------+ -|usePreload |Boolean |usePreload | -+-------------------------+------------------+-------------------------------------------------+ -|rebuildVolumeGroups |Boolean |rebuildVolumeGroups | -+-------------------------+------------------+-------------------------------------------------+ -|payload |String |payload | -+-------------------------+------------------+-------------------------------------------------+ -|controllerType |String |controllerType | -+-------------------------+------------------+-------------------------------------------------+ - -UserParams Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|name |String |Tag name of attribute | -+-------------------------+------------------+-------------------------------------------------+ -|value |String |Value of the tag | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ -|aicNodeClli |String |aicNodeClli property | -+-------------------------+------------------+-------------------------------------------------+ - -Project Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|projectName |String |Name of the project | -+-------------------------+------------------+-------------------------------------------------+ - -OwningEntity Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|owningEntityId |String |owningEntityId of the owingEntity | -+-------------------------+------------------+-------------------------------------------------+ -|owningEntityName |String |owningEntityName of the owingEntity | -+-------------------------+------------------+-------------------------------------------------+ - -Platform Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|platformName |String |Platform Name | -+-------------------------+------------------+-------------------------------------------------+ - -LineOfBusiness Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lineOfBusinessName |String |Line Of Business Name | -+-------------------------+------------------+-------------------------------------------------+ - -Delete service instance -+++++++++++++++++++++++ - -+--------------------+--------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId} | -+--------------------+--------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+--------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+-------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+=========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+-------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+-------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ - -Create Volume Group -+++++++++++++++++++ - -+--------------------+------------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==================================================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups | -+--------------------+------------------------------------------------------------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+------------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+------------------------------------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+--------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+==========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+-------------------+--------------------------+-------------------------------------------------+ -|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | -+-------------------+--------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | -+-------------------+--------------------------+-------------------------------------------------+ -|project |project Object |Content of project object. | -+-------------------+--------------------------+-------------------------------------------------+ -|owningEntity |owningEntity Object |Content of owningEntity object. | -+-------------------+--------------------------+-------------------------------------------------+ -|platform |platform Object |Content of platform object. | -+-------------------+--------------------------+-------------------------------------------------+ -|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | -+-------------------+--------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ -|modelCustomizationUuid |String |The Model Customization UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelVersionId |String |The Model version id | -+-------------------------+------------------+-------------------------------------------------+ -|modelUuid |String |The Model UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInvariantUuid |String |The Model Invariant UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInstanceName |String |The Model Instance name | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ -|aicNodeClli |String |aicNodeClli property | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|billingAccountNumber |String |billingAccountNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|callbackUrl |String |callbackUrl of the request | -+-------------------------+------------------+-------------------------------------------------+ -|correlator |String |correlator of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderNumber |String |orderNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|productFamilyId |String |productFamilyId of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderVersion |String |orderVersion of the request | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |instanceName of the request | -+-------------------------+------------------+-------------------------------------------------+ -|suppressRollback |String |suppressRollback of the request | -+-------------------------+------------------+-------------------------------------------------+ -|requestorId |String |requestorId of the request | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|relatedInstance |Object |relatedInstance Object | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|instanceId |String |instanceId | -+-------------------------+------------------+-------------------------------------------------+ -|modelInfo |Object |Content of modelInfo object. | -+-------------------------+------------------+-------------------------------------------------+ - -Delete Volume Group -+++++++++++++++++++ - -+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+============================================================================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} | -+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+---------------------+-------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=====================+=========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | -+---------------------+-------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ - -Create VF Module -++++++++++++++++ - -+--------------------+---------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+===============================================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules | -+--------------------+---------------------------------------------------------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+---------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+---------------------------------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+---------------------+-------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=====================+=========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | -+---------------------+-------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|relatedInstanceList |List |Content of relatedInstanceList. | -+---------------------+-------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|InstanceName |String |The instance Name | -+-------------------------+------------------+-------------------------------------------------+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|SuppressRollback |Boolean |SuppressRollback | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|relatedInstance |Object |relatedInstance Object | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|instanceId |String |instanceId | -+-------------------------+------------------+-------------------------------------------------+ -|modelInfo |Object |Content of modelInfo object. | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |Name of the instance | -+-------------------------+------------------+-------------------------------------------------+ - -Delete VF Module -++++++++++++++++ - -+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+=====================================================================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} | -+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+---------------------+-------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=====================+=========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | -+---------------------+-------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ - -Create VNF -++++++++++ - -+--------------------+-------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+=====================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs | -+--------------------+-------------------------------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+-------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+--------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+==========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+-------------------+--------------------------+-------------------------------------------------+ -|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | -+-------------------+--------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | -+-------------------+--------------------------+-------------------------------------------------+ -|project |project Object |Content of project object. | -+-------------------+--------------------------+-------------------------------------------------+ -|owningEntity |owningEntity Object |Content of owningEntity object. | -+-------------------+--------------------------+-------------------------------------------------+ -|platform |platform Object |Content of platform object. | -+-------------------+--------------------------+-------------------------------------------------+ -|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | -+-------------------+--------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ -|modelCustomizationUuid |String |The Model Customization UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelVersionId |String |The Model version id | -+-------------------------+------------------+-------------------------------------------------+ -|modelUuid |String |The Model UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInvariantUuid |String |The Model Invariant UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInstanceName |String |The Model Instance name | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|billingAccountNumber |String |billingAccountNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|callbackUrl |String |callbackUrl of the request | -+-------------------------+------------------+-------------------------------------------------+ -|correlator |String |correlator of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderNumber |String |orderNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|productFamilyId |String |productFamilyId of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderVersion |String |orderVersion of the request | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |instanceName of the request | -+-------------------------+------------------+-------------------------------------------------+ -|suppressRollback |String |suppressRollback of the request | -+-------------------------+------------------+-------------------------------------------------+ -|requestorId |String |requestorId of the request | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|relatedInstance |Object |relatedInstance Object | -+-------------------------+------------------+-------------------------------------------------+ - -relatedInstance List - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|instanceId |String |instanceId | -+-------------------------+------------------+-------------------------------------------------+ -|modelInfo |Object |Content of modelInfo object. | -+-------------------------+------------------+-------------------------------------------------+ - -RequestParameters Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|UserParams |Array |The product family Id. | -+-------------------------+------------------+-------------------------------------------------+ - -UserParams Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|name |String |Tag name of attribute | -+-------------------------+------------------+-------------------------------------------------+ -|value |String |Value of the tag | -+-------------------------+------------------+-------------------------------------------------+ - -Delete VNF -++++++++++ - -+--------------------+-----------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+=====================================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} | -+--------------------+-----------------------------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+-----------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+-----------------------------------------------------------------------------------------------------+ - -Request Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+---------------------+-------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=====================+=========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | -+---------------------+-------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+---------------------+-------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+---------------------+-------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ - -CloudConfiguration Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|tenantId |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ - -RequestParameters Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|UserParams |Array |The product family Id. | -+-------------------------+------------------+-------------------------------------------------+ - -UserParams Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|name |String |Tag name of attribute | -+-------------------------+------------------+-------------------------------------------------+ -|value |String |Value of the tag | -+-------------------------+------------------+-------------------------------------------------+ - -GET Orchestration Request -+++++++++++++++++++++++++ - -+--------------------+-------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+=====================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6/{request-id} | -+--------------------+-------------------------------------------------------------------------------------+ -|Operation Type |GET | -+--------------------+-------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------------------------------------------------------+ - -Response Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|request |M |1 |request Object |Content of request object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -Request Object - -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+===================+=========+===========+==========================+===========================================+ -|requestId |M |1 |String |Request Id | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|startTime |M |1 |request Object |Start time. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestScope |M |1 |request Object |Scope of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestType |M |1 |request Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestDetails |M |1 |requestDetails Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestStatus |M |1 |requestStatus Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+--------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+==========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+-------------------+--------------------------+-------------------------------------------------+ -|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | -+-------------------+--------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | -+-------------------+--------------------------+-------------------------------------------------+ -|project |project Object |Content of project object. | -+-------------------+--------------------------+-------------------------------------------------+ -|owningEntity |owningEntity Object |Content of owningEntity object. | -+-------------------+--------------------------+-------------------------------------------------+ -|platform |platform Object |Content of platform object. | -+-------------------+--------------------------+-------------------------------------------------+ -|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | -+-------------------+--------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ -|modelCustomizationUuid |String |The Model Customization UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelVersionId |String |The Model version id | -+-------------------------+------------------+-------------------------------------------------+ -|modelUuid |String |The Model UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInvariantUuid |String |The Model Invariant UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInstanceName |String |The Model Instance name | -+-------------------------+------------------+-------------------------------------------------+ - -SubscriberInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|GlobalSubscriberId |String |Global customer Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|SubscriberName |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|billingAccountNumber |String |billingAccountNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|callbackUrl |String |callbackUrl of the request | -+-------------------------+------------------+-------------------------------------------------+ -|correlator |String |correlator of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderNumber |String |orderNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|productFamilyId |String |productFamilyId of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderVersion |String |orderVersion of the request | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |instanceName of the request | -+-------------------------+------------------+-------------------------------------------------+ -|suppressRollback |String |suppressRollback of the request | -+-------------------------+------------------+-------------------------------------------------+ -|requestorId |String |requestorId of the request | -+-------------------------+------------------+-------------------------------------------------+ - -RequestParameters Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|SubscriptionServiceType |String |The service type of the Subscription | -+-------------------------+------------------+-------------------------------------------------+ - -RequestStatus Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|finishTime |String |Time | -+-------------------------+------------------+-------------------------------------------------+ -|requestState |String |state of the request | -+-------------------------+------------------+-------------------------------------------------+ -|statusMessage |String |statusMessage | -+-------------------------+------------------+-------------------------------------------------+ -|percentProgress |String |percentage of progress | -+-------------------------+------------------+-------------------------------------------------+ - -GET Orchestration Requests -++++++++++++++++++++++++++ - -+--------------------+--------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==============================================================+ -|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 | -+--------------------+--------------------------------------------------------------+ -|Operation Type |GET | -+--------------------+--------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------+ - -Response Body: - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|requestList |M |1 |Array |Content of request List. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestList : - -+----------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+================+=========+===========+==========================+===========================================+ -|request |M |1 |request Object |Content of request object. | -+----------------+---------+-----------+--------------------------+-------------------------------------------+ - -Request Object - -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content |Description | -+===================+=========+===========+==========================+===========================================+ -|requestId |M |1 |String |Request Id. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|startTime |M |1 |request Object |Start time. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestScope |M |1 |request Object |Scope of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestType |M |1 |request Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestDetails |M |1 |requestDetails Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ -|requestStatus |M |1 |requestStatus Object |Type of the request. | -+-------------------+---------+-----------+--------------------------+-------------------------------------------+ - -RequestDetails Object - -+-------------------+--------------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+===================+==========================+=================================================+ -|modelInfo |modelInfo Object |Content of modelInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestInfo |requestInfo Object |Content of requestInfo object. | -+-------------------+--------------------------+-------------------------------------------------+ -|requestParameters |requestParameters Object |Content of requestParameters object. | -+-------------------+--------------------------+-------------------------------------------------+ -|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | -+-------------------+--------------------------+-------------------------------------------------+ -|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | -+-------------------+--------------------------+-------------------------------------------------+ -|project |project Object |Content of project object. | -+-------------------+--------------------------+-------------------------------------------------+ -|owningEntity |owningEntity Object |Content of owningEntity object. | -+-------------------+--------------------------+-------------------------------------------------+ -|platform |platform Object |Content of platform object. | -+-------------------+--------------------------+-------------------------------------------------+ -|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | -+-------------------+--------------------------+-------------------------------------------------+ - -ModelInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|ModelType |String |Type of model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelInvariantId |String |The Model Invariant Id. | -+-------------------------+------------------+-------------------------------------------------+ -|ModelNameVersionId |String |The modelname Version Id | -+-------------------------+------------------+-------------------------------------------------+ -|ModelName |String |Name of the Model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelVersion |String |Version of the model | -+-------------------------+------------------+-------------------------------------------------+ -|ModelCustomization Name |String |The Model Customization name | -+-------------------------+------------------+-------------------------------------------------+ -|modelCustomizationUuid |String |The Model Customization UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelVersionId |String |The Model version id | -+-------------------------+------------------+-------------------------------------------------+ -|modelUuid |String |The Model UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInvariantUuid |String |The Model Invariant UUid | -+-------------------------+------------------+-------------------------------------------------+ -|modelInstanceName |String |The Model Instance name | -+-------------------------+------------------+-------------------------------------------------+ - -SubscriberInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|GlobalSubscriberId |String |Global customer Id (in A&AI) | -+-------------------------+------------------+-------------------------------------------------+ -|SubscriberName |String |Name of the Subscriber | -+-------------------------+------------------+-------------------------------------------------+ - -RequestInfo Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|Source |String |source of the request | -+-------------------------+------------------+-------------------------------------------------+ -|billingAccountNumber |String |billingAccountNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|callbackUrl |String |callbackUrl of the request | -+-------------------------+------------------+-------------------------------------------------+ -|correlator |String |correlator of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderNumber |String |orderNumber of the request | -+-------------------------+------------------+-------------------------------------------------+ -|productFamilyId |String |productFamilyId of the request | -+-------------------------+------------------+-------------------------------------------------+ -|orderVersion |String |orderVersion of the request | -+-------------------------+------------------+-------------------------------------------------+ -|instanceName |String |instanceName of the request | -+-------------------------+------------------+-------------------------------------------------+ -|suppressRollback |String |suppressRollback of the request | -+-------------------------+------------------+-------------------------------------------------+ -|requestorId |String |requestorId of the request | -+-------------------------+------------------+-------------------------------------------------+ - -RequestParameters Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|SubscriptionServiceType |String |The service type of the Subscription | -+-------------------------+------------------+-------------------------------------------------+ - -RequestStatus Object - -+-------------------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+=========================+==================+=================================================+ -|finishTime |String |Time | -+-------------------------+------------------+-------------------------------------------------+ -|requestState |String |state of the request | -+-------------------------+------------------+-------------------------------------------------+ -|statusMessage |String |statusMessage | -+-------------------------+------------------+-------------------------------------------------+ -|percentProgress |String |percentage of progress | -+-------------------------+------------------+-------------------------------------------------+ SDC Client API -------------- @@ -1371,181 +228,6 @@ Response: |Content-Disposition |M |Specifies the name of file to store the downloaded artifact’s payload ( RFC 2183) . | +--------------------+---------+--------------------------------------------------------------------------------------------------------------------------+ -E2E Service API ---------------- - -Create E2E service instance -+++++++++++++++++++++++++++ - -+--------------------+------------------------------------------------------------+ -|Interface Definition|Description | -+====================+============================================================+ -|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3 | -+--------------------+------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+------------------------------------------------------------+ - -Request Body: - -+---------+---------+-----------+--------------------------+-----------------------------+ -|Attribute|Qualifier|Cardinality|Content |Description | -+=========+=========+===========+==========================+=============================+ -|service |M |1 |Service Object |Content of service object. | -+---------+---------+-----------+--------------------------+-----------------------------+ - -Service Object - -+------------------------------+-----------------+------------------------------------+ -|Attribute |Content |Description | -+==============================+=================+====================================+ -|name |String |Service instance name. | -+------------------------------+-----------------+------------------------------------+ -|description |String |Service instance description | -+------------------------------+-----------------+------------------------------------+ -|serviceUuid |String |Model UUID | -+------------------------------+-----------------+------------------------------------+ -|serviceInvariantUuid |String |Model Invariant UUID | -+------------------------------+-----------------+------------------------------------+ -|gloabalSubscriberId |String |Customer Id | -+------------------------------+-----------------+------------------------------------+ -|serviceType |String |service Type | -+------------------------------+-----------------+------------------------------------+ -|parameters |Object |Parameter Object | -+------------------------------+-----------------+------------------------------------+ - -Parameter Object - -+------------------------------+-----------------+------------------------------------+ -|Attribute |Content |Description | -+==============================+=================+====================================+ -|locationConstraints |List of object |location infor for each vnf | -+------------------------------+-----------------+------------------------------------+ -|resource |List of Resource |resource of service/resource | -+------------------------------+-----------------+------------------------------------+ -|requestInputs |key-value map |input of service/resource | -+------------------------------+-----------------+------------------------------------+ - -LocationConstraint Object - -+------------------------------+-----------------+------------------------------------+ -|Attribute |Content |Description | -+==============================+=================+====================================+ -|vnfProfileId |String |Customization id for VNF | -+------------------------------+-----------------+------------------------------------+ -|locationConstraints |Object |DC location info of VNF | -+------------------------------+-----------------+------------------------------------+ - -VnfLocationConstraint Object - -+------------------------------+-----------------+------------------------------------+ -|Attribute |Content |Description | -+==============================+=================+====================================+ -|vimId |String |VIM id from ESR definition | -+------------------------------+-----------------+------------------------------------+ - -Resource Object - -+------------------------------+-----------------+------------------------------------+ -|Attribute |Content |Description | -+==============================+=================+====================================+ -|resourceName |String |The resource name | -+------------------------------+-----------------+------------------------------------+ -|resourceInvariantUuid |String |The resource invariant UUID. | -+------------------------------+-----------------+------------------------------------+ -|resourceUuid |String |The resource UUID. | -+------------------------------+-----------------+------------------------------------+ -|resourceCustomizationUuid |String |The resource customization UUID. | -+------------------------------+-----------------+------------------------------------+ -|parameters |Object |Parameter of resource | -+------------------------------+-----------------+------------------------------------+ - -Response: - -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content|Description | -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ -|serviceId |M |1 |String |Service instance ID. | -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operationId |M |1 |String |Service Operation ID. | -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ - -Delete E2E service instance -+++++++++++++++++++++++++++ - -+--------------------+----------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+======================================================================+ -|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}| -+--------------------+----------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+----------------------------------------------------------------------+ - -Request Parameters: - -+-------------------+---------+-----------+-------+----------------------------------------+ -|Attribute |Qualifier|Cardinality|Content|Description | -+===================+=========+===========+=======+========================================+ -|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI | -+-------------------+---------+-----------+-------+----------------------------------------+ -|serviceType |M |1 |String |The service type. It is defined in AAI | -+-------------------+---------+-----------+-------+----------------------------------------+ - -Response: - -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content|Description | -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operationId |M |1 |String |The operation id. | -+-------------+---------+-----------+-------+------------------------------------------------------------------------+ - -Query E2E service operation result -++++++++++++++++++++++++++++++++++ - -+--------------------+-----------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+===============================================================================================+ -|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}/operations/{operationId}| -+--------------------+-----------------------------------------------------------------------------------------------+ -|Operation Type |GET | -+--------------------+-----------------------------------------------------------------------------------------------+ - -Request Parameters: - -+--------------+---------+-----------+-------+--------------+ -|Attribute |Qualifier|Cardinality|Content|Description | -+==============+=========+===========+=======+==============+ -|serviceId |M |1 |Service instance ID. | -+--------------+---------+-----------+-------+--------------+ -|operationId |M |1 |Service Operation ID. | -+--------------+---------+-----------+-------+--------------+ - -Response: - -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|Attribute |Qualifier|Cardinality|Content|Description | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operation |M |1 |String |Operation object identify. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operationId |M |1 |String |Operation ID. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operation |M |1 |String |Operation type, create|delete. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|result |M |1 |String |Operation result: finished, error, processing. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|reason |M |1 |String |If failing, need to write fail reason. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|userId |M |1 |String |Operation user ID. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operationContent |M |1 |String |The status detail of current operation which is being executing. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|progress |M |1 |String |Current operation progress. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|operateAt |M |1 |String |Time that it starts to execute operation. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ -|finishedAt |M |1 |String |Time that it finished executing operation. | -+------------------+---------+-----------+-------+------------------------------------------------------------------------+ Inventory APIs -------------- @@ -4044,7 +2726,7 @@ Candidates Object +-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ |identifiers |Y |1..N |List |A list of identifiers. | +-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ -|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. | +|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. | +-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ diff --git a/docs/api/apis/e2eServiceInstances-api.rst b/docs/api/apis/e2eServiceInstances-api.rst new file mode 100644 index 0000000000..08434efdfd --- /dev/null +++ b/docs/api/apis/e2eServiceInstances-api.rst @@ -0,0 +1,185 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2018 Huawei Technologies Co., Ltd. + +e2eServiceInstances API +======================= + +This API allows to manage: + +- e2eServiceInstances (create and delete) +- operations on e2eServiceInstances (get) + + +Create E2E service instance ++++++++++++++++++++++++++++ + ++--------------------+------------------------------------------------------------+ +|Interface Definition|Description | ++====================+============================================================+ +|URI |/onap/so/infra/e2eServiceInstances/v3 | ++--------------------+------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+------------------------------------------------------------+ + +Request Body: + ++---------+---------+-----------+--------------------------+-----------------------------+ +|Attribute|Qualifier|Cardinality|Content |Description | ++=========+=========+===========+==========================+=============================+ +|service |M |1 |Service Object |Content of service object. | ++---------+---------+-----------+--------------------------+-----------------------------+ + +Service Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|name |String |Service instance name. | ++------------------------------+-----------------+------------------------------------+ +|description |String |Service instance description | ++------------------------------+-----------------+------------------------------------+ +|serviceUuid |String |Model UUID | ++------------------------------+-----------------+------------------------------------+ +|serviceInvariantUuid |String |Model Invariant UUID | ++------------------------------+-----------------+------------------------------------+ +|gloabalSubscriberId |String |Customer Id | ++------------------------------+-----------------+------------------------------------+ +|serviceType |String |service Type | ++------------------------------+-----------------+------------------------------------+ +|parameters |Object |Parameter Object | ++------------------------------+-----------------+------------------------------------+ + +Parameter Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|locationConstraints |List of object |location infor for each vnf | ++------------------------------+-----------------+------------------------------------+ +|resource |List of Resource |resource of service/resource | ++------------------------------+-----------------+------------------------------------+ +|requestInputs |key-value map |input of service/resource | ++------------------------------+-----------------+------------------------------------+ + +LocationConstraint Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|vnfProfileId |String |Customization id for VNF | ++------------------------------+-----------------+------------------------------------+ +|locationConstraints |Object |DC location info of VNF | ++------------------------------+-----------------+------------------------------------+ + +VnfLocationConstraint Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|vimId |String |VIM id from ESR definition | ++------------------------------+-----------------+------------------------------------+ + +Resource Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|resourceName |String |The resource name | ++------------------------------+-----------------+------------------------------------+ +|resourceInvariantUuid |String |The resource invariant UUID. | ++------------------------------+-----------------+------------------------------------+ +|resourceUuid |String |The resource UUID. | ++------------------------------+-----------------+------------------------------------+ +|resourceCustomizationUuid |String |The resource customization UUID. | ++------------------------------+-----------------+------------------------------------+ +|parameters |Object |Parameter of resource | ++------------------------------+-----------------+------------------------------------+ + +Response: + ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content|Description | ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ +|serviceId |M |1 |String |Service instance ID. | ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operationId |M |1 |String |Service Operation ID. | ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ + +Delete E2E service instance ++++++++++++++++++++++++++++ + ++--------------------+----------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+======================================================================+ +|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId} | ++--------------------+----------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+----------------------------------------------------------------------+ + +Request Parameters: + ++-------------------+---------+-----------+-------+----------------------------------------+ +|Attribute |Qualifier|Cardinality|Content|Description | ++===================+=========+===========+=======+========================================+ +|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI | ++-------------------+---------+-----------+-------+----------------------------------------+ +|serviceType |M |1 |String |The service type. It is defined in AAI | ++-------------------+---------+-----------+-------+----------------------------------------+ + +Response: + ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content|Description | ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operationId |M |1 |String |The operation id. | ++-------------+---------+-----------+-------+------------------------------------------------------------------------+ + +Query E2E service operation result +++++++++++++++++++++++++++++++++++ + ++--------------------+-----------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+===============================================================================================+ +|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId}/operations/{operationId} | ++--------------------+-----------------------------------------------------------------------------------------------+ +|Operation Type |GET | ++--------------------+-----------------------------------------------------------------------------------------------+ + +Request Parameters: + ++--------------+---------+-----------+-------+--------------+ +|Attribute |Qualifier|Cardinality|Content|Description | ++==============+=========+===========+=======+==============+ +|serviceId |M |1 |Service instance ID. | ++--------------+---------+-----------+-------+--------------+ +|operationId |M |1 |Service Operation ID. | ++--------------+---------+-----------+-------+--------------+ + +Response: + ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content|Description | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operation |M |1 |String |Operation object identify. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operationId |M |1 |String |Operation ID. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operation |M |1 |String |Operation type, create|delete. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|result |M |1 |String |Operation result: finished, error, processing. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|reason |M |1 |String |If failing, need to write fail reason. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|userId |M |1 |String |Operation user ID. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operationContent |M |1 |String |The status detail of current operation which is being executing. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|progress |M |1 |String |Current operation progress. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|operateAt |M |1 |String |Time that it starts to execute operation. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ +|finishedAt |M |1 |String |Time that it finished executing operation. | ++------------------+---------+-----------+-------+------------------------------------------------------------------------+ diff --git a/docs/api/apis/serviceInstances-api.rst b/docs/api/apis/serviceInstances-api.rst new file mode 100644 index 0000000000..b3fd2cf47d --- /dev/null +++ b/docs/api/apis/serviceInstances-api.rst @@ -0,0 +1,1192 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2018 Huawei Technologies Co., Ltd. + +serviceInstances API +==================== + + +This API allows to generate some requests to manage: + +- serviceInstances (create, delete) +- volumeGroups attached to a vnf instance (create, delete) +- vfModules attached to a vnf instance (create, delete) +- vnfs attached to a service instance (create, delete) +- orchestrationRequests (get) + +links: + +- :ref:`create_service_instance` +- :ref:`delete_service_instance` +- :ref:`create_volume_group` +- :ref:`delete_volume_group` +- :ref:`create_vf_module` +- :ref:`delete_vf_module` +- :ref:`create_vnf` +- :ref:`delete_vnf` +- :ref:`get_orchestration_request_by_id` +- :ref:`get_orchestration_request_all` + + +.. _create_service_instance: + +Create service instance ++++++++++++++++++++++++ + ++--------------------+--------------------------------------------------------+ +|Interface Definition|Description | ++====================+========================================================+ +|URI |/onap/so/infra/serviceInstances/v6 | ++--------------------+--------------------------------------------------------+ +|Operation Type |POST | ++--------------------+--------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+--------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+==========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++-------------------+--------------------------+-------------------------------------------------+ +|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | ++-------------------+--------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | ++-------------------+--------------------------+-------------------------------------------------+ +|project |project Object |Content of project object. | ++-------------------+--------------------------+-------------------------------------------------+ +|owningEntity |owningEntity Object |Content of owningEntity object. | ++-------------------+--------------------------+-------------------------------------------------+ +|platform |platform Object |Content of platform object. | ++-------------------+--------------------------+-------------------------------------------------+ +|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | ++-------------------+--------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ +|modelCustomizationUuid |String |The Model Customization UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelVersionId |String |The Model version id | ++-------------------------+------------------+-------------------------------------------------+ +|modelUuid |String |The Model UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInvariantUuid |String |The Model Invariant UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInstanceName |String |The Model Instance name | ++-------------------------+------------------+-------------------------------------------------+ + + +SubscriberInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|GlobalSubscriberId |String |Global customer Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|SubscriberName |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|billingAccountNumber |String |billingAccountNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|callbackUrl |String |callbackUrl of the request | ++-------------------------+------------------+-------------------------------------------------+ +|correlator |String |correlator of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderNumber |String |orderNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|productFamilyId |String |productFamilyId of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderVersion |String |orderVersion of the request | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |instanceName of the request | ++-------------------------+------------------+-------------------------------------------------+ +|suppressRollback |String |suppressRollback of the request | ++-------------------------+------------------+-------------------------------------------------+ +|requestorId |String |requestorId of the request | ++-------------------------+------------------+-------------------------------------------------+ + +RequestParameters Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|SubscriptionServiceType |String |The service type of the Subscription | ++-------------------------+------------------+-------------------------------------------------+ +|UserParams |Array |The product family Id. | ++-------------------------+------------------+-------------------------------------------------+ +|aLaCarte |Boolean | aLaCarte | ++-------------------------+------------------+-------------------------------------------------+ +|autoBuildVfModules |Boolean |autoBuildVfModules | ++-------------------------+------------------+-------------------------------------------------+ +|cascadeDelete |Boolean |cascadeDelete | ++-------------------------+------------------+-------------------------------------------------+ +|usePreload |Boolean |usePreload | ++-------------------------+------------------+-------------------------------------------------+ +|rebuildVolumeGroups |Boolean |rebuildVolumeGroups | ++-------------------------+------------------+-------------------------------------------------+ +|payload |String |payload | ++-------------------------+------------------+-------------------------------------------------+ +|controllerType |String |controllerType | ++-------------------------+------------------+-------------------------------------------------+ + +UserParams Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|name |String |Tag name of attribute | ++-------------------------+------------------+-------------------------------------------------+ +|value |String |Value of the tag | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ +|aicNodeClli |String |aicNodeClli property | ++-------------------------+------------------+-------------------------------------------------+ + +Project Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|projectName |String |Name of the project | ++-------------------------+------------------+-------------------------------------------------+ + +OwningEntity Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|owningEntityId |String |owningEntityId of the owingEntity | ++-------------------------+------------------+-------------------------------------------------+ +|owningEntityName |String |owningEntityName of the owingEntity | ++-------------------------+------------------+-------------------------------------------------+ + +Platform Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|platformName |String |Platform Name | ++-------------------------+------------------+-------------------------------------------------+ + +LineOfBusiness Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lineOfBusinessName |String |Line Of Business Name | ++-------------------------+------------------+-------------------------------------------------+ + + +.. _delete_service_instance: + +Delete service instance ++++++++++++++++++++++++ + ++--------------------+--------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId} | ++--------------------+--------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+--------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+-------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+=========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+-------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+-------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ + + +.. _create_volume_group: + +Create Volume Group ++++++++++++++++++++ + ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+==================================================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+------------------------------------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+--------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+==========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++-------------------+--------------------------+-------------------------------------------------+ +|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | ++-------------------+--------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | ++-------------------+--------------------------+-------------------------------------------------+ +|project |project Object |Content of project object. | ++-------------------+--------------------------+-------------------------------------------------+ +|owningEntity |owningEntity Object |Content of owningEntity object. | ++-------------------+--------------------------+-------------------------------------------------+ +|platform |platform Object |Content of platform object. | ++-------------------+--------------------------+-------------------------------------------------+ +|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | ++-------------------+--------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ +|modelCustomizationUuid |String |The Model Customization UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelVersionId |String |The Model version id | ++-------------------------+------------------+-------------------------------------------------+ +|modelUuid |String |The Model UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInvariantUuid |String |The Model Invariant UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInstanceName |String |The Model Instance name | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ +|aicNodeClli |String |aicNodeClli property | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|billingAccountNumber |String |billingAccountNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|callbackUrl |String |callbackUrl of the request | ++-------------------------+------------------+-------------------------------------------------+ +|correlator |String |correlator of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderNumber |String |orderNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|productFamilyId |String |productFamilyId of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderVersion |String |orderVersion of the request | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |instanceName of the request | ++-------------------------+------------------+-------------------------------------------------+ +|suppressRollback |String |suppressRollback of the request | ++-------------------------+------------------+-------------------------------------------------+ +|requestorId |String |requestorId of the request | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|relatedInstance |Object |relatedInstance Object | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|instanceId |String |instanceId | ++-------------------------+------------------+-------------------------------------------------+ +|modelInfo |Object |Content of modelInfo object. | ++-------------------------+------------------+-------------------------------------------------+ + +.. _delete_volume_group: + +Delete Volume Group ++++++++++++++++++++ + ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+============================================================================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++---------------------+-------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=====================+=========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | ++---------------------+-------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ + +.. _create_vf_module: + +Create VF Module +++++++++++++++++ + ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+===============================================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules | ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+---------------------------------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++---------------------+-------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=====================+=========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | ++---------------------+-------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|relatedInstanceList |List |Content of relatedInstanceList. | ++---------------------+-------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|InstanceName |String |The instance Name | ++-------------------------+------------------+-------------------------------------------------+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|SuppressRollback |Boolean |SuppressRollback | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|relatedInstance |Object |relatedInstance Object | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|instanceId |String |instanceId | ++-------------------------+------------------+-------------------------------------------------+ +|modelInfo |Object |Content of modelInfo object. | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |Name of the instance | ++-------------------------+------------------+-------------------------------------------------+ + +.. _delete_vf_module: + +Delete VF Module +++++++++++++++++ + ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} | ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++---------------------+-------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=====================+=========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | ++---------------------+-------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ + + +.. _create_vnf: + +Create VNF +++++++++++ + ++--------------------+-------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs | ++--------------------+-------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+-------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+--------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+==========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++-------------------+--------------------------+-------------------------------------------------+ +|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | ++-------------------+--------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | ++-------------------+--------------------------+-------------------------------------------------+ +|project |project Object |Content of project object. | ++-------------------+--------------------------+-------------------------------------------------+ +|owningEntity |owningEntity Object |Content of owningEntity object. | ++-------------------+--------------------------+-------------------------------------------------+ +|platform |platform Object |Content of platform object. | ++-------------------+--------------------------+-------------------------------------------------+ +|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | ++-------------------+--------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ +|modelCustomizationUuid |String |The Model Customization UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelVersionId |String |The Model version id | ++-------------------------+------------------+-------------------------------------------------+ +|modelUuid |String |The Model UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInvariantUuid |String |The Model Invariant UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInstanceName |String |The Model Instance name | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|billingAccountNumber |String |billingAccountNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|callbackUrl |String |callbackUrl of the request | ++-------------------------+------------------+-------------------------------------------------+ +|correlator |String |correlator of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderNumber |String |orderNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|productFamilyId |String |productFamilyId of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderVersion |String |orderVersion of the request | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |instanceName of the request | ++-------------------------+------------------+-------------------------------------------------+ +|suppressRollback |String |suppressRollback of the request | ++-------------------------+------------------+-------------------------------------------------+ +|requestorId |String |requestorId of the request | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|relatedInstance |Object |relatedInstance Object | ++-------------------------+------------------+-------------------------------------------------+ + +relatedInstance List + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|instanceId |String |instanceId | ++-------------------------+------------------+-------------------------------------------------+ +|modelInfo |Object |Content of modelInfo object. | ++-------------------------+------------------+-------------------------------------------------+ + +RequestParameters Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|UserParams |Array |The product family Id. | ++-------------------------+------------------+-------------------------------------------------+ + +UserParams Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|name |String |Tag name of attribute | ++-------------------------+------------------+-------------------------------------------------+ +|value |String |Value of the tag | ++-------------------------+------------------+-------------------------------------------------+ + +.. _delete_vnf: + +Delete VNF +++++++++++ + ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================================+ +|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} | ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-----------------------------------------------------------------------------------------------------+ + +Request Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++---------------------+-------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=====================+=========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. | ++---------------------+-------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++---------------------+-------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++---------------------+-------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ + +CloudConfiguration Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|lcpCloudRegionId |String |CloudRegion Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|tenantId |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ + +RequestParameters Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|UserParams |Array |The product family Id. | ++-------------------------+------------------+-------------------------------------------------+ + +UserParams Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|name |String |Tag name of attribute | ++-------------------------+------------------+-------------------------------------------------+ +|value |String |Value of the tag | ++-------------------------+------------------+-------------------------------------------------+ + +.. _get_orchestration_request_by_id: + +GET Orchestration Request ++++++++++++++++++++++++++ + ++--------------------+-------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================+ +|URI |/onap/so/infra/orchestrationRequests/v6/{request-id} | ++--------------------+-------------------------------------------------------------------------------------+ +|Operation Type |GET | ++--------------------+-------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------+ + +Response Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|request |M |1 |request Object |Content of request object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +Request Object + ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++===================+=========+===========+==========================+===========================================+ +|requestId |M |1 |String |Request Id | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|startTime |M |1 |request Object |Start time. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestScope |M |1 |request Object |Scope of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestType |M |1 |request Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestDetails |M |1 |requestDetails Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestStatus |M |1 |requestStatus Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+--------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+==========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++-------------------+--------------------------+-------------------------------------------------+ +|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | ++-------------------+--------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | ++-------------------+--------------------------+-------------------------------------------------+ +|project |project Object |Content of project object. | ++-------------------+--------------------------+-------------------------------------------------+ +|owningEntity |owningEntity Object |Content of owningEntity object. | ++-------------------+--------------------------+-------------------------------------------------+ +|platform |platform Object |Content of platform object. | ++-------------------+--------------------------+-------------------------------------------------+ +|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | ++-------------------+--------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ +|modelCustomizationUuid |String |The Model Customization UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelVersionId |String |The Model version id | ++-------------------------+------------------+-------------------------------------------------+ +|modelUuid |String |The Model UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInvariantUuid |String |The Model Invariant UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInstanceName |String |The Model Instance name | ++-------------------------+------------------+-------------------------------------------------+ + +SubscriberInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|GlobalSubscriberId |String |Global customer Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|SubscriberName |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|billingAccountNumber |String |billingAccountNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|callbackUrl |String |callbackUrl of the request | ++-------------------------+------------------+-------------------------------------------------+ +|correlator |String |correlator of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderNumber |String |orderNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|productFamilyId |String |productFamilyId of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderVersion |String |orderVersion of the request | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |instanceName of the request | ++-------------------------+------------------+-------------------------------------------------+ +|suppressRollback |String |suppressRollback of the request | ++-------------------------+------------------+-------------------------------------------------+ +|requestorId |String |requestorId of the request | ++-------------------------+------------------+-------------------------------------------------+ + +RequestParameters Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|SubscriptionServiceType |String |The service type of the Subscription | ++-------------------------+------------------+-------------------------------------------------+ + +RequestStatus Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|finishTime |String |Time | ++-------------------------+------------------+-------------------------------------------------+ +|requestState |String |state of the request | ++-------------------------+------------------+-------------------------------------------------+ +|statusMessage |String |statusMessage | ++-------------------------+------------------+-------------------------------------------------+ +|percentProgress |String |percentage of progress | ++-------------------------+------------------+-------------------------------------------------+ + + +.. _get_orchestration_request_all: + +GET Orchestration Requests +++++++++++++++++++++++++++ + ++--------------------+--------------------------------------------------------------+ +|Interface Definition|Description | ++====================+==============================================================+ +|URI |/onap/so/infra/orchestrationRequests/v6 | ++--------------------+--------------------------------------------------------------+ +|Operation Type |GET | ++--------------------+--------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------------+ + +Response Body: + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|requestList |M |1 |Array |Content of request List. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestList : + ++----------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++================+=========+===========+==========================+===========================================+ +|request |M |1 |request Object |Content of request object. | ++----------------+---------+-----------+--------------------------+-------------------------------------------+ + +Request Object + ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|Attribute |Qualifier|Cardinality|Content |Description | ++===================+=========+===========+==========================+===========================================+ +|requestId |M |1 |String |Request Id. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|startTime |M |1 |request Object |Start time. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestScope |M |1 |request Object |Scope of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestType |M |1 |request Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestDetails |M |1 |requestDetails Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ +|requestStatus |M |1 |requestStatus Object |Type of the request. | ++-------------------+---------+-----------+--------------------------+-------------------------------------------+ + +RequestDetails Object + ++-------------------+--------------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++===================+==========================+=================================================+ +|modelInfo |modelInfo Object |Content of modelInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestInfo |requestInfo Object |Content of requestInfo object. | ++-------------------+--------------------------+-------------------------------------------------+ +|requestParameters |requestParameters Object |Content of requestParameters object. | ++-------------------+--------------------------+-------------------------------------------------+ +|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. | ++-------------------+--------------------------+-------------------------------------------------+ +|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. | ++-------------------+--------------------------+-------------------------------------------------+ +|project |project Object |Content of project object. | ++-------------------+--------------------------+-------------------------------------------------+ +|owningEntity |owningEntity Object |Content of owningEntity object. | ++-------------------+--------------------------+-------------------------------------------------+ +|platform |platform Object |Content of platform object. | ++-------------------+--------------------------+-------------------------------------------------+ +|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. | ++-------------------+--------------------------+-------------------------------------------------+ + +ModelInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|ModelType |String |Type of model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelInvariantId |String |The Model Invariant Id. | ++-------------------------+------------------+-------------------------------------------------+ +|ModelNameVersionId |String |The modelname Version Id | ++-------------------------+------------------+-------------------------------------------------+ +|ModelName |String |Name of the Model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelVersion |String |Version of the model | ++-------------------------+------------------+-------------------------------------------------+ +|ModelCustomization Name |String |The Model Customization name | ++-------------------------+------------------+-------------------------------------------------+ +|modelCustomizationUuid |String |The Model Customization UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelVersionId |String |The Model version id | ++-------------------------+------------------+-------------------------------------------------+ +|modelUuid |String |The Model UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInvariantUuid |String |The Model Invariant UUid | ++-------------------------+------------------+-------------------------------------------------+ +|modelInstanceName |String |The Model Instance name | ++-------------------------+------------------+-------------------------------------------------+ + +SubscriberInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|GlobalSubscriberId |String |Global customer Id (in A&AI) | ++-------------------------+------------------+-------------------------------------------------+ +|SubscriberName |String |Name of the Subscriber | ++-------------------------+------------------+-------------------------------------------------+ + +RequestInfo Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|Source |String |source of the request | ++-------------------------+------------------+-------------------------------------------------+ +|billingAccountNumber |String |billingAccountNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|callbackUrl |String |callbackUrl of the request | ++-------------------------+------------------+-------------------------------------------------+ +|correlator |String |correlator of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderNumber |String |orderNumber of the request | ++-------------------------+------------------+-------------------------------------------------+ +|productFamilyId |String |productFamilyId of the request | ++-------------------------+------------------+-------------------------------------------------+ +|orderVersion |String |orderVersion of the request | ++-------------------------+------------------+-------------------------------------------------+ +|instanceName |String |instanceName of the request | ++-------------------------+------------------+-------------------------------------------------+ +|suppressRollback |String |suppressRollback of the request | ++-------------------------+------------------+-------------------------------------------------+ +|requestorId |String |requestorId of the request | ++-------------------------+------------------+-------------------------------------------------+ + +RequestParameters Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|SubscriptionServiceType |String |The service type of the Subscription | ++-------------------------+------------------+-------------------------------------------------+ + +RequestStatus Object + ++-------------------------+------------------+-------------------------------------------------+ +|Attribute |Content |Description | ++=========================+==================+=================================================+ +|finishTime |String |Time | ++-------------------------+------------------+-------------------------------------------------+ +|requestState |String |state of the request | ++-------------------------+------------------+-------------------------------------------------+ +|statusMessage |String |statusMessage | ++-------------------------+------------------+-------------------------------------------------+ +|percentProgress |String |percentage of progress | ++-------------------------+------------------+-------------------------------------------------+ diff --git a/docs/api/offered_consumed_apis.rst b/docs/api/offered_consumed_apis.rst index 0caef0a426..1d0a8f005b 100644 --- a/docs/api/offered_consumed_apis.rst +++ b/docs/api/offered_consumed_apis.rst @@ -3,7 +3,7 @@ .. Copyright 2018 Huawei Technologies Co., Ltd. SO Offered and Consumed APIs -===================================== +============================ The list of APIs that SO offers can be found in following table: @@ -22,8 +22,9 @@ The list of APIs that SO offers can be found in following table: "swagger json file", "html doc", "yaml doc" ":download:`link <swagger/swagger.json>`", ":download:`link <swagger/swagger.html>`", ":download:`link <swagger/swagger.yaml>`" - -The list of APIs that SO offerers for monitroing the BPMN flows could be found in the following table: + +The list of APIs that SO offerers for monitoring the BPMN flows +could be found in the following table: .. csv-table:: :header: "|Swagger-icon|", "|yml-icon|" @@ -33,11 +34,13 @@ The list of APIs that SO offerers for monitroing the BPMN flows could be found i ":download:`link <swagger/SO_MONITORING_SWAGGER.json>`", ":download:`link <swagger/SO_MONITORING_SWAGGER.yaml>`" Further Reading ----------------------------------------- +--------------- Detailed documentation can be found here: .. toctree:: :maxdepth: 1 - apis/SO_Interface.rst
\ No newline at end of file + apis/serviceInstances-api.rst + apis/e2eServiceInstances-api.rst + apis/consumed-apis.rst diff --git a/docs/release-notes.rst b/docs/release-notes.rst index cdb20c246b..3b2649361e 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -26,6 +26,7 @@ Version: 1.4.4 - onap/so/sdnc-adapter,1.4.4 - onap/so/so-monitoring,1.4.4 - onap/so/vfc-adapter,1.4.4 + - onap/so/vnfm-adapter,1.4.4 **Release Purpose** @@ -37,7 +38,7 @@ The main goal of the Dublin release was to: - Support BroadBand Service Usecase - SO SOL003 plugin support - Improve PNF PnP - + - Improve SO internal modularity **Epics** @@ -50,7 +51,6 @@ The main goal of the Dublin release was to: - [`SO-1273 <https://jira.onap.org/browse/SO-1273>`__\ ] - PNF PnP Dublin updates & improvements - [`SO-1271 <https://jira.onap.org/browse/SO-1271>`__\ ] - PNF PnP Casablanca MR updates - [`SO-677 <https://jira.onap.org/browse/SO-677>`__\ ] - Improve the issues and findings of the SO Casablanca Release -- [`SO-166 <https://jira.onap.org/browse/SO-166>`__\ ] - Non-stop operations required. **Stories** @@ -220,7 +220,7 @@ The main goal of the Dublin release was to: Testing Terminate and Delete of ETSI VNFM Adapter is done and has some of the minor issues pending, it will be done in El Alto. -- [`SO-1742 <https://jira.onap.org/browse/SO-1742>`__\ ] - Test Terminate/Delete VNF with VNFM Adapter +- [`SO-2013 <https://jira.onap.org/browse/SO-2013>`__\ ] - Test Terminate/Delete VNF with VNFM Adapter **Upgrade Notes** diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index a3b9827d9f..bb726e68aa 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -18,7 +18,7 @@ <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <swagger-version>1.3.0</swagger-version> + <swagger.version>2.0.8</swagger.version> <jax-rs-version>1.1.1</jax-rs-version> <json4s-jackson-version>3.6.0</json4s-jackson-version> <json4s-core-version>3.6.0</json4s-core-version> @@ -56,10 +56,16 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> + + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger.version}</version> + </dependency> <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-jersey2-jaxrs</artifactId> - <version>1.5.16</version> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-jaxrs2</artifactId> + <version>2.0.6</version> </dependency> <dependency> <groupId>com.h2database</groupId> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java deleted file mode 100644 index a3ff1ab95d..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandler.filters; - -import java.io.IOException; -import java.net.URI; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.UriInfo; -import org.onap.so.apihandlerinfra.Constants; - - -@PreMatching -public class RequestUriFilter implements ContainerRequestFilter { - - private String requestURI; - - @Override - public void filter(ContainerRequestContext context) throws IOException { - UriInfo uriInfo = context.getUriInfo(); - URI baseURI = uriInfo.getBaseUri(); - requestURI = uriInfo.getPath(); - - if (requestURI.contains("onap/so/infra/serviceInstances")) { - requestURI = requestURI.replaceFirst("serviceInstances", "serviceInstantiation"); - if (!requestURI.contains(Constants.SERVICE_INSTANCE_PATH)) { - // Adds /serviceInstances after the version provided in the URI - requestURI = new StringBuilder(requestURI) - .insert(requestURI.indexOf(Constants.SERVICE_INSTANTIATION_PATH) + 24, - Constants.SERVICE_INSTANCE_PATH) - .toString(); - } - requestURI = baseURI + requestURI; - URI uri = URI.create(requestURI); - context.setRequestUri(uri); - } - } - - public String getRequestUri() { - return requestURI; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java index 5beb4810ec..482fd8868a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java @@ -21,7 +21,7 @@ package org.onap.so.apihandlerinfra; import java.util.concurrent.Executor; -import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.onap.logging.filter.spring.MDCTaskDecorator; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index d3a279fd8e..650922094d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -76,13 +76,19 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/e2eServiceInstances") -@Api(value = "/onap/so/infra/e2eServiceInstances", description = "API Requests for E2E Service Instances") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/e2eServiceInstances", + description = "API Requests for E2E Service Instances")) + public class E2EServiceInstances { private HashMap<String, String> instanceIdMap = new HashMap<>(); @@ -119,7 +125,8 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class) + @Operation(description = "Create an E2E Service Instance on a version provided", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response createE2EServiceInstance(String request, @PathParam("version") String version) throws ApiException { return processE2EserviceInstances(request, Action.createInstance, null, version); @@ -135,8 +142,9 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId", - response = Response.class) + @Operation(description = "Update an E2E Service Instance on a version provided and serviceId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response updateE2EServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceId") String serviceId) throws ApiException { @@ -155,7 +163,9 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class) + @Operation(description = "Delete E2E Service Instance on a specified version and serviceId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response deleteE2EServiceInstance(String request, @PathParam("version") String version, @PathParam(SERVICE_ID) String serviceId) throws ApiException { @@ -166,8 +176,9 @@ public class E2EServiceInstances { @GET @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") - @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", - response = Response.class) + @Operation(description = "Find e2eServiceInstances Requests for a given serviceId and operationId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) public Response getE2EServiceInstances(@PathParam(SERVICE_ID) String serviceId, @PathParam("version") String version, @PathParam("operationId") String operationId) { @@ -184,7 +195,8 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}/scale") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Scale E2E Service Instance on a specified version", response = Response.class) + @Operation(description = "Scale E2E Service Instance on a specified version", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response scaleE2EServiceInstance(String request, @PathParam("version") String version, @PathParam(SERVICE_ID) String serviceId) throws ApiException { @@ -203,9 +215,10 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", - response = Response.class) + @Operation( + description = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response compareModelwithTargetVersion(String request, @PathParam("serviceId") String serviceId, @PathParam("version") String version) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java index 0379ae3578..5327211280 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java @@ -53,13 +53,18 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/globalhealthcheck") -@Api(value = "/globalhealthcheck", description = "APIH Infra Global Health Check") +@OpenAPIDefinition(info = @Info(title = "/globalhealthcheck", description = "APIH Infra Global Health Check")) public class GlobalHealthcheckHandler { private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class); protected static final String CONTEXTPATH_PROPERTY = "management.endpoints.web.base-path"; @@ -98,7 +103,8 @@ public class GlobalHealthcheckHandler { @GET @Produces("application/json") - @ApiOperation(value = "Performing global health check", response = Response.class) + @Operation(description = "Performing global health check", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn, @Context ContainerRequestContext requestContext) { 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 15572f2b39..d3bd769386 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 @@ -23,8 +23,6 @@ package org.onap.so.apihandlerinfra; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.RequestClientParameter; @@ -61,10 +59,18 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.HashMap; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/instanceManagement") -@Api(value = "/onap/so/infra/instanceManagement", description = "Infrastructure API Requests for Instance Management") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/instanceManagement", + description = "Infrastructure API Requests for Instance Management")) public class InstanceManagement { private static Logger logger = LoggerFactory.getLogger(InstanceManagement.class); @@ -87,7 +93,8 @@ public class InstanceManagement { @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Execute custom workflow", response = Response.class) + @Operation(description = "Execute custom workflow", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response executeCustomWorkflow(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index 00d36b3ff9..271efddc71 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,12 +20,16 @@ package org.onap.so.apihandlerinfra; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.annotation.PostConstruct; +import javax.servlet.ServletConfig; import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Context; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; +import org.onap.logging.filter.base.Constants; import org.onap.so.apihandler.filters.RequestIdFilter; -import org.onap.so.apihandler.filters.RequestUriFilter; import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper; import org.onap.so.apihandlerinfra.infra.rest.Network; import org.onap.so.apihandlerinfra.infra.rest.ServiceInstance; @@ -40,12 +44,16 @@ import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.WorkflowEngineCon import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.onap.so.web.exceptions.RuntimeExceptionMapper; import org.springframework.context.annotation.Configuration; -import io.swagger.jaxrs.config.BeanConfig; -import io.swagger.jaxrs.listing.ApiListingResource; -import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; +import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource; +import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; +import io.swagger.v3.oas.integration.OpenApiConfigurationException; +import io.swagger.v3.oas.integration.SwaggerConfiguration; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; @Configuration @ApplicationPath("/") @@ -53,6 +61,7 @@ public class JerseyConfiguration extends ResourceConfig { @PostConstruct public void setUp() { + System.setProperty(Constants.Property.PARTNER_NAME, "SO.APIH"); register(GlobalHealthcheckHandler.class); register(NodeHealthcheckHandler.class); register(ServiceInstances.class); @@ -65,14 +74,13 @@ public class JerseyConfiguration extends ResourceConfig { register(Network.class); register(Volumes.class); register(ServiceInstance.class); - register(JaxRsFilterLogging.class); + register(SOAuditLogContainerFilter.class); register(ManualTasks.class); register(TasksHandler.class); - register(ApiListingResource.class); - register(SwaggerSerializers.class); + register(OpenApiResource.class); + register(AcceptHeaderOpenApiResource.class); register(ApiExceptionMapper.class); register(RuntimeExceptionMapper.class); - register(RequestUriFilter.class); register(RequestIdFilter.class); register(E2EServiceInstances.class); register(WorkflowSpecificationsHandler.class); @@ -88,12 +96,21 @@ public class JerseyConfiguration extends ResourceConfig { register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class); register(ModelDistributionRequest.class); property(ServletProperties.FILTER_FORWARD_ON_404, true); - BeanConfig beanConfig = new BeanConfig(); - beanConfig.setVersion("1.0.2"); - beanConfig.setSchemes(new String[] {"https"}); - beanConfig.setResourcePackage("org.onap.so.apihandlerinfra"); - beanConfig.setPrettyPrint(true); - beanConfig.setScan(true); + + OpenAPI oas = new OpenAPI(); + Info info = new Info(); + info.title("Swagger apihandlerinfra bootstrap code"); + info.setVersion("1.0.2"); + + SwaggerConfiguration oasConfig = new SwaggerConfiguration().openAPI(oas).prettyPrint(true) + .resourcePackages(Stream.of("org.onap.so.apihandlerinfra").collect(Collectors.toSet())); + + try { + new JaxrsOpenApiContextBuilder().application(this).openApiConfiguration(oasConfig).buildContext(true); + } catch (OpenApiConfigurationException e) { + throw new RuntimeException(e.getMessage(), e); + } + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index b9b7fcc0d4..4bafb40b32 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -34,7 +34,6 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; @@ -52,6 +51,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value; import org.onap.so.apihandlerinfra.tasksbeans.Variables; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +60,11 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.swagger.annotations.ApiOperation; - +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("/tasks") @Component @@ -85,7 +88,8 @@ public class ManualTasks { @Path("/{version:[vV]1}/{taskId}/complete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Complete specified task", response = Response.class) + @Operation(description = "Complete specified task", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java index 3337c62afd..e56ee24baf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java @@ -22,7 +22,19 @@ package org.onap.so.apihandlerinfra; -import java.net.UnknownHostException; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.apache.http.HttpStatus; +import org.onap.so.logger.LoggingAnchor; +import org.onap.so.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import javax.transaction.Transactional; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -30,17 +42,10 @@ import javax.ws.rs.Produces; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; -import org.onap.so.logger.LoggingAnchor; -import org.apache.http.HttpStatus; -import org.onap.so.logger.MessageEnum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import java.net.UnknownHostException; @Path("/nodehealthcheck") -@Api(value = "/nodehealthcheck", description = "API Handler Infra Node Health Check") +@OpenAPIDefinition(info = @Info(title = "/nodehealthcheck", description = "API Handler Infra Node Health Check")) @Component public class NodeHealthcheckHandler { @@ -53,7 +58,8 @@ public class NodeHealthcheckHandler { @GET @Produces("text/html") - @ApiOperation(value = "Performing node health check", response = Response.class) + @Operation(description = "Performing node health check", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException { // Generated RequestId diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index a5ccb1b29b..b49f9b5a8d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -73,16 +73,24 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/orchestrationRequests") -@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests", + description = "API Requests for Orchestration requests")) + @Component public class OrchestrationRequests { private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class); + private static final String ERROR_MESSAGE_PREFIX = "Error Source: %s, Error Message: %s"; @Autowired private RequestsDbClient requestsDbClient; @@ -98,7 +106,8 @@ public class OrchestrationRequests { @GET @Path("/{version:[vV][4-7]}/{requestId}") - @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class) + @Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) @Transactional public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @@ -163,7 +172,8 @@ public class OrchestrationRequests { @GET @Path("/{version:[vV][4-7]}") - @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class) + @Operation(description = "Find Orchestrated Requests for a URI Information", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) @Transactional public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version, @@ -220,7 +230,8 @@ public class OrchestrationRequests { @Path("/{version: [vV][4-7]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class) + @Operation(description = "Unlock Orchestrated Requests for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { @@ -449,7 +460,12 @@ public class OrchestrationRequests { String statusMessages = null; if (iar.getStatusMessage() != null) { - statusMessages = "STATUS: " + iar.getStatusMessage(); + if (StringUtils.isNotBlank(iar.getExtSystemErrorSource())) { + statusMessages = "STATUS: " + + String.format(ERROR_MESSAGE_PREFIX, iar.getExtSystemErrorSource(), iar.getStatusMessage()); + } else { + statusMessages = "STATUS: " + iar.getStatusMessage(); + } } if (OrchestrationRequestFormat.STATUSDETAIL.toString().equalsIgnoreCase(format)) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java index 2fddfd9a95..dc38d4eb82 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ @@ -84,7 +85,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestClientException; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java index ed300d95c2..b462415a43 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java @@ -57,11 +57,17 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/orchestrationRequests") -@Api(value = "onap/so/infra/orchestrationRequests") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests")) + @Component public class ResumeOrchestrationRequest { private static Logger logger = LoggerFactory.getLogger(ResumeOrchestrationRequest.class); @@ -84,7 +90,8 @@ public class ResumeOrchestrationRequest { @Path("/{version:[vV][7]}/{requestId}/resume") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Resume request for a given requestId", response = Response.class) + @Operation(description = "Resume request for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response resumeOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { 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 9b72bdc608..da101a2e6d 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 @@ -89,16 +89,19 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") -@Api(value = "/onap/so/infra/serviceInstantiation", description = "Infrastructure API Requests for Service Instances") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceInstantiation", + description = "Infrastructure API Requests for Service Instances")) public class ServiceInstances extends AbstractRestHandler { private static Logger logger = LoggerFactory.getLogger(MsoRequest.class); @@ -132,7 +135,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create a Service Instance on a version provided", response = Response.class) + @Operation(description = "Create a Service Instance on a version provided", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -145,7 +149,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate provided Service Instance", response = Response.class) + @Operation(description = "Activate provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -161,7 +166,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate provided Service Instance", response = Response.class) + @Operation(description = "Deactivate provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -177,7 +183,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Service Instance", response = Response.class) + @Operation(description = "Delete provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -193,7 +200,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/assign") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Assign Service Instance", response = Response.class) + @Operation(description = "Assign Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response assignServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -206,7 +214,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/unassign") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unassign Service Instance", response = Response.class) + @Operation(description = "Unassign Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response unassignServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -222,7 +231,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create Port Mirroring Configuration", response = Response.class) + @Operation(description = "Create Port Mirroring Configuration", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createPortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -238,7 +248,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Port", response = Response.class) + @Operation(description = "Delete provided Port", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deletePortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -256,7 +267,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Enable Port Mirroring", response = Response.class) + @Operation(description = "Enable Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response enablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -274,7 +286,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Disable Port Mirroring", response = Response.class) + @Operation(description = "Disable Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response disablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -292,7 +305,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate Port Mirroring", response = Response.class) + @Operation(description = "Activate Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -310,7 +324,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate Port Mirroring", response = Response.class) + @Operation(description = "Deactivate Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -328,7 +343,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/addRelationships") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Add Relationships to a Service Instance", response = Response.class) + @Operation(description = "Add Relationships to a Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response addRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -344,7 +360,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/removeRelationships") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Remove Relationships from Service Instance", response = Response.class) + @Operation(description = "Remove Relationships from Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response removeRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -360,7 +377,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VNF on a specified version and serviceInstance", response = Response.class) + @Operation(description = "Create VNF on a specified version and serviceInstance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -381,7 +399,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Replace provided VNF instance", response = Response.class) + @Operation(description = "Replace provided VNF instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -398,8 +417,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VNF on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Update VNF on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -416,7 +436,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Apply updated configuration", response = Response.class) + @Operation(description = "Apply updated configuration", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response applyUpdatedConfig(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { @@ -432,7 +453,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/recreate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Recreate VNF Instance", response = Response.class) + @Operation(description = "Recreate VNF Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response recreateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { @@ -448,7 +470,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VNF instance", response = Response.class) + @Operation(description = "Delete provided VNF instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -465,8 +488,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -483,8 +507,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -503,8 +528,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule", - response = Response.class) + @Operation(description = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -523,7 +549,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Perform VNF software update", response = Response.class) + @Operation(description = "Perform VNF software update", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -540,7 +567,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VfModule instance", response = Response.class) + @Operation(description = "Delete provided VfModule instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -559,7 +587,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/deactivateAndCloudDelete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate and Cloud Delete VfModule instance", response = Response.class) + @Operation(description = "Deactivate and Cloud Delete VfModule instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateAndCloudDeleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -579,7 +608,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "VF Auto Scale Out", response = Response.class) + @Operation(description = "VF Auto Scale Out", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response scaleOutVfModule(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -596,8 +626,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance", - response = Response.class) + @Operation(description = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -614,8 +645,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup", - response = Response.class) + @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -634,7 +666,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VolumeGroup instance", response = Response.class) + @Operation(description = "Delete provided VolumeGroup instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -653,8 +686,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create NetworkInstance on a specified version and serviceInstance ", - response = Response.class) + @Operation(description = "Create NetworkInstance on a specified version and serviceInstance ", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -670,8 +704,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, networkInstance", - response = Response.class) + @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, networkInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -689,7 +724,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Network instance", response = Response.class) + @Operation(description = "Delete provided Network instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -707,7 +743,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create instanceGroups", response = Response.class) + @Operation(description = "Create instanceGroups", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createInstanceGroups(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -720,7 +757,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete instanceGroup", response = Response.class) + @Operation(description = "Delete instanceGroup", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteInstanceGroups(@PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) @@ -736,7 +774,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/addMembers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Add instanceGroup members", response = Response.class) + @Operation(description = "Add instanceGroup members", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response addInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) @@ -752,7 +791,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/removeMembers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Remove instanceGroup members", response = Response.class) + @Operation(description = "Remove instanceGroup members", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response removeInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) 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 3c4c90cc37..09a1d9e5a6 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 @@ -36,7 +36,6 @@ import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.json.JSONArray; -import org.json.JSONException; import org.json.JSONObject; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.RequestClient; @@ -60,11 +59,16 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/tasks") -@Api(value = "onap/so/infra/tasks", description = "Queries of Manual Tasks") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/tasks", description = "Queries of Manual Tasks")) @Component public class TasksHandler { @@ -82,7 +86,8 @@ public class TasksHandler { @Path("/{version:[vV]1}") @GET - @ApiOperation(value = "Finds Manual Tasks", response = Response.class) + @Operation(description = "Finds Manual Tasks", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response queryFilters(@QueryParam("taskId") String taskId, @QueryParam("originalRequestId") String originalRequestId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index b57bb5d1d8..925d10179f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -59,11 +59,17 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/workflowSpecifications") -@Api(value = "onap/so/infra/workflowSpecifications", description = "Queries of Workflow Specifications") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/workflowSpecifications", + description = "Queries of Workflow Specifications")) @Component public class WorkflowSpecificationsHandler { @@ -79,7 +85,8 @@ public class WorkflowSpecificationsHandler { @Path("/{version:[vV]1}/workflows") @GET - @ApiOperation(value = "Finds Workflow Specifications", response = Response.class) + @Operation(description = "Finds Workflow Specifications", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java index ec3df21fdb..483ac47235 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java @@ -44,7 +44,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -61,7 +65,8 @@ public class Network { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Network instance", response = Response.class) + @Operation(description = "Delete provided Network instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteNetworkInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java index 07e8092449..135667d3e4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java @@ -44,7 +44,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -61,7 +65,8 @@ public class ServiceInstance { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a Service instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a Service instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteServiceInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java index 1b9eb1f802..4a86d944cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java @@ -45,7 +45,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -62,7 +66,8 @@ public class VfModules { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java index a8ccdeecac..edb09083d4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java @@ -43,7 +43,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -60,7 +64,8 @@ public class Vnf { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a Vnf instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a Vnf instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVnfInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java index d3e394d6d8..3154c86046 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java @@ -46,7 +46,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component("VolumesV8") @Path("/onap/so/infra/serviceInstantiation") @@ -66,7 +70,8 @@ public class Volumes { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, 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 e11732ddc4..20e27a5265 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 @@ -111,7 +111,7 @@ public abstract class AbstractRestHandler { String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException { InfraActiveRequests dup = null; try { - if (!(instanceName == null && requestScope.equals("service") && (action == Action.createInstance + if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance || action == Action.activateInstance || action == Action.assignInstance))) { dup = infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, requestScope); } @@ -175,7 +175,7 @@ public abstract class AbstractRestHandler { selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath)); } catch (Exception e) { selfLinkUrl = Optional.empty(); // ignore - logger.error(e.getMessage()); + logger.error("Exception in buildSelfLinkUrl", e); } return selfLinkUrl; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index d3fb7986ce..877376cc79 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -61,12 +61,18 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/cloudResources") -@Api(value = "/onap/so/infra/cloudResources", description = "API Requests for cloud resources - Tenant Isolation") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/cloudResources", + description = "API Requests for cloud resources - Tenant Isolation")) public class CloudOrchestration { private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class); @@ -85,7 +91,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create an Operational Environment", response = Response.class) + @Operation(description = "Create an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createOperationEnvironment(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -97,7 +104,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate an Operational Environment", response = Response.class) + @Operation(description = "Activate an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @@ -112,7 +120,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate an Operational Environment", response = Response.class) + @Operation(description = "Deactivate an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index e9cd303c0b..47d6932730 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -62,13 +62,18 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("onap/so/infra/cloudResourcesRequests") -@Api(value = "onap/so/infra/cloudResourcesRequests", - description = "API GET Requests for cloud resources - Tenant Isolation") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/cloudResourcesRequests", + description = "API GET Requests for cloud resources - Tenant Isolation")) public class CloudResourcesOrchestration { private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class); @@ -83,7 +88,7 @@ public class CloudResourcesOrchestration { @Path("/{version: [vV][1]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unlock CloudOrchestration requests for a specified requestId") + @Operation(description = "Unlock CloudOrchestration requests for a specified requestId") @Transactional public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { @@ -167,8 +172,9 @@ public class CloudResourcesOrchestration { @Path("/{version:[vV][1]}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get status of an Operational Environment based on filter criteria", - response = Response.class) + @Operation(description = "Get status of an Operational Environment based on filter criteria", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index ef5abe9f74..2f922220c9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -55,12 +55,18 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/modelDistributions") -@Api(value = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions") +@OpenAPIDefinition( + info = @Info(title = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions")) public class ModelDistributionRequest { private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class); @@ -71,7 +77,8 @@ public class ModelDistributionRequest { @Path("/{version:[vV][1]}/distributions/{distributionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update model distribution status", response = Response.class) + @Operation(description = "Update model distribution status", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java index efdc52b837..6449b0bb75 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java @@ -92,6 +92,7 @@ public class TenantIsolationRequest { requestJSON = mapper.writeValueAsString(request.getRequestDetails()); } catch (JsonProcessingException e) { + logger.error("Exception in JSON processing", e); throw new ValidationException("Parse ServiceInstanceRequest to JSON string", true); } @@ -325,6 +326,7 @@ public class TenantIsolationRequest { orchestrationFilterParams.put(queryParam, value); } } catch (Exception e) { + logger.error("Exception in getOrchestrationFilters", e); throw new ValidationException(e.getMessage(), true); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index b5ba9281a6..de5edb5b54 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -38,7 +38,7 @@ import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.utils.CryptoUtils; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -50,12 +50,19 @@ public class SDCClientHelper { private static Logger logger = LoggerFactory.getLogger(SDCClientHelper.class); private static final String SDC_CONTENT_TYPE = "application/json"; private static final String SDC_ACCEPT_TYPE = "application/json"; - private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/"; + private static final String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/"; - private static String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!"; - private static String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC."; + private static final String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!"; + private static final String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC."; private final HttpClientFactory httpClientFactory = new HttpClientFactory(); + private static final String STATUS_CODE = "statusCode"; + private static final String MESSAGE = "message"; + private static final String MESSAGE_ID = "messageId"; + private static final String REQUEST_ERROR = "requestError"; + private static final String SERVICE_EXCEPTION = "serviceException"; + private static final String POLICY_EXCEPTION = "policyException"; + @Value("${mso.sdc.endpoint}") private String sdcEndpoint; @Value("${mso.sdc.activate.userid}") @@ -89,17 +96,16 @@ public class SDCClientHelper { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) .build(); - ValidateException validateException = new ValidateException.Builder( + + throw new ValidateException.Builder( " SDC credentials 'mso.sdc.client.auth' not setup in properties file!", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo) .build(); - - throw validateException; } URL url = new URL(urlString); - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC); httpClient.addBasicAuthHeader(sdcClientAuth, msoKey); httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId); httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString()); @@ -114,12 +120,12 @@ public class SDCClientHelper { sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode); } catch (Exception ex) { - logger.debug("calling SDC Exception message: {}", ex.getMessage()); + logger.debug("calling SDC Exception message:", ex); String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage(); logger.debug(errorMessage); - sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())); - sdcResponseJsonObj.put("messageId", ""); - sdcResponseJsonObj.put("message", errorMessage); + sdcResponseJsonObj.put(STATUS_CODE, String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())); + sdcResponseJsonObj.put(MESSAGE_ID, ""); + sdcResponseJsonObj.put(MESSAGE, errorMessage); } return sdcResponseJsonObj; @@ -139,11 +145,9 @@ public class SDCClientHelper { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) .build(); - ValidateException validateException = - new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); - throw validateException; + throw new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST, + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); } } @@ -154,7 +158,7 @@ public class SDCClientHelper { * @param statusCode - int * @return enhancedAsdcResponseJsonObj - JSONObject object */ - public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) throws JSONException { + public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) { JSONObject enhancedAsdcResponseJsonObj = new JSONObject(); @@ -163,31 +167,31 @@ public class SDCClientHelper { if (statusCode == Response.Status.ACCEPTED.getStatusCode()) { // Accepted enhancedAsdcResponseJsonObj.put("distributionId", sdcResponseJsonObj.get("distributionId")); - enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); - enhancedAsdcResponseJsonObj.put("messageId", ""); - enhancedAsdcResponseJsonObj.put("message", "Success"); + enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode)); + enhancedAsdcResponseJsonObj.put(MESSAGE_ID, ""); + enhancedAsdcResponseJsonObj.put(MESSAGE, "Success"); } else { // error - if (sdcResponseJsonObj.has("requestError")) { - JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject("requestError"); - if (sdcResponseJsonObj.getJSONObject("requestError").has("serviceException")) { - message = requestErrorObj.getJSONObject("serviceException").getString("text"); - messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId"); + if (sdcResponseJsonObj.has(REQUEST_ERROR)) { + JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject(REQUEST_ERROR); + if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(SERVICE_EXCEPTION)) { + message = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString("text"); + messageId = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString(MESSAGE_ID); } - if (sdcResponseJsonObj.getJSONObject("requestError").has("policyException")) { - message = requestErrorObj.getJSONObject("policyException").getString("text"); - messageId = requestErrorObj.getJSONObject("policyException").getString("messageId"); + if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(POLICY_EXCEPTION)) { + message = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString("text"); + messageId = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString(MESSAGE_ID); } - enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); - enhancedAsdcResponseJsonObj.put("messageId", messageId); - enhancedAsdcResponseJsonObj.put("message", message); + enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode)); + enhancedAsdcResponseJsonObj.put(MESSAGE_ID, messageId); + enhancedAsdcResponseJsonObj.put(MESSAGE, message); } else { // unexpected format - enhancedAsdcResponseJsonObj.put("statusCode", + enhancedAsdcResponseJsonObj.put(STATUS_CODE, String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())); - enhancedAsdcResponseJsonObj.put("messageId", MESSAGE_UNDEFINED_ERROR); - enhancedAsdcResponseJsonObj.put("message", MESSAGE_UNEXPECTED_FORMAT); + enhancedAsdcResponseJsonObj.put(MESSAGE_ID, MESSAGE_UNDEFINED_ERROR); + enhancedAsdcResponseJsonObj.put(MESSAGE, MESSAGE_UNEXPECTED_FORMAT); } } return enhancedAsdcResponseJsonObj; @@ -214,7 +218,7 @@ public class SDCClientHelper { * @return String json * @throws JSONException */ - public String buildJsonWorkloadContext(String workloadContext) throws JSONException { + public String buildJsonWorkloadContext(String workloadContext) { return new JSONObject().put("workloadContext", workloadContext).toString(); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 3005abaf9b..3226a0c313 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -61,16 +61,14 @@ public class ActivateVnfStatusOperationalEnvironment { private OperationalEnvServiceModelStatus queryServiceModelResponse = null; private boolean isOverallSuccess = false; - private final int RETRY_COUNT_ZERO = 0; - private final String ERROR_REASON_ABORTED = "ABORTED"; - private final String RECOVERY_ACTION_RETRY = "RETRY"; - private final String RECOVERY_ACTION_ABORT = "ABORT"; - private final String RECOVERY_ACTION_SKIP = "SKIP"; - private final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString(); - private final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(); - private final String DISTRIBUTION_STATUS_SENT = "SENT"; - - private final String MESSAGE_UNDEFINED_ID = "Undefined Error Message!"; + private static final int RETRY_COUNT_ZERO = 0; + private static final String ERROR_REASON_ABORTED = "ABORTED"; + private static final String RECOVERY_ACTION_RETRY = "RETRY"; + private static final String RECOVERY_ACTION_ABORT = "ABORT"; + private static final String RECOVERY_ACTION_SKIP = "SKIP"; + private static final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString(); + private static final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(); + private static final String DISTRIBUTION_STATUS_SENT = "SENT"; @Autowired private ActivateVnfDBHelper dbHelper; @@ -130,6 +128,7 @@ public class ActivateVnfStatusOperationalEnvironment { } } catch (Exception e) { + logger.error("Exception in execute", e); requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java deleted file mode 100644 index 276b438529..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandler.filters; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.io.IOException; -import java.net.URI; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.UriInfo; -import org.junit.Test; -import org.onap.so.apihandlerinfra.BaseTest; - - - -public class RequestUriFilterTest extends BaseTest { - - @Test - public void filterTest() throws IOException { - RequestUriFilter URIFilter = new RequestUriFilter(); - URI baseURI = URI.create("http://localhost:58879/"); - String requestURI = "onap/so/infra/serviceInstances/v5"; - - ContainerRequestContext mockContext = mock(ContainerRequestContext.class); - UriInfo mockInfo = mock(UriInfo.class); - - when(mockContext.getUriInfo()).thenReturn(mockInfo); - when(mockInfo.getBaseUri()).thenReturn(baseURI); - when(mockInfo.getPath()).thenReturn(requestURI); - - - URIFilter.filter(mockContext); - assertEquals("http://localhost:58879/onap/so/infra/serviceInstantiation/v5/serviceInstances", - URIFilter.getRequestUri()); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 9fc9e4a51b..276f891eb2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -29,9 +29,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; -import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; -import static org.onap.so.logger.MdcConstants.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -81,7 +82,7 @@ public class InstanceManagementTest extends BaseTest { // set headers headers = new HttpHeaders(); headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name"); - headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(CLIENT_ID, "VID"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index ad0a878931..8a112e3fdd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -28,15 +28,15 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID; -import static org.onap.so.logger.MdcConstants.ENDTIME; -import static org.onap.so.logger.MdcConstants.INVOCATION_ID; -import static org.onap.so.logger.MdcConstants.PARTNERNAME; -import static org.onap.so.logger.MdcConstants.RESPONSECODE; -import static org.onap.so.logger.MdcConstants.RESPONSEDESC; -import static org.onap.so.logger.MdcConstants.SERVICE_NAME; -import static org.onap.so.logger.MdcConstants.STATUSCODE; -import static org.onap.so.logger.MdcConstants.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; +import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; import java.io.IOException; import java.util.Map; import javax.ws.rs.core.MediaType; @@ -110,27 +110,27 @@ public class ManualTasksTest extends BaseTest { assertThat(realResponse, sameBeanAs(expectedResponse)); for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(STATUSCODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE)); + } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ENDTIME)); + assertNotNull(mdc.get(LOG_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("202", mdc.get(RESPONSECODE)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("202", mdc.get(RESPONSE_CODE)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME)); - assertEquals("COMPLETE", mdc.get(STATUSCODE)); - assertNotNull(mdc.get(RESPONSEDESC)); + assertEquals("COMPLETE", mdc.get(RESPONSE_STATUS_CODE)); + assertNotNull(mdc.get(RESPONSE_DESCRIPTION)); assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java index f672648a6b..627bbc631d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java @@ -25,6 +25,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import javax.ws.rs.core.Response; import org.apache.commons.lang.StringUtils; @@ -232,6 +233,21 @@ public class OrchestrationRequestsUnitTest { } @Test + public void mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest() throws ApiException { + InstanceReferences instanceReferences = new InstanceReferences(); + instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); + iar.setExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE); + iar.setFlowStatus(null); + iar.setStatusMessage("Error retrieving cloud region from AAI"); + + Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, + OrchestrationRequestFormat.DETAIL.toString()); + + assertTrue(actual.getRequestStatus().getStatusMessage() + .contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE)); + } + + @Test public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest() throws ApiException { InstanceReferences instanceReferences = new InstanceReferences(); instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java index e4532cd8d7..d0561a4518 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java @@ -30,9 +30,10 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; -import static org.onap.so.logger.MdcConstants.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -95,7 +96,7 @@ public class RequestHandlerUtilsTest extends BaseTest { // set headers headers = new HttpHeaders(); headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name"); - headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(CLIENT_ID, "VID"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index a79aeb2bd7..94436d54b0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,17 +33,10 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; -import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID; -import static org.onap.so.logger.MdcConstants.CLIENT_ID; -import static org.onap.so.logger.MdcConstants.ENDTIME; -import static org.onap.so.logger.MdcConstants.INVOCATION_ID; -import static org.onap.so.logger.MdcConstants.PARTNERNAME; -import static org.onap.so.logger.MdcConstants.RESPONSECODE; -import static org.onap.so.logger.MdcConstants.RESPONSEDESC; -import static org.onap.so.logger.MdcConstants.SERVICE_NAME; -import static org.onap.so.logger.MdcConstants.STATUSCODE; +import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -64,7 +57,6 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.HttpHeadersConstants; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -121,7 +113,7 @@ public class ServiceInstancesTest extends BaseTest { // set headers headers = new HttpHeaders(); headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name"); - headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(CLIENT_ID, "VID"); @@ -229,27 +221,29 @@ public class ServiceInstancesTest extends BaseTest { for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(STATUSCODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", + mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ENDTIME)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("202", mdc.get(RESPONSECODE)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME)); - assertEquals("COMPLETE", mdc.get(STATUSCODE)); - assertNotNull(mdc.get(RESPONSEDESC)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("202", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", + mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION)); assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0)); @@ -285,14 +279,13 @@ public class ServiceInstancesTest extends BaseTest { requestReferences.setInstanceId("1882939"); requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceUriPrev7 + "v5"; + uri = servInstanceuri + "v5"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers); // then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + assertEquals(404, response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } @Test @@ -407,6 +400,15 @@ public class ServiceInstancesTest extends BaseTest { .withStatus(HttpStatus.SC_NOT_FOUND))); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); + + for (ILoggingEvent logEvent : TestAppender.events) { + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.SOAuditLogContainerFilter") + && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { + Map<String, String> mdc = logEvent.getMDCPropertyMap(); + assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get("PartnerName")); + } + } } @Test @@ -896,7 +898,7 @@ public class ServiceInstancesTest extends BaseTest { ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(404, response.getStatusCode().value()); } @Test @@ -2248,14 +2250,12 @@ public class ServiceInstancesTest extends BaseTest { requestReferences.setInstanceId("1882939"); requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceUriPrev7 + "v5"; + uri = servInstanceuri + "v5"; ResponseEntity<String> response = sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST, headers); // then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertEquals(404, response.getStatusCode().value()); } @Test @@ -2574,11 +2574,11 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d"); for (ILoggingEvent logEvent : TestAppender.events) { - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertEquals("VID", mdc.get(PARTNERNAME)); + assertEquals("VID", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java index f178a3c0cb..cfb865c9e1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java @@ -82,15 +82,15 @@ public class GRMClientTest extends BaseTest { boolean foundInvoke = false; boolean foundInvokeReturn = false; for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); assertEquals("GRM", mdc.get("TargetEntity")); assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); foundInvoke = true; - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE_RETURN")) { + } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter") + && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE-RETURN")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql index 6d8e2e8b09..d5575804ae 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql @@ -1,10 +1,10 @@ -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql index 22f68e0579..72922ae9c1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql @@ -1,12 +1,12 @@ --Changes here should also be made in InfraActiveRequestsReset.sql to be re-inserted after tests -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, null), ('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, null), ('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index ee53e491a4..2129dc2ede 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -1276,7 +1276,7 @@ CREATE TABLE `infra_active_requests` ( `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, @@ -1329,7 +1329,7 @@ CREATE TABLE `archived_infra_requests` ( `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql index 43571e42fc..bfd3d2160a 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql @@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re ('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10'); -insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values +insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values ('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql index 192e6d55b6..22e84344f7 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql @@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS( VF_MODULE_NAME VARCHAR SELECTIVITY 8, VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3, AAI_SERVICE_ID VARCHAR SELECTIVITY 1, - AIC_CLOUD_REGION VARCHAR SELECTIVITY 1, + CLOUD_REGION VARCHAR SELECTIVITY 1, CALLBACK_URL VARCHAR SELECTIVITY 1, CORRELATOR VARCHAR SELECTIVITY 1, NETWORK_ID VARCHAR SELECTIVITY 2, @@ -102,11 +102,11 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS( ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1 ); -INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, STRINGDECODE('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n'), 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); -INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES ('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'md5621', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), ('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); @@ -151,7 +151,7 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS( VF_MODULE_NAME VARCHAR SELECTIVITY 8, VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3, AAI_SERVICE_ID VARCHAR SELECTIVITY 1, - AIC_CLOUD_REGION VARCHAR SELECTIVITY 1, + CLOUD_REGION VARCHAR SELECTIVITY 1, CALLBACK_URL VARCHAR SELECTIVITY 1, CORRELATOR VARCHAR SELECTIVITY 1, NETWORK_ID VARCHAR SELECTIVITY 2, diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java index 05845dd058..73e5e16324 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java @@ -117,7 +117,7 @@ public abstract class InfraRequests implements java.io.Serializable { private String vfModuleModelName; @Column(name = "AAI_SERVICE_ID", length = 50) private String aaiServiceId; - @Column(name = "AIC_CLOUD_REGION", length = 11) + @Column(name = "CLOUD_REGION", length = 11) private String aicCloudRegion; @Column(name = "CALLBACK_URL", length = 200) private String callBackUrl; 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 9be92ad93a..5ea0d3c54a 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 @@ -44,7 +44,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; @@ -157,7 +157,7 @@ public class RequestsDbClient { return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory) .setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); + restTemplate.getInterceptors().add((new SOSpringClientFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java index 425e0b8bbc..ac0d09b13b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java @@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; @IdClass(ControllerSelectionReferenceId.class) @Entity -@Table(name = "CONTROLLER_SELECTION_REFERENCE") +@Table(name = "controller_selection_reference") public class ControllerSelectionReference implements Serializable { private static final long serialVersionUID = -608098800737567188L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java index 93e2992d3f..9691eff5f5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java @@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans; public enum OrchestrationStatus { ACTIVE("Active", "active"), + ACTIVATED("Activated", "activated"), ASSIGNED("Assigned", "assigned"), CREATED("Created", "created"), INVENTORIED("Inventoried", "inventoried"), diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java index c2cf2d7cf6..9ec61ff05f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java @@ -17,7 +17,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; @Entity -@Table(name = "USER_PARAMETERS") +@Table(name = "user_parameters") public class UserParameters implements Serializable { private static final long serialVersionUID = -5036895978102778877L; 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 23539b074d..fcafe90405 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 @@ -30,6 +30,7 @@ import javax.persistence.EntityNotFoundException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpStatus; +import org.onap.logging.filter.base.Constants; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; @@ -64,7 +65,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.logger.LogConstants; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -366,12 +367,12 @@ public class CatalogDbClient { ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); + restTemplate.getInterceptors().add((new SOSpringClientFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); - request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY); + request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); return execution.execute(request, body); }); }).build().buildClientFactory(); @@ -415,12 +416,12 @@ public class CatalogDbClient { ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory) .setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); + restTemplate.getInterceptors().add((new SOSpringClientFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth); - request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY); + request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); return execution.execute(request, body); }); }).build().buildClientFactory(); @@ -1007,7 +1008,7 @@ public class CatalogDbClient { headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); - headers.set(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY); + headers.set(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); return headers; } diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index 89482fdcda..c68495d27e 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -27,16 +27,16 @@ <property name="currentTimeStamp" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",UTC}"/> <property name="errorPattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" /> <property name="debugPattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" /> + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" /> <property name="auditPattern" - value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> + value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" /> <property name="metricPattern" - value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" /> + value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" /> <property name="defaultPattern" value="%nopexception%logger @@ -81,7 +81,7 @@ class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>INVOKE_RETURN</marker> + <marker>INVOKE-RETURN</marker> </evaluator> <onMismatch>DENY</onMismatch> <onMatch>ACCEPT</onMatch> @@ -137,7 +137,7 @@ <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> <marker>INVOKE</marker> - <marker>INVOKE_RETURN</marker> + <marker>INVOKE-RETURN</marker> <marker>ENTRY</marker> <marker>EXIT</marker> </evaluator> @@ -180,6 +180,7 @@ <logger name="org.onap" level="DEBUG" /> <logger name="com.att.ecomp" level="DEBUG" /> <logger name="org.apache.cxf.interceptor" level="DEBUG" /> + <logger name="com.att.commons" level="DEBUG" /> <logger name="AUDIT" level="INFO" additivity="false"> <appender-ref ref="asyncAudit" /> @@ -635,6 +635,21 @@ <!-- *********************************************************************************************************** --> <!-- Dependencies --> <dependencies> + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-slf4j</artifactId> + <version>1.5.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-filter-base</artifactId> + <version>1.5.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-filter-spring</artifactId> + <version>1.5.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts index 71294bfffe..5adfc049af 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts @@ -19,7 +19,7 @@ See the License for the specific language governing permissions and SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= -@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com +@authors: ronan.kenny@est.tech, waqas.ikram@est.tech */ import { BrowserModule } from '@angular/platform-browser'; @@ -35,13 +35,13 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { DetailsComponent } from './details/details.component'; import { ToastrNotificationService } from './toastr-notification-service.service'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatSelectModule, MatNativeDateModule, MatDatepickerModule, MatCardModule, MatPaginatorModule, MatSortModule } from '@angular/material'; +import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatSelectModule, MatNativeDateModule, MatDatepickerModule, MatCardModule, MatPaginatorModule, MatSortModule, MatIconModule } from '@angular/material'; import { NgxSpinnerModule } from 'ngx-spinner'; import { RouterModule, Routes } from '@angular/router'; import { APP_BASE_HREF } from '@angular/common'; import { LoginComponent } from './login/login.component'; -import {BasicAuthInterceptor} from "./basic-auth.interceptor"; -import {ErrorInterceptor} from "./error.interceptor"; +import { BasicAuthInterceptor } from "./basic-auth.interceptor"; +import { ErrorInterceptor } from "./error.interceptor"; @NgModule({ declarations: [ @@ -70,6 +70,7 @@ import {ErrorInterceptor} from "./error.interceptor"; RouterModule, MatPaginatorModule, MatSortModule, + MatIconModule, RouterModule.forRoot([]), ReactiveFormsModule ], diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html index a98095ca00..8ad955f38e 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html @@ -17,12 +17,23 @@ See the License for the specific language governing permissions and SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= -@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com +@authors: ronan.kenny@est.tech, waqas.ikram@est.tech --> <div class="completeForm"> <div class="topCanvas"> - <section class="canvas" id="canvas"></section> + <div class="navigation"> + <button class="zoomButton" mat-icon-button title="zoom in" (click)="zoomIn()"> + <mat-icon>zoom_in</mat-icon> + </button> + <button class="zoomButton" mat-icon-button title="zoom out" (click)="zoomOut()"> + <mat-icon>zoom_out</mat-icon> + </button> + <button class="zoomButton" mat-icon-button title="reset zoom" (click)="resetZoom()"> + <mat-icon>all_out</mat-icon> + </button> + </div> + <div #canvas class="canvas" id="canvas"></div> <mat-card class="besideCanvas" id="besideCanvas"> <mat-card-title>Process Information</mat-card-title> <br /> diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss index 2789723964..b96fe4ace2 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss @@ -17,23 +17,39 @@ See the License for the specific language governing permissions and SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= -@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com +@authors: ronan.kenny@est.tech, waqas.ikram@est.tech */ #canvas { background: white; padding: 0; - margin: 0; + margin-left: -43px; width: 70%; height: 470px; margin-top: 0; - box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); + box-shadow: 0 8px 10px 1px rgba(0,0,0,.2); +} + +.navigation { + background: #e6e6e6; + width: 40px; + box-shadow: -5px 8px 10px 1px rgba(0,0,0,.2); + height: 470px; + border: 1px; + border-color: black; + position: relative; +} + +.zoomButton { + padding-top: 8px; + background: none; + border: none; } #besideCanvas { background: white; padding-left: 20px; margin: 0; - width: 28%; + width: 25%; height: 470px; margin-top: 0; box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts index 7106a87937..a42fa3f5a6 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= -@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com +@authors: ronan.kenny@est.tech, waqas.ikram@est.tech */ import { Component, OnInit } from '@angular/core'; @@ -34,6 +34,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { VariableInstance } from '../model/variableInstance.model'; import { ToastrNotificationService } from '../toastr-notification-service.service'; import { NgxSpinnerService } from 'ngx-spinner'; +import { ElementRef, ViewChild } from '@angular/core'; @Component({ selector: 'app-details', @@ -43,6 +44,9 @@ import { NgxSpinnerService } from 'ngx-spinner'; }) export class DetailsComponent implements OnInit { + + @ViewChild("canvas") elementReference: ElementRef; + bpmnViewer: any; processInstanceID: string; @@ -82,7 +86,8 @@ export class DetailsComponent implements OnInit { async (data: ProcessDefinitionDetail) => { this.processDefinition = data; console.log(data); - await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance, this.router); + await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance, + this.router, this.spinner, this.popup); }, error => { console.log(error); this.popup.error("Unable to get process definition for id: " + procDefId + " Error code:" + error.status); @@ -104,30 +109,53 @@ export class DetailsComponent implements OnInit { }); } - displayCamundaflow(bpmnXml, activities: ActivityInstance[], r: Router) { - this.spinner.show(); + displayCamundaflow(bpmnXml, activities: ActivityInstance[], router: Router, + spinner: NgxSpinnerService, popup: ToastrNotificationService) { + spinner.show(); this.bpmnViewer.importXML(bpmnXml, (error) => { if (error) { console.error('Unable to load BPMN flow ', error); - this.popup.error('Unable to load BPMN flow '); - this.spinner.hide(); + popup.error('Unable to load BPMN flow '); + spinner.hide(); } else { - this.spinner.hide(); - var canvas = this.bpmnViewer.get('canvas'); + spinner.hide(); + let canvas = this.bpmnViewer.get('canvas'); var eventBus = this.bpmnViewer.get('eventBus'); - eventBus.on('element.click', function(e) { + var elementRegistry = this.bpmnViewer.get('elementRegistry'); + var overlays = this.bpmnViewer.get('overlays'); - activities.forEach(a => { - if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) { - console.log("will drill down to : " + a.calledProcessInstanceId); - r.navigate(['/details/' + a.calledProcessInstanceId]); - this.spinner.show(); - } - }); + activities.forEach(a => { + if (a.calledProcessInstanceId !== null) { + var element = elementRegistry.get(a.activityId); + let newNode = document.createElement('div'); + newNode.className = 'highlight-overlay'; + newNode.id = element.id; + newNode.style.width = element.width + "px"; + newNode.style.height = element.height + "px"; + newNode.style.cursor = "pointer"; + + overlays.add(a.activityId, { + position: { + top: -5, + left: -5 + }, + html: newNode + }); + + newNode.addEventListener('click', function(e) { + console.log("clicked on: " + e.srcElement.id) + activities.forEach(a => { + if (a.activityId == e.srcElement.id && a.calledProcessInstanceId !== null) { + console.log("will drill down to : " + a.calledProcessInstanceId); + router.navigate(['/details/' + a.calledProcessInstanceId]); + } + }); + }); + } }); // zoom to fit full viewport - canvas.zoom('fit-viewport'); + canvas.zoom('fit-viewport', 'auto'); activities.forEach(a => { canvas.addMarker(a.activityId, 'highlight'); }); @@ -135,6 +163,26 @@ export class DetailsComponent implements OnInit { }); } + zoomIn() { + this.bpmnViewer.get('zoomScroll').zoom(1, { + x: this.elementReference.nativeElement.offsetWidth / 2, + y: this.elementReference.nativeElement.offsetHeight / 2 + }); + } + + zoomOut() { + this.bpmnViewer.get('zoomScroll').zoom(-1, { + x: this.elementReference.nativeElement.offsetWidth / 2, + y: this.elementReference.nativeElement.offsetHeight / 2 + }); + } + resetZoom() { + let canvas = this.bpmnViewer.get('canvas'); + canvas.resized(); + canvas.zoom('fit-viewport', 'auto'); + + } + getVarInst(procInstId: string) { this.data.getVariableInstance(procInstId).subscribe( (data: VariableInstance[]) => { diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts index 16d274f16a..b22fa6ee9c 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
*/
import { Injectable } from '@angular/core';
@@ -44,9 +44,9 @@ export class HttpErrorHandlerService { this.popup.error("Internal Service Error occured for operation: " + operation + " please check backend service log. status code: " + error.status);
}
console.error(
- 'Backend returned code ${error.status}, ' +
- 'body was: ${error.error}');
- return throwError(error.error || "Internal Service Error occured for operation: " + operation + " please check backend service log. status code: " + error.status);
+ 'Backend returned status code: ', error.status + ' from URL ' + url);
+ return throwError(error.error || "Internal Service Error occured for operation: " +
+ operation + ". Please check backend service log. Status code: " + error.status);
};
}
|