<build.tools.version>${project.version}</build.tools.version>
<togglz.version>2.4.1.Final</togglz.version>
<bouncycastle.version>1.61</bouncycastle.version>
+ <onap.logging.version>1.5.0</onap.logging.version>
</properties>
<dependencyManagement>
package org.openecomp.sdcrests.action.rest.services;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR;
import static org.openecomp.sdc.action.ActionConstants.ACTION_REQUEST_PARAM_NAME;
import static org.openecomp.sdc.action.ActionConstants.ACTION_REQUEST_PARAM_SUPPORTED_COMPONENTS;
import static org.openecomp.sdc.action.ActionConstants.ACTION_REQUEST_PARAM_SUPPORTED_MODELS;
import org.openecomp.sdc.action.errors.ActionErrorConstants;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
-import org.openecomp.sdc.action.logging.StatusCode;
import org.openecomp.sdc.action.types.Action;
import org.openecomp.sdc.action.types.ActionArtifact;
import org.openecomp.sdc.action.types.ActionArtifactProtection;
responseList = getActionsByInvId(servletRequest, invariantID);
} else {
Response response = getActionByUUID(servletRequest, invariantID, actionUUID);
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return response;
}
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error("");
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error("");
}
LOGGER.debug(" exit getActionsByActionInvariantUuId ");
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return Response.ok(responseList).build();
}
response.setActionList(null);
response.setComponentList(openEcompComponents);
LOGGER.debug(" exit getEcompComponents ");
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return Response.ok(response).build();
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error("");
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error("");
if (StringUtils.isEmpty(servletRequest.getQueryString())) {
response = getAllActions(servletRequest);
LOGGER.debug(" exit getFilteredActions ");
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return response;
}
validateNoOfFilterParamsExactly1(noOfFilterParams);
}
LOGGER.debug(" exit getFilteredActions ");
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return response;
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error("");
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error("");
} else {
checkAndThrowError(errorMap);
}
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
LOGGER.debug(" exit API createAction with ActionInvariantUUID= " + MDC.get(SERVICE_INSTANCE_ID));
return Response.ok(actionResponseDTO).build();
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error("");
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
} else {
checkAndThrowError(errorMap);
}
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error("");
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
checkAndThrowError(errorMap);
}
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
return Response.ok(new ActionResponseDto()).build();
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
ActionResponseDto actionResponseDTO = new ActionResponseDto();
new MapActionToActionResponseDto().doMapping(action, actionResponseDTO);
response = Response.ok(actionResponseDTO).build();
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
response =
uploadArtifactInternal(actionInvariantUUID, artifactName, artifactLabel, artifactCategory,
artifactDescription, artifactProtection, checksum, artifactToUpload, servletRequest);
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
LOGGER.debug("exiting uploadArtifact with actionInvariantUuId= " + actionInvariantUUID +
"artifactName= " + artifactName);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
" entering downloadArtifact with actionUUID= " + actionUUID + " and artifactUUID= " +
artifactUUID);
response = downloadArtifactInternal(actionUUID, artifactUUID, servletRequest);
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
response = deleteArtifactInternal(actionInvariantUUID, artifactUUID, servletRequest);
LOGGER.debug(" exit deleteArtifact with actionInvariantUuId= " + actionInvariantUUID +
" and artifactUUID= " + artifactUUID);
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
updateArtifactInternal(actionInvariantUUID, artifactUUID, artifactName, artifactLabel,
artifactCategory, artifactDescription, artifactProtection, checksum, artifactToUpdate,
servletRequest);
- actionLogPostProcessor(StatusCode.COMPLETE, true);
+ actionLogPostProcessor(COMPLETE, true);
} catch (ActionException exception) {
- actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true);
+ actionLogPostProcessor(ERROR, exception.getErrorCode(), exception.getDescription(), true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription());
LOGGER.error(MDC.get(ERROR_DESCRIPTION));
throw exception;
} catch (Exception exception) {
- actionLogPostProcessor(StatusCode.ERROR, true);
+ actionLogPostProcessor(ERROR, true);
actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
LOGGER.error(exception.getMessage());
MDC.put(PARTNER_NAME, servletRequest.getRemoteUser());
MDC.put(INSTANCE_UUID, MDC_ASDC_INSTANCE_UUID);
MDC.put(SERVICE_METRIC_BEGIN_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
- MDC.put(STATUS_CODE, StatusCode.COMPLETE.name());
+ MDC.put(STATUS_CODE, COMPLETE.name());
MDC.put(SERVICE_NAME, requestType.name());
MDC.put(CLIENT_IP, MDC.get(REMOTE_HOST));
MDC.put(SERVICE_INSTANCE_ID, actionInvariantId);
<bean class="org.openecomp.sdcrests.errors.DefaultExceptionMapper"/>
<bean class="org.openecomp.sdcrests.errors.ZusammenExceptionMapper"/>
<bean class="org.openecomp.sdc.logging.servlet.jaxrs.LoggingRequestFilter">
- <property name="requestIdHeaders" value="X-ECOMP-RequestID,X-ONAP-RequestID"/>
- <property name="partnerNameHeaders" value="USER_ID"/>
+ <property name="requestIdHeaders" value="X-ONAP-RequestID,X-RequestID,X-TransactionId,X-ECOMP-RequestID"/>
+ <property name="partnerNameHeaders" value="USER_ID,X-ONAP-PartnerName,User-Agent"/>
</bean>
<bean class="org.openecomp.sdc.logging.servlet.jaxrs.LoggingResponseFilter"/>
</jaxrs:providers>
import org.openecomp.sdc.action.dao.types.ActionEntity;
import org.openecomp.sdc.action.errors.ActionErrorConstants;
import org.openecomp.sdc.action.errors.ActionException;
-import org.openecomp.sdc.action.logging.StatusCode;
-import org.openecomp.sdc.action.types.Action;
-import org.openecomp.sdc.action.types.ActionArtifact;
-import org.openecomp.sdc.action.types.ActionArtifactProtection;
-import org.openecomp.sdc.action.types.ActionStatus;
-import org.openecomp.sdc.action.types.ActionSubOperation;
-import org.openecomp.sdc.action.types.OpenEcompComponent;
+import org.openecomp.sdc.action.types.*;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.slf4j.MDC;
+import java.util.*;
+
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR;
+import static org.openecomp.sdc.action.ActionConstants.*;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
+import static org.openecomp.sdc.action.util.ActionUtil.*;
+import static org.openecomp.sdc.versioning.dao.types.Version.VERSION_STRING_VIOLATION_MSG;
+
/**
* Manager Implementation for {@link ActionManager Action Library Operations}
* <br>
"entering deleteAction with actionInvariantUuId = " + actionInvariantUuId + " and user = " + user);
actionLogPreProcessor(ActionSubOperation.DELETE_ACTION, TARGET_ENTITY_API);
versioningManager.delete(ACTION_VERSIONABLE_TYPE, actionInvariantUuId, user);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
actionDao.deleteAction(actionInvariantUuId);
} catch (CoreException ce) {
try {
actionLogPreProcessor(ActionSubOperation.VALIDATE_ACTION_UNIQUE_NAME, TARGET_ENTITY_API);
uniqueValueUtil.validateUniqueValue(ActionConstants.UniqueValues.ACTION_NAME, action.getName());
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
} catch (CoreException exception) {
String errorDesc = String.format(ACTION_ENTITY_UNIQUE_VALUE_MSG, ActionConstants.UniqueValues.ACTION_NAME,
action.getName());
log.error(errorDesc, exception);
- actionLogPostProcessor(StatusCode.ERROR, ACTION_ENTITY_UNIQUE_VALUE_ERROR, errorDesc, false);
+ actionLogPostProcessor(ERROR, ACTION_ENTITY_UNIQUE_VALUE_ERROR, errorDesc, false);
throw new ActionException(ACTION_ENTITY_UNIQUE_VALUE_ERROR, errorDesc);
} finally {
log.metrics("");
actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_VERSION, TARGET_ENTITY_API);
Version version = versioningManager.create(ACTION_VERSIONABLE_TYPE, action.getActionInvariantUuId(), user);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
action.setVersion(version.toString());
actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_UNIQUE_VALUE, TARGET_ENTITY_API);
uniqueValueUtil.createUniqueValue(ActionConstants.UniqueValues.ACTION_NAME, action.getName());
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
return action;
actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_API);
VersionInfo versionInfo = versioningManager.getEntityVersionInfo(ACTION_VERSIONABLE_TYPE, invariantUuId,
user, VersionableEntityAction.Write);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
Version activeVersion = versionInfo.getActiveVersion();
log.debug("entering checkout for Action with invariantUUID= " + invariantUuId + BY_USER + user);
actionLogPreProcessor(ActionSubOperation.CHECKOUT_ACTION, TARGET_ENTITY_API);
version = versioningManager.checkout(ACTION_VERSIONABLE_TYPE, invariantUuId, user);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
actionEntity = updateUniqueIdForVersion(invariantUuId, version, ActionStatus.Locked.name(), user);
actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
VersionInfoEntity versionInfoEntity = versionInfoDao
.get(new VersionInfoEntity(ACTION_VERSIONABLE_TYPE, invariantUuId));
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
String checkoutUser = versionInfoEntity.getCandidate()
.getUser();
// Get list of uploaded artifacts in this checked out version
VersionInfoEntity versionInfoEntity = versionInfoDao
.get(new VersionInfoEntity(ACTION_VERSIONABLE_TYPE, invariantUuId));
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
if (versionInfoEntity == null) {
throw new CoreException(new EntityNotExistErrorBuilder(ACTION_VERSIONABLE_TYPE, invariantUuId).build());
actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VERSION, TARGET_ENTITY_DB);
Action action = actionDao.get(new ActionEntity(invariantUuId, activeVersion))
.toDto();
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
// Perform undo checkout on the action
actionLogPreProcessor(ActionSubOperation.UNDO_CHECKOUT_ACTION, TARGET_ENTITY_API);
version = versioningManager.undoCheckout(ACTION_VERSIONABLE_TYPE, invariantUuId, user);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
if (version.equals(new Version(0, 0))) {
actionLogPreProcessor(ActionSubOperation.DELETE_UNIQUEVALUE, TARGET_ENTITY_API);
UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
uniqueValueUtil.deleteUniqueValue(ActionConstants.UniqueValues.ACTION_NAME, action.getName());
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
actionLogPreProcessor(ActionSubOperation.DELETE_ACTIONVERSION, TARGET_ENTITY_DB);
// Added for the case where Create->Undo_Checkout->Checkout
// should not get the action
versionInfoDao.delete(new VersionInfoEntity(ACTION_VERSIONABLE_TYPE, invariantUuId));
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
}
getEffectiveVersion(activeVersion.toString()));
actionLogPreProcessor(ActionSubOperation.DELETE_ARTIFACT, TARGET_ENTITY_DB);
actionArtifactDao.delete(artifactDeleteEntity);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
}
}
log.debug("entering checkin for Action with invariantUUID= " + invariantUuId + BY_USER + user);
actionLogPreProcessor(ActionSubOperation.CHECKIN_ACTION, TARGET_ENTITY_API);
version = versioningManager.checkin(ACTION_VERSIONABLE_TYPE, invariantUuId, user, null);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
actionEntity = updateStatusForVersion(invariantUuId, version, ActionStatus.Available.name(), user);
} catch (CoreException exception) {
log.debug("entering submit for Action with invariantUUID= " + invariantUuId + BY_USER + user);
actionLogPreProcessor(ActionSubOperation.SUBMIT_ACTION, TARGET_ENTITY_API);
version = versioningManager.submit(ACTION_VERSIONABLE_TYPE, invariantUuId, user, null);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
actionEntity = updateUniqueIdForVersion(invariantUuId, version, ActionStatus.Final.name(), user);
} catch (CoreException exception) {
actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
VersionInfo versionInfo = versioningManager.getEntityVersionInfo(ACTION_VERSIONABLE_TYPE,
actionInvariantUuId, user, VersionableEntityAction.Write);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
Version activeVersion = versionInfo.getActiveVersion();
actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB);
Action action = actionDao.get(new ActionEntity(actionInvariantUuId, activeVersion))
.toDto();
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
String artifactUuId = generateActionArtifactUuId(action, artifact.getArtifactName());
// Check for Unique document name
actionEntity.setData(data);
actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
actionDao.update(actionEntity);
- actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
// delete Artifact if it's upload and delete action on same checkout
// version
actionLogPreProcessor(ActionSubOperation.DELETE_ACTION_ARTIFACT, TARGET_ENTITY_DB);
actionArtifactDao.delete(artifactDeleteEntity);
}
- actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
}
actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_API);
VersionInfo versionInfo = versioningManager.getEntityVersionInfo(ACTION_VERSIONABLE_TYPE,
actionInvariantUuId, user, VersionableEntityAction.Write);
- actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
Version activeVersion = versionInfo.getActiveVersion();
actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB);
Action action = actionDao.get(new ActionEntity(actionInvariantUuId, activeVersion))
.toDto();
- actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
List<ActionArtifact> actionArtifacts = action.getArtifacts();
ActionArtifact artifactMetadataByUuId = getArtifactMetadataFromAction(actionArtifacts,
actionLogPreProcessor(ActionSubOperation.GET_VERSIONINFO_FOR_ALL_ACTIONS, TARGET_ENTITY_API);
Map<String, VersionInfo> actionVersionMap = versioningManager.listEntitiesVersionInfo(ACTION_VERSIONABLE_TYPE,
"", VersionableEntityAction.Read);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
for (Action action : actions) {
if (action.getStatus() == ActionStatus.Deleted) {
actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VERSION, TARGET_ENTITY_DB);
entity = actionDao
.get(new ActionEntity(invariantUuId != null ? invariantUuId.toUpperCase() : null, version));
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
}
log.debug("exit getActionsEntityByVersion with invariantUuId= " + invariantUuId + AND_VERSION + version);
actionEntity.setTimestamp(getCurrentTimeStampUtc());
actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
actionDao.update(actionEntity);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
}
actionEntity.setTimestamp(getCurrentTimeStampUtc());
actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
actionDao.update(actionEntity);
- actionLogPostProcessor(StatusCode.COMPLETE);
+ actionLogPostProcessor(COMPLETE);
log.metrics("");
}
log.debug("exit updateStatusForVersion with invariantUuId= " + invariantUuId + AND_VERSION + version
<version>1.7.4</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.4.0</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
package org.openecomp.sdc.securityutil.filters;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.openecomp.sdc.securityutil.AuthenticationCookieUtils;
import org.openecomp.sdc.securityutil.CipherUtilException;
import org.openecomp.sdc.securityutil.ISessionValidationFilterConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.apache.commons.lang.StringUtils;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
private ISessionValidationFilterConfiguration filterConfiguration;
private List<String> excludedUrls;
+ private static final String REQUEST_ID = ONAPLogConstants.MDCs.REQUEST_ID;
+ private static final String ONAP_REQUEST_ID_HEADER = ONAPLogConstants.Headers.REQUEST_ID;
+ private static final String REQUEST_ID_HEADER = "X-RequestID";
+ private static final String TRANSACTION_ID_HEADER = "X-TransactionId";
+ private static final String ECOMP_REQUEST_ID_HEADER = "X-ECOMP-RequestID";
+
+ private static final String PARTNER_NAME = ONAPLogConstants.MDCs.PARTNER_NAME;
+ private static final String USER_ID_HEADER = "USER_ID";
+ private static final String ONAP_PARTNER_NAME_HEADER = ONAPLogConstants.Headers.PARTNER_NAME;
+ private static final String USER_AGENT_HEADER = "User-Agent";
+ private static final String UNKNOWN = "UNKNOWN";
+
+
public abstract ISessionValidationFilterConfiguration getFilterConfiguration();
protected abstract Cookie addRoleToCookie(Cookie updatedCookie);
protected abstract boolean isRoleValid(Cookie cookie);
final HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
final HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
- long starTime = System.nanoTime();
+ long startTime = System.nanoTime();
+ fillMDCFromHeaders(httpRequest);
log.debug("SessionValidationFilter: Validation started, received request with URL {}", httpRequest.getRequestURL());
// request preprocessing
- boolean isContinueProcessing = preProcessingRequest(servletRequest, servletResponse, filterChain, httpRequest, httpResponse);
+ boolean isContinueProcessing = preProcessingRequest(servletRequest, servletResponse, filterChain, httpRequest, httpResponse, startTime);
List<Cookie> cookies = null;
+ Cookie extractedCookie = null;
// request processing
if (isContinueProcessing) {
cookies = extractAuthenticationCookies(httpRequest.getCookies());
- isContinueProcessing = processRequest(httpRequest, httpResponse, cookies.get(0));
+ extractedCookie = cookies.get(0);
+ isContinueProcessing = processRequest(httpRequest, httpResponse, extractedCookie);
}
// response processing
if(isContinueProcessing){
log.debug("SessionValidationFilter: Cookie from request {} is valid, passing request to session extension ...", httpRequest.getRequestURL());
- Cookie updatedCookie = processResponse(cookies.get(cookies.size()-1));
-
+ Cookie updatedCookie = processResponse(extractedCookie);
cleanResponceFromLeftoverCookies(httpResponse, cookies);
-
- // Use responce wrapper if servlet remove Cookie header from responce
-// OutputStream out = httpResponse.getOutputStream();
-// ResponceWrapper responceWrapper = new ResponceWrapper(httpResponse);
-
log.debug("SessionValidationFilter: request {} passed all validations, passing request to endpoint ...", httpRequest.getRequestURL());
httpResponse.addCookie(updatedCookie);
+ long durationSec = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime);
+ long durationMil = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
+ log.debug("SessionValidationFilter: Validation ended, running time for URL {} is: {} seconds {} miliseconds", httpRequest.getPathInfo(), durationSec, durationMil);
filterChain.doFilter(servletRequest, httpResponse);
-
- // Use responce wrapper if servlet remove Cookie header from responce
-// responceWrapper.addCookie(updatedCookie);
-// httpResponse.setContentLength(responceWrapper.getData().length);
-// out.write(responceWrapper.getData());
-// out.close();
}
- long durationSec = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - starTime);
- long durationMil = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - starTime);
- log.debug("SessionValidationFilter: Validation ended, running time for URL {} is: {} seconds {} miliseconds", httpRequest.getPathInfo(), durationSec, durationMil);
}
- private boolean preProcessingRequest(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletException {
+ private boolean preProcessingRequest(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain, HttpServletRequest httpRequest, HttpServletResponse httpResponse, long startTime) throws IOException, ServletException {
boolean isPreProcessingSucceeded = true;
if (isUrlFromWhiteList(httpRequest)) {
log.debug("SessionValidationFilter: URL {} excluded from access validation , passing request to endpoint ... ", httpRequest.getRequestURL());
+ long durationSec = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime);
+ long durationMil = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
+ log.debug("SessionValidationFilter: Validation ended, running time for URL {} is: {} seconds {} miliseconds", httpRequest.getPathInfo(), durationSec, durationMil);
filterChain.doFilter(servletRequest, servletResponse);
isPreProcessingSucceeded = false;
}
}
+ public static void fillMDCFromHeaders(HttpServletRequest httpServletRequest) {
+ fillRequestIdFromHeader(httpServletRequest);
+ fillPartnerNameFromHeader(httpServletRequest);
+
+ }
+
+ private static void fillRequestIdFromHeader(HttpServletRequest httpServletRequest){
+ if (MDC.get(REQUEST_ID) == null) {
+ if (StringUtils.isNotEmpty(httpServletRequest.getHeader(ONAP_REQUEST_ID_HEADER))) {
+ MDC.put(REQUEST_ID, httpServletRequest.getHeader(ONAP_REQUEST_ID_HEADER));
+ } else if (StringUtils.isNotEmpty(httpServletRequest.getHeader(REQUEST_ID_HEADER))) {
+ MDC.put(REQUEST_ID, httpServletRequest.getHeader(REQUEST_ID_HEADER));
+ } else if (StringUtils.isNotEmpty(httpServletRequest.getHeader(TRANSACTION_ID_HEADER))) {
+ MDC.put(REQUEST_ID, httpServletRequest.getHeader(TRANSACTION_ID_HEADER));
+ } else if (StringUtils.isNotEmpty(httpServletRequest.getHeader(ECOMP_REQUEST_ID_HEADER))) {
+ MDC.put(REQUEST_ID, httpServletRequest.getHeader(ECOMP_REQUEST_ID_HEADER));
+ } else {
+ MDC.put(REQUEST_ID, UUID.randomUUID().toString());
+ }
+ }
+ }
+
+ private static void fillPartnerNameFromHeader(HttpServletRequest httpServletRequest){
+ if (MDC.get(PARTNER_NAME) == null) {
+ if (StringUtils.isNotEmpty(httpServletRequest.getHeader(USER_ID_HEADER))) {
+ MDC.put(PARTNER_NAME, httpServletRequest.getHeader(USER_ID_HEADER));
+ } else if (StringUtils.isNotEmpty(httpServletRequest.getHeader(ONAP_PARTNER_NAME_HEADER))) {
+ MDC.put(PARTNER_NAME, httpServletRequest.getHeader(ONAP_PARTNER_NAME_HEADER));
+ } else if (StringUtils.isNotEmpty(httpServletRequest.getHeader(USER_AGENT_HEADER))) {
+ MDC.put(PARTNER_NAME, httpServletRequest.getHeader(USER_AGENT_HEADER));
+ } else {
+ MDC.put(PARTNER_NAME, UNKNOWN);
+ }
+ }
+ }
+
+
@Override
public void destroy() {
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="5 seconds">
- <property scope="system" name="ECOMP-component-name" value="SDC" />
- <property scope="system" name="ECOMP-subcomponent-name" value="ONBOARD-BE" />
- <property file="${config.home}/catalog-be/configuration.yaml" />
- <property scope="context" name="enable-all-log" value="false" />
-
- <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
- <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
- <property name="default-log-pattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{uuid}|%X{serviceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{userId}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%level|%X{alarmSeverity}|%X{localAddr}|%X{ElapsedTime}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" />
-
- <property name="auditLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| ActivityType=<%M>, Desc=<%msg>%n" />
-
- <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/>
-
- <!-- All log -->
- <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
- <then>
- <appender name="ALL_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log</file>
-
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i</fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="ALL_ROLLING" />
- </appender>
- </then>
- </if>
-
- <!-- Error log -->
- <appender name="ERROR_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log
- </file>
-
- <!-- Audit messages filter - deny audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>AUDIT_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- Transaction messages filter - deny Transaction messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Debug log -->
- <appender name="DEBUG_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log
- </file>
-
- <!-- No need to deny audit messages - they are INFO only, will be denied
- anyway -->
- <!-- Transaction messages filter - deny Transaction messages, there are
- some DEBUG level messages among them -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- accept DEBUG and TRACE level -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
- <expression>
- e.level.toInt() <= DEBUG.toInt()
- </expression>
- </evaluator>
- <OnMismatch>DENY</OnMismatch>
- <!--<OnMatch>NEUTRAL</OnMatch>-->
- <OnMatch>ACCEPT</OnMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
-
- <!-- ASDC debug by package-->
- <appender name="PACKAGE_DEBUG_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log
- </file>
-
- <!-- No need to deny audit messages - they are INFO only, will be denied
- anyway -->
- <!-- Transaction messages filter - deny Transaction messages, there are
- some DEBUG level messages among them -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- accept DEBUG and TRACE level -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
- <expression>
- e.level.toInt() <= DEBUG.toInt()
- </expression>
- </evaluator>
- <OnMismatch>DENY</OnMismatch>
- <OnMatch>NEUTRAL</OnMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${asdc-debug-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Audit log -->
- <appender name="AUDIT_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
-
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log
- </file>
-
- <!-- Audit messages filter - accept audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>AUDIT_MARKER</marker>
- <marker>AUDIT</marker>
- </evaluator>
- <onMismatch>DENY</onMismatch>
- <onMatch>ACCEPT</onMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${auditLoggerPattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Metrics log -->
- <appender name="METRICS_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
-
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/metrics.log
- </file>
-
- <!-- Metric messages filter - accept metric messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>METRICS</marker>
- </evaluator>
- <onMismatch>DENY</onMismatch>
- <onMatch>ACCEPT</onMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/metrics.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- SdncTransaction log -->
- <appender name="TRANSACTION_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
-
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log
- </file>
-
- <!-- Transaction messages filter - accept audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>DENY</onMismatch>
- <onMatch>ACCEPT</onMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Asynchronicity Configurations -->
- <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="DEBUG_ROLLING" />
- </appender>
-
- <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="TRANSACTION_ROLLING" />
- </appender>
-
- <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="ERROR_ROLLING" />
- </appender>
-
- <root level="INFO">
- <appender-ref ref="ASYNC_ERROR" />
- <appender-ref ref="ASYNC_DEBUG" />
- <appender-ref ref="AUDIT_ROLLING" />
- <appender-ref ref="ASYNC_TRANSACTION" />
- <appender-ref ref="METRICS_ROLLING" />
- <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
- <then>
- <appender-ref ref="ALL_ROLLING" />
- </then>
- </if>
- </root>
-
- <logger name="org.openecomp.sdc" level="INFO" />
+ <property scope="system" name="ECOMP-component-name" value="SDC"/>
+ <property scope="system" name="ECOMP-subcomponent-name" value="ONBOARD-BE"/>
+ <property file="${config.home}/catalog-be/configuration.yaml"/>
+ <property scope="context" name="enable-all-log" value="false"/>
+ <property name="p_msg"
+ value="%replace(%replace(%replace(%replace(%msg){'\t','\\\\t'}){'\n', '\\\\n'}){'\r','\\\\r'}){'\\\|','-'}"/>
+ <property name="p_ex"
+ value="%replace(%replace(%replace(%replace(%exception{full}){'\t','\\\\t'}){'\n', '\\\\n'}){'\r','\\\\r'}){'\\\|','-'}"/>
+ <property name="p_debugInfo"
+ value="%replace(%replace(%replace(%replace(%thread # %level # %logger{35} # %msg){'\t','\\\\t'}){'\n', '\\\\n'}){'\r','\\\\r'}){'\\\|','-'}"/>
+
+ <property name="all-log-pattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%level|%X{AlertSeverity}|%X{ServerIpAddress}|%X{ElapsedTime}|${ServerFQDN}|%X{ClientIPAddress}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<${p_msg}>%n"/>
+
+ <property name="debug-log-pattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|${p_debugInfo} ${p_ex}|^\n %n%nopex"/>
+
+ <property name="error-log-pattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|500|${p_msg} ${p_ex}|%n%nopex"/>
+
+ <property name="audit-log-pattern"
+ value="%X{EntryTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIpAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%marker|InvocationID=%X{InvocationID}|%X{CustomField3}|%X{CustomField4}|ActivityType=<%M>, Desc=<${p_msg}>%n"/>
+
+ <property name="metric-log-pattern"
+ value="%X{InvokeTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIpAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIPAddress }|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|ActivityType=<%M>, Desc=<${p_msg}>%n"/>
+
+ <!-- All log -->
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender name="ALL_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log</file>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <pattern>${all-log-pattern}</pattern>
+ </encoder>
+ </appender>
+ </then>
+ </if>
+
+
+ <!-- Debug log -->
+ <appender name="DEBUG_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log</file>
+
+ <!-- Audit and Metric messages filter - deny audit and metric messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>AUDIT</marker>
+ <marker>METRICS</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- accept INFO, DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() <= INFO.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>ACCEPT</OnMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <pattern>${debug-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <!-- Error log -->
+ <appender name="ERROR_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log</file>
+
+ <!-- deny all events with a level below WARN, that is INFO TRACE and DEBUG -->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <pattern>${error-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <!-- Audit log -->
+ <appender name="AUDIT_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log</file>
+
+ <!-- Audit messages filter - accept audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>ENTRY</marker>
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <pattern>${audit-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <!-- Metrics log -->
+ <appender name="METRICS_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/metrics.log
+ </file>
+
+ <!-- Metric messages filter - accept metric messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>METRICS</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/metrics.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <pattern>${metric-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <!-- Asynchronicity Configurations -->
+ <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="DEBUG_ROLLING"/>
+ </appender>
+
+ <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ERROR_ROLLING"/>
+ </appender>
+
+ <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ALL_ROLLING"/>
+ </appender>
+
+
+ <root level="INFO">
+ <appender-ref ref="ASYNC_ERROR"/>
+ <appender-ref ref="ASYNC_DEBUG"/>
+ <appender-ref ref="AUDIT_ROLLING"/>
+ <appender-ref ref="METRICS_ROLLING"/>
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender-ref ref="ASYNC_ALL"/>
+ </then>
+ </if>
+ </root>
+
+ <logger name="org.openecomp.sdc" level="INFO"/>
</configuration>
\ No newline at end of file
package org.openecomp.sdc.heat.services;
+
public class HeatConstants {
public static final String GET_ATTR_FROM_RESOURCE_GROUP_PREFIX = "resource.";
public static final String RESOURCE_GROUP_INDEX_VAR_DEFAULT_VALUE = "%index%";
package org.openecomp.sdc.action;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+
public class ActionConstants {
//
public static final String ARTIFACT_METADATA_ATTR_UUID = "ARTIFACT_UUID";
public static final String ARTIFACT_METADATA_ATTR_NAME = "ARTIFACT_NAME";
- public static final String REQUEST_ID = "uuid";
+ public static final String REQUEST_ID = ONAPLogConstants.MDCs.REQUEST_ID;
public static final String SERVICE_INSTANCE_ID = "serviceInstanceID";
- public static final String PARTNER_NAME = "userId";
- public static final String SERVICE_NAME = "ServiceName";
- public static final String INSTANCE_UUID = "InstanceUUID";
+ public static final String PARTNER_NAME = ONAPLogConstants.MDCs.PARTNER_NAME;
+ public static final String SERVICE_NAME = ONAPLogConstants.MDCs.SERVICE_NAME;
+ public static final String INSTANCE_UUID = ONAPLogConstants.MDCs.INSTANCE_UUID;
public static final String REMOTE_HOST = "RemoteHost";
- public static final String CLIENT_IP = "ClientIP";
+ public static final String CLIENT_IP = ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS;
public static final String CATEGORY_LOG_LEVEL = "level";
- public static final String STATUS_CODE = "StatusCode";
- public static final String RESPONSE_CODE = "ResponseCode";
- public static final String RESPONSE_DESCRIPTION = "ResponseDescription";
+ public static final String STATUS_CODE = ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+ public static final String RESPONSE_CODE = ONAPLogConstants.MDCs.RESPONSE_CODE;
+ public static final String RESPONSE_DESCRIPTION = ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
public static final String ELAPSED_TIME = "ElapsedTime";
- public static final String BEGIN_TIMESTAMP = "BeginTimestamp";
- public static final String TARGET_SERVICE_NAME = "TargetServiceName";
- public static final String TARGET_ENTITY = "TargetEntity";
+ public static final String BEGIN_TIMESTAMP = ONAPLogConstants.MDCs.ENTRY_TIMESTAMP;
+ public static final String TARGET_SERVICE_NAME = ONAPLogConstants.MDCs.TARGET_SERVICE_NAME;
+ public static final String TARGET_ENTITY = ONAPLogConstants.MDCs.TARGET_ENTITY;
public static final String TARGET_ENTITY_API = "API";
public static final String TARGET_ENTITY_DB = "DB";
public static final String END_TIMESTAMP = "EndTimestamp";
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.action.logging;
-
-public enum StatusCode {
- COMPLETE,
- ERROR
-}
package org.openecomp.sdc.action.util;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
-import org.openecomp.sdc.action.logging.StatusCode;
import org.openecomp.sdc.action.types.ActionLogResponseCode;
import org.openecomp.sdc.action.types.ActionSubOperation;
import org.slf4j.MDC;
*
* @param statusCode Response code for the current operation
*/
- public static void actionLogPostProcessor(StatusCode statusCode) {
+ public static void actionLogPostProcessor(ResponseStatus statusCode) {
actionLogPostProcessor(statusCode, false);
}
- public static void actionLogPostProcessor(StatusCode statusCode, boolean isServiceMetricLog) {
+ public static void actionLogPostProcessor(ResponseStatus statusCode, boolean isServiceMetricLog) {
actionLogPostProcessor(statusCode, null, isServiceMetricLog);
}
- public static void actionLogPostProcessor(StatusCode statusCode, String responseCode,
+ public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode,
boolean isServiceMetricLog) {
actionLogPostProcessor(statusCode, responseCode, null, isServiceMetricLog);
}
* @param responseDescription the response description
* @param isServiceMetricLog the is service metric log
*/
- public static void actionLogPostProcessor(StatusCode statusCode, String responseCode,
+ public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode,
String responseDescription,
boolean isServiceMetricLog) {
MDC.put(STATUS_CODE, statusCode.name());
import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
-import org.openecomp.sdc.action.logging.StatusCode;
import org.openecomp.sdc.action.types.ActionArtifact;
import org.openecomp.sdc.action.types.ActionSubOperation;
import org.openecomp.sdc.action.util.ActionUtil;
import java.util.Collection;
import java.util.List;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR;
import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
try {
ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ARTIFACT, TARGET_ENTITY_DB);
this.create(data.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
.actionLogPreProcessor(ActionSubOperation.GET_ARTIFACT_BY_ARTIFACTUUID, TARGET_ENTITY_DB);
Result<ActionArtifactEntity> result = null;
result = accessor.getArtifactByUuId(effectiveVersion, artifactUuId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
List<ActionArtifactEntity> artifactEntities = result.all();
if (artifactEntities != null && !artifactEntities.isEmpty()) {
try {
ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_ARTIFACT, TARGET_ENTITY_DB);
this.update(data.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
}
private void logGenericException(Exception exception) {
- ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
+ ActionUtil.actionLogPostProcessor(ERROR, ACTION_QUERY_FAILURE_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
log.metrics("");
ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE,
import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR;
import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
-import org.openecomp.sdc.action.logging.StatusCode;
import org.openecomp.sdc.action.types.Action;
import org.openecomp.sdc.action.types.ActionStatus;
import org.openecomp.sdc.action.types.ActionSubOperation;
try {
ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
this.create(action.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
return action;
} catch (NoHostAvailableException exception) {
log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
this.update(action.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
return action;
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao
.get(new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
Version activeVersion = activeVersionEntity.getActiveVersion();
.and(in(VERSION, activeVersion));
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
ResultSet results = getSession().execute(getNameFromInvUuId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (!results.isExhausted()) {
case FILTER_TYPE_VENDOR:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR, TARGET_ENTITY_DB);
result = accessor.getActionsByVendor(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
break;
case FILTER_TYPE_CATEGORY:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY, TARGET_ENTITY_DB);
result = accessor.getActionsByCategory(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
break;
case FILTER_TYPE_MODEL:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL, TARGET_ENTITY_DB);
result = accessor.getActionsByModel(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
break;
case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT, TARGET_ENTITY_DB);
result = accessor.getActionsByOpenEcompComponent(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
break;
case FILTER_TYPE_NONE:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
result = accessor.getAllActions();
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
break;
case FILTER_TYPE_NAME:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
result = accessor.getInvIdByName(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ ActionUtil.actionLogPostProcessor(COMPLETE);
log.metrics("");
List<ActionEntity> actionEntities = result.all();
if (actionEntities != null && !actionEntities.isEmpty()) {
log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID, TARGET_ENTITY_DB);
Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
log.debug(" entering getOpenEcompComponents ");
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
result = accessor.getOpenEcompComponents();
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
openEcompComponents.addAll(result.all()
}
MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
log.debug("Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB);
Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
new ArrayList<>(viewableVersions));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
actions.addAll(result.all()
Action action = null;
VersionInfoEntity versionInfoEntity = versionInfoDao
.get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (versionInfoEntity != null) {
if (versionInfoEntity.getCandidate() != null) {
TARGET_ENTITY_DB);
Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
new ArrayList<>(versions));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
ActionEntity actionEntity = result.one();
}
private void logGenericException(Exception exception) {
- ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
+ ActionUtil.actionLogPostProcessor(ERROR, ACTION_QUERY_FAILURE_CODE,
ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
log.metrics("");
ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, ACTION_QUERY_FAILURE_MSG);
.where(eq("actioninvariantuuid", actionInvariantUuId))
.and(in(VERSION, versions));
getSession().execute(updateStatusStatement);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
// Update the status in the data field of action table
updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
.from("dox", ACTION)
.where(eq("name", name));
ResultSet results = getSession().execute(statement);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
log.metrics("");
List<Version> versionList = new ArrayList<>();
"results": {
"hello": "world"
},
- "status": "COMPLETED",
+ "status": "COMPLETE",
"startTime": 1550780567585,
"endTime": 1550780567585
}
Assert.assertTrue(UUID.fromString(rsp.getExecutionId()).getLeastSignificantBits() != 0);
Assert.assertEquals("parameters", 6, rsp.getParameters().size());
Assert.assertNotNull(rsp.getResults());
- Assert.assertEquals("COMPLETED", rsp.getStatus());
+ Assert.assertEquals("COMPLETE", rsp.getStatus());
Assert.assertNotNull(rsp.getStartTime());
Assert.assertNotNull(rsp.getEndTime());
"results": {
"this is": "a fake result"
},
- "status": "COMPLETED",
+ "status": "COMPLETE",
"startTime": "2019-03-08T21:43:10.527",
"endTime": "2019-03-08T21:43:10.617"
}
// send a request for a prior execution.
VtpTestExecutionResponse execRsp = m.getExecution("repository", "execId");
- Assert.assertEquals("COMPLETED", execRsp.getStatus());
+ Assert.assertEquals("COMPLETE", execRsp.getStatus());
}
@Test
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
package org.openecomp.sdc.logging.api;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
+import lombok.Getter;
+
/**
* Builder to populate <i>audit</i> data. This includes only data known to an application, and not otherwise available
* to the logging framework. As opposed, for example, to local runtime, host address, etc.
* @author KATYR, evitaliy
* @since February 15, 2018
*/
+@Getter
public class AuditData {
// don't inherit from MetricsData because it has a very different meaning
private final long startTime;
private final long endTime;
- private final StatusCode statusCode;
+ private final ResponseStatus statusCode;
private final String responseCode;
private final String responseDescription;
private final String clientIpAddress;
this.clientIpAddress = builder.clientIpAddress;
}
- /**
- * Begin timestamp of an API invocation.
- *
- * @return timestamp
- */
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * End timestamp of an API invocation.
- *
- * @return timestamp
- */
- public long getEndTime() {
- return endTime;
- }
-
- /**
- * Result status of an API invocation.
- *
- * @return protocol and application agnostic status code
- */
- public StatusCode getStatusCode() {
- return statusCode;
- }
-
- /**
- * Application/protocol specific response status of an API invocation.
- *
- * @return response code
- */
- public String getResponseCode() {
- return responseCode;
- }
-
- /**
- * Application/protocol specific response in a human-friendly way.
- *
- * @return human-friendly response description
- */
- public String getResponseDescription() {
- return responseDescription;
- }
-
- /**
- * IP address of the invoking client when available.
- *
- * @return IP address
- */
- public String getClientIpAddress() {
- return clientIpAddress;
- }
-
@Override
public String toString() {
return "AuditData{startTime=" + startTime + ", endTime=" + endTime + ", statusCode=" + statusCode
private long startTime;
private long endTime;
- private StatusCode statusCode;
+ private ResponseStatus statusCode;
private String responseCode;
private String responseDescription;
private String clientIpAddress;
* @param statusCode invocation status success/failure
* @return this builder for fluent API
*/
- public AuditDataBuilder statusCode(final StatusCode statusCode) {
+ public AuditDataBuilder statusCode(final ResponseStatus statusCode) {
this.statusCode = statusCode;
return this;
}
boolean isAuditEnabled();
- void audit(AuditData data);
+ void auditEntry(AuditData data);
+
+ void auditExit(AuditData data);
boolean isDebugEnabled();
}
@Override
- public void audit(AuditData data) {
+ public void auditEntry(AuditData data) {
+ // no-op
+ }
+
+ @Override
+ public void auditExit(AuditData data) {
// no-op
}
package org.openecomp.sdc.logging.api;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
+import lombok.Getter;
+
/**
* Builder to populate <i>metrics</i> data. This includes only data known to an application, and not otherwise available
* to the logging framework.
* @author evitaliy
* @since 26 Mar 2018
*/
+@Getter
public class MetricsData {
// don't inherit from AuditData because it has a very different meaning
private final long startTime;
private final long endTime;
- private final StatusCode statusCode;
+ private final ResponseStatus statusCode;
private final String responseCode;
private final String responseDescription;
private final String clientIpAddress;
this.targetVirtualEntity = builder.targetVirtualEntity;
}
- /**
- * Begin timestamp of an API invocation.
- *
- * @return timestamp
- */
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * End timestamp of an API invocation.
- *
- * @return timestamp
- */
- public long getEndTime() {
- return endTime;
- }
-
- /**
- * Result status of an API invocation.
- *
- * @return protocol and application agnostic status code
- */
- public StatusCode getStatusCode() {
- return statusCode;
- }
-
- /**
- * Application/protocol specific response status of an API invocation.
- *
- * @return response code
- */
- public String getResponseCode() {
- return responseCode;
- }
-
- /**
- * Application/protocol specific response in a human-friendly way.
- *
- * @return human-friendly response description
- */
- public String getResponseDescription() {
- return responseDescription;
- }
-
- /**
- * IP address of the invoking client when available.
- *
- * @return IP address
- */
- public String getClientIpAddress() {
- return clientIpAddress;
- }
-
- /**
- * External entity invoked by the local system.
- *
- * @return identifier of an external entity (system, component, sub-component)
- */
- public String getTargetEntity() {
- return targetEntity;
- }
-
- /**
- * External API invoked by the local system.
- *
- * @return name of an external API
- */
- public String getTargetVirtualEntity() {
- return targetVirtualEntity;
- }
-
@Override
public String toString() {
return "AuditData{startTime=" + startTime + ", endTime=" + endTime + ", statusCode=" + statusCode
private long startTime;
private long endTime;
- private StatusCode statusCode;
+ private ResponseStatus statusCode;
private String responseCode;
private String responseDescription;
private String clientIpAddress;
* @param statusCode invocation status success/failure
* @return this builder for fluent API
*/
- public MetricsDataBuilder statusCode(final StatusCode statusCode) {
+ public MetricsDataBuilder statusCode(final ResponseStatus statusCode) {
this.statusCode = statusCode;
return this;
}
+++ /dev/null
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.logging.api;
-
-/**
- * Protocol-agnostic status codes to indicate the result status (success, failure) of an API invocation.
- *
- * @author EVITALIY
- * @since 04 Mar 18
- */
-public enum StatusCode {
- COMPLETE, ERROR
-}
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
+
/**
* Tracks and logs audit information when a request is being processed. An instance of this class cannot be reused, and
* the pre- and post-request methods must be called only once.
this.started = System.currentTimeMillis();
this.clientIpAddress = request.getRemoteAddr();
+ AuditData auditData = AuditData.builder().startTime(started).endTime(started).statusCode(COMPLETE)
+ .clientIpAddress(clientIpAddress)
+ .build();
+ logger.auditEntry(auditData);
}
@Override
.responseCode(Integer.toString(result.getStatus()))
.responseDescription(result.getStatusPhrase()).clientIpAddress(clientIpAddress)
.build();
- logger.audit(auditData);
+ logger.auditExit(auditData);
}
}
String requestId = requestIdHeaders.getAny(request::getHeader).orElse(UUID.randomUUID().toString());
ContextData.ContextDataBuilder contextBuilder =
ContextData.builder().serviceName(serviceName).requestId(requestId);
+ String partnerName = partnerNameHeaders.getAny(request::getHeader).orElse("UNKNOWN");
+ contextBuilder.partnerName(partnerName);
- partnerNameHeaders.getAny(request::getHeader).ifPresent(contextBuilder::partnerName);
LoggingContext.put(contextBuilder.build());
}
package org.openecomp.sdc.logging.servlet;
-import org.openecomp.sdc.logging.api.StatusCode;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
/**
* Interpretation of request processing results.
*
* @return on of pre-defined status codes
*/
- StatusCode getStatusCode();
+ ResponseStatus getStatusCode();
/**
* Human-friendly description of the numeric status.
import static javax.ws.rs.core.Response.Status.Family.REDIRECTION;
import static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL;
-import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE;
-import static org.openecomp.sdc.logging.api.StatusCode.ERROR;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.*;
import static org.openecomp.sdc.logging.servlet.jaxrs.LoggingRequestFilter.LOGGING_TRACKER_KEY;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
+
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.api.StatusCode;
import org.openecomp.sdc.logging.servlet.RequestProcessingResult;
import org.openecomp.sdc.logging.servlet.Tracker;
}
@Override
- public StatusCode getStatusCode() {
+ public ResponseStatus getStatusCode() {
Response.Status.Family family = statusInfo.getFamily();
return family.equals(SUCCESSFUL) || family.equals(REDIRECTION) ? COMPLETE : ERROR;
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
import org.junit.Test;
final String responseDescription = "Response-Description";
final String ipAddress = "DUMMY.IP.ADDRESS";
- AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE)
+ AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(COMPLETE)
.responseCode(responseCode).responseDescription(responseDescription)
.clientIpAddress(ipAddress).build();
assertEquals(start, data.getStartTime());
assertEquals(responseCode, data.getResponseCode());
assertEquals(responseDescription, data.getResponseDescription());
- assertEquals(StatusCode.COMPLETE, data.getStatusCode());
+ assertEquals(COMPLETE, data.getStatusCode());
}
@Test
logger.warn("");
logger.info("");
logger.debug("");
- logger.audit(null);
+ logger.auditExit(null);
logger.metrics(MetricsData.builder().build());
}
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
import org.junit.Test;
final String targetEntity = "Metrics-Target-Entity";
final String targetVirtualEntity = "Metrics-Target-Virtual-Entity";
- MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE)
+ MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(COMPLETE)
.responseCode(responseCode).responseDescription(responseDescription)
.clientIpAddress(ipAddress).targetEntity(targetEntity)
.targetVirtualEntity(targetVirtualEntity).build();
assertEquals(start, data.getStartTime());
assertEquals(responseCode, data.getResponseCode());
assertEquals(responseDescription, data.getResponseDescription());
- assertEquals(StatusCode.COMPLETE, data.getStatusCode());
+ assertEquals(COMPLETE, data.getStatusCode());
assertEquals(targetEntity, data.getTargetEntity());
assertEquals(targetVirtualEntity, data.getTargetVirtualEntity());
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.api.AuditData;
import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.StatusCode;
/**
* Test initialization and of audit tracker and log invocation.
tracker.preRequest(mock(HttpServletRequest.class));
tracker.postRequest(mock(RequestProcessingResult.class));
- verify(logger, never()).audit(any(AuditData.class));
+ verify(logger, never()).auditExit(any(AuditData.class));
}
@Test
tracker.postRequest(mock(RequestProcessingResult.class));
ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class);
- verify(logger).audit(auditDataCaptor.capture());
+ verify(logger).auditExit(auditDataCaptor.capture());
assertTrue(auditDataCaptor.getValue().getEndTime() > 0);
}
tracker.postRequest(result);
ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class);
- verify(logger).audit(auditDataCaptor.capture());
+ verify(logger).auditExit(auditDataCaptor.capture());
AuditData capturedAuditData = auditDataCaptor.getValue();
assertEquals(Integer.toString(result.getStatus()), capturedAuditData.getResponseCode());
tracker.postRequest(mock(RequestProcessingResult.class));
ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class);
- verify(logger).audit(auditDataCaptor.capture());
+ verify(logger).auditExit(auditDataCaptor.capture());
AuditData capturedAuditData = auditDataCaptor.getValue();
assertEquals(address, capturedAuditData.getClientIpAddress());
}
@Override
- public StatusCode getStatusCode() {
- return StatusCode.ERROR;
+ public ResponseStatus getStatusCode() {
+ return ResponseStatus.ERROR;
}
@Override
}
@Test
- public void partnerNameAbsentWhenNotGiven() {
+ public void partnerNameIsUnknownWhenNotGiven() {
mockStatic(LoggingContext.class);
LoggingContext.put(contextDataCaptor.capture());
- assertNull(contextDataCaptor.getValue().getPartnerName());
+ assertEquals(contextDataCaptor.getValue().getPartnerName(), "UNKNOWN");
}
@Test
final Marker marker = event.getMarker();
if (marker != null) {
- if (marker.contains(Markers.AUDIT)) {
+ if (marker.contains(Markers.ENTRY) || marker.contains(Markers.EXIT)){
return AUDIT;
}
package org.openecomp.sdc.logging.slf4j;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+
/**
* MDC fields that represent audit data.
*
*/
enum AuditField implements MDCField {
- BEGIN_TIMESTAMP("BeginTimestamp"),
+ BEGIN_TIMESTAMP(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP),
END_TIMESTAMP("EndTimestamp"),
ELAPSED_TIME("ElapsedTime"),
- STATUS_CODE("StatusCode"),
- RESPONSE_CODE("ResponseCode"),
- RESPONSE_DESCRIPTION("ResponseDescription"),
- CLIENT_IP_ADDRESS("ClientIpAddress");
+ STATUS_CODE(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE),
+ RESPONSE_CODE(ONAPLogConstants.MDCs.RESPONSE_CODE),
+ RESPONSE_DESCRIPTION(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION),
+ CLIENT_IP_ADDRESS(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS);
private final String key;
package org.openecomp.sdc.logging.slf4j;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+
/**
* MDC fields that represent context data.
*
*/
enum ContextField implements MDCField {
- REQUEST_ID("RequestId"),
- SERVICE_NAME("ServiceName"),
- PARTNER_NAME("PartnerName"),
- INSTANCE_ID("InstanceId"),
- SERVER("Server"),
+ REQUEST_ID(ONAPLogConstants.MDCs.REQUEST_ID),
+ SERVICE_NAME(ONAPLogConstants.MDCs.SERVICE_NAME),
+ PARTNER_NAME(ONAPLogConstants.MDCs.PARTNER_NAME),
+ INSTANCE_ID(ONAPLogConstants.MDCs.INSTANCE_UUID),
+ SERVER(ONAPLogConstants.MDCs.SERVER_FQDN),
SERVER_IP_ADDRESS("ServerIpAddress");
private final String key;
package org.openecomp.sdc.logging.slf4j;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
*/
public class Markers {
- public static final Marker AUDIT = MarkerFactory.getMarker("AUDIT");
+ public static final Marker ENTRY = MarkerFactory.getMarker(ONAPLogConstants.Markers.ENTRY.getName());
+ public static final Marker EXIT = MarkerFactory.getMarker(ONAPLogConstants.Markers.EXIT.getName());
+
public static final Marker METRICS = MarkerFactory.getMarker("METRICS");
private Markers() {
package org.openecomp.sdc.logging.slf4j;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+
/**
* DC fields that represent metrics data.
*
*/
public enum MetricsField implements MDCField {
- BEGIN_TIMESTAMP("BeginTimestamp"),
+ BEGIN_TIMESTAMP(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP),
END_TIMESTAMP("EndTimestamp"),
ELAPSED_TIME("ElapsedTime"),
- STATUS_CODE("StatusCode"),
- RESPONSE_CODE("ResponseCode"),
- RESPONSE_DESCRIPTION("ResponseDescription"),
- CLIENT_IP_ADDRESS("ClientIpAddress"),
+ STATUS_CODE(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE),
+ RESPONSE_CODE(ONAPLogConstants.MDCs.RESPONSE_CODE),
+ RESPONSE_DESCRIPTION(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION),
+ CLIENT_IP_ADDRESS(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS),
TARGET_VIRTUAL_ENTITY("TargetVirtualEntity"),
- TARGET_ENTITY("TargetEntity");
+ TARGET_ENTITY(ONAPLogConstants.MDCs.TARGET_ENTITY);
private final String key;
static ContextData to(Map<ContextField, String> values) {
return ContextData.builder()
- .requestId(values.get(ContextField.REQUEST_ID))
- .serviceName(values.get(ContextField.SERVICE_NAME))
- .partnerName(values.get(ContextField.PARTNER_NAME)).build();
+ .requestId(values.get(ContextField.REQUEST_ID))
+ .serviceName(values.get(ContextField.SERVICE_NAME))
+ .partnerName(values.get(ContextField.PARTNER_NAME)).build();
}
@Override
}
private void putIfNotNull(Map<ContextField, String> values, ContextField field, String value) {
-
if (value != null) {
values.put(field, value);
}
@Override
public boolean isAuditEnabled() {
- return logger.isInfoEnabled(Markers.AUDIT);
+ return logger.isInfoEnabled(Markers.EXIT);
}
@Override
- public void audit(AuditData data) {
+ public void auditEntry(AuditData data) {
if (data == null) {
return; // not failing if null
try {
putAuditOnMdc(data);
- logger.info(Markers.AUDIT, "");
+ logger.info(Markers.ENTRY, "");
+ } finally {
+ clearAuditFromMdc();
+ }
+ }
+
+
+ @Override
+ public void auditExit(AuditData data) {
+
+ if (data == null) {
+ return; // not failing if null
+ }
+
+ try {
+ putAuditOnMdc(data);
+ logger.info(Markers.EXIT, "");
} finally {
clearAuditFromMdc();
}
@Test
public void testAudit() {
String msg = "This is a test audit";
- logger.info(Markers.AUDIT, msg);
+ logger.info(Markers.EXIT, msg);
TestAppender appender = result.get(AUDIT);
Assert.assertTrue(appender.contains(
(event) -> Level.INFO.equals(event.getLevel()) && msg.equals(event.getFormattedMessage())));
EventTypeDiscriminator discriminator = new EventTypeDiscriminator();
LoggingEvent event = new LoggingEvent();
event.setLevel(Level.ERROR);
- event.setMarker(Markers.AUDIT);
+ event.setMarker(Markers.EXIT);
assertEquals(ERROR, discriminator.getDiscriminatingValue(event));
}
EventTypeDiscriminator discriminator = new EventTypeDiscriminator();
LoggingEvent event = new LoggingEvent();
event.setLevel(Level.WARN);
- event.setMarker(Markers.AUDIT);
+ event.setMarker(Markers.EXIT);
assertEquals(ERROR, discriminator.getDiscriminatingValue(event));
}
EventTypeDiscriminator discriminator = new EventTypeDiscriminator();
LoggingEvent event = new LoggingEvent();
event.setLevel(Level.DEBUG);
- event.setMarker(Markers.AUDIT);
+ event.setMarker(Markers.EXIT);
assertEquals(DEBUG, discriminator.getDiscriminatingValue(event));
}
EventTypeDiscriminator discriminator = new EventTypeDiscriminator();
LoggingEvent event = new LoggingEvent();
event.setLevel(Level.TRACE);
- event.setMarker(Markers.AUDIT);
+ event.setMarker(Markers.EXIT);
assertEquals(DEBUG, discriminator.getDiscriminatingValue(event));
}
EventTypeDiscriminator discriminator = new EventTypeDiscriminator();
LoggingEvent event = new LoggingEvent();
event.setLevel(Level.INFO);
- event.setMarker(Markers.AUDIT);
+ event.setMarker(Markers.EXIT);
assertEquals("Audit", discriminator.getDiscriminatingValue(event));
}
String random = UUID.randomUUID().toString();
ContextData context = ContextData.builder().serviceName(random).build();
LoggingContext.put(context);
- assertEquals(context, LoggingContext.get());
+ assertEquals(context.getServiceName(), LoggingContext.get().getServiceName());
}
@Test
String random = UUID.randomUUID().toString();
ContextData context = ContextData.builder().requestId(random).build();
LoggingContext.put(context);
- assertEquals(context, LoggingContext.get());
+ assertEquals(context.getRequestId(), LoggingContext.get().getRequestId());
}
@Test
String random = UUID.randomUUID().toString();
ContextData context = ContextData.builder().partnerName(random).build();
LoggingContext.put(context);
- assertEquals(context, LoggingContext.get());
+ assertEquals(context.getPartnerName(), LoggingContext.get().getPartnerName());
}
}
package org.openecomp.sdc.logging.slf4j;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
import org.junit.Test;
import org.openecomp.sdc.logging.api.ContextData;
+import static org.junit.Assert.*;
+
/**
* Unit-test retrieving values from client-provided request data.
*
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import org.junit.Test;
import org.openecomp.sdc.logging.api.AuditData;
import org.openecomp.sdc.logging.api.MetricsData;
-import org.openecomp.sdc.logging.api.StatusCode;
import org.slf4j.Logger;
import org.slf4j.MDC;
import org.slf4j.Marker;
@Test
public void auditDoesNotFailWhenInputNull() {
- new SLF4JLoggerWrapper(this.getClass()).audit(null);
+ new SLF4JLoggerWrapper(this.getClass()).auditExit(null);
}
@Test
public void auditBeginTimeAvailableWhenPassed() {
SpyLogger spy = createSpy();
long start = System.currentTimeMillis();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().startTime(start).build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().startTime(start).build());
assertNotNull(spy.mdc().get(AuditField.BEGIN_TIMESTAMP.asKey()));
}
public void auditEndTimeAvailableWhenPassed() {
SpyLogger spy = createSpy();
long end = System.currentTimeMillis();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().endTime(end).build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().endTime(end).build());
assertNotNull(spy.mdc().get(AuditField.END_TIMESTAMP.asKey()));
}
public void auditElapsedTimeAvailableWhenPassed() {
SpyLogger spy = createSpy();
long start = System.currentTimeMillis();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder()
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder()
.startTime(start).endTime(start + 777).build());
assertEquals("777", spy.mdc().get(AuditField.ELAPSED_TIME.asKey()));
}
@Test
public void auditStatusCodeAvailableWhenPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().statusCode(StatusCode.COMPLETE).build());
- assertEquals(StatusCode.COMPLETE.name(), spy.mdc().get(AuditField.STATUS_CODE.asKey()));
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().statusCode(COMPLETE).build());
+ assertEquals(COMPLETE.name(), spy.mdc().get(AuditField.STATUS_CODE.asKey()));
}
@Test
public void metricsStatusCodeAvailableWhenPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).metrics(MetricsData.builder().statusCode(StatusCode.COMPLETE).build());
- assertEquals(StatusCode.COMPLETE.name(), spy.mdc().get(MetricsField.STATUS_CODE.asKey()));
+ new SLF4JLoggerWrapper(spy).metrics(MetricsData.builder().statusCode(COMPLETE).build());
+ assertEquals(COMPLETE.name(), spy.mdc().get(MetricsField.STATUS_CODE.asKey()));
}
@Test
public void auditStatusCodeEmptyWhenNotPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build());
assertNull(spy.mdc().get(AuditField.STATUS_CODE.asKey()));
}
public void auditResponseCodeAvailableWhenPassed() {
final String responseCode = "AuditSpyResponse";
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().responseCode(responseCode).build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().responseCode(responseCode).build());
assertEquals(responseCode, spy.mdc().get(AuditField.RESPONSE_CODE.asKey()));
}
@Test
public void auditResponseCodeEmptyWhenNotPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build());
assertNull(spy.mdc().get(AuditField.RESPONSE_CODE.asKey()));
}
public void auditResponseDescriptionAvailableWhenPassed() {
final String responseDescription = "AuditSpyDescription";
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().responseDescription(responseDescription).build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().responseDescription(responseDescription).build());
assertEquals(responseDescription, spy.mdc().get(AuditField.RESPONSE_DESCRIPTION.asKey()));
}
@Test
public void auditResponseDescriptionEmptyWhenNotPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build());
assertNull(spy.mdc().get(AuditField.RESPONSE_DESCRIPTION.asKey()));
}
public void auditClientIpAddressAvailableWhenPassed() {
final String ipAddress = "10.56.20.20";
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().clientIpAddress(ipAddress).build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().clientIpAddress(ipAddress).build());
assertEquals(ipAddress, spy.mdc().get(AuditField.CLIENT_IP_ADDRESS.asKey()));
}
@Test
public void auditClientIpAddressEmptyWhenNotPassed() {
SpyLogger spy = createSpy();
- new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build());
+ new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build());
assertNull(spy.mdc().get(AuditField.CLIENT_IP_ADDRESS.asKey()));
}
}
private boolean isAuditMethod(Method method, Object[] args) {
- return isSpecialLogMethod(method, args, Markers.AUDIT);
+ return isSpecialLogMethod(method, args, Markers.EXIT);
}
private boolean isSpecialLogMethod(Method method, Object[] args, Marker marker) {
package org.openecomp.sdc.logging.servlet.spring;
-import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE;
-import static org.openecomp.sdc.logging.api.StatusCode.ERROR;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.*;
import static org.springframework.http.HttpStatus.Series.REDIRECTION;
import static org.springframework.http.HttpStatus.Series.SUCCESSFUL;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.api.StatusCode;
import org.openecomp.sdc.logging.servlet.AuditTracker;
import org.openecomp.sdc.logging.servlet.CombinedTracker;
import org.openecomp.sdc.logging.servlet.ContextTracker;
}
@Override
- public StatusCode getStatusCode() {
+ public ResponseStatus getStatusCode() {
return statusInfo.getStatusCode();
}
return reasonPhrase;
}
- private StatusCode getStatusCode() {
+ private ResponseStatus getStatusCode() {
return series.equals(SUCCESSFUL) || series.equals(REDIRECTION) ? COMPLETE : ERROR;
}
}
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE;
-import static org.openecomp.sdc.logging.api.StatusCode.ERROR;
import static org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor.LOGGING_TRACKER_KEY;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.servlet.HttpHeader;
import org.openecomp.sdc.logging.servlet.RequestProcessingResult;
import org.openecomp.sdc.logging.servlet.Tracker;
final int status = 101;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 404;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 503;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 204;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
final int status = 307;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
final int status = 133;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 485;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 547;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
final int status = 277;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
final int status = 364;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
}
if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) {
return;
}
- String[] regexList = new String[]{".*_net_id", ".*_net_name", ".*_net_fqdn"};
+ String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"};
heatOrchestrationTemplate
.getResources()
private void checkNeutronPortFixedIpsName(String fileName,
Map.Entry<String, Resource> resourceEntry,
GlobalValidationContext globalContext) {
- String[] regexList =
- new String[]{"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)",
- "[^_]+_[^_]+_v6_ip_(\\d+)"};
+ String[] regexList = {"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)",
+ "[^_]+_[^_]+_v6_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_ips", "[^_]+_[^_]+_[^_]+_v6_ips",
+ "[^_]+_[^_]+_[^_]+_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_v6_ip_(\\d+)"};
if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) {
return;
String fixedIpsName = ValidationUtil
.getWantedNameFromPropertyValueGetParam(fixedIpsEntry.getValue());
- if (nonNull(fixedIpsName) && !ValidationUtil
- .evalPattern(fixedIpsName, regexList)) {
- globalContext.addMessage(
- fileName,
- ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters(
- ERROR_CODE_NNP1,
- Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(),
+
+ if (nonNull(fixedIpsName) && !ValidationUtil.evalPattern(fixedIpsName, regexList)) {
+ globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters(ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(),
"Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey()));
}
}else if (network instanceof List){
role = getNetworkRole((String)((List) network).get(0));
}
- if (role != null && uniqueResourcePortNetworkRole.containsKey(role)) {
+ if (role != null && (uniqueResourcePortNetworkRole.containsKey(role))) {
globalValidationContext.addMessage(
fileName,
ErrorLevel.WARNING,
ErrorMessagesFormatBuilder.getErrorWithParameters(
ERROR_CODE_NNS12, Messages.RESOURCE_CONNECTED_TO_TWO_EXTERNAL_NETWORKS_WITH_SAME_ROLE
- .getErrorMessage(), resourceId, role));
+ .getErrorMessage(), role, resourceId));
} else {
- uniqueResourcePortNetworkRole.put(role, portResourceId);
+ uniqueResourcePortNetworkRole.put(role, resourceId);
}
}
}
PATH + "negativeFixedIP/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
- Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
"WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v6_ip_a], Resource ID [port_resource_0]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(),
"WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_ipz], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information");
-
- Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(),
- "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v0_ip_3], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information");
}
@Test
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: [NNS12]: A resource is connected twice to the same network role, Network Role [FSB2], Resource ID [Internal1]");
+ "WARNING: [NNS12]: A resource is connected twice to the same network role, Network Role [Internal1], Resource ID [FSB2]");
}
@Test
package org.openecomp.sdc.tosca.services;
+
public class ToscaConstants {
//TOSCA Requirement Ids
<version>${bean-matchers.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>${onap.logging.version}</version>
+ </dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-core</artifactId>