diff options
10 files changed, 22 insertions, 26 deletions
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java index 097db5c153..749e85e3db 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java @@ -66,9 +66,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata } return Optional.empty(); } catch (final Exception restProcessingException) { - logger.error("Caught exception while getting NS package model for: {}", nsdId, restProcessingException); - throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.", - restProcessingException); + final String message = "Caught exception while getting NS package model for: " + nsdId; + throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException); } } @@ -82,9 +81,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata } return Optional.empty(); } catch (final Exception restProcessingException) { - logger.error("Caught exception while getting VNF package model for: {}", vnfPkgId, restProcessingException); - throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.", - restProcessingException); + final String message = "Caught exception while getting VNF package model for: " + vnfPkgId; + throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException); } } @@ -101,9 +99,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata } return Optional.empty(); } catch (final Exception restProcessingException) { - logger.error("Caught exception while getting NS package content for: {}", nsdId, restProcessingException); - throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.", - restProcessingException); + final String message = "Caught exception while getting NS package content for: " + nsdId; + throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException); } } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java index 8c6ea92428..7adf87adf4 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java @@ -69,11 +69,11 @@ import org.springframework.web.client.RestTemplate; @Configuration public class EtsiCatalogServiceProviderConfiguration { - public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate"; + private static final Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class); public static final String ETSI_CATALOG_SERVICE_PROVIDER_BEAN = "etsiCatalogServiceProvider"; - private final static Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class); + public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate"; private final HttpClientConnectionConfiguration clientConnectionConfiguration; diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java index e3c159c7b0..54f6ad6543 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java @@ -33,8 +33,6 @@ public class EtsiCatalogUrlProvider { @Value("${etsi-catalog-manager.base.endpoint}") private String etsiCatalogManagerEndpoint; - public EtsiCatalogUrlProvider() {} - public String getNsPackageUrl(final String nsdId) { return etsiCatalogManagerEndpoint + "/nsd/v1/ns_descriptors/" + nsdId; } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java index fe710ec00b..45ed5a6002 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java @@ -79,14 +79,14 @@ public class Sol003AdapterConfiguration { @Autowired private GsonProvider gsonProvider; - @Autowired - private HttpComponentsClientConfiguration httpComponentsClientConfiguration; - @Bean @Qualifier(SOL003_ADAPTER_REST_TEMPLATE_BEAN) - public RestTemplate sol003AdapterRestTemplate() { + public RestTemplate sol003AdapterRestTemplate( + @Autowired final HttpComponentsClientConfiguration httpComponentsClientConfiguration) { + final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory(); + final RestTemplate restTemplate = new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory)); restTemplate.getInterceptors().add(new SOSpringClientFilter()); @@ -114,7 +114,7 @@ public class Sol003AdapterConfiguration { final HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory)); - } catch (Exception exception) { + } catch (final Exception exception) { logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception); } } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java index a0798f6e55..df3a0c2e31 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java @@ -22,6 +22,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm; import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_HTTP_REST_SERVICE_PROVIDER_BEAN; import java.util.Optional; +import org.apache.commons.lang3.StringUtils; import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest; import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse; import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse; @@ -76,7 +77,7 @@ public class Sol003AdapterServiceProviderImpl implements Sol003AdapterServicePro final CreateVnfResponse createVnfResponse = response.getBody(); - if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) { + if (StringUtils.isBlank(createVnfResponse.getJobId())) { LOGGER.error("Received invalid instantiation response: {}", response); return Optional.empty(); } @@ -134,7 +135,7 @@ public class Sol003AdapterServiceProviderImpl implements Sol003AdapterServicePro } final DeleteVnfResponse deleteVnfResponse = response.getBody(); - if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) { + if (StringUtils.isBlank(deleteVnfResponse.getJobId())) { LOGGER.error("Received invalid terminate response: {}", response); return Optional.empty(); } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java index 7df2e6973d..cc92234750 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java @@ -108,7 +108,7 @@ public class NetworkServiceDescriptorParser { final Map<String, Object> substitutionMappings = (Map<String, Object>) topologyTemplates.get(SUBSTITUTION_MAPPINGS); final Object nodeType = substitutionMappings.get(NODE_TYPE); - if (substitutionMappings != null && nodeType != null && NS_NODE_TYPE.equals(nodeType)) { + if (substitutionMappings != null && NS_NODE_TYPE.equals(nodeType)) { final NetworkServiceDescriptor networkServiceDescriptor = new NetworkServiceDescriptor(); networkServiceDescriptor.setType(nodeType.toString()); networkServiceDescriptor.setProperties((Map<String, Object>) substitutionMappings.get(PROPERTIES)); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java index d23e81201c..f87a35f3ab 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java @@ -48,7 +48,7 @@ public abstract class AbstractNetworkServiceTask { private final Logger logger = LoggerFactory.getLogger(getClass()); protected final DatabaseServiceProvider databaseServiceProvider; - public AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) { + protected AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) { this.databaseServiceProvider = jobServiceProvider; } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java index f3dbf37f6a..a6d35e301e 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java @@ -299,7 +299,7 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask { } private Optional<Tenant> getTenant(final Map<String, String> additionalParams) { - final String vimId = (String) additionalParams.get("vim_id"); + final String vimId = additionalParams.get("vim_id"); if (vimId != null) { final String[] splitString = vimId.split("_"); if (splitString.length == 3) { diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java index e4dc3d5e07..001c369801 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java @@ -37,7 +37,7 @@ public abstract class MonitorSol003AdapterNodeTask extends AbstractNetworkServic private static final Logger LOGGER = LoggerFactory.getLogger(MonitorSol003AdapterNodeTask.class); private final AaiServiceProvider aaiServiceProvider; - public MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider, + protected MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider, final AaiServiceProvider aaiServiceProvider) { super(databaseServiceProvider); this.aaiServiceProvider = aaiServiceProvider; @@ -56,7 +56,7 @@ public abstract class MonitorSol003AdapterNodeTask extends AbstractNetworkServic LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId); final Optional<GenericVnf> aaiGenericVnfOptional = aaiServiceProvider.getGenericVnf(vnfId); - if (!aaiGenericVnfOptional.isPresent()) { + if (aaiGenericVnfOptional.isEmpty()) { abortOperation(execution, "Unable to find generic vnf in A&AI using vnfId" + vnfId); } final GenericVnf genericVnf = aaiGenericVnfOptional.get(); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java index 23a239e3b1..c0d1df8c50 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java @@ -119,7 +119,7 @@ public class TerminateNsTask extends AbstractNetworkServiceTask { logger.info("Getting NfvoNfInstList using nsInstId: {}", nsInstId); final List<NfvoNfInst> nfvoNfInstList = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId); - if (nfvoNfInstList == null || nfvoNfInstList.size() == 0) { + if (nfvoNfInstList == null || nfvoNfInstList.isEmpty()) { final String message = "Unable to find NF Instances in database using id: " + nsInstId; abortOperation(execution, message); } |