diff options
Diffstat (limited to 'adapters')
22 files changed, 146 insertions, 67 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java new file mode 100644 index 0000000000..86be9ec3d8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java @@ -0,0 +1,36 @@ +package org.onap.so.openstack.beans; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CreateStackRequest { + + @JsonProperty("parameters") + private Map<String, Object> parameters; + + @JsonProperty("environment") + private String environment; + + public Map<String, Object> getParameters() { + return parameters; + } + + public void setParameters(Map<String, Object> parameters) { + this.parameters = parameters; + } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + @Override + public String toString() { + return "CreateStackRequest [parameters=" + parameters + ", environment=" + environment + "]"; + } + + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 28d4f3f9b4..1d75892138 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -55,6 +55,7 @@ import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; +import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -354,7 +355,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { try { ObjectMapper mapper = new ObjectMapper(); InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId); - String stackRequest = mapper.writeValueAsString(request.getParameters()); + CreateStackRequest createStackRequest = new CreateStackRequest(); + createStackRequest.setEnvironment(request.getEnvironment()); + createStackRequest.setParameters(request.getParameters()); + String stackRequest = mapper.writeValueAsString(createStackRequest); CloudApiRequests cloudReq = new CloudApiRequests(); cloudReq.setCloudIdentifier(stackName); cloudReq.setRequestBody(stackRequest); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 687b7d8d2f..e840d5affd 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -48,10 +48,12 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.exceptions.MsoStackAlreadyExists; import org.springframework.core.env.Environment; +import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.base.client.OpenStackResponseException; import com.woorea.openstack.heat.Heat; import com.woorea.openstack.heat.StackResource; @@ -415,11 +417,22 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { @Test public final void saveStack_Test() throws MsoException, IOException, NovaClientException { + CreateStackParam createStackParam = new CreateStackParam(); createStackParam.setStackName("stackName"); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("test", "value"); + String environment = + "parameters:\n mmn_volume_name_1: \"data-mn-v-vdb\"\n mmn_volume_name_2: \"arch-mn-v-vdc\"\n"; createStackParam.setParameters(parameters); + createStackParam.setEnvironment(environment); + + CreateStackRequest createStackRequest = new CreateStackRequest(); + createStackRequest.setEnvironment(environment); + createStackRequest.setParameters(parameters); + ObjectMapper mapper = new ObjectMapper(); + String stackRequest = mapper.writeValueAsString(createStackRequest); + InfraActiveRequests request = new InfraActiveRequests(); request.setRequestId("requestId"); doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId"); @@ -427,7 +440,8 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { heatUtils.saveStackRequest(createStackParam, "requestId", "stackName"); Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request); assertNotNull(request.getCloudApiRequests().get(0)); - assertEquals(request.getCloudApiRequests().get(0).getRequestId(), "requestId"); + assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId()); + assertEquals(stackRequest, request.getCloudApiRequests().get(0).getRequestBody()); } @Test diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java index 2f99fed875..4a5a6119cd 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -37,6 +37,16 @@ public class VduArtifact { private byte[] content; private ArtifactType type; + // Default constructor + public VduArtifact() {} + + // Fully specified constructor + public VduArtifact(String name, byte[] content, ArtifactType type) { + this.name = name; + this.content = content; + this.type = type; + } + @Override public boolean equals(final Object other) { if (!(other instanceof VduArtifact)) { @@ -52,16 +62,6 @@ public class VduArtifact { return new HashCodeBuilder().append(name).append(content).append(type).toHashCode(); } - // Default constructor - public VduArtifact() {} - - // Fully specified constructor - public VduArtifact(String name, byte[] content, ArtifactType type) { - this.name = name; - this.content = content; - this.type = type; - } - public String getName() { return name; } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index a0d822d394..0b8de60a81 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =========================================================================== + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +27,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import javax.xml.bind.annotation.XmlRootElement; -import org.onap.so.db.catalog.beans.InstanceGroup; -import org.onap.so.db.catalog.beans.VFCInstanceGroup; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.slf4j.Logger; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index bcf5429789..1487cb21b2 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -41,6 +41,8 @@ spring: jackson: serialization: fail-on-empty-beans: false + main: + allow-bean-definition-overriding: true #Actuator management: 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 7500097b6a..8edce124ec 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 @@ -87,9 +87,12 @@ public abstract class AbstractAuditService { } protected void setupMDC(ExternalTask externalTask) { + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); String msoRequestId = externalTask.getVariable("mso-request-id"); - if (msoRequestId != null && !msoRequestId.isEmpty()) + 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) { 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 77229919cd..1e5b6de857 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 @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Optional; 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.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAuditList; @@ -48,9 +49,9 @@ public class AuditCreateStackService extends AbstractAuditService { public Environment environment; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { + setupMDC(externalTask); AuditInventory auditInventory = externalTask.getVariable("auditInventory"); Map<String, Object> variables = new HashMap<>(); - setupMDC(externalTask); boolean success = false; try { logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, @@ -71,6 +72,7 @@ public class AuditCreateStackService extends AbstractAuditService { if (success) { externalTaskService.complete(externalTask, variables); logger.debug("The External Task Id: {} Successful", externalTask.getId()); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", @@ -80,6 +82,7 @@ public class AuditCreateStackService extends AbstractAuditService { } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); externalTaskService.complete(externalTask, variables); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, 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 b99eaa98d9..0aa4f9bdc3 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 @@ -25,6 +25,7 @@ import java.util.Map; import java.util.Optional; 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.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAuditList; @@ -52,9 +53,9 @@ public class AuditDeleteStackService extends AbstractAuditService { protected Environment env; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { + setupMDC(externalTask); AuditInventory auditInventory = externalTask.getVariable("auditInventory"); Map<String, Object> variables = new HashMap<>(); - setupMDC(externalTask); boolean success = false; try { logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries()); @@ -79,6 +80,7 @@ public class AuditDeleteStackService extends AbstractAuditService { if (success) { externalTaskService.complete(externalTask, variables); logger.debug("The External Task Id: {} Successful", externalTask.getId()); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", @@ -88,6 +90,7 @@ public class AuditDeleteStackService extends AbstractAuditService { } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); externalTaskService.complete(externalTask, variables); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, 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 c8ac9d1a58..2ef7d5b325 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 @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Optional; 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.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; @@ -24,8 +25,8 @@ public class AuditQueryStackService extends AbstractAuditService { protected AuditDataService auditDataService; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { - AuditInventory auditInventory = externalTask.getVariable("auditInventory"); setupMDC(externalTask); + AuditInventory auditInventory = externalTask.getVariable("auditInventory"); boolean success = false; Map<String, Object> variables = new HashMap<>(); try { @@ -42,6 +43,7 @@ public class AuditQueryStackService extends AbstractAuditService { if (success) { externalTaskService.complete(externalTask, variables); logger.debug("The External Task {} was Successful", externalTask.getId()); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}", @@ -51,6 +53,7 @@ public class AuditQueryStackService extends AbstractAuditService { } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId()); externalTaskService.complete(externalTask, variables); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, 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 c106591b25..a6c61704ad 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 @@ -77,6 +77,7 @@ public class CreateInventoryTask { if (success) { externalTaskService.complete(externalTask); logger.debug("The External Task Id: {} Successful", externalTask.getId()); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else if (inventoryException) { logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId()); externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); @@ -89,6 +90,7 @@ public class CreateInventoryTask { } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, @@ -107,6 +109,8 @@ public class CreateInventoryTask { 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); 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 34177ff5a3..3c073af6ba 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 @@ -48,10 +48,10 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import org.onap.so.client.RestTemplateConfig; +import javax.inject.Provider; @Component public class ValetClient { @@ -75,6 +75,9 @@ public class ValetClient { private static final String BODY = ", body="; @Autowired private ObjectMapper mapper; + @Autowired + private Provider<RestTemplate> templateProvider; + protected String baseUrl; protected String basePath; @@ -123,10 +126,7 @@ public class ValetClient { } private RestTemplate getRestTemplate() { - RestTemplate restTemplate = new RestTemplate(); - restTemplate - .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - return restTemplate; + return templateProvider.get(); } /* diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index c22bb327d4..2d77bf625a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -187,11 +187,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder<Map<String, String>> outputs) throws VnfException { logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); - // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); - long subStartTime = System.currentTimeMillis(); - - VduInstance vduInstance = null; + VduInstance vduInstance; CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null); VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); @@ -252,7 +248,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void rollbackVnf(VnfRollback rollback) throws VnfException { - long startTime = System.currentTimeMillis(); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); @@ -279,7 +274,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Use the VduPlugin to delete the VF Module. VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); - long subStartTime = System.currentTimeMillis(); try { // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object // and use that. @@ -336,7 +330,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { logger.debug("Unable to convert " + inputValue + " to an integer!", e); return null; } - } else if (type.equalsIgnoreCase("json")) { + } else if ("json".equalsIgnoreCase(type)) { try { JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue)); return jsonNode; @@ -344,7 +338,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e); return null; } - } else if (type.equalsIgnoreCase("boolean")) { + } else if ("boolean".equalsIgnoreCase(type)) { return new Boolean(inputValue.toString()); } @@ -353,7 +347,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) { - Map<String, String> stringOutputs = new HashMap<String, String>(); + Map<String, String> stringOutputs = new HashMap<>(); for (String key : stackOutputs.keySet()) { if (stackOutputs.get(key) instanceof String) { stringOutputs.put(key, (String) stackOutputs.get(key)); @@ -447,7 +441,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (objectMap == null) { return null; } - Map<String, String> stringMap = new HashMap<String, String>(); + Map<String, String> stringMap = new HashMap<>(); for (String key : objectMap.keySet()) { if (!stringMap.containsKey(key)) { Object obj = objectMap.get(key); @@ -540,8 +534,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException { - // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { @@ -665,7 +657,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Use the VduPlugin. VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); - long subStartTime1 = System.currentTimeMillis(); try { vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleName); } catch (VduException me) { @@ -761,8 +752,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // If a Volume Group was provided, query its outputs for inclusion in Module input parameters if (volumeGroupId != null) { - long subStartTime2 = System.currentTimeMillis(); - VduInstance volumeVdu = null; + VduInstance volumeVdu; try { volumeVdu = vduPlugin.queryVdu(cloudInfo, volumeGroupId); } catch (VduException me) { @@ -811,8 +801,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } if (baseVfModuleId != null) { - long subStartTime2 = System.currentTimeMillis(); - VduInstance baseVdu = null; + VduInstance baseVdu; try { baseVdu = vduPlugin.queryVdu(cloudInfo, baseVfModuleId); } catch (MsoException me) { @@ -887,19 +876,19 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Create the combined set of parameters from the incoming request, base-module outputs, // volume-module outputs. Also, convert all variables to their native object types. - HashMap<String, Object> goldenInputs = new HashMap<String, Object>(); - List<String> extraInputs = new ArrayList<String>(); + HashMap<String, Object> goldenInputs = new HashMap<>(); + List<String> extraInputs = new ArrayList<>(); Boolean skipInputChecks = false; if (skipInputChecks) { - goldenInputs = new HashMap<String, Object>(); + goldenInputs = new HashMap<>(); for (String key : inputs.keySet()) { goldenInputs.put(key, inputs.get(key)); } } else { // Build maps for the parameters (including aliases) to simplify checks - HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>(); + HashMap<String, HeatTemplateParam> params = new HashMap<>(); Set<HeatTemplateParam> paramSet = heatTemplate.getParameters(); logger.debug("paramSet has " + paramSet.size() + " entries"); @@ -909,7 +898,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Include aliases. String alias = htp.getParamAlias(); - if (alias != null && !alias.equals("") && !params.containsKey(alias)) { + if (alias != null && !"".equals(alias) && !params.containsKey(alias)) { params.put(alias, htp); } } @@ -1026,7 +1015,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Here we go... ready to deploy the VF Module. - long instantiateVduStartTime = System.currentTimeMillis(); if (backout == null) backout = true; @@ -1088,11 +1076,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); - // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); // Capture the output parameters on a delete, so need to query first - VduInstance vduInstance = null; + VduInstance vduInstance; CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null); // Use the VduPlugin. @@ -1123,7 +1109,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success) // - a vnfInstance object with status of FAILED (error) // Also, VduException could be thrown. - long subStartTime = System.currentTimeMillis(); try { // TODO: Get an appropriate timeout value - require access to the model vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5); @@ -1166,11 +1151,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { CloudSite cloudSite = cloudSiteOp.get(); String orchestrator = cloudSite.getOrchestrator(); - if (orchestrator.equalsIgnoreCase("CLOUDIFY")) { + if ("CLOUDIFY".equalsIgnoreCase(orchestrator)) { return cloudifyUtils; - } else if (orchestrator.equalsIgnoreCase("HEAT")) { + } else if ("HEAT".equalsIgnoreCase(orchestrator)) { return heatUtils; - } else if (orchestrator.equalsIgnoreCase("MULTICLOUD")) { + } else if ("MULTICLOUD".equalsIgnoreCase(orchestrator)) { return multicloudUtils; } else { // Default if cloudSite record exists - return HEAT plugin - will fail later diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 1c4de2daa1..ba31daaeaf 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -33,6 +33,8 @@ spring: ddl-auto: none naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy enable-lazy-load-no-trans: true + main: + allow-bean-definition-overriding: true org: onap: so: diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml index 7234733b95..17b014b993 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml @@ -47,6 +47,8 @@ spring: username: mso_admin password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' role: ACTUATOR + main: + allow-bean-definition-overriding: true #Actuator management: diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index a68bd3e0be..5697ed56a5 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -88,11 +88,9 @@ public class SDNCServiceRequestTask { String xml = genSdncReq(request, mappedTunables); - long sdncStartTime = System.currentTimeMillis(); SDNCResponseCommon response = connector.send(xml, mappedTunables); - long bpStartTime = System.currentTimeMillis(); - boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson()); + bpRestCallback.send(request.getBPNotificationUrl(), response.toJson()); } private Element addChild(Element parent, String tag) { diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml index 9be0a257c9..2ef721fca5 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml +++ b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml @@ -11,6 +11,10 @@ mso: max-pool-size: 50 queue-capacity: 500 +spring: + main: + allow-bean-definition-overriding: true + #Actuator management: endpoints: diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java index cff36061b1..2dcdf11316 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java @@ -28,8 +28,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** @@ -44,8 +42,6 @@ import org.springframework.stereotype.Component; @Component public class HealthCheckHandler { - private static Logger logger = LoggerFactory.getLogger(HealthCheckHandler.class); - private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>"; 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 3342e0d054..ab631837db 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 @@ -63,9 +63,9 @@ public class VnfmServiceProviderConfiguration { private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class); - @Value("${http.client.ssl.trust-store}") + @Value("${http.client.ssl.trust-store:#{null}}") private Resource keyStore; - @Value("${http.client.ssl.trust-store-password}") + @Value("${http.client.ssl.trust-store-password:#{null}}") private String keyStorePassword; @Bean(name = "vnfmServiceProvider") @@ -77,7 +77,9 @@ public class VnfmServiceProviderConfiguration { private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) { setGsonMessageConverter(restTemplate); - setTrustStore(restTemplate); + if (keyStore != null) { + setTrustStore(restTemplate); + } removeSpringClientFilter(restTemplate); return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider); } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml index 0bd63dffa9..4434d2edd9 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml @@ -34,6 +34,11 @@ server: port: 9092 tomcat: max-threads: 50 + ssl: + key-alias: so@so.onap.org + key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L' + key-store: classpath:so-vnfm-adapter.p12 + key-store-type: PKCS12 mso: key: 07a7159d3bf51a0e53be7a8f89699be7 @@ -50,7 +55,7 @@ sdc: endpoint: http://sdc.onap/1234A vnfmadapter: - endpoint: http://so-vnfm-adapter.onap:9092 + endpoint: https://so-vnfm-adapter.onap:9092 #Actuator management: diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 Binary files differnew file mode 100644 index 0000000000..ae4fddc684 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml index 3afc542a1b..8cf8b51b9f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml @@ -38,3 +38,17 @@ sdc: vnfmadapter: endpoint: https://so-vnfm-adapter.onap:30406 + +#Actuator +management: + endpoints: + web: + base-path: /manage + exposure: + include: "*" + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. |