diff options
Diffstat (limited to 'adapters')
8 files changed, 43 insertions, 38 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index de8aedcc47..2eeed777de 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -22,7 +22,7 @@ */ package org.onap.so.adapters.network; - + import java.net.MalformedURLException; import java.net.URL; @@ -196,9 +196,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyCreateSubnetIdMap (subnetIdMap), copyNrb (networkRollback)); } catch (Exception e) { - error = "Error sending createNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java index 6bbdebea52..aca16d9996 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -17,7 +19,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.adapters.openstack; import org.onap.so.security.MSOSpringFirewall; @@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable() .authorizeRequests() .antMatchers("/manage/health","/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",")) .and() .httpBasic(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java index 344895f8f3..30062a0144 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java @@ -34,11 +34,7 @@ public class GenericValetResponse<T> { private String errorMessage; private T returnObject; - @Override - public String toString() { - return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage) - .append("returnObject", returnObject).toString(); - } + public GenericValetResponse(int statusCode, String errorMessage, T obj) { super(); this.statusCode = statusCode; @@ -48,6 +44,11 @@ public class GenericValetResponse<T> { public GenericValetResponse() { this(-1, "not set", null); } + @Override + public String toString() { + return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage) + .append("returnObject", returnObject).toString(); + } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java index 4f7afa2d5c..5a28f65db4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java @@ -19,7 +19,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.adapters.valet.beans; import java.io.Serializable; @@ -46,9 +46,9 @@ public class HeatRequest implements Serializable { @JsonProperty("environment") private String environment; @JsonProperty("files") - private Map<String, Object> files = new HashMap<String, Object>(); + private Map<String, Object> files = new HashMap<>(); @JsonProperty("parameters") - private Map<String, Object> parameters = new HashMap<String, Object>(); + private Map<String, Object> parameters = new HashMap<>(); public HeatRequest(String stackName, boolean disableRollback, int timeoutMins, String template, String environment, Map<String, Object> files, Map<String, Object> parameters) { super(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index b4b5894491..e7bf3f79ce 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -81,7 +83,9 @@ import io.swagger.annotations.ApiResponses; public class VolumeAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - + private static final String EXCEPTION="Exception :"; + private static final String RESP=", resp="; + private static final String VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT="VolumeGroupId in URL does not match content"; @Autowired private MsoVnfAdapterImpl vnfAdapter; @@ -225,7 +229,7 @@ public class VolumeAdapterRest { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -234,7 +238,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -261,7 +265,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req); @@ -322,7 +326,7 @@ public class VolumeAdapterRest { } response = new DeleteVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -330,7 +334,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -357,7 +361,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req); @@ -420,7 +424,7 @@ public class VolumeAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -428,7 +432,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -456,7 +460,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req); @@ -552,7 +556,7 @@ public class VolumeAdapterRest { req.getVolumeGroupId(), req.getVolumeGroupStackId(), outputs.value, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -560,7 +564,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } 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 766a48a3c4..543c8e4b00 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 @@ -48,8 +48,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration("CXFConfiguration") public class CXFConfiguration { - - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); JAXRSServerFactoryBean endpoint; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java index 5bb83a7c1b..6ff6ec9379 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -18,14 +20,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.adapters.vfc; +package org.onap.so.adapters.vfc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java index b560690e30..0f0a14c8f5 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java @@ -54,6 +54,7 @@ public class VfcAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class); private static final String REQUEST_DEBUG_MSG="body from request is {}"; + private static final String APPLICATION_EXCEPTION="ApplicationException: "; @Autowired private VfcManager driverMgr ; @@ -80,7 +81,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.createNs(nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -106,7 +107,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -131,7 +132,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -156,7 +157,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -181,7 +182,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -207,7 +208,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } |