</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
- </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
endpoint: http://localhost:8090
db:
auth: Basic YnBlbDptc28tZGItMTUwNyE=
-
spring:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
- username: catalog
- password: catalog123
- driver-class-name: org.mariadb.jdbc.Driver
- initialization-mode: never
-
security:
usercredentials:
-
server:
port: 8090
-flyway:
- baseline-on-migrate: false
- jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
- user: catalog
- password: catalog123
+
spring:
datasource:
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jdbc</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>swagger-ui</artifactId>
<version>3.5.0</version>
</dependency>
-
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
tomcat:
max-threads: 50
mso:
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436
logPath: logs
+ workflow:
+ endpoint: http://bpmn-infra:8081/sobpmnengine
+ topics:
+ retryMultiplier: 1000
+ config:
+ cadi:
+ aafId: test
catalog:
db:
spring:
core-pool-size: 50
max-pool-size: 50
queue-capacity: 500
-# H2
-spring:
- datasource:
- url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
- h2:
- console:
- enabled: true
- path: /h2
- jpa:
- show-sql: true
- hibernate:
- dialect: org.hibernate.dialect.MySQL5Dialect
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable_lazy_load_no_trans: true
+spring:
security:
usercredentials:
-
retryMultiplier: 60000
spring:
datasource:
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
queue-capacity: 500
spring:
datasource:
- jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb
+ url: jdbc:mariadb://localhost:3307/catalogdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import javax.annotation.PreDestroy;
-import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import org.onap.so.logger.MsoLogger;
import java.security.SecureRandom;
@Autowired
private ASDCController asdcController;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC, ASDCControllerSingleton.class);
+ private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
@Scheduled (fixedRate = 50000)
public void periodicControllerTask() {
-
- try {
- int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
- asdcController.setControllerName("mso-controller"+randomNumber);
- asdcController.initASDC();
- } catch (ASDCControllerException e) {
- msoLogger.error(e);
-
- }
+ try {
+ int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+ asdcController.setControllerName("mso-controller" + randomNumber);
+ asdcController.initASDC();
+ } catch (ASDCControllerException e) {
+ logger.error("Exception occurred", e);
+ }
}
@PreDestroy
private void terminate () {
- try {
- asdcController.closeASDC ();
- } catch (ASDCControllerException e) {
- msoLogger.error(e);
- }
- }
+ try {
+ asdcController.closeASDC();
+ } catch (ASDCControllerException e) {
+ logger.error("Exception occurred", e);
+ }
+ }
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
// SHell command to obtain the same encryption, 128 bits key, key must be HEX
// echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
+ private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
private String asdcControllerName;
public static final String TOSCA_CSAR="TOSCA_CSAR";
public static final String WORKFLOWS="Workflows";
public static final String VF_MODULES_METADATA="VF_MODULES_METADATA";
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC,ASDCConfiguration.class);
-
-
private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT,
HEAT_ARTIFACT,
try {
decryptedKey = CryptoUtils.decrypt(config, this.configKey);
} catch (GeneralSecurityException e) {
- msoLogger.debug("Exception while decrypting property: " + propertyName, e);
+ logger.debug("Exception while decrypting property: {}", propertyName, e);
return null;
}
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.List;
import java.util.Optional;
-import org.hibernate.StaleObjectStateException;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@Component
public class ASDCController {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCController.class);
-
-
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCController.class);
protected boolean isAsdcClientAutoManaged = false;
public void initASDC () throws ASDCControllerException {
String event = "Initialize the ASDC Controller";
MsoLogger.setServiceName ("InitASDC");
- LOGGER.debug (event);
+ logger.debug(event);
if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
String endEvent = "The controller is already initialized, call the closeASDC method first";
throw new ASDCControllerException (endEvent);
distributionClient = DistributionClientFactory.createDistributionClient ();
}
- long initStartTime = System.currentTimeMillis ();
IDistributionClientResult result = this.distributionClient.init (asdcConfig,
asdcNotificationCallBack, asdcStatusCallBack);
if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client init failed with reason:"
+ result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Initialization of the ASDC Controller failed with reason:" + result.getDistributionMessageResult (), "ASDC", "init", null);
- LOGGER.debug (endEvent);
+ logger.debug (endEvent);
this.changeControllerStatus (ASDCControllerStatus.STOPPED);
throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: "
+ result.getDistributionMessageResult ());
}
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully initialize ASDC Controller", "ASDC", "init", null);
- long clientstartStartTime = System.currentTimeMillis ();
result = this.distributionClient.start ();
if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client start failed with reason:"
+ result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, endEvent, "ASDC", "start", null);
- LOGGER.debug (endEvent);
+ logger.debug (endEvent);
this.changeControllerStatus (ASDCControllerStatus.STOPPED);
throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: "
+ result.getDistributionMessageResult ());
}
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully start ASDC distribution client", "ASDC", "start", null);
-
this.changeControllerStatus (ASDCControllerStatus.IDLE);
- LOGGER.info (MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC, "ASDC", "changeControllerStatus","");
+ logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus");
}
/**
if (toscaInstaller.isResourceAlreadyDeployed (resource)) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST,
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
resource.getResourceInstance().getResourceInstanceName(),
resource.getResourceInstance().getResourceUUID(),
- resource.getResourceInstance().getResourceName(), "", "");
+ resource.getResourceInstance().getResourceName());
this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
String distributionId) throws ASDCDownloadException {
- LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
+ logger.debug("Trying to download the artifact : " + artifact.getArtifactURL ()
+ UUID_PARAM
+ artifact.getArtifactUUID ()
+ ")");
try {
downloadResult = distributionClient.download (artifact);
if (null == downloadResult) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_NULL, artifact.getArtifactUUID (), "", "");
+ logger.info ("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
return downloadResult;
}
} catch (RuntimeException e) {
- LOGGER.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
+ logger.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
this.sendASDCNotification (NotificationType.DOWNLOAD,
artifact.getArtifactURL (),
asdcConfig.getConsumerID (),
}
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) {
-
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC,
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- String.valueOf (downloadResult.getArtifactPayload ().length), "", "");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(),
+ artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length));
} else {
-
- LOGGER.error (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- downloadResult.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC artifact download fail");
+ logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ downloadResult.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC artifact download fail");
this.sendASDCNotification (NotificationType.DOWNLOAD,
artifact.getArtifactURL (),
private void writeArtifactToFile (IArtifactInfo artifact,
IDistributionClientDownloadResult resultArtifact) {
- LOGGER.debug ("Trying to write artifact to file : " + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")");
-
+ logger.debug(
+ "Trying to write artifact to file : " + artifact.getArtifactURL() + UUID_PARAM + artifact.getArtifactUUID()
+ + ")");
+
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
// make parent directory
File file = new File(filePath);
}
byte[] payloadBytes = resultArtifact.getArtifactPayload();
-
+
try (FileOutputStream outFile = new FileOutputStream(filePath)) {
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
- outFile.write(payloadBytes, 0, payloadBytes.length);
- outFile.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
- }
-
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME",
+ "ASDC", artifact.getArtifactName());
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ outFile.close();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ resultArtifact.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC write to file failed");
+ }
+
}
protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
- LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
+ resourceStructure.getResourceInstance().getResourceInstanceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
String resourceType = resourceStructure.getResourceInstance().getResourceType();
String category = resourceStructure.getResourceInstance().getCategory();
toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
} catch (ArtifactInstallerException e) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
- throw e;
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ throw e;
}
if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_OK, null);
}
}
if (errorReason != null) {
event=event+"("+errorReason+")";
}
- LOGGER.info (MessageEnum.ASDC_SEND_NOTIF_ASDC, notificationType.name (), status.name (), artifactURL, "ASDC", "sendASDCNotification");
- LOGGER.debug (event);
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
+ status.name(), artifactURL, "ASDC", "sendASDCNotification");
+ logger.debug (event);
- long subStarttime = System.currentTimeMillis ();
String action = "";
try {
IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL,
default:
break;
}
- } catch (RuntimeException e) {
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
+ } catch (RuntimeException e) {
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ "sendASDCNotification", MsoLogger.ErrorCode.SchemaError.getValue(),
+ "RuntimeException - sendASDCNotification", e);
}
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null);
}
protected void sendFinalDistributionStatus (
String errorReason) {
- LOGGER.debug ("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status.name() + " and ErrorReason " + errorReason);
+ logger.debug("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status
+ .name() + " and ErrorReason " + errorReason);
long subStarttime = System.currentTimeMillis ();
try {
}
- } catch (RuntimeException e) {
- LOGGER.debug ("Exception caught in sendFinalDistributionStatus " + e.getMessage());
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
- }
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null);
+ } catch (RuntimeException e) {
+ logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification",
+ MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e);
+ }
}
private Optional<String> getNotificationJson(INotificationData iNotif) {
try {
returnValue = Optional.of(mapper.writeValueAsString(iNotif));
} catch (JsonProcessingException e) {
- LOGGER.error("Error converting incoming ASDC notification to JSON" , e);
+ logger.error("Error converting incoming ASDC notification to JSON" , e);
}
return returnValue;
}
for (IResourceInstance resource : iNotif.getResources ()) {
noOfArtifacts += resource.getArtifacts ().size ();
}
- LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF,
- String.valueOf (noOfArtifacts),
- iNotif.getServiceUUID (), "ASDC");
-
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts),
+ iNotif.getServiceUUID(), "ASDC");
try {
- LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
-
- this.changeControllerStatus(ASDCControllerStatus.BUSY);
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC",
+ "treatNotification");
+
+ this.changeControllerStatus(ASDCControllerStatus.BUSY);
Optional<String> notificationMessage = getNotificationJson(iNotif);
toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage,
asdcConfig.getConsumerID());
distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
Thread.sleep(watchDogTimeout / 10);
}catch(Exception e){
- LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage());
+ logger.debug ("Exception in Watchdog Loop {}", e.getMessage());
Thread.sleep(watchDogTimeout / 10);
}
}
if(!componentsComplete){
- LOGGER.debug("Timeout of " + watchDogTimeout + " seconds was reached before all components reported status");
+ logger.debug("Timeout of {} seconds was reached before all components reported status", watchDogTimeout);
watchdogError = "Timeout occurred while waiting for all components to report status";
overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
}
if(distributionStatus == null){
overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- LOGGER.debug("DistributionStatus is null for DistributionId: " + iNotif.getDistributionID());
+ logger.debug("DistributionStatus is null for DistributionId: {}", iNotif.getDistributionID());
}
try {
wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
- LOGGER.debug ("A&AI Updated succefully with Distribution Status!");
+ logger.debug("A&AI Updated succefully with Distribution Status!");
}
catch(Exception e) {
- LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage());
+ logger.debug("Exception in Watchdog executePatchAAI(): {}", e.getMessage());
watchdogError = "Error calling A&AI " + e.getMessage();
if(e.getCause() != null) {
- LOGGER.debug ("Exception caused by: " + e.getCause().getMessage());
+ logger.debug("Exception caused by: {}", e.getCause().getMessage());
}
}
} catch(ObjectOptimisticLockingFailureException e) {
-
- LOGGER.debug ("OptimisticLockingFailure for DistributionId: " + iNotif.getDistributionID() + " Another process has already altered this distribution, so not going to process it on this site.");
- LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Database concurrency exception: ", "ASDC", "treatNotification", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in treatNotification",
- e);
-
+
+ logger.debug("OptimisticLockingFailure for DistributionId: {} Another process "
+ + "has already altered this distribution, so not going to process it on this site.",
+ iNotif.getDistributionID());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Database concurrency exception: ", "ASDC", "treatNotification",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
+
} catch (Exception e) {
- LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification",
+ logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Unexpected exception caught during the notification processing", "ASDC",
+ "treatNotification", MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification",
e);
-
- try {
- wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
- LOGGER.debug ("A&AI Updated succefully with Distribution Status of " + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
- }
- catch(Exception aaiException) {
- LOGGER.debug ("Exception in executePatchAAI(): " + aaiException);
- if(aaiException.getCause() != null) {
- LOGGER.debug ("Exception caused by: " + aaiException.getCause().getMessage());
- }
- }
+
+ try {
+ wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(),
+ DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ logger.debug("A&AI Updated succefully with Distribution Status of {}",
+ DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ } catch (Exception aaiException) {
+ logger.debug("Exception in executePatchAAI(): {}", aaiException);
+ if (aaiException.getCause() != null) {
+ logger.debug("Exception caused by: {}", aaiException.getCause().getMessage());
+ }
+ }
sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage());
String resourceType = resourceStructure.getResourceInstance().getResourceType();
String category = resourceStructure.getResourceInstance().getCategory();
- LOGGER.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID());
+ logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure
+ .getResourceInstance().getResourceUUID());
if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
if (resultArtifact != null) {
if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
- LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8"));
- LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
+ logger.debug("VF_MODULE_ARTIFACT: "+ new String(resultArtifact.getArtifactPayload(),"UTF-8"));
+ logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact
+ (resultArtifact.getArtifactPayload())));
}
resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
}
}
//Deploy VF resource and artifacts
- LOGGER.debug("Preparing to deploy Service: " + iNotif.getServiceUUID());
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
try{
this.deployResourceStructure(resourceStructure, toscaResourceStructure);
} catch(ArtifactInstallerException e){
deploySuccessful = false;
errorMessage = e.getMessage();
- LOGGER.error(e);
+ logger.error("Exception occurred", e);
}
}
// There are cases where the Service has no VF resources, those are handled here
if (!hasVFResource) {
- LOGGER.debug("No resources found for Service: " + iNotif.getServiceUUID());
+ logger.debug("No resources found for Service: {}", iNotif.getServiceUUID());
try{
resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance());
} catch(ArtifactInstallerException e){
deploySuccessful = false;
errorMessage = e.getMessage();
- LOGGER.error(e);
+ logger.error("Exception occurred", e);
}
}
this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage);
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
- }
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
+ }
}
protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
- LOGGER.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
+ logger.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
} catch(Exception e){
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e);
}
}
else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){
toscaResourceStructure.setToscaArtifact(artifact);
- LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
} catch(Exception e){
- System.out.println("Whats the error " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
- }
+ logger.info("Whats the error {}", e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts",
+ e);
+ }
}
}
return UNKNOWN;
}
-
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.api.notification.INotificationData;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Autowired
private ASDCController asdcController;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCNotificationCallBack.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCNotificationCallBack.class);
/**
* This method can be called multiple times at the same moment.
*/
@Override
public void activateCallback (INotificationData iNotif) {
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("NotificationHandler");
- MsoLogger.setLogContext (iNotif.getDistributionID (), iNotif.getServiceUUID ());
String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources ().size ();
- LOGGER.debug(event);
+ logger.debug(event);
asdcController.treatNotification (iNotif);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Autowired
private ToscaResourceInstaller toscaInstaller;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCStatusCallBack.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCStatusCallBack.class);
@Autowired
private WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
@Override
public void activateCallback (IStatusData iStatus) {
-
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("ASDCStatusCallBack");
- MsoLogger.setLogContext (iStatus.getDistributionID (), iStatus.getComponentName());
String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID();
try{
watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ());
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
}
- LOGGER.debug(event);
+ logger.debug(event);
toscaInstaller.installTheComponentStatus(iStatus);
}
}
}catch(ArtifactInstallerException e){
- LOGGER.error("Error in ASDCStatusCallback " + e.getMessage(),e);
- LOGGER.debug("Error in ASDCStatusCallback " + e.getMessage());
+ logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e);
+ logger.debug("Error in ASDCStatusCallback {}", e.getMessage());
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
- }
-}
\ No newline at end of file
+ }
+}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.List;
import org.onap.so.asdc.installer.IVfModuleData;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
import org.onap.sdc.impl.DistributionClientResultImpl;
import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DistributionClientEmulator implements IDistributionClient {
private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>();
- private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,DistributionClientEmulator.class );
+ private static final Logger logger = LoggerFactory.getLogger(DistributionClientEmulator.class );
public DistributionClientEmulator() {
}
byte[] inputStream=null;
try {
inputStream = getData(filename);
- } catch (IOException e) {
-
- logger.error("IOException in DistributionClientEmulator.download() method :",e);
+ } catch (IOException e) {
+ logger.error("IOException in DistributionClientEmulator.download() method", e);
}
return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),inputStream);
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
private static JsonStatusData statusData;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCRestInterface.class );
+ private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class );
@Autowired
private ASDCController asdcController;
statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()");
asdcController.initASDC();
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()");
toscaInstaller.installTheComponentStatus(statusData);
- //asdcController.treatNotification(notifDataWithoutModuleInfo);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()");
asdcController.closeASDC();
}catch(Exception e){
- System.out.println("Error caught " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION,
- "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e);
+ logger.info("Error caught " + e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
+ "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
}
- System.out.println("ASDC Updates are complete");
- LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
-
+ logger.info("ASDC Updates are complete");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC",
+ "ASDC Updates Are Complete");
return null;
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ToscaResourceStructure {
private VfModule vfModule;
private VfModuleCustomization vfModuleCustomization;
-
- //private VnfResource vnfResource;
-
+
private VnfResourceCustomization vnfResourceCustomization;
private AllottedResource allottedResource;
private ToscaCsar toscaCsar;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, ToscaResourceStructure.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceStructure.class);
public ToscaResourceStructure(){
SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable
- LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
+ logger.debug("MSO config path is: " + System.getProperty("mso.config.path"));
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
File spoolFile = new File(filePath);
-
- LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
-
+
+ logger.debug("ASDC File path is: {}", spoolFile.getAbsolutePath());
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
+ spoolFile.getAbsolutePath());
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(),false);
}catch(Exception e){
- System.out.println("System out " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
+ logger.info("System out {}", e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
+ "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Exception in " + "processResourceNotification", e);
throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e);
}
this.toscaCsar = toscaCsar;
}
- public static MsoLogger getLogger() {
- return LOGGER;
- }
-
public boolean isDeployedSuccessfully() {
return isDeployedSuccessfully;
}
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure).
*
public class VfResourceStructure {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, VfResourceStructure.class);
+ protected static final Logger logger = LoggerFactory.getLogger(VfResourceStructure.class);
private boolean isDeployedSuccessfully=false;
/**
//for vender tosca VNF there is no VFModule in VF
if (vfModulesMetadataList == null) {
- LOGGER.info(MessageEnum.ASDC_GENERAL_INFO,"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
- return;
+ logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.", "ASDC",
+ "createVfModuleStructures");
+ return;
}
for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
return listVFModuleMetaData;
} catch (JsonParseException e) {
- LOGGER.debug("JsonParseException : ",e);
+ logger.debug("JsonParseException : ",e);
} catch (JsonMappingException e) {
- LOGGER.debug("JsonMappingException : ",e);
+ logger.debug("JsonMappingException : ",e);
} catch (IOException e) {
- LOGGER.debug("IOException : ",e);
+ logger.debug("IOException : ",e);
}
return null;
}
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.logger.MessageEnum;
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.stereotype.Component;
@Component
public class BpmnInstaller {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,BpmnInstaller.class);
+ protected static final Logger logger = LoggerFactory.getLogger(BpmnInstaller.class);
private static final String BPMN_SUFFIX = ".bpmn";
private static final String CAMUNDA_URL = "mso.camundaURL";
private static final String CREATE_DEPLOYMENT_PATH = "/sobpmnengine/deployment/create";
private Environment env;
public void installBpmn(String csarFilePath) {
- LOGGER.info("Deploying BPMN files from " + csarFilePath);
+ logger.info("Deploying BPMN files from {}", csarFilePath);
try {
ZipInputStream csarFile = new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
ZipEntry entry = csarFile.getNextEntry();
while (entry != null) {
String name = entry.getName();
if (name.endsWith(BPMN_SUFFIX)) {
- LOGGER.debug("Attempting to deploy BPMN file: " + name);
+ logger.debug("Attempting to deploy BPMN file: {}", name);
try {
Path p = Paths.get(name);
String fileName = p.getFileName().toString();
extractBpmnFileFromCsar(csarFile, fileName);
HttpResponse response = sendDeploymentRequest(fileName);
- LOGGER.debug("Response status line: " + response.getStatusLine());
- LOGGER.debug("Response entity: " + response.getEntity().toString());
+ logger.debug("Response status line: {}", response.getStatusLine());
+ logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
- LOGGER.debug("Failed deploying BPMN " + name);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- name,
- fileName,
- "",
- Integer.toString(response.getStatusLine().getStatusCode()), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed");
+ logger.debug("Failed deploying BPMN {}", name);
+ logger
+ .error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName,
+ Integer.toString(response.getStatusLine().getStatusCode()), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC BPMN deploy failed");
}
else {
- LOGGER.debug("Successfully deployed to Camunda: " + name);
+ logger.debug("Successfully deployed to Camunda: {}", name);
}
}
catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- name,
- "",
- "",
- e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed");
+ logger.debug("Exception :", e);
+ logger
+ .error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
}
}
entry = csarFile.getNextEntry();
}
csarFile.close();
} catch (IOException ex) {
- LOGGER.debug("Exception :",ex);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- csarFilePath,
- "",
- "",
- ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed");
+ logger.debug("Exception :", ex);
+ logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
+ ex.getMessage(), MsoLogger.ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
return;
}
}
}
} catch (Exception e) {
- LOGGER.debug("Exception :", e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC,
- csarFilePath,"","",
- e.getMessage(), "", "",
- MsoLogger.ErrorCode.DataError, "ASDC Unable to check CSAR entries");
- }
+ logger.debug("Exception :", e);
+ logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
+ }
return workflowsInCsar;
}
}
/* outputStream.close(); */
} catch (IOException e) {
- LOGGER.error("Unable to open file.", e);
+ logger.error("Unable to open file.", e);
}
}
}
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.Set;
import java.util.stream.Collectors;
-import org.hibernate.StaleObjectStateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@Autowired
protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
- protected static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ToscaResourceInstaller.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class);
public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
boolean status = false;
}
return status;
} catch (Exception e) {
- logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError,
+ logger
+ .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), MsoLogger.ErrorCode.SchemaError.getValue(),
"Exception - isResourceAlreadyDeployed");
throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
}
}
public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
- logger.debug("Entering installTheComponentStatus for distributionId " + iStatus.getDistributionID()
- + " and ComponentName " + iStatus.getComponentName());
+ logger.debug("Entering installTheComponentStatus for distributionId {} and ComponentName {}",
+ iStatus.getDistributionID(), iStatus.getComponentName());
try {
WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(iStatus.getDistributionID(),
watchdogCDStatusRepository.save(cdStatus);
} catch (Exception e) {
- logger.debug("Exception caught in installTheComponentStatus " + e.getMessage());
+ logger.debug("Exception caught in installTheComponentStatus {}", e.getMessage());
throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
}
}
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED,
- vfResourceStructure.getResourceInstance().getResourceName(),
- vfResourceStructure.getNotification().getServiceVersion(), "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ vfResourceStructure.getResourceInstance().getResourceName(),
+ vfResourceStructure.getNotification().getServiceVersion(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - ASCDC Artifact already deployed", e);
} else {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError,
- "Exception caught during installation of "
- + vfResourceStructure.getResourceInstance().getResourceName()
- + ". Transaction rollback",
- e);
+ logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName()
+ + ". Transaction rollback", e);
throw new ArtifactInstallerException("Exception caught during installation of "
+ vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
}
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
- logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
- vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
- + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
- "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported");
+ logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
+ vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo()
+ .getArtifactName() + ")", MsoLogger.ErrorCode.DataError.getValue(), "Artifact type not supported");
break;
default:
break;
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class WatchdogDistribution {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,WatchdogDistribution.class);
+ private static final Logger logger = LoggerFactory.getLogger(WatchdogDistribution.class);
private AAIResourcesClient aaiClient;
private String[] componentNames;
public String getOverallDistributionStatus(String distributionId) throws Exception {
- LOGGER.debug("Entered getOverallDistributionStatus method for distrubutionId: " + distributionId);
+ logger.debug("Entered getOverallDistributionStatus method for distrubutionId: {}", distributionId);
String status = null;
try {
String distributionStatus = watchdogDistributionStatus.getDistributionIdStatus();
if(DistributionStatus.TIMEOUT.name().equalsIgnoreCase(distributionStatus)) {
- LOGGER.debug("Ignoring to update WatchdogDistributionStatus as distributionId: " + distributionId + " status is set to: " + distributionStatus);
+ logger.debug("Ignoring to update WatchdogDistributionStatus as distributionId: {} status is set to: {}",
+ distributionId, distributionStatus);
return DistributionStatus.TIMEOUT.name();
} else {
List<WatchdogComponentDistributionStatus> results = watchdogCDStatusRepository.findByDistributionId(distributionId);
- LOGGER.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: " + distributionId);
+ logger.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: {}",
+ distributionId);
//*************************************************************************************************************************************************
//**** Compare config values verse DB watchdog component names to see if every component has reported status before returning final result back to ASDC
for(WatchdogComponentDistributionStatus cdStatus: cdStatuses){
if(name.equals(cdStatus.getComponentName())){
- LOGGER.debug("Found componentName " + name + " in the WatchDog Component DB");
+ logger.debug("Found componentName {} in the WatchDog Component DB", name);
match = true;
break;
}
}
if(!match){
- LOGGER.debug(name + " has not be updated in the the WatchDog Component DB yet, so ending the loop");
+ logger.debug("{} has not be updated in the the WatchDog Component DB yet, so ending the loop", name);
allComponentsComplete = false;
break;
}
if(allComponentsComplete) {
- LOGGER.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
+ logger.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
for(WatchdogComponentDistributionStatus componentDist : results) {
String componentDistributionStatus = componentDist.getComponentDistributionStatus();
- LOGGER.debug("Component status: " + componentDistributionStatus + " on componentName: " + componentDist.getComponentName());
+ logger.debug("Component status: {} on componentName: ", componentDistributionStatus, componentDist
+ .getComponentName());
if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_ERROR")) {
status = DistributionStatus.FAILURE.name();
break;
}
}
- LOGGER.debug("Updating overall DistributionStatus to: " + status + " for distributionId: " + distributionId);
+ logger.debug("Updating overall DistributionStatus to: {} for distributionId: ", status, distributionId);
watchdogDistributionStatus.setDistributionIdStatus(status);
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
} else {
- LOGGER.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
+ logger.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
status = DistributionStatus.INCOMPLETE.name();
return status;
}
}
}catch (Exception e) {
- LOGGER.debug("Exception occurred on getOverallDistributionStatus : " + e.getMessage());
- LOGGER.error(e);
+ logger.debug("Exception occurred on getOverallDistributionStatus : {}", e.getMessage());
+ logger.error("Exception occurred", e);
throw new Exception(e);
}
- LOGGER.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution");
+ logger.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution");
return status;
}
public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception {
- LOGGER.debug("Entered executePatchAAI method with distrubutionId: " + distributionId + " and distributionStatus: " + distributionStatus);
+ logger.debug("Entered executePatchAAI method with distrubutionId: {} and distributionStatus: ", distributionId,
+ distributionStatus);
try {
WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId);
if(lookup != null) {
serviceModelVersionId = lookup.getServiceModelVersionId();
}
-
- LOGGER.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: " + distributionId + " and serviceModelVersionId: " + serviceModelVersionId);
- LOGGER.debug("ASDC Notification ServiceModelInvariantUUID : " + serviceModelInvariantUUID);
+
+ logger.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: {} "
+ + "and serviceModelVersionId: {}", distributionId, serviceModelVersionId);
+ logger.debug("ASDC Notification ServiceModelInvariantUUID : {}", serviceModelInvariantUUID);
if(serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) {
String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID;
- LOGGER.debug(error);
+ logger.debug(error);
throw new Exception(error);
}
AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID, serviceModelVersionId);
aaiUri.depth(Depth.ZERO); //Do not return relationships if any
- LOGGER.debug("Target A&AI Resource URI: " + aaiUri.build().toString());
+ logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString());
Map<String, String> payload = new HashMap<>();
payload.put("distribution-status", distributionStatus);
getAaiClient().update(aaiUri, payload);
-
- LOGGER.debug("A&AI UPDATE MODEL Version is success!");
+
+ logger.debug("A&AI UPDATE MODEL Version is success!");
} catch (Exception e) {
- LOGGER.debug("Exception occurred on executePatchAAI : " + e.getMessage());
- LOGGER.error(e);
+ logger.debug("Exception occurred on executePatchAAI : {}", e.getMessage());
+ logger.error("Exception occurred", e);
throw new Exception(e);
}
}
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.List;
import java.util.Map;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.notification.INotificationData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NotificationLogging implements InvocationHandler {
private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, NotificationLogging.class);
+ protected static final Logger logger = LoggerFactory.getLogger(NotificationLogging.class);
private static InvocationHandler handler = (arg0, arg1, arg2) -> {
List<Method> methods = objectMethodsToLog.get(arg0);
buffer.append(testNull(m.invoke(iNotif, (Object[])null)));
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
- LOGGER.debug("Exception :"+e);
+ logger.debug("Exception", e);
buffer.append("UNREADABLE");
}
buffer.append(System.lineSeparator());
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class BpmnRestClient {
+ private static Logger logger = LoggerFactory.getLogger(BpmnRestClient.class);
+
public static final String DEFAULT_BPEL_AUTH = "admin:admin";
public static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@Autowired
private UrnPropertiesReader urnPropertiesReader;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class);
private static boolean noProperties = true;
RequestConfig requestConfig =
RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build();
post.setConfig(requestConfig);
- msoLogger.debug("call the bpmn, url:" + recipeUri);
+ logger.debug("call the bpmn, url: {}", recipeUri);
String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
StringEntity input = new StringEntity(jsonReq);
recipeRequest.setResourceInput(resourceInput);
recipeRequest.setRecipeTimeout(recipeTimeoutInput);
jsonReq = recipeRequest.toString();
- msoLogger.trace("request body is " + jsonReq);
+ logger.trace("request body is {}", jsonReq);
} catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request",
- e);
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
try {
return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey));
} catch(GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
package org.onap.so.bpmn.common.recipe;
import org.onap.so.bpmn.core.domain.ModelInfo;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* the inputs for the resource recipe
@JsonRootName("variables")
public class ResourceInput {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class);
+ private static Logger logger = LoggerFactory.getLogger(ResourceInput.class);
@JsonProperty("resourceInstanceName")
private String resourceInstanceName;
String jsonStr = "";
try {
jsonStr = mapper.writeValueAsString(this);
- } catch(JsonProcessingException e) {
- msoLogger.error("JsonProcessingException", e);
+ } catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException", e);
}
return jsonStr;
}
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
package org.onap.so.bpmn.common.recipe;
-import org.onap.so.logger.MsoLogger;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* java object of the resource recipe , it
@JsonRootName("variables")
public class ResourceRecipeRequest {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class);
@JsonProperty("resourceInput")
private BpmnParam resourceInput;
@Override
public String toString() {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- String jsonStr = "ResourceRecipeRequest";
- try {
- jsonStr = mapper.writeValueAsString(this);
- } catch(JsonProcessingException e) {
- msoLogger.error("JsonProcessingException", e);
- }
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ String jsonStr = "ResourceRecipeRequest";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException", e);
+ }
return jsonStr;
}
-
}
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ResourceRequestBuilder {
private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources";
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class);
+ private static Logger logger = LoggerFactory.getLogger(ResourceRequestBuilder.class);
static JsonUtils jsonUtil = new JsonUtils();
}
}
} catch (Exception e) {
- LOGGER.error("not able to retrieve service order.");
+ logger.error("not able to retrieve service order.");
}
return resourceSequence;
}
}
} catch (Exception e) {
- LOGGER.error("not able to retrieve service instance");
+ logger.error("not able to retrieve service instance");
}
return new HashMap();
}
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
try {
return mapper.readValue(jsonstr, type);
- } catch(IOException e) {
- LOGGER.error("fail to unMarshal json" + e.getMessage ());
+ } catch (IOException e) {
+ logger.error("fail to unMarshal json {}", e.getMessage());
}
return null;
}
String jsonStr = null;
try {
jsonStr = mapper.writeValueAsString(srcObj);
- } catch(JsonProcessingException e) {
- LOGGER.error("SdcToscaParserException", e);
+ } catch (JsonProcessingException e) {
+ logger.error("SdcToscaParserException", e);
}
return jsonStr;
}
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.Properties;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CryptoHandler implements ICryptoHandler {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CryptoHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class);
private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :";
private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd";
keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties"));
return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY);
} catch (GeneralSecurityException | IOException e) {
- LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
+ logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
return null;
}
}
try {
return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY);
} catch (GeneralSecurityException e) {
- LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
+ logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
return null;
}
}
try {
return CryptoUtils.decrypt(encryptedPwd, MSO_KEY);
} catch (GeneralSecurityException e) {
- LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
+ logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
return null;
}
}
* ================================================================================
* Copyright (C) 2018. Intel Corp. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.MsoLogger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import java.util.Arrays;
import java.util.Optional;
public class OofInfraUtils {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofInfraUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger(OofInfraUtils.class);
/**
* This method creates a cloudsite in catalog database.
getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite());
if (!cloudSite.getId().equals(getCloudsite.getId())) {
client.postCloudSite(cloudSite);
- LOGGER.debug("Did not findd cloudsite : " + cloudSite.getId());
- LOGGER.debug("Will create cloudSite: " + cloudSite.toString());
+ logger.debug("Did not findd cloudsite : {}", cloudSite.getId());
+ logger.debug("Will create cloudSite: {}", cloudSite.toString());
}
else {
- LOGGER.debug("Found cloudsite : " + cloudSite.getId());
- LOGGER.debug("Will not create cloudSite: " + cloudSite.toString());
+ logger.debug("Found cloudsite : {}", cloudSite.getId());
+ logger.debug("Will not create cloudSite: {}", cloudSite.toString());
}
} catch (Exception e) {
- LOGGER.debug("Error looking up or creating cloudsite : " + cloudSite.getId());
- LOGGER.debug("CloudSite Lookup/Creation Error: " + e);
+ logger.debug("Error looking up or creating cloudsite : {}", cloudSite.getId());
+ logger.debug("CloudSite Lookup/Creation Error: " + e);
}
try {
client.postHomingInstance(homingInstance);
} catch (Exception exception) {
- LOGGER.debug("Could not create HomingInstance : " + homingInstance.getServiceInstanceId());
- LOGGER.debug("HomingInstance Creation Error: " + exception);
+ logger.debug("Could not create HomingInstance : {}", homingInstance.getServiceInstanceId());
+ logger.debug("HomingInstance Creation Error: {}", exception);
}
}
try {
return client.getHomingInstance(serviceInstanceId, endpoint + "/homingInstance/");
} catch (Exception exception) {
- LOGGER.debug("Could not get HomingInstance for serviceInstanceId : " + serviceInstanceId);
- LOGGER.debug("Get HomingInstance Error: " + exception);
+ logger.debug("Could not get HomingInstance for serviceInstanceId : {}", serviceInstanceId);
+ logger.debug("Get HomingInstance Error: {}", exception);
}
return null;
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class WorkflowContextHolder {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowContextHolder.class);
+ private static Logger logger = LoggerFactory.getLogger(WorkflowContextHolder.class);
private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]";
private static WorkflowContextHolder instance = null;
}
public void put(WorkflowContext context) {
- msoLogger.debug(logMarker + " Adding context to the queue: "
- + context.getRequestId());
+ logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId());
responseQueue.put(context);
}
public void remove(WorkflowContext context) {
- msoLogger.debug(logMarker + " Removing context from the queue: "
- + context.getRequestId());
+ logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId());
responseQueue.remove(context);
}
try {
WorkflowContext requestObject = responseQueue.take();
MsoLogger.setLogContext(requestObject.getRequestId(), null);
- msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS));
- msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId());
+ logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject
+ .getDelay
+ (TimeUnit.MILLISECONDS));
+ logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), requestObject
+ .getRequestId());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception e) {
- msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e);
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread");
-
+ logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
}
}
- msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
+ logger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
}
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.util.List;
import java.util.Map;
-import org.onap.so.logger.MsoLogger;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@JsonRootName(value = "requestParameters")
@JsonInclude(Include.NON_DEFAULT)
public class RequestParameters implements Serializable {
- private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class);
+ private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class);
private static final long serialVersionUID = -5979049912538894930L;
@JsonProperty("subscriptionServiceType")
try{
json = ow.writeValueAsString(this);
}catch (Exception e){
- log.error("Unable to convert Sniro Manager Request to string", e);
+ logger.error("Unable to convert Sniro Manager Request to string", e);
}
return json;
}
+ subscriptionServiceType + ", userParams=" + userParams
+ ", aLaCarte=" + aLaCarte + "]";
}
-}
\ No newline at end of file
+}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@Component("BBInputSetup")
public class BBInputSetup implements JavaDelegate {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetup.class);
+ private static final Logger logger = LoggerFactory.getLogger(BBInputSetup.class);
private static final String FLOW_VAR_NAME = "flowToBeCalled";
private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap";
private static final String GBB_INPUT_VAR_NAME = "gBBInput";
outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
- msoLogger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB));
+ logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB));
setHomingFlag(outputBB, homing, lookupKeyMap);
execution.setVariable("RetryCount", 1);
execution.setVariable("handlingCode", "Success");
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
}
}
resourceId, vnfType);
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
} else {
- msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance);
- msoLogger.debug("Related Service Instance Model Info from AAI: " + service);
+ logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
+ logger.debug("Related Service Instance Model Info from AAI: {}", service);
throw new Exception("Could not find relevant information for related Service Instance");
}
}
mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
}
} else {
- msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
+ logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
throw new Exception("Could not find relevant information for related VNF");
}
}
mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID);
}
} else {
- msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
+ logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
throw new Exception("Could not find relevant information for related VNF");
}
}
this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap,
networkId, null);
} else {
- msoLogger.debug("Could not find a network customization with key: " + key);
+ logger.debug("Could not find a network customization with key: {}", key);
}
} else {
- msoLogger.debug("Orchestrating on Collection Network Resource Customization");
+ logger.debug("Orchestrating on Collection Network Resource Customization");
CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
NetworkResourceCustomization networkResourceCustomization =
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
} else {
- msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance);
- msoLogger.debug("Related Service Instance Model Info from AAI: " + service);
+ logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
+ logger.debug("Related Service Instance Model Info from AAI: {}", service);
throw new Exception("Could not find relevant information for related Service Instance");
}
ServiceInstance serviceInstance = gBB.getServiceInstance();
if(configurationCust != null) {
this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
} else {
- msoLogger.debug("Could not find a configuration customization with key: " + key);
+ logger.debug("Could not find a configuration customization with key: {}", key);
}
}
return gBB;
org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
} else {
- msoLogger.debug("Could not find any cloud configuration for this request.");
+ logger.debug("Could not find any cloud configuration for this request.");
return null;
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component("BBInputSetupMapperLayer")
private static final String USER_PARAM_NAME_KEY = "name";
private static final String USER_PARAM_VALUE_KEY = "value";
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- BBInputSetupMapperLayer.class);
+ private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class);
private ModelMapper modelMapper = new ModelMapper();
CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
}
-}
\ No newline at end of file
+}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class);
private ObjectMapper objectMapper = new ObjectMapper();
private static final String REQUEST_ERROR = "Could not find request.";
request.setVnfId(vnfId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setVfModuleId(vfModuleId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setVolumeGroupId(volumeGroupId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setNetworkId(networkId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
customer.getServiceSubscription().getServiceType())
.queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
.orElseGet(() -> {
- msoLogger.debug("No Service Instance matched by name");
+ logger.debug("No Service Instance matched by name");
return null;
});
}
AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
.queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
.orElseGet(() -> {
- msoLogger.debug("No Service Instance matched by name");
+ logger.debug("No Service Instance matched by name");
return null;
});
}
return this.injectionHelper.getAaiClient().get(Configuration.class,
AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE))
.orElseGet(() -> {
- msoLogger.debug("No Configuration matched by id");
+ logger.debug("No Configuration matched by id");
return null;
});
}
return this.injectionHelper.getAaiClient().get(GenericVnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))
.orElseGet(() -> {
- msoLogger.debug("No Generic Vnf matched by id");
+ logger.debug("No Generic Vnf matched by id");
return null;
});
}
return this.injectionHelper.getAaiClient().get(VolumeGroup.class,
AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE))
.orElseGet(() -> {
- msoLogger.debug("No Generic Vnf matched by id");
+ logger.debug("No Generic Vnf matched by id");
return null;
});
}
return this.injectionHelper.getAaiClient().get(VfModule.class,
AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE))
.orElseGet(() -> {
- msoLogger.debug("No Generic Vnf matched by id");
+ logger.debug("No Generic Vnf matched by id");
return null;
});
}
return this.injectionHelper.getAaiClient().get(L3Network.class,
AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE))
.orElseGet(() -> {
- msoLogger.debug("No Generic Vnf matched by id");
+ logger.debug("No Generic Vnf matched by id");
return null;
});
Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
L3Network network = null;
if (!networks.isPresent()) {
- msoLogger.debug("No Networks matched by name");
+ logger.debug("No Networks matched by name");
return Optional.empty();
} else {
if (networks.get().getL3Network().size() > 1) {
Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
GenericVnf vnf = null;
if (!vnfs.isPresent()) {
- msoLogger.debug("No Vnfs matched by name");
+ logger.debug("No Vnfs matched by name");
return Optional.empty();
} else {
if (vnfs.get().getGenericVnf().size() > 1) {
Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
VolumeGroup volumeGroup = null;
if (!volumeGroups.isPresent()) {
- msoLogger.debug("No VolumeGroups matched by name");
+ logger.debug("No VolumeGroups matched by name");
return Optional.empty();
} else {
if (volumeGroups.get().getVolumeGroup().size() > 1) {
Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
VolumeGroup volumeGroup = null;
if (!volumeGroups.isPresent()) {
- msoLogger.debug("No VolumeGroups matched by name");
+ logger.debug("No VolumeGroups matched by name");
return Optional.empty();
} else {
if (volumeGroups.get().getVolumeGroup().size() > 1) {
return Optional.of(volumeGroup);
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CloudInfoFromAAI {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudInfoFromAAI.class);
+ private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class);
@Autowired
private BBInputSetupUtils bbInputSetupUtils;
new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network));
relationshipsOp = getRelationshipsFromWrapper(networkWrapper);
} else {
- msoLogger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI.");
+ logger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI.");
return Optional.empty();
}
if (relationshipsOp.isPresent()) {
return getRelatedCloudRegionAndTenant(relationshipsOp.get());
} else {
- msoLogger.debug("BBInputSetup could not find a cloud region or tenant");
+ logger.debug("BBInputSetup could not find a cloud region or tenant");
return Optional.empty();
}
}
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.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.stereotype.Component;
@Component
public class ExecuteBuildingBlockRainyDay {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- ExecuteBuildingBlockRainyDay.class);
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class);
public static final String HANDLING_CODE = "handlingCode";
@Autowired
String RetryDuration = "PT" + retryTimeToWait + "S";
execution.setVariable("RetryDuration", RetryDuration);
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
throw new BpmnError("Unknown error incrementing retry counter");
}
}
// Extract error data to be returned to WorkflowAction
execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage());
} catch (Exception e) {
- msoLogger.error("No WorkflowException Found",e);
+ logger.error("No WorkflowException Found",e);
}
RainyDayHandlerStatus rainyDayHandlerStatus;
rainyDayHandlerStatus = catalogDbClient
request.setRetryStatusMessage("Retries have been exhausted.");
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
- msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex);
+ logger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex);
}
}
if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
handlingCode = "Rollback";
}
}
- msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode);
+ logger.debug("RainyDayHandler Status Code is: {}", handlingCode);
execution.setVariable(HANDLING_CODE, handlingCode);
} catch (Exception e) {
String code = this.environment.getProperty(defaultCode);
- msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e);
+ logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e);
execution.setVariable(HANDLING_CODE, code);
}
try{
int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
execution.setVariable("maxRetries", envMaxRetries);
} catch (Exception ex) {
- msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
execution.setVariable("maxRetries", 5);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.google.common.base.CaseFormat;
@Component
public class ExtractPojosForBB {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class);
+ private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
throws BBObjectNotFoundException {
} catch (BBObjectNotFoundException e) { // re-throw parent object not found
throw e;
} catch (Exception e) { // convert all other exceptions to object not found
- msoLogger.warnSimple("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in gBBInput using reference value: " + value);
+ logger.warn("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in "
+ + "gBBInput using reference value: " + value);
throw new BBObjectNotFoundException(key, value);
}
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.avpn.dmaap.beans.InstanceReferences;
import org.onap.so.client.avpn.dmaap.beans.RequestStatus;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DmaapPropertiesClient {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DmaapPropertiesClient.class);
+ private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class);
@Autowired
private Provider<GlobalDmaapPublisher> dmaapPublisher;
try {
return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean);
} catch (JsonProcessingException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
throw new MapperException(e.getMessage());
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class ExceptionBuilder {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class);
+ private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class);
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) {
String msg = "Exception in %s.%s ";
try{
- msoLogger.error(exception);
+ logger.error("Exception occurred", exception);
String errorVariable = "Error%s%s";
}
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
- msoLogger.error(ex);
+ logger.error("Exception occurred", ex);
}
if (exception.getMessage() != null)
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
String msg = "Exception in %s.%s ";
try{
- msoLogger.error(exception);
+ logger.error("Exception occurred", exception);
String errorVariable = "Error%s%s";
break;
}
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
- msoLogger.error(ex);
+ logger.error("Exception occurred", ex);
}
if (exception.getMessage() != null)
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
- msoLogger.info("Building a WorkflowException for Subflow");
+ logger.info("Building a WorkflowException for Subflow");
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- msoLogger.info("Outgoing WorkflowException is " + exception);
- msoLogger.info("Throwing MSOWorkflowException");
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
throw new BpmnError("MSOWorkflowException");
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOCommonApplication {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- MSOCommonApplication.class);
+ private static final Logger logger = LoggerFactory.getLogger(MSOCommonApplication.class);
@Value("${mso.async.core-pool-size}")
private int corePoolSize;
@PostDeploy
public void postDeploy(ProcessEngine processEngineInstance) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Post deployment complete...");
}
@PreUndeploy
public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
List<ProcessEngine> processEngines) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Pre Undeploy complete...");
-
}
@Bean
executor.initialize();
return executor;
}
-}
\ No newline at end of file
+}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import java.io.IOException;
import java.io.InputStream;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
*/
public class FileUtil {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
/**
* Read the specified resource file and return the contents as a String.
return "";
}
} catch (IOException e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
*/
public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class);
private String callbackResponse;
private String requestId;
String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- System.out.println("callbackResponse:" + callbackResponse);
+ logger.info("callbackResponse:" + callbackResponse);
if (this.requestId != null) {
callbackResponse = callbackResponse.replace(this.requestId, requestId);
}
//Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
+ logger.info("callback Url:" + callbackUrl + ":delay:" + delay);
CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
calbackResponseThread.start();
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :", e1);
}
- LOGGER.debug("Sending callback response:" + callbackUrl);
+ logger.debug("Sending callback response:" + callbackUrl);
try {
HttpClient client = new HttpClientFactory().newTextXmlClient(
UriBuilder.fromUri(callbackUrl).build().toURL(),
TargetEntity.SDNC_ADAPTER);
client.post(payLoad);
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :", e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterNetworkTopologyMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class);
private String callbackResponse;
private String requestId;
String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- System.out.println("request callbackUrl : " + callbackUrl);
- System.out.println("request requestId : " + requestId);
-
- System.out.println("file path/name : " + responseDefinition.getBodyFileName());
+ logger.info("request callbackUrl : " + callbackUrl);
+ logger.info("request requestId : " + requestId);
+
+ logger.info("file path/name : " + responseDefinition.getBodyFileName());
callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
// extract Response responseRequestId
String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- System.out.println("response requestId: " + responseRequestId);
- System.out.println("callbackResponse (before): " + callbackResponse);
+ logger.info("response requestId: " + responseRequestId);
+ logger.info("callbackResponse (before): " + callbackResponse);
callbackResponse = callbackResponse.replace(responseRequestId, requestId);
if (this.requestId != null) {
callbackResponse = callbackResponse.replace(this.requestId, requestId);
} else {
callbackResponse = callbackResponse.replace(responseRequestId, requestId);
}
- System.out.println("callbackResponse (after):" + callbackResponse);
+ logger.info("callbackResponse (after):" + callbackResponse);
Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
int delay = 300;
}
//Kick off callback thread
- System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
+ logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
calbackResponseThread.start();
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :", e1);
}
- LOGGER.debug("Sending callback response to url: " + callbackUrl);
+ logger.debug("Sending callback response to url: {}", callbackUrl);
try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
+ HttpClient client = new HttpClientFactory()
+ .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER);
Response response = client.post(payLoad);
- LOGGER.debug("Successfully posted callback? Status: " + response.getStatus());
+ logger.debug("Successfully posted callback? Status: {}", response.getStatus());
} catch (Exception e) {
// TODO Auto-generated catch block
- LOGGER.debug("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
+ logger.debug("catch error in - request.post() ");
+ logger.debug("Exception :", e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*/
public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class);
private String notifyCallbackResponse;
private String ackResponse;
responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
updatedResponse = ackResponse.replace(responseMessageId, messageId);
} catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
+ logger.debug("Exception :",ex);
System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
}
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
+ logger.info("response (mock) messageId : {}", responseMessageId);
+ logger.info("request (replacement) messageId: {}", messageId);
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
+ logger.info("vnf Response (before): {}", notifyCallbackResponse);
+ logger.info("vnf Response (after): {}", updatedResponse);
Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
int delay = 300;
}
//Kick off callback thread
- System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
callbackResponseThread.start();
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
- LOGGER.debug("Sending callback response to url: " + callbackUrl);
+ logger.debug("Sending callback response to url: {}", callbackUrl);
try {
HttpClient client = new HttpClientFactory().newTextXmlClient(
UriBuilder.fromUri(callbackUrl).build().toURL(),
TargetEntity.VNF_ADAPTER);
Response response = client.post(payLoad);
- LOGGER.debug("Successfully posted callback? Status: " + response.getStatus());
- //System.err.println("Successfully posted callback:" + result.getStatus());
+ logger.debug("Successfully posted callback? Status: {}", response.getStatus());
} catch (Exception e) {
// TODO Auto-generated catch block
- LOGGER.debug("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
+ logger.debug("catch error in - request.post() ");
+ logger.debug("Exception :", e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*/
public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class);
private String notifyCallbackResponse;
private String ackResponse;
public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
FileSource fileSource, Parameters parameters) {
- // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse);
-
String requestBody = request.getBodyAsString();
String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
try {
// try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
notifyCallbackResponse = ackResponse;
responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
updatedResponse = ackResponse.replace(responseMessageId, messageId);
} catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
+ logger.debug("Exception :",ex);
+ logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
}
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
+ logger.info("response (mock) messageId : {}", responseMessageId);
+ logger.info("request (replacement) messageId: {}", messageId);
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
+ logger.info("vnf Response (before):{}", notifyCallbackResponse);
+ logger.info("vnf Response (after):{}", updatedResponse);
Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
int delay = 300;
}
//Kick off callback thread
- System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
callbackResponseThread.start();
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
client.post(payLoad);
} catch (Exception e) {
// TODO Auto-generated catch block
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
+ logger.info("catch error in - request.post() ");
+ logger.debug("Exception :",e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Please describe the VnfAdapterQueryMockTransformer.java class
public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterQueryMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer
+ .class);
private String notifyCallbackResponse;
private String ackResponse;
String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId);
-
+
String responseMessageId = "";
String updatedResponse = "";
-
- // if (ackResponse == null) {
- //System.err.println("file:" + responseDefinition.getBodyFileName());
- // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- //}
-
try {
// try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
notifyCallbackResponse = ackResponse;
responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
updatedResponse = ackResponse.replace(responseMessageId, messageId);
} catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
+ logger.debug("Exception :",ex);
+ logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
}
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
+
+ logger.info("response (mock) messageId : {}", responseMessageId);
+ logger.info("request (replacement) messageId: {}", messageId);
+
+ logger.info("vnf Response (before):{}", notifyCallbackResponse);
+ logger.info("vnf Response (after):{}", updatedResponse);
Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
}
//Kick off callback thread
-
- //System.out.println("notficationUrl" + notficationUrl);
- //System.out.println("updatedResponse" + updatedResponse);
- System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay);
CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- System.out.println("Inside Callback" );
+ logger.info("Inside Callback" );
callbackResponseThread.start();
return ResponseDefinitionBuilder
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
TargetEntity.VNF_ADAPTER);
client.post(payLoad);
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*/
public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRollbackMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class);
private String notifyCallbackResponse;
private String ackResponse;
try {
// try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
notifyCallbackResponse = ackResponse;
responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
updatedResponse = ackResponse.replace(responseMessageId, messageId);
} catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
+ logger.debug("Exception :",ex);
+ logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
}
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
+
+ logger.info("response (mock) messageId : {}", responseMessageId);
+ logger.info("request (replacement) messageId: {}", messageId);
+
+ logger.info("vnf Response (before):{}", notifyCallbackResponse);
+ logger.info("vnf Response (after):{}", updatedResponse);
Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
int delay = 300;
}
//Kick off callback thread
- System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
callbackResponseThread.start();
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
TargetEntity.VNF_ADAPTER);
client.post(payLoad);
} catch (Exception e) {
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
+ logger.info("catch error in - request.post() ");
+ logger.debug("Exception :", e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.TargetEntity;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Please describe the VnfAdapterUpdateMockTransformer.java class
*/
public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUpdateMockTransformer.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class);
private String notifyCallbackResponse;
private String requestId;
try {
// try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
notifyCallbackResponse = ackResponse;
responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
updatedResponse = ackResponse.replace(responseMessageId, messageId);
} catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
+ logger.debug("Exception :",ex);
+ logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
}
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
+
+ logger.info("response (mock) messageId : {}", responseMessageId);
+ logger.info("request (replacement) messageId: {}", messageId);
+
+ logger.info("vnf Response (before):{}", notifyCallbackResponse);
+ logger.info("vnf Response (after):{}", updatedResponse);
Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
int delay = 300;
}
//Kick off callback thread
- System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
callbackResponseThread.start();
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :", e1);
+ logger.debug("Exception :", e1);
}
try {
TargetEntity.VNF_ADAPTER);
client.post(payLoad);
} catch (Exception e) {
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
+ logger.info("catch error in - request.post() ");
+ logger.debug("Exception :", e);
}
}
job-execution:
max-pool-size: 30
core-pool-size: 3
-entitymanager:
- packagesToScan: com
pnf:
dmaap:
host: message-router
core-pool-size: 50
max-pool-size: 50
queue-capacity: 500
- adapters:
+ adapters:
+ requestDb:
+ endpoint: http://request-db-adapter:8083
+ auth: Basic bTA0NzY4QG5vbi1wcm9kLm1zby5lY29tcC5hdHQuY29tOkF0dG0wNDc2OExpZmUhQA==
completemsoprocess:
endpoint: http://localhost:30253/CompleteMsoProcess
db:
secret: lgjXraD1HutKxv8jEN6tVouu
service: ueb
poolMembers: localhost:3904
-server:
- port: 8080
- tomcat:
- max-threads: 50
-spring:
- h2:
- console:
- enabled: true
- path: /h2
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driverClassName: org.h2.Driver
+
+spring:
security:
usercredentials:
-
username: mso_admin
password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
role: ACTUATOR
-request:
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
-
-# Hibernate
-hibernate:
- dialect: org.hibernate.dialect.MySQL5Dialect
- show_sql: true
- hbm2ddl:
- auto: create
-
-#Actuator
-management:
- context-path: /manage
spring:
datasource:
driver-class-name: org.mariadb.jdbc.Driver
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
username: ${DB_ADMIN_USERNAME}
password: ${DB_ADMIN_PASSWORD}
http:
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import java.util.HashMap;
@Test
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
+ variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"AaiEntryExists",
"InformDmaapClient",
@Test
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+ variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"CreatePnfEntryInAai",
"AaiEntryExists",
@Primary
public class DmaapClientTestImpl implements DmaapClient {
- private String correlationId;
+ private String pnfCorrelationId;
private Runnable informConsumer;
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
- this.correlationId = correlationId;
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
@Override
- public Runnable unregister(String correlationId) {
- if (Objects.equals(this.correlationId, correlationId)) {
- this.correlationId = null;
+ public Runnable unregister(String pnfCorrelationId) {
+ if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) {
+ this.pnfCorrelationId = null;
Runnable informConsumer = this.informConsumer;
this.informConsumer = null;
return informConsumer;
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
private Map<String, String> serviceAndPnfRelationMap = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
- if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
+ if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
return Optional.empty();
}
@Override
- public void createEntry(String correlationId, Pnf entry) {
- created.put(correlationId, entry);
+ public void createEntry(String pnfCorrelationId, Pnf entry) {
+ created.put(pnfCorrelationId, entry);
}
@Override
headers.latestVersion: 2
spring:
datasource:
- jdbcUrl: jdbc:mariadb://localhost:3307/camundabpmn
+ url: jdbc:mariadb://localhost:3307/camundabpmn
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID);
- dmaapClient.unregister(correlationId);
+ String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
+ dmaapClient.unregister(pnfCorrelationId);
}
@Autowired
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import java.io.IOException;
import org.springframework.stereotype.Component;
/**
- * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn
+ * Implementation of "Check AAI for pnf_correlation_id" task in CreateAndActivatePnfResource.bpmn
*
- * Inputs: - correlationId - String
+ * Inputs: - pnfCorrelationId - String
*
* Outputs: - aaiContainsInfoAboutPnf - local Boolean
*/
@Component
-public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
+public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate {
- private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class);
+ private static final Logger logger = LoggerFactory.getLogger(CheckAaiForPnfCorrelationIdDelegate.class);
private PnfManagement pnfManagement;
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
- if (correlationId == null) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
+ if (pnfCorrelationId == null) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, PNF_CORRELATION_ID + " is not set");
}
try {
- boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent();
- logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry);
+ boolean isEntry = pnfManagement.getEntryFor(pnfCorrelationId).isPresent();
+ logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
* Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
* Inputs:
- * - correlationId - String
+ * - pnfCorrelationId - String
* - pnfUuid - String
*/
@Component
@Override
public void execute(DelegateExecution execution) throws Exception {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
String pnfUuid = (String) execution.getVariable(PNF_UUID);
Pnf pnf = new Pnf();
pnf.setPnfId(pnfUuid);
- pnf.setPnfName(correlationId);
- pnfManagement.createEntry(correlationId, pnf);
- logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid);
+ pnf.setPnfName(pnfCorrelationId);
+ pnfManagement.createEntry(pnfCorrelationId, pnf);
+ logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid);
}
}
@Override
public void execute(DelegateExecution delegateExecution) {
String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
- String pnfName = (String) delegateExecution.getVariable("correlationId");
+ String pnfName = (String) delegateExecution.getVariable("pnfCorrelationId");
try {
pnfManagementImpl.createRelation(serviceInstanceId, pnfName);
} catch (Exception e) {
private ExecutionVariableNames() {}
- public final static String CORRELATION_ID = "correlationId";
+ public final static String PNF_CORRELATION_ID = "pnfCorrelationId";
public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf";
public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp";
public final static String DMAAP_MESSAGE = "dmaapMessage";
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID);
+ String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
- dmaapClient.registerForUpdate(correlationId, () ->
+ dmaapClient.registerForUpdate(pnfCorrelationId, () ->
runtimeService
.createMessageCorrelation("WorkflowMessage")
.processInstanceBusinessKey(execution.getProcessBusinessKey())
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
@Override
public void execute(DelegateExecution execution) {
- validateCorrelationId(execution);
+ validatePnfCorrelationId(execution);
validatePnfUuid(execution);
validateTimeout(execution);
validateServiceInstanceId(execution);
}
- private void validateCorrelationId(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
- if (Strings.isNullOrEmpty(correlationId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined");
+ private void validatePnfCorrelationId(DelegateExecution execution) {
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
+ if (Strings.isNullOrEmpty(pnfCorrelationId)) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined");
}
}
public interface DmaapClient {
- void registerForUpdate(String correlationId, Runnable informConsumer);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer);
- Runnable unregister(String correlationId);
+ Runnable unregister(String pnfCorrelationId);
}
import java.util.Optional;
import java.util.Spliterator;
-public final class JsonUtilForCorrelationId {
+public final class JsonUtilForPnfCorrelationId {
- private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId";
+ private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "pnfCorrelationId";
- static List<String> parseJsonToGelAllCorrelationId(String json) {
+ static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
spliterator.forEachRemaining(jsonElement -> {
handleEscapedCharacters(jsonElement)
- .ifPresent(jsonObject -> getCorrelationId(jsonObject)
- .ifPresent(correlationId -> list.add(correlationId)));
+ .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
});
return list;
}
return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject());
}
- private static Optional<String> getCorrelationId(JsonObject jsonObject) {
- if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) {
- return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString());
+ private static Optional<String> getPnfCorrelationId(JsonObject jsonObject) {
+ if (jsonObject.has(JSON_PNF_CORRELATION_ID_FIELD_NAME)) {
+ return Optional.ofNullable(jsonObject.get(JSON_PNF_CORRELATION_ID_FIELD_NAME).getAsString());
}
return Optional.empty();
}
}
@Override
- public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) {
- logger.debug("registering for pnf ready dmaap event for correlation id: {}", correlationId);
- pnfCorrelationIdToThreadMap.put(correlationId, informConsumer);
+ public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
}
}
@Override
- public synchronized Runnable unregister(String correlationId) {
- logger.debug("unregistering from pnf ready dmaap event for correlation id: {}", correlationId);
- Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId);
+ public synchronized Runnable unregister(String pnfCorrelationId) {
+ logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
if (pnfCorrelationIdToThreadMap.isEmpty()) {
stopDmaapThreadListener();
}
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound);
+ getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
}
}
}
- private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException {
+ private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException {
if (response.getStatusLine().getStatusCode() == 200) {
String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
if (responseString != null) {
- return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString);
+ return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString);
}
}
return Collections.emptyList();
}
- private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
- Runnable runnable = unregister(correlationId);
+ private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
+ Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
- logger.debug("dmaap listener gets pnf ready event for correlationId: {}", correlationId);
+ logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId);
runnable.run();
}
}
public interface PnfManagement {
- Optional<Pnf> getEntryFor(String correlationId) throws IOException;
+ Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException;
- void createEntry(String correlationId, Pnf entry) throws IOException;
+ void createEntry(String pnfCorrelationId, Pnf entry) throws IOException;
void createRelation(String serviceInstanceId, String pnfName) throws IOException;
}
public class PnfManagementImpl implements PnfManagement {
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
- return restClient.getPnfByName(correlationId);
+ return restClient.getPnfByName(pnfCorrelationId);
}
@Override
- public void createEntry(String correlationId, Pnf entry) {
+ public void createEntry(String pnfCorrelationId, Pnf entry) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
- restClient.createPnf(correlationId, entry);
+ restClient.createPnf(pnfCorrelationId, entry);
}
@Override
DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl();
delegate.setDmaapClient(dmaapClientTest);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
- dmaapClientTest.registerForUpdate("testCorrelationId", () -> {
+ dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
});
// when
delegate.execute(delegateExecution);
import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException;
@RunWith(Enclosed.class)
-public class CheckAaiForCorrelationIdDelegateTest {
+public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class ConnectionOkTests {
- private CheckAaiForCorrelationIdDelegate delegate;
+ private CheckAaiForPnfCorrelationIdDelegate delegate;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
- delegate = new CheckAaiForCorrelationIdDelegate();
+ delegate = new CheckAaiForPnfCorrelationIdDelegate();
delegate.setPnfManagement(new PnfManagementTestImpl());
}
@Test
- public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
+ public void shouldThrowExceptionWhenPnfCorrelationIdIsNotSet() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(null);
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
// when, then
expectedException.expect(BpmnError.class);
public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
// when
delegate.execute(execution);
// then
public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
// when
delegate.execute(execution);
// then
public static class NoConnectionTests {
- private CheckAaiForCorrelationIdDelegate delegate;
+ private CheckAaiForPnfCorrelationIdDelegate delegate;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
- delegate = new CheckAaiForCorrelationIdDelegate();
+ delegate = new CheckAaiForPnfCorrelationIdDelegate();
delegate.setPnfManagement(new PnfManagementThrowingException());
}
public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
// when, then
expectedException.expect(BpmnError.class);
import static org.mockito.BDDMockito.given;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import java.util.UUID;
PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl();
delegate.setPnfManagement(pnfManagementTest);
DelegateExecution execution = mock(DelegateExecution.class);
- given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId");
+ given(execution.getVariable(eq(PNF_CORRELATION_ID))).willReturn("testPnfCorrelationId");
given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid);
// when
delegate.execute(execution);
// then
- Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId");
+ Pnf createdEntry = pnfManagementTest.getCreated().get("testPnfCorrelationId");
assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid);
- assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
+ assertThat(createdEntry.getPnfName()).isEqualTo("testPnfCorrelationId");
assertThat(createdEntry.isInMaint()).isNull();
}
}
public void setUp() {
executionFake = new DelegateExecutionFake();
executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID);
- executionFake.setVariable("correlationId", PNF_NAME);
+ executionFake.setVariable("pnfCorrelationId", PNF_NAME);
}
@Test
public class DmaapClientTestImpl implements DmaapClient {
- private String correlationId;
+ private String pnfCorrelationId;
private Runnable informConsumer;
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
- this.correlationId = correlationId;
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
@Override
- public Runnable unregister(String correlationId) {
- if (Objects.equals(this.correlationId, correlationId)) {
- this.correlationId = null;
+ public Runnable unregister(String pnfCorrelationId) {
+ if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) {
+ this.pnfCorrelationId = null;
Runnable informConsumer = this.informConsumer;
this.informConsumer = null;
return informConsumer;
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
// when
informDmaapClient.execute(delegateExecution);
// then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId");
assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
verifyZeroInteractions(messageCorrelationBuilder);
}
informDmaapClient.execute(delegateExecution);
dmaapClientTest.getInformConsumer().run();
// then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId");
InOrder inOrder = inOrder(messageCorrelationBuilder);
inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
inOrder.verify(messageCorrelationBuilder).correlateWithResult();
private DelegateExecution mockDelegateExecution() {
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
private static final String RESERVED_UUID = new UUID(0, 0).toString();
private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169";
- private static final String DEFAULT_CORRELATION_ID = "testCorrelationId";
+ private static final String DEFAULT_PNF_CORRELATION_ID = "testPnfCorrelationId";
private DelegateExecutionBuilder delegateExecutionBuilder;
}
@Test
- public void shouldThrowException_whenCorrelationIdNotSet() {
+ public void shouldThrowException_whenPnfCorrelationIdNotSet() {
PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build();
+ DelegateExecution execution = delegateExecutionBuilder.setPnfCorrelationId(null).setPnfUuid(VALID_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
}
private static class DelegateExecutionBuilder {
- private String correlationId = DEFAULT_CORRELATION_ID;
+ private String pnfCorrelationId = DEFAULT_PNF_CORRELATION_ID;
private String pnfUuid = VALID_UUID;
private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID;
- public DelegateExecutionBuilder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public DelegateExecutionBuilder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
public DelegateExecution build() {
DelegateExecution execution = new DelegateExecutionFake();
execution.setVariable("testProcessKey", "testProcessKeyValue");
- execution.setVariable(CORRELATION_ID, this.correlationId);
+ execution.setVariable(PNF_CORRELATION_ID, this.pnfCorrelationId);
execution.setVariable(PNF_UUID, this.pnfUuid);
execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId);
return execution;
private Map<String, Pnf> created = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
- if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
+ if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
return Optional.empty();
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
- created.put(correlationId, entry);
+ public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException {
+ created.put(pnfCorrelationId, entry);
}
@Override
public class PnfManagementThrowingException implements PnfManagement {
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException {
throw new IOException();
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
+ public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException {
throw new IOException();
}
import java.util.List;
import org.junit.Test;
-public class JsonUtilForCorrelationIdTest {
+public class JsonUtilForPnfCorrelationIdTest {
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\","
- + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"corrTest1\","
+ + "\"key1\":\"value1\"},{\"pnfCorrelationId\": \"corrTest2\",\"key2\":\"value2\"}]";
- private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]";
+ private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\":\"corrTest3\"}]";
- private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
- "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]";
+ private static final String JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
+ "[\"{\\\"pnfCorrelationId\\\":\\\"corrTest4\\\"}\", \"{\\\"pnfCorrelationId\\\":\\\"corrTest5\\\"}\"]";
- private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
+ private static final String JSON_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
@Test
public void parseJsonSuccessful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
- List<String> expectedResult2 = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID);
+ List<String> expectedResult2 = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
assertThat(expectedResult2).containsExactly("corrTest3");
}
@Test
public void parseJsonWithEscapeCharacters_Successful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS);
assertThat(expectedResult).containsExactly("corrTest4", "corrTest5");
}
@Test
public void parseJson_emptyListReturnedWhenNothingFound() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
assertThat(expectedResult).isEmpty();
}
@RunWith(MockitoJUnitRunner.class)
public class PnfEventReadyDmaapClientTest {
- private static final String CORRELATION_ID = "corrTestId";
- private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\","
- + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]";
+ private static final String PNF_CORRELATION_ID = "corrTestId";
+ private static final String PNF_CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"%s\","
+ + "\"value\":\"value1\"},{\"pnfCorrelationId\": \"corr\",\"value\":\"value2\"}]";
- private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
+ private static final String JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
private static final String HOST = "hostTest";
private static final int PORT = 1234;
* empty) and shutdown the executor because of empty map
*/
@Test
- public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady()
+ public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady()
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
+ thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
testedObjectInnerClassThread.run();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
verify(httpClientMock).execute(captor1.capture());
/**
* Test run method, where the are following conditions:
* <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId that does not match to correlationId
+ * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId
* taken from http response. run method should not do anything with the map not run any thread to notify camunda
* process
*/
@Test
- public void correlationIdIsFoundInHttpResponse_NotFoundInMap()
+ public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap()
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(
- String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
+ String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
/**
* Test run method, where the are following conditions:
* <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse
+ * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse
* run method should not do anything with the map and not run any thread to notify camunda process
*/
@Test
- public void correlationIdIsNotFoundInHttpResponse() throws IOException {
+ public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
+ thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
.getDeclaredField("pnfCorrelationIdToThreadMap");
pnfCorrelationToThreadMapField.setAccessible(true);
Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
- pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow);
+ pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow);
pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap);
Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning");
<bpmn:participant id="Participant_0atuyq0" name="AAI" />
<bpmn:participant id="Participant_19w87ws" name="Workflow Message Service (communication with DMAAP) " />
<bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0atuyq0" />
- <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" />
- <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForPnfCorrelationId" targetRef="Participant_0atuyq0" />
+ <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForPnfCorrelationId" />
<bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" />
<bpmn:messageFlow id="MessageFlow_0tg4hw9" sourceRef="InformDmaapClient" targetRef="Participant_19w87ws" />
<bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="CancelDmaapClientSubscription" targetRef="Participant_19w87ws" />
<bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="CreateRelationId" />
<bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
<bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
- <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
+ <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForPnfCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
<bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" />
<bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" />
<bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForPnfCorrelationId" />
<bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}">
<bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}">
+ <bpmn:serviceTask id="CheckAiiForPnfCorrelationId" name="Check AAI for pnf_correlation_id" camunda:delegateExpression="${CheckAaiForPnfCorrelationIdDelegate}">
<bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
<bpmn:text><![CDATA[Inputs:
 - timeoutForPnfEntryNotification - String
- - correlationId - String
+ - pnfCorrelationId - String
- uuid - String]]></bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
<dc:Bounds x="-80" y="228" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId">
+ <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForPnfCorrelationId">
<dc:Bounds x="219" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreatePnfEntryInAai">
<bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource">
<bpmn2:extensionElements>
<camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" />
- <camunda:in source="correlationId" target="correlationId" />
+ <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
<camunda:in businessKey="#{execution.processBusinessKey}" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming>
<bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource">
<bpmn2:extensionElements>
<camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" />
- <camunda:in source="correlationId" target="correlationId" />
+ <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
<camunda:in businessKey="#{execution.processBusinessKey}" />
<camunda:in source="pnfUuid" target="pnfUuid" />
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import org.onap.so.cloudify.base.client.CloudifyRequest;
import org.onap.so.cloudify.base.client.CloudifyResponse;
import org.onap.so.cloudify.base.client.CloudifyResponseException;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HttpClientConnector implements CloudifyClientConnector {
private static ObjectMapper DEFAULT_MAPPER;
private static ObjectMapper WRAPPED_MAPPER;
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientConnector.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientConnector.class);
static {
DEFAULT_MAPPER = new ObjectMapper();
String entityJson = mapper.writeValueAsString (request.entity().getEntity());
entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
- LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
+ logger.debug ("Request JSON Body: {}", entityJson.replaceAll("\"password\":\"[^\"]*\"",
+ "\"password\":\"***\""));
} catch (JsonProcessingException e) {
throw new HttpClientException ("Json processing error on request entity", e);
try {
httpResponse = httpClient.execute(httpRequest);
- LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode());
+ logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode());
httpClientResponse = new HttpClientResponse (httpResponse);
}
catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
- LOGGER.error("Client exception", e);
+ logger.error("Client exception", e);
throw new RuntimeException("Unexpected client exception", e);
}
finally {
try {
httpResponse.close();
} catch (IOException e) {
- LOGGER.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: " + e);
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.so.cloudify.base.client.CloudifyResponse;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public class HttpClientResponse implements CloudifyResponse {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientResponse.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
private HttpResponse response = null;
private String entityBody = null;
// Read the body so InputStream can be closed
if (response.getEntity() == null) {
- // No body
- LOGGER.debug ("No Response Body");
- return;
+ // No body
+ logger.debug("No Response Body");
+ return;
}
ByteArrayOutputStream responseBody = new ByteArrayOutputStream();
throw new HttpClientException ("Error Reading Response Body", e);
}
entityBody = responseBody.toString();
- LOGGER.debug (entityBody);
+ logger.debug(entityBody);
}
@Override
public Map<String, String> headers() {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
Header responseHeaders[] = response.getAllHeaders();
for (Header h : responseHeaders) {
private String vfModuleInstanceId;
@JsonProperty("configurationId")
private String configurationId;
- @JsonProperty("correlationId")
- private String correlationId;
@JsonProperty("instanceGroupId")
private String instanceGroupId;
this.configurationId = configurationId;
}
- public String getCorrelationId() {
- return correlationId;
- }
-
- public void setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
- }
-
public String getInstanceGroupId() {
return instanceGroupId;
}
sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
sb.append(", configurationId='").append(configurationId).append('\'');
- sb.append(", correlationId='").append(correlationId).append('\'');
sb.append('}');
return sb.toString();
}
CommonConstants.REQUEST_ID_HEADER,
CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE,
- CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
+ CommonConstants.PNF_CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE,
CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE,
@JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
private CamundaInput serviceInstanceId;
- @JsonProperty(CommonConstants.CORRELATION_ID)
- private CamundaInput correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ private CamundaInput pnfCorrelationId;
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
private CamundaInput vnfId;
this.serviceInstanceId = serviceInstanceId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public CamundaInput getCorrelationId() {
- return correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public CamundaInput getPnfCorrelationId() {
+ return pnfCorrelationId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public void setCorrelationId(CamundaInput correlationId) {
- this.correlationId = correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public void setPnfCorrelationId(CamundaInput pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
}
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE+ url);
String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
- parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
+ parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
parameterObject.getInstanceGroupId());
protected String wrapVIDRequest(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId,
+ int recipeTimeout, String requestAction, String serviceInstanceId, String pnfCorrelationId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
String serviceType, String vnfType, String vfModuleType, String networkType,
String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd,
CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
CamundaInput requestActionInput = new CamundaInput();
CamundaInput serviceInstanceIdInput = new CamundaInput();
- CamundaInput correlationIdInput = new CamundaInput();
+ CamundaInput pnfCorrelationIdInput = new CamundaInput();
CamundaInput vnfIdInput = new CamundaInput();
CamundaInput vfModuleIdInput = new CamundaInput();
CamundaInput volumeGroupIdInput = new CamundaInput();
recipeTimeoutInput.setValue(recipeTimeout);
requestActionInput.setValue(StringUtils.defaultString(requestAction));
serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
- correlationIdInput.setValue(StringUtils.defaultString(correlationId));
+ pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId));
vnfIdInput.setValue(StringUtils.defaultString(vnfId));
vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
- camundaRequest.setCorrelationId(correlationIdInput);
+ camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
camundaRequest.setVolumeGroupId(volumeGroupIdInput);
public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout";
public static final String REQUEST_ACTION_VARIABLE = "requestAction";
public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId";
- public static final String CORRELATION_ID = "correlationId";
+ public static final String PNF_CORRELATION_ID = "pnfCorrelationId";
public static final String VNF_ID_VARIABLE = "vnfId";
public static final String VF_MODULE_ID_VARIABLE = "vfModuleId";
public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId";
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
recipeTimeout = builder.recipeTimeout;
requestAction = builder.requestAction;
serviceInstanceId = builder.serviceInstanceId;
- correlationId = builder.correlationId;
+ pnfCorrelationId = builder.pnfCorrelationId;
vnfId = builder.vnfId;
vfModuleId = builder.vfModuleId;
volumeGroupId = builder.volumeGroupId;
return serviceInstanceId;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public String getVnfId() {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
return this;
}
- public Builder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public Builder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
int recipeTimeout = 10000;
String requestAction = "createInstance";
String serviceInstanceId = "12345679";
- String correlationId = "12345679";
+ String pnfCorrelationId = "12345679";
String vnfId = "234567891";
String vfModuleId = "345678912";
String volumeGroupId = "456789123";
String requestUri = "v7/serviceInstances/assign";
String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
- String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId,
+ String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId,
vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType,
vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", instanceGroupId);
String expected = inputStream("/WrappedVIDRequest.json");
-{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"correlationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}}
\ No newline at end of file
+{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}}
\ No newline at end of file
String vfModuleId = "";
String volumeGroupId = "";
String networkId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
String instanceGroupId = null;
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
instanceGroupId = sir.getInstanceGroupId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setVnfId(vnfId)
.setVfModuleId(vfModuleId)
.setVolumeGroupId(volumeGroupId)
return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope);
}
- private String getCorrelationId(ServiceInstancesRequest sir) {
+ private String getPnfCorrelationId(ServiceInstancesRequest sir) {
return Optional.of(sir)
.map(ServiceInstancesRequest::getRequestDetails)
.map(RequestDetails::getRequestParameters)
serviceInstanceId = "";
String configurationId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
configurationId = sir.getConfigurationId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
.setRecipeTimeout(Integer.parseInt(timeOut))
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setConfigurationId(configurationId)
.setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
.setApiVersion(apiVersion)
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * 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.apihandlerinfra.tenantisolation.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.apihandlerinfra.BaseTest;
+
+public class AAIClientCallFailedTest extends BaseTest {
+
+ @Test
+ public void testAAIClientCallFailedException() {
+ AAIClientCallFailed aAIClientCallFailed = new AAIClientCallFailed("failed", new Throwable("throwable"));
+ assertEquals("failed", aAIClientCallFailed.getMessage());
+ assertEquals("throwable", aAIClientCallFailed.getCause().getMessage());
+ }
+}
},
{
"type": "String",
- "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}",
+ "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}",
"valueInfo": {
},
},
"id": "595745ec-9736-11e8-8caf-022ac9304eeb",
- "name": "correlationId",
+ "name": "pnfCorrelationId",
"processDefinitionKey": "AFRFLOW",
"processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb",
"processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb",
},
{
"type": "String",
- "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}",
+ "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}",
"valueInfo": {
},