diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
7 files changed, 122 insertions, 408 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java deleted file mode 100644 index 6c646f3e63..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 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========================================================= - */ - -package org.onap.so.adapters.network; - - -import java.security.GeneralSecurityException; -import java.util.Set; -import java.util.TreeSet; - -import javax.annotation.PostConstruct; -import javax.xml.bind.DatatypeConverter; - -import org.apache.http.HttpEntity; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.CryptoUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -/** - * This is the class that is used to POST replies from the MSO adapters to the BPEL engine. - * It can be configured via property file, or modified using the member methods. - * The properties to use are: - * org.onap.so.adapters.vnf.bpelauth encrypted authorization string to send to BEPL engine - * org.onap.so.adapters.vnf.sockettimeout socket timeout value - * org.onap.so.adapters.vnf.connecttimeout connect timeout value - * org.onap.so.adapters.vnf.retrycount number of times to retry failed connections - * org.onap.so.adapters.vnf.retryinterval interval (in seconds) between retries - * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code - * 900 means "connection was not established") - */ -@Component("NetworkBpel") -@Scope("prototype") -public class BpelRestClient { - public static final String MSO_PROP_NETWORK_ADAPTER = "MSO_PROP_NETWORK_ADAPTER"; - private static final String PROPERTY_DOMAIN = "org.onap.so.adapters.network"; - private static final String BPEL_AUTH_PROPERTY = PROPERTY_DOMAIN+".bpelauth"; - private static final String SOCKET_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".sockettimeout"; - private static final String CONN_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".connecttimeout"; - private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount"; - private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; - private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; - private static final String ENCRYPTION_KEY_PROP = PROPERTY_DOMAIN + ".encryptionKey"; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); - - @Autowired - private Environment env; - /** Default socket timeout (in seconds) */ - public static final int DEFAULT_SOCKET_TIMEOUT = 5; - /** Default connect timeout (in seconds) */ - public static final int DEFAULT_CONNECT_TIMEOUT = 5; - /** By default, retry up to five times */ - public static final int DEFAULT_RETRY_COUNT = 5; - /** Default interval to wait between retries (in seconds), negative means use backoff algorithm */ - public static final int DEFAULT_RETRY_INTERVAL = -15; - /** Default list of response codes to trigger a retry */ - public static final String DEFAULT_RETRY_LIST = "408,429,500,502,503,504,900"; // 900 is "connection failed" - /** Default credentials */ - public static final String DEFAULT_CREDENTIALS = ""; - - // Properties of the BPEL client -- all are configurable - private int socketTimeout; - private int connectTimeout; - private int retryCount; - private int retryInterval; - private Set<Integer> retryList; - private String credentials; - - // last response from BPEL engine - private int lastResponseCode; - private String lastResponse; - - /** - * Create a client to send results to the BPEL engine, using configuration from the - * MSO_PROP_NETWORK_ADAPTER properties. - */ - public BpelRestClient() { - socketTimeout = DEFAULT_SOCKET_TIMEOUT; - connectTimeout = DEFAULT_CONNECT_TIMEOUT; - retryCount = DEFAULT_RETRY_COUNT; - retryInterval = DEFAULT_RETRY_INTERVAL; - setRetryList(DEFAULT_RETRY_LIST); - credentials = DEFAULT_CREDENTIALS; - lastResponseCode = 0; - lastResponse = ""; - - } - - @PostConstruct - protected void init() { - - socketTimeout = env.getProperty(SOCKET_TIMEOUT_PROPERTY, Integer.class, DEFAULT_SOCKET_TIMEOUT); - connectTimeout = env.getProperty(CONN_TIMEOUT_PROPERTY, Integer.class, DEFAULT_CONNECT_TIMEOUT); - retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); - retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); - setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, env.getProperty(ENCRYPTION_KEY_PROP)); - } - - public int getSocketTimeout() { - return socketTimeout; - } - - public void setSocketTimeout(int socketTimeout) { - this.socketTimeout = socketTimeout; - } - - public int getConnectTimeout() { - return connectTimeout; - } - - public void setConnectTimeout(int connectTimeout) { - this.connectTimeout = connectTimeout; - } - - public int getRetryCount() { - return retryCount; - } - - public void setRetryCount(int retryCount) { - int retCnt = 0; - if (retryCount < 0) - retCnt = DEFAULT_RETRY_COUNT; - this.retryCount = retCnt; - } - - public int getRetryInterval() { - return retryInterval; - } - - public void setRetryInterval(int retryInterval) { - this.retryInterval = retryInterval; - } - - public String getCredentials() { - return credentials; - } - - public void setCredentials(String credentials) { - this.credentials = credentials; - } - - public String getRetryList() { - if (retryList.isEmpty()) - return ""; - String t = retryList.toString(); - return t.substring(1, t.length()-1); - } - - public void setRetryList(String retryList) { - Set<Integer> s = new TreeSet<>(); - for (String t : retryList.split("[, ]")) { - try { - s.add(Integer.parseInt(t)); - } catch (NumberFormatException x) { - LOGGER.debug("Exception while parsing", x); - } - } - this.retryList = s; - } - - public int getLastResponseCode() { - return lastResponseCode; - } - - public String getLastResponse() { - return lastResponse; - } - - /** - * Post a response to the URL of the BPEL engine. As long as the response code is one of those in - * the retryList, the post will be retried up to "retrycount" times with an interval (in seconds) - * of "retryInterval". If retryInterval is negative, then each successive retry interval will be - * double the previous one. - * @param toBpelStr the content (XML or JSON) to post - * @param bpelUrl the URL to post to - * @param isxml true if the content is XML, otherwise assumed to be JSON - * @return true if the post succeeded, false if all retries failed - */ - public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) { - debug("Sending response to BPEL: " + toBpelStr); - int totalretries = 0; - int retryint = retryInterval; - while (true) { - sendOne(toBpelStr, bpelUrl, isxml); - // Note: really should handle response code 415 by switching between content types if needed - if (!retryList.contains(lastResponseCode)) { - debug("Got response code: " + lastResponseCode + ": returning."); - return true; - } - if (totalretries >= retryCount) { - debug("Retried " + totalretries + " times, giving up."); - LOGGER.error(MessageEnum.RA_SEND_VNF_NOTIF_ERR, "Could not deliver response to BPEL after "+totalretries+" tries: "+toBpelStr, "Camunda", "", MsoLogger.ErrorCode.DataError, "Could not deliver response to BPEL"); - return false; - } - totalretries++; - int sleepinterval = retryint; - if (retryint < 0) { - // if retry interval is negative double the retry on each pass - sleepinterval = -retryint; - retryint *= 2; - } - debug("Sleeping for " + sleepinterval + " seconds."); - try { - Thread.sleep(sleepinterval * 1000L); - } catch (InterruptedException e) { - LOGGER.debug("Exception while Thread sleep", e); - Thread.currentThread().interrupt(); - } - } - } - private void debug(String m) { - LOGGER.debug(m); - } - private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) { - LOGGER.debug("Sending to BPEL server: "+bpelUrl); - LOGGER.debug("Content is: "+toBpelStr); - - //POST - HttpPost post = new HttpPost(bpelUrl); - if (credentials != null && !credentials.isEmpty()) - post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes())); - - //ContentType - ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON; - post.setEntity(new StringEntity(toBpelStr, ctype)); - - //Timeouts - RequestConfig requestConfig = RequestConfig - .custom() - .setSocketTimeout(socketTimeout * 1000) - .setConnectTimeout(connectTimeout * 1000) - .build(); - post.setConfig(requestConfig); - - //Client 4.3+ - //Execute & GetResponse - try (CloseableHttpClient client = HttpClients.createDefault()) { - CloseableHttpResponse response = client.execute(post); - if (response != null) { - lastResponseCode = response.getStatusLine().getStatusCode(); - HttpEntity entity = response.getEntity(); - lastResponse = (entity != null) ? EntityUtils.toString(entity) : ""; - } else { - lastResponseCode = 900; - lastResponse = ""; - } - } catch (Exception e) { - String error = "Error sending Bpel notification:" + toBpelStr; - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e); - lastResponseCode = 900; - lastResponse = ""; - } - LOGGER.debug("Response code from BPEL server: "+lastResponseCode); - LOGGER.debug("Response body is: "+lastResponse); - } - - private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { - if (env.getProperty(key) != null) { - try { - return CryptoUtils.decrypt(env.getProperty(key), encryptionKey); - } catch (GeneralSecurityException e) { - LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e); - } - } - return defaultValue; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index 8d08b3b52c..fd658244ee 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -59,6 +59,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkError; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.adapters.vnf.BpelRestClient; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; 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 2f688dbf48..5645759b02 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 @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +24,11 @@ package org.onap.so.adapters.valet; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.URI; +import javax.annotation.PostConstruct; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; import org.onap.so.adapters.valet.beans.HeatRequest; import org.onap.so.adapters.valet.beans.ValetConfirmRequest; import org.onap.so.adapters.valet.beans.ValetConfirmResponse; @@ -34,16 +40,8 @@ import org.onap.so.adapters.valet.beans.ValetRollbackRequest; import org.onap.so.adapters.valet.beans.ValetRollbackResponse; import org.onap.so.adapters.valet.beans.ValetUpdateRequest; import org.onap.so.adapters.valet.beans.ValetUpdateResponse; - -import java.net.URI; - -import javax.annotation.PostConstruct; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.adapters.valet.GenericValetResponse; - -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; @@ -52,14 +50,13 @@ 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.web.client.RestTemplate; import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.web.client.RestTemplate; @Component public class ValetClient { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ValetClient.class); + + private static Logger logger = LoggerFactory.getLogger(ValetClient.class); @Autowired private Environment environment; @@ -93,8 +90,8 @@ public class ValetClient { this.basePath = this.environment.getProperty(ValetClient.VALET_BASE_PATH, ValetClient.DEFAULT_BASE_PATH); this.authString = this.environment.getProperty(ValetClient.VALET_AUTH, ValetClient.DEFAULT_AUTH_STRING); } catch (Exception e) { - LOGGER.debug("Error retrieving valet properties. " + e.getMessage()); - } + logger.debug("Error retrieving valet properties. {}", e.getMessage()); + } } /* @@ -117,8 +114,8 @@ public class ValetClient { response = getRestTemplate().exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { - LOGGER.error("An exception occurred in callValetCreateRequest", e); - throw e; + logger.error("An exception occurred in callValetCreateRequest", e); + throw e; } return gvr; } @@ -150,8 +147,8 @@ public class ValetClient { response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { - LOGGER.error("An exception occurred in callValetUpdateRequest", e); - throw e; + logger.error("An exception occurred in callValetUpdateRequest", e); + throw e; } return gvr; } @@ -177,8 +174,8 @@ public class ValetClient { response = getRestTemplate().exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { - LOGGER.error("An exception occurred in callValetDeleteRequest", e); - throw e; + logger.error("An exception occurred in callValetDeleteRequest", e); + throw e; } return gvr; } @@ -199,12 +196,12 @@ public class ValetClient { String body = mapper.writeValueAsString(vcr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet confirm req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); - + logger.debug("valet confirm req: {} {} {} {} {}", uri, HEADERS, headers, BODY, body); + response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetConfirmResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { - LOGGER.error("An exception occurred in callValetConfirmRequest", e); + logger.error("An exception occurred in callValetConfirmRequest", e); throw e; } return gvr; @@ -231,7 +228,7 @@ public class ValetClient { response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { - LOGGER.error("An exception occurred in callValetRollbackRequest", e); + logger.error("An exception occurred in callValetRollbackRequest", e); throw e; } return gvr; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 5fa21c64b1..4b02b73786 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -57,7 +57,7 @@ import org.springframework.stereotype.Component; * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code * 900 means "connection was not established") */ -@Component("VnfBpel") +@Component() @Scope("prototype") public class BpelRestClient { public static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER"; @@ -249,6 +249,8 @@ public class BpelRestClient { if (credentials != null && !credentials.isEmpty()) post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes())); + LOGGER.debug("HTTPPost Headers: " + post.getAllHeaders()); + //ContentType ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON; post.setEntity(new StringEntity(toBpelStr, ctype)); 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 cbdd29d83c..7913a6d827 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 @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +25,13 @@ package org.onap.so.adapters.vnf; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import java.util.HashMap; import java.util.Map; - import javax.inject.Provider; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -41,7 +46,6 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; - import org.apache.http.HttpStatus; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; @@ -61,16 +65,12 @@ import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - /** * This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. @@ -81,7 +81,8 @@ import io.swagger.annotations.ApiResponses; @Api(value = "/v1/volume-groups", description = "root of volume-groups adapters restful web service") @Component public class VolumeAdapterRest { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRest.class); + + private static final Logger logger = LoggerFactory.getLogger(VolumeAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String EXCEPTION="Exception :"; private static final String RESP=", resp="; @@ -108,7 +109,7 @@ public class VolumeAdapterRest { @ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req ) { - LOGGER.debug("createVNFVolumes enter: " + req.toJsonString()); + logger.debug("createVNFVolumes enter: {}", req.toJsonString()); CreateVNFVolumesTask task = new CreateVNFVolumesTask(req); if (req.isSynchronous()) { // This is a synchronous request @@ -124,11 +125,12 @@ public class VolumeAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, "", "createVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVNFVolumes", e); + logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("createVNFVolumes exit"); + logger.debug("createVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -160,14 +162,14 @@ public class VolumeAdapterRest { } @Override public void run() { - LOGGER.debug ("CreateVFModule VolumesTask start"); + logger.debug("CreateVFModule VolumesTask start"); try { // Synchronous Web Service Outputs Holder<String> stackId = new Holder<>(); Holder<Map<String, String>> outputs = new Holder<>(); Holder<VnfRollback> vnfRollback = new Holder<>(); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); - LOGGER.debug("in createVfModuleVolumes - completeVnfVfModuleType=" + completeVnfVfModuleType); + logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType); String cloudsite = req.getCloudSiteId(); if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) { @@ -231,7 +233,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()); } @@ -240,7 +242,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()); } } @@ -262,7 +264,7 @@ public class VolumeAdapterRest { final DeleteVolumeGroupRequest req ) { - LOGGER.debug("deleteVNFVolumes enter: " + req.toJsonString()); + logger.debug("deleteVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -285,11 +287,12 @@ public class VolumeAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "deleteVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - deleteVNFVolumes", e); + logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("deleteVNFVolumes exit"); + logger.debug("deleteVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -321,14 +324,14 @@ public class VolumeAdapterRest { } @Override public void run() { - LOGGER.debug("DeleteVNFVolumesTask start"); + logger.debug("DeleteVNFVolumesTask start"); try { if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) { vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest()); } 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()) { @@ -336,7 +339,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()); } } @@ -358,7 +361,7 @@ public class VolumeAdapterRest { final RollbackVolumeGroupRequest req ) { - LOGGER.debug("rollbackVNFVolumes enter: " + req.toJsonString()); + logger.debug("rollbackVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || req.getVolumeGroupRollback() == null || !aaiVolumeGroupId.equals(req.getVolumeGroupRollback().getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -381,11 +384,12 @@ public class VolumeAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVNFVolumes", e); + logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug("rollbackVNFVolumes exit"); + logger.debug("rollbackVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -417,7 +421,7 @@ public class VolumeAdapterRest { } @Override public void run() { - LOGGER.debug("DeleteVNFVolumesTask start"); + logger.debug("DeleteVNFVolumesTask start"); try { VolumeGroupRollback vgr = req.getVolumeGroupRollback(); VnfRollback vrb = new VnfRollback( @@ -426,7 +430,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()) { @@ -434,7 +438,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()); } } @@ -457,7 +461,7 @@ public class VolumeAdapterRest { final UpdateVolumeGroupRequest req ) { - LOGGER.debug("updateVNFVolumes enter: " + req.toJsonString()); + logger.debug("updateVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -480,11 +484,12 @@ public class VolumeAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, "", "updateVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - updateVNFVolumes", e); + logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("updateVNFVolumes exit"); + logger.debug("updateVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -516,12 +521,12 @@ public class VolumeAdapterRest { } @Override public void run() { - LOGGER.debug("UpdateVNFVolumesTask start"); + logger.debug("UpdateVNFVolumesTask start"); try { Holder<Map<String, String>> outputs = new Holder<> (); Holder<VnfRollback> vnfRollback = new Holder<> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); - LOGGER.debug("in updateVfModuleVolume - completeVnfVfModuleType=" + completeVnfVfModuleType); + logger.debug("in updateVfModuleVolume - completeVnfVfModuleType={}", completeVnfVfModuleType); if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { outputs.value = testMap(); @@ -558,7 +563,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()) { @@ -566,7 +571,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()); } } @@ -597,7 +602,7 @@ public class VolumeAdapterRest { ) { //This request responds synchronously only - LOGGER.debug ("queryVNFVolumes enter:" + aaiVolumeGroupId + " " + volumeGroupStackId); + logger.debug("queryVNFVolumes enter: {} {}", aaiVolumeGroupId, volumeGroupStackId); MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId); try { @@ -619,23 +624,24 @@ public class VolumeAdapterRest { vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); } if (!vnfExists.value) { - LOGGER.debug ("VNFVolumes not found"); + logger.debug("VNFVolumes not found"); qryResp.setVolumeGroupStatus(status.value); respStatus = HttpStatus.SC_NOT_FOUND; } else { - LOGGER.debug ("VNFVolumes found " + vfModuleId.value + ", status=" + status.value); + logger.debug("VNFVolumes found {}, status={}", vfModuleId.value, status.value); qryResp.setVolumeGroupStatus(status.value); qryResp.setVolumeGroupOutputs(outputs.value); } - LOGGER.debug("Query queryVNFVolumes exit"); + logger.debug("Query queryVNFVolumes exit"); return Response .status(respStatus) .entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}) .build(); } catch (VnfException e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, aaiVolumeGroupId, "", "queryVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - queryVNFVolumes", e); + logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes", MessageEnum.RA_QUERY_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); - LOGGER.debug("Query queryVNFVolumes exit"); + logger.debug("Query queryVNFVolumes exit"); return Response .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) .entity(new GenericEntity<VolumeGroupExceptionResponse>(excResp) {}) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 445f0071a7..3dc223f5c7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -5,6 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +24,13 @@ package org.onap.so.adapters.vnf; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import java.util.HashMap; import java.util.Map; - import javax.inject.Provider; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -40,7 +45,6 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; - import org.apache.http.HttpStatus; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; @@ -60,16 +64,12 @@ import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - /** * This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. @@ -83,7 +83,8 @@ import io.swagger.annotations.ApiResponses; @Api(value = "/v2/volume-groups", description = "root of volume-groups adapters restful web service v2") @Component public class VolumeAdapterRestV2 { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRestV2.class); + + private static final Logger logger = LoggerFactory.getLogger(VolumeAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String RESP=", resp="; private static final String EXCEPTION="Exception :"; @@ -113,7 +114,7 @@ public class VolumeAdapterRestV2 { @ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req) { - LOGGER.debug("createVNFVolumes enter: " + req.toJsonString()); + logger.debug("createVNFVolumes enter: {}", req.toJsonString()); CreateVNFVolumesTask task = new CreateVNFVolumesTask(req, mode); if (req.isSynchronous()) { // This is a synchronous request @@ -129,11 +130,12 @@ public class VolumeAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, "", "createVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVNFVolumes", e); + logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("createVNFVolumes exit"); + logger.debug("createVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -167,14 +169,14 @@ public class VolumeAdapterRestV2 { } @Override public void run() { - LOGGER.debug ("CreateVFModule VolumesTask start"); + logger.debug("CreateVFModule VolumesTask start"); try { // Synchronous Web Service Outputs Holder<String> stackId = new Holder<>(); Holder<Map<String, String>> outputs = new Holder<>(); Holder<VnfRollback> vnfRollback = new Holder<>(); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); - LOGGER.debug("in createVfModuleVolumes - completeVnfVfModuleType=" + completeVnfVfModuleType); + logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType); String cloudsiteId = req.getCloudSiteId(); if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) { @@ -226,7 +228,7 @@ public class VolumeAdapterRestV2 { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug(EXCEPTION,e); + logger.debug(EXCEPTION, e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -235,7 +237,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -259,7 +261,7 @@ public class VolumeAdapterRestV2 { final DeleteVolumeGroupRequest req ) { - LOGGER.debug("deleteVNFVolumes enter: " + req.toJsonString()); + logger.debug("deleteVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -282,11 +284,12 @@ public class VolumeAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "deleteVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - deleteVNFVolumes", e); + logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("deleteVNFVolumes exit"); + logger.debug("deleteVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -320,7 +323,7 @@ public class VolumeAdapterRestV2 { } @Override public void run() { - LOGGER.debug("DeleteVNFVolumesTask start"); + logger.debug("DeleteVNFVolumesTask start"); String cloudSiteId = req.getCloudSiteId(); try { if (! cloudSiteId.equals(TESTING_KEYWORD)) { @@ -330,7 +333,7 @@ public class VolumeAdapterRestV2 { } 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()) { @@ -338,7 +341,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -360,7 +363,7 @@ public class VolumeAdapterRestV2 { final RollbackVolumeGroupRequest req ) { - LOGGER.debug("rollbackVNFVolumes enter: " + req.toJsonString()); + logger.debug("rollbackVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || req.getVolumeGroupRollback() == null || !aaiVolumeGroupId.equals(req.getVolumeGroupRollback().getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -383,11 +386,12 @@ public class VolumeAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVNFVolumes", e); + logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug("rollbackVNFVolumes exit"); + logger.debug("rollbackVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -419,7 +423,7 @@ public class VolumeAdapterRestV2 { } @Override public void run() { - LOGGER.debug("RollbackVNFVolumesTask start"); + logger.debug("RollbackVNFVolumesTask start"); try { VolumeGroupRollback vgr = req.getVolumeGroupRollback(); VnfRollback vrb = new VnfRollback( @@ -431,7 +435,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -439,7 +443,7 @@ public class VolumeAdapterRestV2 { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("RollbackVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); + logger.debug("RollbackVNFVolumesTask exit: code= {} {} {}", getStatusCode(), RESP, getResponse()); } } @@ -464,7 +468,7 @@ public class VolumeAdapterRestV2 { final UpdateVolumeGroupRequest req ) { - LOGGER.debug("updateVNFVolumes enter: " + req.toJsonString()); + logger.debug("updateVNFVolumes enter: {}", req.toJsonString()); if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -487,11 +491,12 @@ public class VolumeAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, "", "updateVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - updateVNFVolumes", e); + logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("updateVNFVolumes exit"); + logger.debug("updateVNFVolumes exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -525,12 +530,12 @@ public class VolumeAdapterRestV2 { } @Override public void run() { - LOGGER.debug("UpdateVNFVolumesTask start"); + logger.debug("UpdateVNFVolumesTask start"); try { Holder<Map<String, String>> outputs = new Holder<> (); Holder<VnfRollback> vnfRollback = new Holder<> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); - LOGGER.debug("in updateVfModuleVolume - completeVnfVfModuleType=" + completeVnfVfModuleType); + logger.debug("in updateVfModuleVolume - completeVnfVfModuleType={}", completeVnfVfModuleType); if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { outputs.value = testMap(); @@ -557,7 +562,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -565,7 +570,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -598,7 +603,7 @@ public class VolumeAdapterRestV2 { ) { //This request responds synchronously only - LOGGER.debug ("queryVNFVolumes enter:" + aaiVolumeGroupId + " " + volumeGroupStackId); + logger.debug("queryVNFVolumes enter: {} {}", aaiVolumeGroupId, volumeGroupStackId); MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId); try { @@ -622,23 +627,24 @@ public class VolumeAdapterRestV2 { vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); } if (!vnfExists.value) { - LOGGER.debug ("VNFVolumes not found"); + logger.debug("VNFVolumes not found"); qryResp.setVolumeGroupStatus(status.value); respStatus = HttpStatus.SC_NOT_FOUND; } else { - LOGGER.debug ("VNFVolumes found " + vfModuleId.value + ", status=" + status.value); + logger.debug("VNFVolumes found {}, status={}", vfModuleId.value, status.value); qryResp.setVolumeGroupStatus(status.value); qryResp.setVolumeGroupOutputs(outputs.value); } - LOGGER.debug("Query queryVNFVolumes exit"); + logger.debug("Query queryVNFVolumes exit"); return Response .status(respStatus) .entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}) .build(); } catch (VnfException e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, aaiVolumeGroupId, "", "queryVNFVolumes", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - queryVNFVolumes", e); + logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes: ", MessageEnum.RA_QUERY_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); - LOGGER.debug("Query queryVNFVolumes exit"); + logger.debug("Query queryVNFVolumes exit"); return Response .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) .entity(new GenericEntity<VolumeGroupExceptionResponse>(excResp) {}) diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 4e8d389998..a68372f833 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -18,7 +18,7 @@ mso: retryMultiplier: 60000 spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver |