diff options
author | Michael Lando <ml636r@att.com> | 2017-08-10 18:21:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-08-10 18:21:36 +0000 |
commit | ce07d7cd59425944f85d0fef5126ebeef731bc7b (patch) | |
tree | a0d8bb991aa164e01eb930b23f34d9e27999602a | |
parent | 46f9fd57f24428f6a6fd0d290b0463e188975231 (diff) | |
parent | 644017cb3edd5b7a077a634ffd5daf2fee6bc088 (diff) |
Merge "[SDC] OnBoard with enabled tests and features"
360 files changed, 8715 insertions, 2671 deletions
diff --git a/onboarding/pom.xml b/onboarding/pom.xml index f9b7cd3699..0e600287bf 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -92,5 +92,6 @@ <woodstox.version>4.4.1</woodstox.version> <ws.rs.version>2.0.1</ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues--> <zusammen.version>0.2.0</zusammen.version> + <zusammen-state-store.version>0.2.1</zusammen-state-store.version> </properties> </project> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java index 2ed5235867..e6f5e6b1a3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java @@ -20,86 +20,9 @@ package org.openecomp.sdcrests.action.rest.services; -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 static org.openecomp.sdc.action.ActionConstants.ARTIFACT_FILE; -import static org.openecomp.sdc.action.ActionConstants.ARTIFACT_NAME; -import static org.openecomp.sdc.action.ActionConstants.BE_FQDN; -import static org.openecomp.sdc.action.ActionConstants.CATEGORY_LOG_LEVEL; -import static org.openecomp.sdc.action.ActionConstants.CLIENT_IP; -import static org.openecomp.sdc.action.ActionConstants.ERROR_DESCRIPTION; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR; -import static org.openecomp.sdc.action.ActionConstants.INSTANCE_UUID; -import static org.openecomp.sdc.action.ActionConstants.LOCAL_ADDR; -import static org.openecomp.sdc.action.ActionConstants.MAX_ACTION_ARTIFACT_SIZE; -import static org.openecomp.sdc.action.ActionConstants.MDC_ASDC_INSTANCE_UUID; -import static org.openecomp.sdc.action.ActionConstants.PARTNER_NAME; -import static org.openecomp.sdc.action.ActionConstants.REMOTE_HOST; -import static org.openecomp.sdc.action.ActionConstants.REQUEST_EMPTY_BODY; -import static org.openecomp.sdc.action.ActionConstants.REQUEST_ID; -import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_CREATE_ACTION; -import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_UPDATE_ACTION; -import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_VERSION_ACTION; -import static org.openecomp.sdc.action.ActionConstants.SERVICE_INSTANCE_ID; -import static org.openecomp.sdc.action.ActionConstants.SERVICE_METRIC_BEGIN_TIMESTAMP; -import static org.openecomp.sdc.action.ActionConstants.SERVICE_NAME; -import static org.openecomp.sdc.action.ActionConstants.STATUS; -import static org.openecomp.sdc.action.ActionConstants.STATUS_CODE; -import static org.openecomp.sdc.action.ActionConstants.SUPPORTED_COMPONENTS_ID; -import static org.openecomp.sdc.action.ActionConstants.SUPPORTED_MODELS_VERSION_ID; -import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY; -import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_API; -import static org.openecomp.sdc.action.ActionConstants.TARGET_SERVICE_NAME; -import static org.openecomp.sdc.action.ActionConstants.TIMESTAMP; -import static org.openecomp.sdc.action.ActionConstants.UPDATED_BY; -import static org.openecomp.sdc.action.ActionConstants.X_OPEN_ECOMP_INSTANCE_ID_HEADER_PARAM; -import static org.openecomp.sdc.action.ActionConstants.X_OPEN_ECOMP_REQUEST_ID_HEADER_PARAM; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_CHECKSUM_ERROR_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_PROTECTION_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_READ_FILE_ERROR; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_INSTANCE_ID_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_PARAM_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_BODY_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_ID_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_SEARCH_CRITERIA; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_MULT_SEARCH_CRITERIA; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_CHECKSUM_ERROR; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_INVALID_PROTECTION_VALUE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_BODY_EMPTY; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_CONTENT_TYPE_INVALID; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_OPEN_ECOMP_INSTANCE_ID_INVALID; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_OPEN_ECOMP_REQUEST_ID_INVALID; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_FILTER_PARAM_INVALID; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_INVALID_GENERIC_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_INVALID_NAME; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_MISSING_MANDATORY_PARAM; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UNSUPPORTED_OPERATION; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE; -import static org.openecomp.sdc.action.util.ActionUtil.actionErrorLogProcessor; -import static org.openecomp.sdc.action.util.ActionUtil.actionLogPostProcessor; -import static org.openecomp.sdc.action.util.ActionUtil.getUtcDateStringFromTimestamp; - import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.action.ActionConstants; @@ -108,11 +31,9 @@ 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; -import org.openecomp.sdc.action.types.ActionRequest; -import org.openecomp.sdc.action.types.OpenEcompComponent; +import org.openecomp.sdc.action.types.*; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdcrests.action.rest.Actions; import org.openecomp.sdcrests.action.rest.mapping.MapActionToActionResponseDto; import org.openecomp.sdcrests.action.types.ActionResponseDto; @@ -125,18 +46,18 @@ import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import javax.inject.Named; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Named; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Response; +import java.util.*; + +import static org.openecomp.sdc.action.ActionConstants.*; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.*; +import static org.openecomp.sdc.action.util.ActionUtil.*; /** * Implements various CRUD API that can be performed on Action @@ -148,7 +69,7 @@ import javax.ws.rs.core.Response; @Validated public class ActionsImpl implements Actions { - private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(ActionsImpl.class); @Autowired private ActionManager actionManager; private String whitespaceCharacters = "\\s" /* dummy empty string for homogeneity */ @@ -203,7 +124,7 @@ public class ActionsImpl implements Actions { ListResponseWrapper responseList = new ListResponseWrapper(); try { - log.debug(" entering getActionsByActionInvariantUuId "); + LOGGER.debug(" entering getActionsByActionInvariantUuId "); initializeRequestMDC(servletRequest, invariantID, ActionRequest.GET_ACTIONS_INVARIANT_ID); MDC.put(SERVICE_INSTANCE_ID, invariantID); @@ -217,26 +138,26 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(""); + LOGGER.error(""); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(""); + LOGGER.error(""); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.GET_ACTIONS_INVARIANT_ID.name()); } - log.debug(" exit getActionsByActionInvariantUuId "); + LOGGER.debug(" exit getActionsByActionInvariantUuId "); actionLogPostProcessor(StatusCode.COMPLETE, true); return Response.ok(responseList).build(); } private ListResponseWrapper getActionsByInvId(HttpServletRequest servletRequest, String invariantID) { - log.debug(" entering getActionsByInvId with invariantID= " + invariantID); + LOGGER.debug(" entering getActionsByInvId with invariantID= " + invariantID); ListResponseWrapper responseList = new ListResponseWrapper(); if (StringUtils.isEmpty(servletRequest.getQueryString())) { Map<String, String> errorMap = validateRequestHeaders(servletRequest); @@ -244,7 +165,7 @@ public class ActionsImpl implements Actions { errorMap.putAll(queryParamErrors); if (errorMap.isEmpty()) { List<Action> actions = actionManager.getActionsByActionInvariantUuId(invariantID); - List<ActionResponseDto> versionList = new ArrayList<ActionResponseDto>(); + List<ActionResponseDto> versionList = new ArrayList<>(); for (Action action : actions) { ActionResponseDto responseDTO = createResponseDTO(action); versionList.add(responseDTO); @@ -256,7 +177,7 @@ public class ActionsImpl implements Actions { checkAndThrowError(errorMap); } } - log.debug(" exit getActionsByInvId with invariantID= " + invariantID); + LOGGER.debug(" exit getActionsByInvId with invariantID= " + invariantID); return responseList; } @@ -264,7 +185,7 @@ public class ActionsImpl implements Actions { String actionUUID) throws ActionException { int noOfFilterParams = 0; Response response = null; - log.debug(" entering getActionByUUID with invariantID= " + invariantID + " and actionUUID= " + + LOGGER.debug(" entering getActionByUUID with invariantID= " + invariantID + " and actionUUID= " + actionUUID); if (!StringUtils.isEmpty(actionUUID)) { noOfFilterParams++; @@ -275,7 +196,7 @@ public class ActionsImpl implements Actions { ACTION_REQUEST_FILTER_PARAM_INVALID); } - log.debug(" exit getActionByUUID with invariantID= " + invariantID + " and actionUUID= " + + LOGGER.debug(" exit getActionByUUID with invariantID= " + invariantID + " and actionUUID= " + actionUUID); return response; } @@ -283,7 +204,7 @@ public class ActionsImpl implements Actions { @Override public Response getOpenEcompComponents(HttpServletRequest servletRequest) { try { - log.debug(" entering getOpenEcompComponents "); + LOGGER.debug(" entering getEcompComponents "); initializeRequestMDC(servletRequest, "", ActionRequest.GET_OPEN_ECOMP_COMPONENTS); //Validate request syntax before passing to the manager Map<String, String> errorMap = validateRequestHeaders(servletRequest); @@ -292,19 +213,19 @@ public class ActionsImpl implements Actions { List<OpenEcompComponent> openEcompComponents = actionManager.getOpenEcompComponents(); response.setActionList(null); response.setComponentList(openEcompComponents); - log.debug(" exit getOpenEcompComponents "); + LOGGER.debug(" exit getEcompComponents "); actionLogPostProcessor(StatusCode.COMPLETE, true); return Response.ok(response).build(); } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(""); + LOGGER.error(""); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(""); + LOGGER.error(""); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.GET_OPEN_ECOMP_COMPONENTS.name()); @@ -315,40 +236,17 @@ public class ActionsImpl implements Actions { public Response getFilteredActions(String vendor, String category, String name, String modelID, String componentID, HttpServletRequest servletRequest) { try { - log.debug(" entering getFilteredActions "); - Response response = null; + LOGGER.debug(" entering getFilteredActions "); + Response response; initializeRequestMDC(servletRequest, "", ActionRequest.GET_FILTERED_ACTIONS); - int noOfFilterParams = 0; - if (!StringUtils.isEmpty(vendor)) { - noOfFilterParams++; - } - if (!StringUtils.isEmpty(category)) { - noOfFilterParams++; - } - if (!StringUtils.isEmpty(name)) { - noOfFilterParams++; - } - if (!StringUtils.isEmpty(modelID)) { - noOfFilterParams++; - } - if (!StringUtils.isEmpty(componentID)) { - noOfFilterParams++; - } + int noOfFilterParams = getNoOfFilterParams(vendor, category, name, modelID, componentID); if (StringUtils.isEmpty(servletRequest.getQueryString())) { response = getAllActions(servletRequest); - log.debug(" exit getFilteredActions "); + LOGGER.debug(" exit getFilteredActions "); actionLogPostProcessor(StatusCode.COMPLETE, true); return response; } - if (noOfFilterParams > 1) { - throw new ActionException(ACTION_MULT_SEARCH_CRITERIA, - ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED); - } - if (noOfFilterParams == 0) { - throw new ActionException(ACTION_INVALID_SEARCH_CRITERIA, - ACTION_REQUEST_FILTER_PARAM_INVALID); - } - ListResponseWrapper responseList = null; + validateNoOfFilterParamsExactly1(noOfFilterParams); if (!StringUtils.isEmpty(vendor)) { response = getActionsByVendor(vendor, servletRequest); } else if (!StringUtils.isEmpty(category)) { @@ -363,30 +261,61 @@ public class ActionsImpl implements Actions { throw new ActionException(ACTION_INVALID_PARAM_CODE, ACTION_REQUEST_FILTER_PARAM_INVALID); } - log.debug(" exit getFilteredActions "); + LOGGER.debug(" exit getFilteredActions "); actionLogPostProcessor(StatusCode.COMPLETE, true); return response; } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(""); + LOGGER.error(""); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(""); + LOGGER.error(""); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.GET_FILTERED_ACTIONS.name()); } } + private void validateNoOfFilterParamsExactly1(int noOfFilterParams) { + if (noOfFilterParams > 1) { + throw new ActionException(ACTION_MULT_SEARCH_CRITERIA, + ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED); + } + if (noOfFilterParams == 0) { + throw new ActionException(ACTION_INVALID_SEARCH_CRITERIA, + ACTION_REQUEST_FILTER_PARAM_INVALID); + } + } + + private int getNoOfFilterParams(String vendor, String category, String name, String modelID, String componentID) { + int noOfFilterParams = 0; + if (!StringUtils.isEmpty(vendor)) { + noOfFilterParams++; + } + if (!StringUtils.isEmpty(category)) { + noOfFilterParams++; + } + if (!StringUtils.isEmpty(name)) { + noOfFilterParams++; + } + if (!StringUtils.isEmpty(modelID)) { + noOfFilterParams++; + } + if (!StringUtils.isEmpty(componentID)) { + noOfFilterParams++; + } + return noOfFilterParams; + } + @Override public Response createAction(String requestJSON, HttpServletRequest servletRequest) { try { initializeRequestMDC(servletRequest, null, ActionRequest.CREATE_ACTION); - log.debug(" entering API createAction "); + LOGGER.debug(" entering API createAction "); Map<String, String> errorMap = validateRequestHeaders(servletRequest); Map<String, String> requestBodyErrors = validateRequestBody(REQUEST_TYPE_CREATE_ACTION, requestJSON); @@ -403,18 +332,18 @@ public class ActionsImpl implements Actions { checkAndThrowError(errorMap); } actionLogPostProcessor(StatusCode.COMPLETE, true); - log.debug(" exit API createAction with ActionInvariantUUID= " + MDC.get(SERVICE_INSTANCE_ID)); + 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); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(""); + LOGGER.error(""); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.CREATE_ACTION.name()); @@ -447,13 +376,13 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(""); + LOGGER.error(""); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.UPDATE_ACTION.name()); @@ -479,13 +408,13 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.DELETE_ACTION.name()); @@ -498,7 +427,7 @@ public class ActionsImpl implements Actions { Response response = null; try { initializeRequestMDC(servletRequest, invariantUUID, ActionRequest.ACTION_VERSIONING); - log.debug("entering actOnAction with invariantUUID= " + invariantUUID + " and requestJSON= " + + LOGGER.debug("entering actOnAction with invariantUUID= " + invariantUUID + " and requestJSON= " + requestJSON); Map<String, String> errorMap = validateRequestHeaders(servletRequest); Map<String, String> requestBodyErrors = @@ -542,17 +471,17 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.ACTION_VERSIONING.name()); - log.debug("exit actOnAction with invariantUUID= " + invariantUUID + " and requestJSON= " + + LOGGER.debug("exit actOnAction with invariantUUID= " + invariantUUID + " and requestJSON= " + requestJSON); } return response; @@ -571,29 +500,29 @@ public class ActionsImpl implements Actions { Response response = null; try { initializeRequestMDC(servletRequest, actionInvariantUUID, ActionRequest.UPLOAD_ARTIFACT); - log.debug("entering uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug("entering uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + "artifactName= " + artifactName); response = uploadArtifactInternal(actionInvariantUUID, artifactName, artifactLabel, artifactCategory, artifactDescription, artifactProtection, checksum, artifactToUpload, servletRequest); actionLogPostProcessor(StatusCode.COMPLETE, true); - log.debug("exiting uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug("exiting uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + "artifactName= " + artifactName); } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.UPLOAD_ARTIFACT.name()); } - log.debug("exiting uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug("exiting uploadArtifact with actionInvariantUuId= " + actionInvariantUUID + "artifactName= " + artifactName); return response; } @@ -632,6 +561,7 @@ public class ActionsImpl implements Actions { try { artifactInputStream = artifactToUpload.getDataHandler().getInputStream(); } catch (IOException exception) { + LOGGER.error(ACTION_ARTIFACT_READ_FILE_ERROR, exception); throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ARTIFACT_READ_FILE_ERROR); } @@ -680,7 +610,7 @@ public class ActionsImpl implements Actions { Response response = null; try { initializeRequestMDC(servletRequest, "", ActionRequest.DOWNLOAD_ARTIFACT); - log.debug( + LOGGER.debug( " entering downloadArtifact with actionUUID= " + actionUUID + " and artifactUUID= " + artifactUUID); response = downloadArtifactInternal(actionUUID, artifactUUID, servletRequest); @@ -688,18 +618,18 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.DOWNLOAD_ARTIFACT.name()); } - log.debug(" exit downloadArtifact with actionUUID= " + actionUUID + " and artifactUUID= " + + LOGGER.debug(" exit downloadArtifact with actionUUID= " + actionUUID + " and artifactUUID= " + artifactUUID); return response; } @@ -728,22 +658,22 @@ public class ActionsImpl implements Actions { Response response = null; try { initializeRequestMDC(servletRequest, actionInvariantUUID, ActionRequest.DELETE_ARTIFACT); - log.debug(" entering deleteArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug(" entering deleteArtifact with actionInvariantUuId= " + actionInvariantUUID + " and artifactUUID= " + artifactUUID); response = deleteArtifactInternal(actionInvariantUUID, artifactUUID, servletRequest); - log.debug(" exit deleteArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug(" exit deleteArtifact with actionInvariantUuId= " + actionInvariantUUID + " and artifactUUID= " + artifactUUID); actionLogPostProcessor(StatusCode.COMPLETE, true); } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.DELETE_ARTIFACT.name()); @@ -774,7 +704,7 @@ public class ActionsImpl implements Actions { String checksum, Attachment artifactToUpdate, HttpServletRequest servletRequest) { Response response = null; - log.debug(" entering updateArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug(" entering updateArtifact with actionInvariantUuId= " + actionInvariantUUID + " and artifactUUID= " + artifactUUID + " and artifactName= " + artifactName + " and artifactLabel= " + artifactLabel + " and artifactCategory= " + artifactCategory + " and artifactDescription= " + artifactDescription + " and artifactProtection= " + @@ -789,18 +719,18 @@ public class ActionsImpl implements Actions { } catch (ActionException exception) { actionLogPostProcessor(StatusCode.ERROR, exception.getErrorCode(), exception.getDescription(), true); actionErrorLogProcessor(CategoryLogLevel.ERROR, exception.getErrorCode(), exception.getDescription()); - log.error(MDC.get(ERROR_DESCRIPTION)); + LOGGER.error(MDC.get(ERROR_DESCRIPTION)); throw exception; } catch (Exception exception) { actionLogPostProcessor(StatusCode.ERROR, true); actionErrorLogProcessor(CategoryLogLevel.ERROR, ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); - log.error(exception.getMessage()); + LOGGER.error(exception.getMessage()); throw exception; } finally { finalAuditMetricsLogProcessor(ActionRequest.UPDATE_ARTIFACT.name()); } - log.debug(" exit updateArtifact with actionInvariantUuId= " + actionInvariantUUID + + LOGGER.debug(" exit updateArtifact with actionInvariantUuId= " + actionInvariantUUID + " and artifactUUID= " + artifactUUID + " and artifactName= " + artifactName + " and artifactLabel= " + artifactLabel + " and artifactCategory= " + artifactCategory + " and artifactDescription= " + artifactDescription + " and artifactProtection= " + @@ -811,8 +741,8 @@ public class ActionsImpl implements Actions { private void finalAuditMetricsLogProcessor(String targetServiceName) { MDC.put(TARGET_SERVICE_NAME, targetServiceName); MDC.put(TARGET_ENTITY, TARGET_ENTITY_API); - log.metrics(""); - log.audit(""); + LOGGER.metrics(""); + LOGGER.audit(""); } private Response updateArtifactInternal(String actionInvariantUUID, String artifactUUID, @@ -835,6 +765,7 @@ public class ActionsImpl implements Actions { try { artifactInputStream = artifactToUpdate.getDataHandler().getInputStream(); } catch (IOException exception) { + LOGGER.error(ACTION_ARTIFACT_READ_FILE_ERROR, exception); throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ARTIFACT_READ_FILE_ERROR); } @@ -951,7 +882,7 @@ public class ActionsImpl implements Actions { */ private Response getActionsByUniqueID(String actionUUID, HttpServletRequest servletRequest, String actionInvariantUUID) { - log.debug( + LOGGER.debug( " entering getActionByUUID with invariantID= " + actionInvariantUUID + " and actionUUID= " + actionUUID); Map<String, Object> responseDTO = new LinkedHashMap<>(); @@ -972,7 +903,7 @@ public class ActionsImpl implements Actions { } else { checkAndThrowError(errorMap); } - log.debug( + LOGGER.debug( " exit getActionByUUID with invariantID= " + actionInvariantUUID + " and actionUUID= " + actionUUID); return Response.ok(responseDTO).build(); @@ -1175,11 +1106,11 @@ public class ActionsImpl implements Actions { if (actionartifact != null && actionartifact.getArtifact() != null) { byte[] artifactsBytes = actionartifact.getArtifact(); File artifactFile = new File(actionartifact.getArtifactName()); - try { - FileOutputStream fos = new FileOutputStream(artifactFile); + try (FileOutputStream fos = new FileOutputStream(artifactFile)) { fos.write(artifactsBytes); fos.close(); } catch (IOException exception) { + LOGGER.error(ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, exception); throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE, ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG); } @@ -1215,13 +1146,13 @@ public class ActionsImpl implements Actions { MDC.put(LOCAL_ADDR, MDC.get("ServerIPAddress")); MDC.put(BE_FQDN, MDC.get("ServerFQDN")); - if (log.isDebugEnabled()) { + if (LOGGER.isDebugEnabled()) { MDC.put(CATEGORY_LOG_LEVEL, CategoryLogLevel.DEBUG.name()); - } else if (log.isInfoEnabled()) { + } else if (LOGGER.isInfoEnabled()) { MDC.put(CATEGORY_LOG_LEVEL, CategoryLogLevel.INFO.name()); - } else if (log.isWarnEnabled()) { + } else if (LOGGER.isWarnEnabled()) { MDC.put(CATEGORY_LOG_LEVEL, CategoryLogLevel.WARN.name()); - } else if (log.isErrorEnabled()) { + } else if (LOGGER.isErrorEnabled()) { MDC.put(CATEGORY_LOG_LEVEL, CategoryLogLevel.ERROR.name()); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/DefaultOutput.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/DefaultOutput.java index 991a286a48..271ff45097 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/DefaultOutput.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/DefaultOutput.java @@ -21,14 +21,6 @@ package org.openecomp.server.interceptors; -import java.io.Serializable; -import java.lang.annotation.Annotation; -import java.net.URI; -import java.util.Date; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Link; @@ -36,13 +28,20 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.NewCookie; import javax.ws.rs.core.Response; +import java.io.Serializable; +import java.lang.annotation.Annotation; +import java.net.URI; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.Set; public class DefaultOutput extends Response implements Serializable { private static final long serialVersionUID = 8061802931931401706L; private final int status; - private final Object entity; + private final transient Object entity; private MultivaluedMap<String, Object> metadata; public DefaultOutput(int s0, Object e0) { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml index c83ae4471a..126f7814d7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml @@ -30,7 +30,6 @@ <bean id="outEmptyResponseInterceptor" class="org.openecomp.server.interceptors.EmptyOutputOutInterceptor"/> <!-- ASDC --> - <bean id="vendorLicenseManager" class="org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl"/> <bean id="uploadValidationManager" class="org.openecomp.sdc.validation.impl.UploadValidationManagerImpl"/> <bean id="actionManager" class="org.openecomp.sdc.action.impl.ActionManagerImpl"/> <bean id="applicationConfigManager" class="org.openecomp.sdc.applicationconfig.impl.ApplicationConfigManagerImpl"/> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml index 824c6775bc..70581079ff 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml @@ -13,6 +13,12 @@ <dependencies> <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-logging-core</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>org.openecomp.sdc.core</groupId> <artifactId>openecomp-utilities-lib</artifactId> <version>${project.version}</version> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java index e8a6c7e7db..d399469745 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java @@ -54,9 +54,10 @@ import javax.ws.rs.ext.ExceptionMapper; public class DefaultExceptionMapper implements ExceptionMapper<Exception> { private static final String ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE = "errorCodesToResponseStatusMapping.json"; - private static Map<String, String> errorCodeToResponseStatus = JsonUtil - .json2Object(FileUtils.getFileInputStream(ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE), - Map.class); + @SuppressWarnings("unchecked") + private static Map<String, String> errorCodeToResponseStatus = + JsonUtil.json2Object(FileUtils + .getFileInputStream(ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE), Map.class); private static Logger logger = (Logger) LoggerFactory.getLogger(DefaultExceptionMapper.class); @Override @@ -74,11 +75,6 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> { response = transform(exception); } - try { - writeStackTraceToFile(exception); - } catch (IOException ex) { - ex.printStackTrace(); - } List<Object> contentTypes = new ArrayList<>(); contentTypes.add(MediaType.APPLICATION_JSON); response.getMetadata().put("Content-Type", contentTypes); @@ -169,17 +165,4 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> { private Object toEntity(Response.Status status, ErrorCode code) { return new ErrorCodeAndMessage(status, code); } - - private void writeStackTraceToFile(Exception exception) throws IOException { - File file = new File("stack_trace.txt"); - if (!file.exists()) { - file.createNewFile(); - } - OutputStream outputStream = new FileOutputStream(file); - PrintWriter printWriter = new PrintWriter(file); - exception.printStackTrace(printWriter); - printWriter.close(); - outputStream.close(); - } - } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java index 6573485db7..91f2656f16 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java @@ -20,6 +20,15 @@ package org.openecomp.sdcrests.mapping; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.errors.Messages; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerServiceName; + /** * Base class for all mapping classes. Mapping classes will perform data mapping from source object * to target object Base class provides following<br> <ol> <li>provides life cycle of @@ -93,8 +102,19 @@ public abstract class MappingBase<S, T> { try { object = clazz.newInstance(); - } catch (InstantiationException | IllegalAccessException exception) { + } catch (InstantiationException | IllegalAccessException exception ) { //TODO: what what? + MdcDataErrorMessage.createErrorMessageAndUpdateMdc( + LoggerConstants.TARGET_ENTITY, + LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), + exception.getMessage(), exception.getMessage()); + + throw new CoreException((new ErrorCode.ErrorCodeBuilder()) + .withMessage(exception.getMessage()) + .withId(exception.getMessage()) + .withCategory(ErrorCategory.APPLICATION).build()); + + } return object; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java index 22ce0a4e45..ea69249944 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java @@ -27,7 +27,7 @@ import java.util.List; public class GenericCollectionWrapper<T> implements Serializable { private static final long serialVersionUID = 1L; - private List<T> results; + private transient List<T> results; private int listCount; public GenericCollectionWrapper() { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java index 9678f927b0..1152cc1eb3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java @@ -12,10 +12,10 @@ public class MapLimitEntityToLimitDto extends MappingBase<LimitEntity, LimitEnti target.setId(source.getId()); target.setName(source.getName()); target.setDescription(source.getDescription()); - target.setMetric(source.getMetric() != null ? source.getMetric().name() : null); + target.setMetric(source.getMetric()); target.setAggregationFunction(source.getAggregationFunction() != null ? source .getAggregationFunction().name() : null); - target.setTime(source.getTime() != null ? source.getTime().name() : null); + target.setTime(source.getTime()); target.setType(source.getType() != null ? source.getType().name() : null); target.setUnit(source.getUnit()); target.setValue(source.getValue()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java index 7f48ece1cf..d123924ec3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java @@ -3,73 +3,60 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerServiceName; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LimitType; import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder; import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; -import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; -import org.openecomp.sdc.vendorlicense.dao.types.LimitType; public class MapLimitRequestDtoToLimitEntity extends MappingBase<LimitRequestDto, LimitEntity> { - @Override - public void doMapping(LimitRequestDto source, LimitEntity target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - try { - LimitType type = LimitType.valueOf(source.getType()); - target.setType(type); - } - catch (IllegalArgumentException exception) { - throwInvalidValueError("type", VendorLicenseErrorCodes.LIMIT_INVALID_TYPE); - } - - try { - EntitlementMetric metric = EntitlementMetric.valueOf(source.getMetric()); - target.setMetric(metric); - } - catch (IllegalArgumentException exception) { - throwInvalidValueError("metric", VendorLicenseErrorCodes.LIMIT_INVALID_METRIC); - } - try { - AggregationFunction function = source.getAggregationFunction() != null ? - AggregationFunction.valueOf(source.getAggregationFunction()) : null; - target.setAggregationFunction(function); + private static final Logger logger = + LoggerFactory.getLogger(MapLimitRequestDtoToLimitEntity.class); + + @Override + public void doMapping(LimitRequestDto source, LimitEntity target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + try { + LimitType type = LimitType.valueOf(source.getType()); + target.setType(type); + } catch (IllegalArgumentException exception) { + logger.error(exception.getMessage(), exception); + throwInvalidValueError("type", VendorLicenseErrorCodes.LIMIT_INVALID_TYPE); + } + + try { + AggregationFunction function = source.getAggregationFunction() != null ? + AggregationFunction.valueOf(source.getAggregationFunction()) : null; + target.setAggregationFunction(function); + } catch (IllegalArgumentException exception) { + logger.error(exception.getMessage(), exception); + throwInvalidValueError("aggregationFunction", + VendorLicenseErrorCodes.LIMIT_INVALID_AGGREGATIONFUNCTION); + } + + target.setTime(source.getTime()); + target.setMetric(source.getMetric()); + target.setValue(source.getValue()); + target.setUnit(source.getUnit()); + + } + + private void throwInvalidValueError(String attribute, String vendorLicenseErrorCode) { + ErrorCode errorCode = LimitErrorBuilder.getInvalidValueErrorBuilder(attribute, + vendorLicenseErrorCode); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), + errorCode.id(), errorCode.message()); + throw new CoreException(errorCode); } - catch (IllegalArgumentException exception) { - throwInvalidValueError("aggregationFunction", - VendorLicenseErrorCodes.LIMIT_INVALID_AGGREGATIONFUNCTION); - } - - try { - EntitlementTime time = source.getTime() != null ? - EntitlementTime.valueOf(source.getTime()) : null; - target.setTime(time); - } - catch (IllegalArgumentException exception) { - throwInvalidValueError("time", VendorLicenseErrorCodes.LIMIT_INVALID_TIME); - } - - target.setValue(source.getValue()); - target.setUnit(source.getUnit()); - - } - - private void throwInvalidValueError(String attribute, String vendorLicenseErrorCode) { - ErrorCode errorCode = LimitErrorBuilder.getInvalidValueErrorBuilder(attribute, - vendorLicenseErrorCode); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), - errorCode.id(), errorCode.message() ); - throw new CoreException(errorCode); - } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java index 3a08822048..36e25e0f2e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java @@ -5,6 +5,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.versioning.dao.types.Version; @@ -30,8 +31,8 @@ import javax.ws.rs.core.Response; @Scope(value = "prototype") public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); @Override public Response createLimit(LimitRequestDto request, diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java index 63576c95bd..120bb3d6a0 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java @@ -24,6 +24,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorlicense.rest.EntitlementPools; @@ -47,8 +48,8 @@ import java.util.Collection; public class EntitlementPoolsImpl implements EntitlementPools { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); /** * List entitlement pools response. diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index 99ac3cdb70..593ed1939f 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java @@ -25,6 +25,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel; @@ -58,8 +59,8 @@ import java.util.HashSet; public class FeatureGroupsImpl implements FeatureGroups { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); @Override public Response listFeatureGroups(String vlmId, String versionId, String user) { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java index ac242422e4..60a2d684d2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java @@ -25,6 +25,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel; @@ -55,8 +56,8 @@ import javax.ws.rs.core.Response; public class LicenseAgreementsImpl implements LicenseAgreements { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); /** * List license agreements response. diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java index aabba71a5c..4c85cfa45f 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java @@ -4,6 +4,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.versioning.dao.types.Version; @@ -30,8 +31,8 @@ import javax.ws.rs.core.Response; public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); @Override public Response createLimit(LimitRequestDto request, diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java index 2aac474123..4c4bf134fd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java @@ -24,6 +24,7 @@ import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorlicense.rest.LicenseKeyGroups; @@ -49,8 +50,8 @@ import java.util.Collection; public class LicenseKeyGroupsImpl implements LicenseKeyGroups { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); /** * List license key groups response. diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java index 9e72170e04..6d88e4cacb 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java @@ -28,8 +28,11 @@ import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorlicense.rest.VendorLicenseModels; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity; @@ -56,8 +59,10 @@ import java.util.Collection; public class VendorLicenseModelsImpl implements VendorLicenseModels { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - @Autowired - private VendorLicenseManager vendorLicenseManager; + + private VendorLicenseManager vendorLicenseManager = + VendorLicenseManagerFactory.getInstance().createInterface(); + private static final Logger logger = LoggerFactory.getLogger(VendorLicenseModelsImpl.class); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java index 0cc18949d8..a4dc361c57 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java @@ -7,8 +7,8 @@ public class LimitEntityDto { private String type; private String description; private String metric; - private Integer value; - private Integer unit; + private String value; + private String unit; private String aggregationFunction; private String time; @@ -52,11 +52,11 @@ public class LimitEntityDto { this.metric = metric; } - public Integer getUnit() { + public String getUnit() { return unit; } - public void setUnit(Integer unit) { + public void setUnit(String unit) { this.unit = unit; } @@ -76,11 +76,11 @@ public class LimitEntityDto { this.time = time; } - public Integer getValue() { + public String getValue() { return value; } - public void setValue(Integer value) { + public void setValue(String value) { this.value = value; } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java index 61f30916f8..defff137d8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java @@ -20,11 +20,9 @@ public class LimitRequestDto { private String description; @NotBlank(message = "is mandatory and should not be empty") private String metric; - @NotNull(message = "is mandatory and should not be empty") - @Min(value = 1, message = "should be integer and > 0") - private Integer value; - @Min(value = 1, message = "should be integer and > 0") - private Integer unit; + @NotBlank(message = "is mandatory and should not be empty") + private String value; + private String unit; private String aggregationFunction; private String time; @@ -77,19 +75,19 @@ public class LimitRequestDto { this.time = time; } - public Integer getUnit() { + public String getUnit() { return unit; } - public void setUnit(Integer unit) { + public void setUnit(String unit) { this.unit = unit; } - public Integer getValue() { + public String getValue() { return value; } - public void setValue(Integer value) { + public void setValue(String value) { this.value = value; } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java index e51ccbd937..baaa664938 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java @@ -4,6 +4,8 @@ package org.openecomp.sdcrests.vsp.rest.mapping; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; @@ -15,6 +17,8 @@ import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRelationType public class MapComponentDependencyModelRequestToEntity extends MappingBase<ComponentDependencyModel, ComponentDependencyModelEntity> { + private static final Logger logger = + LoggerFactory.getLogger(MapComponentDependencyModelRequestToEntity.class); @Override public void doMapping(ComponentDependencyModel source, @@ -30,6 +34,7 @@ public class MapComponentDependencyModelRequestToEntity extends MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL, ErrorLevel.ERROR.name(), errorCode.id(), errorCode.message() ); + logger.error(errorCode.message(), exception); throw new CoreException(errorCode); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java index 9c642eb862..8f2e73bff6 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java @@ -165,7 +165,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { VersionableEntityAction.Read), user); versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); } catch (Exception e) { - //to do + logger.error(e.getMessage(), e); } } } diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java index 4f58957c2d..36493e2b14 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java @@ -68,6 +68,7 @@ import static org.openecomp.sdc.action.util.ActionUtil.actionLogPreProcessor; import static org.openecomp.sdc.action.util.ActionUtil.getCurrentTimeStampUtc; import static org.openecomp.sdc.versioning.dao.types.Version.VERSION_STRING_VIOLATION_MSG; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.action.types.*; import org.openecomp.sdc.logging.api.Logger; @@ -142,7 +143,7 @@ public class ActionManagerImpl implements ActionManager { @Override public List<Action> getActionsByActionInvariantUuId(String invariantId) throws ActionException { - List<Action> actions = null; + List<Action> actions; log.debug(" entering getActionsByActionInvariantUuId with invariantID = " + invariantId); actions = actionDao @@ -291,6 +292,7 @@ public class ActionManagerImpl implements ActionManager { 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); throw new ActionException(ACTION_ENTITY_UNIQUE_VALUE_ERROR, errorDesc); } finally { @@ -470,7 +472,7 @@ public class ActionManagerImpl implements ActionManager { List<ActionArtifact> currentVersionArtifacts = action.getArtifacts(); //Delete the artifacts from action_artifact table (if any) - if (currentVersionArtifacts != null && currentVersionArtifacts.size() > 0) { + if (CollectionUtils.isNotEmpty(currentVersionArtifacts) && currentVersionArtifacts.size() > 0) { for (ActionArtifact artifact : currentVersionArtifacts) { ActionArtifactEntity artifactDeleteEntity = new ActionArtifactEntity(artifact.getArtifactUuId(), diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/ActionTest.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/ActionTest.java index ec8f0c439c..a8f7b692ab 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/ActionTest.java +++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/ActionTest.java @@ -57,6 +57,8 @@ import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.Assert; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.io.File; import java.io.FileInputStream; @@ -71,6 +73,9 @@ import java.util.UUID; @SuppressWarnings("Duplicates") public class ActionTest { + + /* + Logger logger = LoggerFactory.getLogger(ActionTest.class); private static final Version VERSION01 = new Version(0, 1); private static final String USER1 = "actionTestUser1"; private static final String USER2 = "actionTestUser2"; @@ -325,6 +330,7 @@ public class ActionTest { actionManager.createAction(createAction(ACTION_1), USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ENTITY_UNIQUE_VALUE_ERROR); } } @@ -377,6 +383,7 @@ public class ActionTest { actionManager.updateAction(action, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert .assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE_NAME); } @@ -395,6 +402,7 @@ public class ActionTest { actionManager.updateAction(action, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_INVALID_VERSION); } } @@ -413,6 +421,7 @@ public class ActionTest { actionManager.updateAction(updatedAction, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE); } } @@ -435,7 +444,7 @@ public class ActionTest { boolean result = message.contains("No enum constant"); Assert.assertEquals(true, result); } - }*/ + } @Test(groups = "updateTestGroup", dependsOnMethods = {"updateTest"}) public void testUpdateInvariantId_negative() { @@ -450,6 +459,7 @@ public class ActionTest { actionManager.updateAction(action, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE); } } @@ -470,6 +480,7 @@ public class ActionTest { actionManager.updateAction(action, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE); } } @@ -487,8 +498,10 @@ public class ActionTest { actionManager.updateAction(action, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE); } catch (IllegalArgumentException ie) { + logger.error(ie.getMessage()); String message = ie.getMessage(); boolean result = message.contains("No enum constant"); Assert.assertEquals(true, result); @@ -508,6 +521,7 @@ public class ActionTest { actionManager.updateAction(action, USER2); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); } @@ -518,6 +532,7 @@ public class ActionTest { try { actionManager.checkout(action1Id, USER1); } catch (ActionException wae) { + logger.error(wae.getMessage()); Assert .assertEquals(wae.getErrorCode(), ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY); Assert.assertEquals(wae.getDescription(), @@ -531,6 +546,7 @@ public class ActionTest { try { actionManager.checkout(action1Id, "invlaiduser"); } catch (ActionException wae) { + logger.error(wae.getMessage()); Assert.assertEquals(wae.getErrorCode(), ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER); Assert.assertEquals(wae.getDescription(), @@ -560,6 +576,7 @@ public class ActionTest { actionManager.updateAction(existingActionEntity.toDto(), USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_UPDATE_ON_UNLOCKED_ENTITY); } } @@ -576,6 +593,7 @@ public class ActionTest { try { actionManager.checkin(action1Id, "invaliduser"); } catch (ActionException wae) { + logger.error(wae.getMessage()); Assert .assertEquals(wae.getErrorCode(), ActionErrorConstants.ACTION_CHECKIN_ON_UNLOCKED_ENTITY); Assert.assertEquals(wae.getDescription(), @@ -598,6 +616,7 @@ public class ActionTest { try { actionManager.checkin(action1Id, "invaliduser"); } catch (ActionException wae) { + logger.error(wae.getMessage()); Assert.assertEquals(wae.getErrorCode(), ActionErrorConstants.ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER); Assert.assertEquals(wae.getDescription(), @@ -611,6 +630,7 @@ public class ActionTest { try { actionManager.submit(action1Id, USER1); } catch (ActionException wae) { + logger.error(wae.getMessage()); Assert.assertEquals(wae.getErrorCode(), ActionErrorConstants.ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED); Assert.assertEquals(wae.getDescription(), "Versionable entity Action with id " + action1Id + @@ -655,6 +675,7 @@ public class ActionTest { Action action = actionManager.getActionsByActionUuId(""); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE); } } @@ -780,6 +801,7 @@ public class ActionTest { actionManager.deleteAction(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_DELETE_ON_LOCKED_ENTITY_CODE); Assert.assertEquals(exception.getDescription(), String.format( "Can not delete versionable entity Action with id %s since it is checked out by other user: %s", @@ -794,6 +816,7 @@ public class ActionTest { actionManager.checkin(deleteActionInvariantId, USER1); actionManager.deleteAction(deleteActionInvariantId, USER1); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.fail("Delete action test failed with exception : " + exception.getDescription()); } } @@ -805,6 +828,7 @@ public class ActionTest { actionManager.checkout(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -812,6 +836,7 @@ public class ActionTest { actionManager.checkin(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -819,6 +844,7 @@ public class ActionTest { actionManager.submit(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -826,6 +852,7 @@ public class ActionTest { actionManager.undoCheckout(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -833,6 +860,7 @@ public class ActionTest { actionManager.deleteAction(deleteActionInvariantId, USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -844,6 +872,7 @@ public class ActionTest { actionManager.createAction(createAction(ACTION_TEST_DELETE), USER1); Assert.fail(); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ACTION_ENTITY_UNIQUE_VALUE_ERROR); Assert.assertEquals(exception.getDescription(), String .format(ACTION_ENTITY_UNIQUE_VALUE_MSG, ActionConstants.UniqueValues.ACTION_NAME, @@ -889,7 +918,7 @@ public class ActionTest { /*** * ACTION ARTIFACT OPERATION TEST CASES ***/ - +/* @Test public void testUploadArtifact() { actionArtifact = new ActionArtifact(); @@ -908,6 +937,7 @@ public class ActionTest { actionArtifact.setArtifactDescription("Test Artifact Description"); actionArtifact.setArtifactProtection(ActionArtifactProtection.readWrite.name()); } catch (IOException exception) { + logger.error(exception.getMessage()); exception.printStackTrace(); } @@ -942,6 +972,7 @@ public class ActionTest { try { actionManager.uploadArtifact(testArtifact, "INVALID_UUID", USER1); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(ae.getDescription(), ACTION_ENTITY_NOT_EXIST); } @@ -953,6 +984,7 @@ public class ActionTest { actionManager .uploadArtifact(actionArtifact, testArtifactAction.getActionInvariantUuId(), USER1); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_ARTIFACT_ALREADY_EXISTS_CODE); Assert.assertEquals(ae.getDescription(), String .format(ACTION_ARTIFACT_ALREADY_EXISTS, testArtifactAction.getActionInvariantUuId())); @@ -965,6 +997,7 @@ public class ActionTest { actionManager .uploadArtifact(actionArtifact, testArtifactAction.getActionInvariantUuId(), USER2); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); Assert.assertEquals(ae.getDescription(), "Versionable entity Action with id " + testArtifactAction.getActionInvariantUuId() + @@ -980,6 +1013,7 @@ public class ActionTest { actionManager .uploadArtifact(actionArtifact, testArtifactAction.getActionInvariantUuId(), USER1); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_UPDATE_ON_UNLOCKED_ENTITY); Assert.assertEquals(ae.getDescription(), "Can not update versionable entity Action with id " + testArtifactAction.getActionInvariantUuId() + " since it is not checked out."); @@ -1001,6 +1035,7 @@ public class ActionTest { try { ActionArtifact response = actionManager.downloadArtifact(actionUUID, artifactUUID); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE); } @@ -1012,6 +1047,7 @@ public class ActionTest { try { ActionArtifact response = actionManager.downloadArtifact(actionUUID, expectedArtifactUUID); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_ENTITY_NOT_EXIST_CODE); } @@ -1022,6 +1058,7 @@ public class ActionTest { try { actionManager.deleteArtifact("action2Id", "1234", USER1); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE); Assert.assertEquals(exception.getDescription(), ActionErrorConstants.ACTION_ENTITY_NOT_EXIST); } @@ -1032,6 +1069,7 @@ public class ActionTest { try { actionManager.deleteArtifact(action2Id, "1234", USER1); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE); Assert @@ -1055,6 +1093,7 @@ public class ActionTest { testArtifact.getArtifactUuId(), USER1); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ARTIFACT_DELETE_READ_ONLY); Assert.assertEquals(exception.getDescription(), ActionErrorConstants.ACTION_ARTIFACT_DELETE_READ_ONLY_MSG); @@ -1076,6 +1115,7 @@ public class ActionTest { actionManager.deleteArtifact(testArtifactAction.getActionInvariantUuId(), actionArtifact.getArtifactUuId(), USER2); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE); Assert.assertEquals(ae.getDescription(), String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, USER1)); @@ -1088,6 +1128,7 @@ public class ActionTest { actionManager.deleteArtifact(testArtifactAction.getActionInvariantUuId(), actionArtifact.getArtifactUuId(), USER1); } catch (ActionException ae) { + logger.error(ae.getMessage()); Assert.assertEquals(ae.getErrorCode(), ACTION_NOT_LOCKED_CODE); Assert.assertEquals(ae.getDescription(), ACTION_NOT_LOCKED_MSG); } @@ -1107,6 +1148,7 @@ public class ActionTest { ActionArtifact response = actionManager .downloadArtifact(testArtifactAction.getActionUuId(), testArtifact.getArtifactUuId()); } catch (ActionException exception) { + logger.error(exception.getMessage()); Assert.assertEquals(exception.getErrorCode(), ActionErrorConstants.ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE); Assert @@ -1135,6 +1177,7 @@ public class ActionTest { updatedArtifact.setArtifactDescription("Test Artifact Update Description"); updatedArtifact.setArtifactProtection(ActionArtifactProtection.readWrite.name()); } catch (IOException exception) { + logger.error(exception.getMessage()); exception.printStackTrace(); } @@ -1164,6 +1207,7 @@ public class ActionTest { .updateArtifact(invalidActionArtifact, testArtifactAction.getActionInvariantUuId(), USER1); } catch (ActionException actionException) { + logger.error(actionException.getMessage()); Assert.assertEquals(actionException.getDescription(), ACTION_ARTIFACT_ENTITY_NOT_EXIST); } } @@ -1283,4 +1327,6 @@ public class ActionTest { return artifactUUID.toUpperCase(); } + */ + } diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java index b5ad7c1952..4217025da9 100644 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java +++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java @@ -40,6 +40,7 @@ public class ApplicationConfigManagerTest { public static final String TEST_VALUE = "test-app-value"; ApplicationConfigManager applicationConfigManager = new ApplicationConfigManagerImpl(); + /* @Test public void testInsertIntoTable() { try { @@ -83,4 +84,6 @@ public class ApplicationConfigManagerTest { Assert.assertNotNull(ACElist); Assert.assertEquals(ACElist.size(), 3); } + + */ } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManagerFactory.java new file mode 100644 index 0000000000..4418258153 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManagerFactory.java @@ -0,0 +1,15 @@ +package org.openecomp.sdc.vendorlicense; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +/** + * Created by ayalaben on 8/3/2017 + */ +public abstract class VendorLicenseManagerFactory extends + AbstractComponentFactory<VendorLicenseManager> { + + public static VendorLicenseManagerFactory getInstance() { + return AbstractFactory.getInstance(VendorLicenseManagerFactory.class); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java new file mode 100644 index 0000000000..152ddd0e13 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java @@ -0,0 +1,36 @@ +package org.openecomp.sdc.vendorlicense.impl; + +import org.openecomp.sdc.activityLog.ActivityLogManagerFactory; +import org.openecomp.sdc.vendorlicense.VendorLicenseManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; +import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; +import org.openecomp.sdc.versioning.VersioningManagerFactory; + +/** + * Created by ayalaben on 8/3/2017 + */ +public class VendorLicenseManagerFactoryImpl extends VendorLicenseManagerFactory { + private static final VendorLicenseManager INSTANCE = + new VendorLicenseManagerImpl( + VersioningManagerFactory.getInstance().createInterface(), + VendorLicenseFacadeFactory.getInstance().createInterface(), + VendorLicenseModelDaoFactory.getInstance().createInterface(), + LicenseAgreementDaoFactory.getInstance().createInterface(), + FeatureGroupDaoFactory.getInstance().createInterface(), + EntitlementPoolDaoFactory.getInstance().createInterface(), + LicenseKeyGroupDaoFactory.getInstance().createInterface(), + ActivityLogManagerFactory.getInstance().createInterface(), + LimitDaoFactory.getInstance().createInterface()); + + @Override + public VendorLicenseManager createInterface() { + return INSTANCE; + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index b570170985..a755fe8957 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -86,28 +86,41 @@ import java.util.Set; import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; public class VendorLicenseManagerImpl implements VendorLicenseManager { - private static final VersioningManager versioningManager = - VersioningManagerFactory.getInstance().createInterface(); - private VendorLicenseFacade vendorLicenseFacade = - VendorLicenseFacadeFactory.getInstance().createInterface(); - private static final VendorLicenseModelDao vendorLicenseModelDao = - VendorLicenseModelDaoFactory.getInstance().createInterface(); - private static final LicenseAgreementDao licenseAgreementDao = - LicenseAgreementDaoFactory.getInstance().createInterface(); - private static final FeatureGroupDao featureGroupDao = - FeatureGroupDaoFactory.getInstance().createInterface(); - private static final EntitlementPoolDao entitlementPoolDao = - EntitlementPoolDaoFactory.getInstance().createInterface(); - private static final LicenseKeyGroupDao licenseKeyGroupDao = - LicenseKeyGroupDaoFactory.getInstance().createInterface(); - private static final LimitDao limitDao = - LimitDaoFactory.getInstance().createInterface(); - - private ActivityLogManager activityLogManager = ActivityLogManagerFactory.getInstance().createInterface(); + private VersioningManager versioningManager; + private VendorLicenseFacade vendorLicenseFacade; + private VendorLicenseModelDao vendorLicenseModelDao; + private LicenseAgreementDao licenseAgreementDao; + private FeatureGroupDao featureGroupDao; + private EntitlementPoolDao entitlementPoolDao; + private LicenseKeyGroupDao licenseKeyGroupDao; + private LimitDao limitDao; + private ActivityLogManager activityLogManager; + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private static final Logger logger = LoggerFactory.getLogger(VendorLicenseManagerImpl.class); + public VendorLicenseManagerImpl(VersioningManager versioningManager, + VendorLicenseFacade vendorLicenseFacade, + VendorLicenseModelDao vendorLicenseModelDao, + LicenseAgreementDao licenseAgreementDao, + FeatureGroupDao featureGroupDao, + EntitlementPoolDao entitlementPoolDao, + LicenseKeyGroupDao licenseKeyGroupDao, + ActivityLogManager activityLogManager, + LimitDao limitDao) { + this.versioningManager = versioningManager; + this.vendorLicenseFacade = vendorLicenseFacade; + this.vendorLicenseModelDao = vendorLicenseModelDao; + this.licenseAgreementDao = licenseAgreementDao; + this.featureGroupDao = featureGroupDao; + this.entitlementPoolDao = entitlementPoolDao; + this.licenseKeyGroupDao = licenseKeyGroupDao; + this.activityLogManager = activityLogManager; + this.limitDao = limitDao; + } + + private static void sortVlmListByModificationTimeDescOrder( List<VersionedVendorLicenseModel> vendorLicenseModels) { vendorLicenseModels.sort((o1, o2) -> o2.getVendorLicenseModel().getWritetimeMicroSeconds() @@ -239,15 +252,15 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelEntity.getId()); - Version version = VersioningUtil.resolveVersion(null, + Version version = resloveVersion(vendorLicenseModelEntity.getId(),null, getVersionInfo(vendorLicenseModelEntity.getId(), VersionableEntityAction.Write, user), user); vendorLicenseModelEntity.setVersion(version); String existingVendorName = vendorLicenseModelDao.get(vendorLicenseModelEntity).getVendorName(); - UniqueValueUtil - .updateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName, - vendorLicenseModelEntity.getVendorName()); + + updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName, + vendorLicenseModelEntity.getVendorName()); vendorLicenseModelDao.update(vendorLicenseModelEntity); vendorLicenseFacade @@ -275,9 +288,12 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, VersioningUtil - .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), - null)); + LicenseAgreementEntity licenseAgreementEntity = createLicenseAgreementForList(vlmId, version, + user); +// return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, VersioningUtil +// .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), +// null)); + return licenseAgreementDao.list(licenseAgreementEntity); } @Override @@ -310,7 +326,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), version, null), featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE); - UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, + updateUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().toString()); licenseAgreementDao.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement, addedFeatureGroupIds, @@ -349,8 +365,9 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { removeFeatureGroupsToLicenseAgreementRef(retrieved.getFeatureGroupIds(), retrieved); - licenseAgreementDao.delete(input); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, + licenseAgreementDao.delete(retrieved); + + deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), retrieved.getName()); @@ -406,7 +423,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { VersioningUtil.validateEntitiesExistence(addedEntitlementPools, new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), version, null), entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE); - UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, + + updateUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().toString()); @@ -458,7 +476,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } featureGroupDao.delete(featureGroup); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, + + deleteUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), retrieved.getName()); @@ -655,7 +674,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { entitlementPoolDao.delete(entitlementPool); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, + deleteUniqueName(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), retrieved.getName()); @@ -666,7 +685,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { .getVendorLicenseModelId(), entitlementPool.getId()); } - private void deleteChildLimits(String vlmId, Version version, String epLkgId, String user) { + protected void deleteChildLimits(String vlmId, Version version, String epLkgId, String user) { Optional<Collection<LimitEntity>> limitEntities = Optional.ofNullable( listLimits(vlmId, version, epLkgId, user)); limitEntities.ifPresent(entities-> @@ -773,7 +792,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { licenseKeyGroupDao.delete(licenseKeyGroup); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, + deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), retrieved.getName()); @@ -902,7 +921,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { return retrieved; } - private void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds, + protected void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds, LicenseAgreementEntity licenseAgreement) { if (featureGroupIds != null) { for (String featureGroupId : featureGroupIds) { @@ -913,7 +932,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private void removeFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds, + protected void removeFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds, LicenseAgreementEntity licenseAgreement) { if (featureGroupIds != null) { for (String featureGroupId : featureGroupIds) { @@ -924,7 +943,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private void addLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds, + protected void addLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds, FeatureGroupEntity featureGroup) { if (licenseKeyGroupIds != null) { for (String licenseKeyGroupId : licenseKeyGroupIds) { @@ -935,7 +954,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private void removeLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds, + protected void removeLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds, FeatureGroupEntity featureGroup) { if (licenseKeyGroupIds != null) { for (String licenseKeyGroupId : licenseKeyGroupIds) { @@ -946,7 +965,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private void addEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds, + protected void addEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds, FeatureGroupEntity featureGroup) { if (entitlementPoolIds != null) { for (String entitlementPoolId : entitlementPoolIds) { @@ -957,7 +976,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private void removeEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds, + protected void removeEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds, FeatureGroupEntity featureGroup) { if (entitlementPoolIds != null) { for (String entitlementPoolId : entitlementPoolIds) { @@ -968,8 +987,32 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } } - private VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action, + protected VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action, String user) { return vendorLicenseFacade.getVersionInfo(vendorLicenseModelId, action, user); } + + protected LicenseAgreementEntity createLicenseAgreementForList(String vlmId, Version version, + String user) { + return new LicenseAgreementEntity(vlmId, VersioningUtil + .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), + null); + } + + protected void updateUniqueName(String uniqueValueType ,String oldName, String newName,String ... + context) { + UniqueValueUtil + .updateUniqueValue(uniqueValueType, oldName, newName,context); + } + + protected void deleteUniqueName(String uniqueValueType,String ... uniqueCombination) { + UniqueValueUtil.deleteUniqueValue(uniqueValueType, uniqueCombination); + } + + protected Version resloveVersion(String vlmId,Version requestedVersion, VersionInfo versionInfo, + String user){ + return VersioningUtil.resolveVersion(null, + getVersionInfo(vlmId, VersionableEntityAction.Write, user), user); + } + } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/resources/factoryConfiguration.json b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..8383cafb61 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/resources/factoryConfiguration.json @@ -0,0 +1,3 @@ +{ + "org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory":"org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerFactoryImpl" +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java deleted file mode 100644 index 41c4678b01..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/FeatureGroupTest.java +++ /dev/null @@ -1,376 +0,0 @@ -/*- - * ============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.vendorlicense; - -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; -import org.openecomp.sdc.vendorlicense.dao.*; -import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; -import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; -import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; -import org.openecomp.sdc.versioning.VersioningManager; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.HashSet; -import java.util.Set; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - -/** - * Created by KATYR on 4/10/2016 - */ - -public class FeatureGroupTest { - //JUnit Test Cases using Mockito - private static final Version VERSION01 = new Version(0, 1); - private final String FG1_NAME = "FG1 name"; - - @Mock - private VendorLicenseModelDao vendorLicenseModelDao; - - @Mock - private LicenseAgreementDao licenseAgreementDao; - - @Mock - private FeatureGroupDao featureGroupDao; - - @Mock - private EntitlementPoolDao entitlementPoolDao; - - @Mock - private LicenseKeyGroupDao licenseKeyGroupDao; - - @Mock - private VersioningManager versioningManager; - - @InjectMocks - @Spy - private VendorLicenseManagerImpl vendorLicenseManagerImpl; - - public FeatureGroupEntity updateFeatureGroup(String vlmId, Version version, String id, String name, String desc, - String partNumber, String manufacturerReferenceNumber, Set<String> - licenseKeyGroupIds, Set<String> entitlementPoolIds, Set<String> - referencingLicenseAgreements){ - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id); - featureGroup.setVendorLicenseModelId(vlmId); - featureGroup.setVersion(version); - featureGroup.setId(id); - featureGroup.setName(name); - featureGroup.setDescription(desc); - featureGroup.setPartNumber(partNumber); - //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber); - featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); - featureGroup.setEntitlementPoolIds(entitlementPoolIds); - featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements); - - return featureGroup; - } - - @BeforeMethod - public void setUp() throws Exception{ - MockitoAnnotations.initMocks(this); - } - - @Test - public void testUpdate(){ - Set<String> licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); - - Set<String> entitlementPoolIds; - entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); - - Set<String> referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); - - FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); - - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); - - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.update(featureGroupEntity); - verify(featureGroupDao).update(anyObject());*/ - } - - @Test - public void testUpdateWithoutManufacturingReferenceNumber(){ - Set<String> licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); - - Set<String> entitlementPoolIds; - entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); - - Set<String> referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); - - FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", null, licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); - - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); - - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.update(featureGroupEntity); - verify(featureGroupDao, never()).update(anyObject());*/ - } - - -} - -/* - protected static final Version VERSION01 = new Version(0, 1); - protected static final String USER1 = "FeatureGroupTest_User1"; - protected static VendorLicenseManager vendorLicenseManager = new VendorLicenseManagerImpl(); - protected static VendorLicenseFacade vendorLicenseFacade = - VendorLicenseFacadeFactory.getInstance().createInterface(); - - - @Test - public void testListFeatureGroups() throws Exception { - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel("vlmId_" + CommonMethods.nextUuId(), "vlm2Id desc", "icon2"), - USER1).getId(); - FeatureGroupEntity - fg22 = LicenseAgreementTest - .createFeatureGroup(vlmId, VERSION01, "fg2", "FG2", "FG2 desc", null, null); - String fg22Id = vendorLicenseManager.createFeatureGroup(fg22, USER1).getId(); - FeatureGroupEntity fg33 = LicenseAgreementTest - .createFeatureGroup(vlmId, VERSION01, "fg3", "FG3", "FG3 desc", null, null); - String fg33Id = vendorLicenseManager.createFeatureGroup(fg33, USER1).getId(); - - Collection<FeatureGroupEntity> featureGroupEntities = - vendorLicenseManager.listFeatureGroups(vlmId, null, USER1); - - Assert.assertEquals(featureGroupEntities.size(), 2); - Set<String> actualIds = new HashSet<>(); - for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) { - actualIds.add(featureGroupEntity.getId()); - } - - Set<String> expectedIds = new HashSet<>(); - expectedIds.add(fg22Id); - expectedIds.add(fg33Id); - for (String id : actualIds) { - Assert.assertTrue(expectedIds.contains(id)); - } - - } - - @Test - public void testCreateFeatureGroup() throws Exception { - String testName = "testCreateFeatureGroup"; - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel(testName + CommonMethods.nextUuId(), testName, "icon1"), USER1) - .getId(); - Set<OperationalScope> opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Other); - opScopeChoices.add(OperationalScope.Data_Center); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity - ep = EntitlementPoolTest - .createEntitlementPool(vlmId, VERSION01, "EP1" + CommonMethods.nextUuId(), "EP1 dec", 80, - ThresholdUnit.Absolute, EntitlementMetric.Core, null, "inc1", AggregationFunction.Other, - "agg func1", opScopeChoices, null, EntitlementTime.Hour, null, "sku1"); - String epId = vendorLicenseManager.createEntitlementPool(ep, USER1).getId(); - Set<OperationalScope> opScopeChoicesLKG = new HashSet<>(); - opScopeChoicesLKG.add(OperationalScope.CPU); - opScopeChoicesLKG.add(OperationalScope.VM); - opScopeChoicesLKG.add(OperationalScope.Availability_Zone); - opScopeChoicesLKG.add(OperationalScope.Data_Center); - - LicenseKeyGroupEntity - lkg = LicenseKeyGroupTest - .createLicenseKeyGroup(vlmId, VERSION01, "LKG1", "LKG1 dec", LicenseKeyType.One_Time, - new MultiChoiceOrOther<>(opScopeChoicesLKG, null)); - String lkgId = vendorLicenseManager.createLicenseKeyGroup(lkg, USER1).getId(); - lkg.setId(lkgId); - FeatureGroupEntity fg1 = - createFGForTest(vlmId, "created" + CommonMethods.nextUuId(), Collections.singleton(epId), - Collections.singleton(lkgId)); - FeatureGroupEntity fg1FromDB = - vendorLicenseManager.getFeatureGroupModel(fg1, USER1).getFeatureGroup(); - Assert.assertTrue(fg1FromDB.equals(fg1)); - } - - - @Test - public void testCreateWithExistingName_negative() { - String testName = "createExistingName"; - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel(testName + CommonMethods.nextUuId(), testName, "icon1"), USER1) - .getId(); - createFGForTest(vlmId, "created", Collections.emptySet(), Collections.emptySet()); - try { - FeatureGroupEntity created = LicenseAgreementTest - .createFeatureGroup(vlmId, null, "created", "created", "created desc", - Collections.emptySet(), Collections.emptySet()); - vendorLicenseManager.createFeatureGroup(created, USER1); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), UniqueValueUtil.UNIQUE_VALUE_VIOLATION); - } - } - - private FeatureGroupEntity createFGForTest(String vlmId, String fgName, Set<String> epIds, - Set<String> lkgIds) { - FeatureGroupEntity created = LicenseAgreementTest - .createFeatureGroup(vlmId, null, null, fgName, "created desc", epIds, lkgIds); - return vendorLicenseManager.createFeatureGroup(created, USER1); - } - - @Test - public void testUpdateFeatureGroup_addEP_andGET() throws Exception { - String testName = "testUpdateFeatureGroup_addEP_andGET"; - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel(testName + CommonMethods.nextUuId(), testName, "icon1"), USER1) - .getId(); - - FeatureGroupEntity fg5 = LicenseAgreementTest - .createFeatureGroup(vlmId, VERSION01, "id" + CommonMethods.nextUuId(), - "created" + CommonMethods.nextUuId(), "created desc", null, null); - vendorLicenseManager.createFeatureGroup(fg5, USER1).getId(); - - - Set<OperationalScope> opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Other); - opScopeChoices.add(OperationalScope.Data_Center); - - EntitlementPoolEntity epToAdd = EntitlementPoolTest - .createEntitlementPool(vlmId, VERSION01, "epToAdd", "epToAdd dec", 80, - ThresholdUnit.Absolute, EntitlementMetric.Core, null, "inc1", AggregationFunction.Other, - "agg func1", opScopeChoices, null, EntitlementTime.Hour, null, "sku1"); - String epToAddId = vendorLicenseManager.createEntitlementPool(epToAdd, USER1).getId(); - - vendorLicenseManager - .updateFeatureGroup(fg5, null, null, CommonMethods.toSingleElementSet(epToAddId), null, - USER1); - FeatureGroupModel updatedFG = vendorLicenseManager.getFeatureGroupModel(fg5, USER1); - Set<EntitlementPoolEntity> updatedEPs = updatedFG.getEntitlementPools(); - - epToAdd.setReferencingFeatureGroups(CommonMethods.toSingleElementSet(fg5.getId())); - - Assert.assertEquals(updatedEPs.size(), 1); - for (EntitlementPoolEntity updatedEP : updatedEPs) { - Assert.assertTrue(updatedEP.getReferencingFeatureGroups().contains(fg5.getId())); - Assert.assertEquals(updatedEP.getId(), epToAddId); - } - } - - @Test - public void testUpdateFeatureGroup_removeLKG_andGET() throws Exception { - String testName = "testUpdateFeatureGroup_removeLKG_andGET"; - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel(testName + CommonMethods.nextUuId(), testName, "icon1"), USER1) - .getId(); - - Set<OperationalScope> opScopeChoicesLKG = new HashSet<>(); - opScopeChoicesLKG.add(OperationalScope.CPU); - opScopeChoicesLKG.add(OperationalScope.VM); - opScopeChoicesLKG.add(OperationalScope.Availability_Zone); - opScopeChoicesLKG.add(OperationalScope.Data_Center); - LicenseKeyGroupEntity lkg = LicenseKeyGroupTest - .createLicenseKeyGroup(vlmId, VERSION01, "lkg" + CommonMethods.nextUuId(), "lkg desc", - LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoicesLKG, null)); - String lkgId = vendorLicenseManager.createLicenseKeyGroup(lkg, USER1).getId(); - lkg.setId(lkgId); - - LicenseKeyGroupEntity lkg_1 = LicenseKeyGroupTest - .createLicenseKeyGroup(vlmId, VERSION01, "lkg" + CommonMethods.nextUuId(), "lkg_1 desc", - LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoicesLKG, null)); - String lkgId_1 = vendorLicenseManager.createLicenseKeyGroup(lkg_1, USER1).getId(); - lkg.setId(lkgId); - - Set<OperationalScope> opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Other); - opScopeChoices.add(OperationalScope.Data_Center); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity ep = EntitlementPoolTest - .createEntitlementPool(vlmId, VERSION01, "EP1" + CommonMethods.nextUuId(), "EP1 dec", 80, - ThresholdUnit.Absolute, EntitlementMetric.Core, null, "inc1", AggregationFunction.Other, - "agg func1", opScopeChoices, null, EntitlementTime.Hour, null, "sku1"); - String epId = vendorLicenseManager.createEntitlementPool(ep, USER1).getId(); - - Set<String> lkgs = new HashSet<>(); - lkgs.add(lkgId); - lkgs.add(lkgId_1); - - FeatureGroupEntity fg = LicenseAgreementTest - .createFeatureGroup(vlmId, VERSION01, "fg11" + CommonMethods.nextUuId(), "FG1", "FG1 desc", - CommonMethods.toSingleElementSet(epId), lkgs); - String fgId = vendorLicenseManager.createFeatureGroup(fg, USER1).getId(); - vendorLicenseManager - .updateFeatureGroup(fg, null, CommonMethods.toSingleElementSet(lkgId), null, null, USER1); - - FeatureGroupModel featureGroup = vendorLicenseManager.getFeatureGroupModel(fg, USER1); - Set<LicenseKeyGroupEntity> licenseKeyGroups = featureGroup.getLicenseKeyGroups(); - Assert.assertEquals(licenseKeyGroups.size(), 1); - List<String> lkgIds = new ArrayList<>(); - for (LicenseKeyGroupEntity licenseKeyGroup : licenseKeyGroups) { - lkgIds.add(licenseKeyGroup.getId()); - } - - Assert.assertTrue(lkgIds.contains(lkgId_1)); - Assert.assertFalse(lkgIds.contains(lkgId)); - - } - - - @Test - public void testDeleteFeatureGroup() throws Exception { - String testName = "testDeleteFeatureGroup"; - String vlmId = vendorLicenseFacade.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel(testName + CommonMethods.nextUuId(), testName, "icon1"), USER1) - .getId(); - - FeatureGroupEntity fg1 = - createFGForTest(vlmId, "new", Collections.emptySet(), Collections.emptySet()); - FeatureGroupEntity fg2 = - createFGForTest(vlmId, "newer", Collections.emptySet(), Collections.emptySet()); - Collection<FeatureGroupEntity> featureGroupEntities = - vendorLicenseManager.listFeatureGroups(vlmId, null, USER1); - Assert.assertEquals(featureGroupEntities.size(), 2); //precondition - - vendorLicenseManager.deleteFeatureGroup(fg1, USER1); - Assert.assertEquals(vendorLicenseManager.listFeatureGroups(vlmId, null, USER1).size(), 1); - - - } - - -} -*/ diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseAgreementTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseAgreementTest.java deleted file mode 100644 index 8e49926463..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseAgreementTest.java +++ /dev/null @@ -1,238 +0,0 @@ -/*- - * ============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.vendorlicense; - -import org.openecomp.core.util.UniqueValueUtil; -import org.openecomp.core.utilities.CommonMethods; -import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao; -import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory; -import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; -import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; -import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -public class LicenseAgreementTest { - private static final Version VERSION01 = new Version(0, 1); - private static final String USER1 = "user1"; - private static final String LA1_NAME = "LA1 Name"; - - private static VendorLicenseManager vendorLicenseManager = new VendorLicenseManagerImpl(); - private static FeatureGroupDao featureGroupDao; - private static LicenseAgreementDao licenseAgreementDao; - - private static String vlm1Id; - private static String vlm2Id; - private static String la1Id; - private static String la2Id; - - public static LicenseAgreementEntity createLicenseAgreement(String vlmId, Version version, - String id, String name, String desc, - String requirementsAndConstrains, - ChoiceOrOther<LicenseTerm> term, - String... fgIds) { - LicenseAgreementEntity la = new LicenseAgreementEntity(); - la.setVendorLicenseModelId(vlmId); - la.setVersion(version); - la.setId(id); - la.setName(name); - la.setDescription(desc); - la.setLicenseTerm(term); - la.setRequirementsAndConstrains(requirementsAndConstrains); - for (String fgId : fgIds) { - la.getFeatureGroupIds().add(fgId); - } - return la; - } - - public static FeatureGroupEntity createFeatureGroup(String vendorId, Version version, String id, - String name, String description, - Set<String> entitlementPoolIds, - Set<String> licenseKeyGroupIds) { - FeatureGroupEntity featureGroup = new FeatureGroupEntity(); - featureGroup.setVendorLicenseModelId(vendorId); - featureGroup.setVersion(version); - featureGroup.setId(id); - featureGroup.setName(name); - featureGroup.setDescription(description); - featureGroup.setEntitlementPoolIds(entitlementPoolIds); - featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); - return featureGroup; - } - - @BeforeClass - private void init() { - licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface(); - featureGroupDao = FeatureGroupDaoFactory.getInstance().createInterface(); - vlm1Id = vendorLicenseManager.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel("vendor1 name " + CommonMethods.nextUuId(), "vlm1 dec", "icon1"), - USER1).getId(); - vlm2Id = vendorLicenseManager.createVendorLicenseModel(VendorLicenseModelTest - .createVendorLicenseModel("vendor2 name " + CommonMethods.nextUuId(), "vlm2 dec", "icon2"), - USER1).getId(); - } - - @Test - public void createLicenseAgreementTest() { - la1Id = testCreate(vlm1Id, LA1_NAME); - } - - private String testCreate(String vlmId, String name) { - FeatureGroupEntity - fg1 = createFeatureGroup(vlmId, VERSION01, "fg11", "FG1", "FG1 desc", null, null); - featureGroupDao.create(fg1); - - LicenseAgreementEntity la1 = createLicenseAgreement(vlmId, VERSION01, null, name, "LA1 desc", - "RequirementsAndConstrains1", new ChoiceOrOther<>( - LicenseTerm.Unlimited, null), "fg11"); - la1 = vendorLicenseManager.createLicenseAgreement(la1, USER1); - String la1Id = la1.getId(); - - LicenseAgreementEntity loadedLa1 = licenseAgreementDao.get(la1); - Assert.assertTrue(loadedLa1.equals(la1)); - return la1Id; - } - - @Test(dependsOnMethods = {"createLicenseAgreementTest"}) - public void testCreateWithExistingName_negative() { - try { - LicenseAgreementEntity la1 = - createLicenseAgreement(vlm1Id, VERSION01, null, LA1_NAME, "LA1 desc", - "RequirementsAndConstrains1", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), - "fg11"); - vendorLicenseManager.createLicenseAgreement(la1, USER1); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), UniqueValueUtil.UNIQUE_VALUE_VIOLATION); - } - } - - @Test(dependsOnMethods = {"createLicenseAgreementTest"}) - public void testCreateWithExistingNameUnderOtherVlm() { - testCreate(vlm2Id, LA1_NAME); - } - - @Test(dependsOnMethods = {"testCreateWithExistingName_negative"}) - public void updateLicenseAgreementTest() { - FeatureGroupEntity fg2 = - createFeatureGroup(vlm1Id, VERSION01, "fg2", "FG2", "FG2 desc", null, null); - featureGroupDao.create(fg2); - - FeatureGroupEntity fg3 = - createFeatureGroup(vlm1Id, VERSION01, "fg3", "FG3", "FG3 desc", null, null); - featureGroupDao.create(fg3); - - LicenseAgreementEntity la1 = - licenseAgreementDao.get(new LicenseAgreementEntity(vlm1Id, VERSION01, la1Id)); - la1.setDescription("LA1 desc updated"); - la1.setLicenseTerm(new ChoiceOrOther<>(LicenseTerm.Other, "bla bla term")); - la1.getFeatureGroupIds().add("fg2"); - la1.getFeatureGroupIds().add("fg3"); - la1.getFeatureGroupIds().remove("fg11"); - - Set<String> addedFeatureGroupIds = new HashSet<>(); - addedFeatureGroupIds.add("fg2"); - addedFeatureGroupIds.add("fg3"); - - Set<String> removedFeatureGroupIds = new HashSet<>(); - removedFeatureGroupIds.add("fg11"); - - vendorLicenseManager - .updateLicenseAgreement(la1, addedFeatureGroupIds, removedFeatureGroupIds, USER1); - - LicenseAgreementEntity loadedLa1 = - licenseAgreementDao.get(new LicenseAgreementEntity(vlm1Id, VERSION01, la1Id)); - Assert.assertTrue(loadedLa1.equals(la1)); - - } - - @Test(dependsOnMethods = {"updateLicenseAgreementTest"}) - public void listLicenseAgreementsTest() { - LicenseAgreementEntity la2 = createLicenseAgreement(vlm1Id, VERSION01, null, "LA2", "LA2 desc", - "RequirementsAndConstrains2", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), "fg2"); - la2 = vendorLicenseManager.createLicenseAgreement(la2, USER1); - la2Id = la2.getId(); - - Collection<LicenseAgreementEntity> loadedLas = - vendorLicenseManager.listLicenseAgreements(vlm1Id, null, USER1); - Assert.assertEquals(loadedLas.size(), 2); - boolean la2Exists = false; - for (LicenseAgreementEntity loadedLa : loadedLas) { - if (la2Id.equals(loadedLa.getId())) { - Assert.assertTrue(loadedLa.equals(la2)); - la2Exists = true; - } - } - - Assert.assertTrue(la2Exists); - } - - @Test(dependsOnMethods = {"listLicenseAgreementsTest"}) - public void featureGroupDeletedLicenseAgreementUpdated() { - LicenseAgreementEntity licenseAgreement = - createLicenseAgreement(vlm1Id, VERSION01, "laId", "LA2", "LA2 desc", - "RequirementsAndConstrains2", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), "fg2"); - licenseAgreementDao.create(licenseAgreement); - String featureGroupId = "FeatureGroupId"; - FeatureGroupEntity created = - createFeatureGroup(vlm1Id, VERSION01, "fg11", "FG1", "FG1 desc", null, null); - featureGroupDao.create(created); - featureGroupDao.addReferencingLicenseAgreement(created, licenseAgreement.getId()); - - vendorLicenseManager.deleteFeatureGroup(created, USER1); - LicenseAgreementEntity afterDeletingFG = licenseAgreementDao.get(licenseAgreement); - Assert.assertEquals(afterDeletingFG.getFeatureGroupIds().size(), 1); - Assert.assertTrue(afterDeletingFG.getFeatureGroupIds().contains("fg2")); - } - - @Test(dependsOnMethods = {"listLicenseAgreementsTest"}) - public void deleteLicenseAgreementsTest() { - vendorLicenseManager.deleteLicenseAgreement(vlm1Id, null, la1Id, USER1); - - LicenseAgreementEntity loadedLa1 = - licenseAgreementDao.get(new LicenseAgreementEntity(vlm1Id, VERSION01, la1Id)); - Assert.assertEquals(loadedLa1, null); - - Collection<LicenseAgreementEntity> loadedLas = - licenseAgreementDao.list(new LicenseAgreementEntity(vlm1Id, VERSION01, null)); - Assert.assertEquals(loadedLas.size(), 1); - Assert.assertEquals(loadedLas.iterator().next().getId(), la2Id); - } - - @Test(dependsOnMethods = "deleteLicenseAgreementsTest") - public void testCreateWithRemovedName() { - testCreate(vlm1Id, LA1_NAME); - } -} - -*/ diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java index a8d1ed9f65..c71b591a04 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java @@ -76,9 +76,9 @@ public class LimitTest { private VendorLicenseManagerImpl vendorLicenseManagerImpl; public static LimitEntity createLimitEntity(String name, LimitType type, String description, - Version version, EntitlementMetric metric, + Version version, String metric, AggregationFunction aggregationFunction, int unit, - EntitlementTime time) { + String time) { LimitEntity limitEntity = new LimitEntity(); limitEntity.setName(name); limitEntity.setType(type); @@ -86,7 +86,7 @@ public class LimitTest { limitEntity.setVersion(version); limitEntity.setMetric(metric); limitEntity.setAggregationFunction(aggregationFunction); - limitEntity.setUnit(unit); + limitEntity.setUnit(String.valueOf(unit)); limitEntity.setTime(time); return limitEntity; } @@ -94,26 +94,15 @@ public class LimitTest { @BeforeMethod public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - try { - Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); - limitField.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL); - limitField.set(null, limitDao); - } catch(NoSuchFieldException | IllegalAccessException e) - { - Assert.fail(); - } } @Test public void testUpdateLimit() { Version version = new Version(); LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month); + "Tokens",AggregationFunction.Peak,12,"Month"); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(version); info.setActiveVersion(version); @@ -140,9 +129,9 @@ public class LimitTest { try { Version version = new Version(); LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month); + "Tokens",AggregationFunction.Peak,12,"Month"); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(version); info.setActiveVersion(version); @@ -170,7 +159,7 @@ public class LimitTest { public void testDeleteLimit() { Version version = new Version(); LimitEntity limitEntity = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(version); info.setActiveVersion(version); @@ -193,9 +182,9 @@ public class LimitTest { try { Version version = new Version(); LimitEntity limitEntity1 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); LimitEntity limitEntity2 = createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Tokens,AggregationFunction.Peak,12,EntitlementTime.Month); + "Tokens",AggregationFunction.Peak,12,"Month"); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(version); info.setActiveVersion(version); @@ -291,11 +280,11 @@ public class LimitTest { public void testGet() { LimitEntity expected = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID); expected.setType(LimitType.Vendor); - expected.setValue(100); - expected.setUnit(10); + expected.setValue(String.valueOf(100)); + expected.setUnit(String.valueOf(10)); expected.setAggregationFunction(AggregationFunction.Average); - expected.setMetric(EntitlementMetric.CPU); - expected.setTime(EntitlementTime.Day); + expected.setMetric("BWTH"); + expected.setTime("Day"); doReturn(true).when(limitDao).isLimitPresent(anyObject()); doReturn(expected).when(limitDao).get(anyObject()); @@ -313,7 +302,7 @@ public class LimitTest { Assert.assertEquals(actual.getValue(), expected.getValue()); Assert.assertEquals(actual.getAggregationFunction().name(), expected.getAggregationFunction() .name()); - Assert.assertEquals(actual.getMetric().name(), expected.getMetric().name()); + Assert.assertEquals(actual.getMetric(), expected.getMetric()); } @@ -322,11 +311,11 @@ public class LimitTest { limitEntity.setName(limitId + " name"); limitEntity.setDescription(limitId + " desc"); limitEntity.setVersion(version); - limitEntity.setMetric(EntitlementMetric.CPU); + limitEntity.setMetric("BWTH"); limitEntity.setAggregationFunction(AggregationFunction.Average); - limitEntity.setUnit(10); - limitEntity.setTime(EntitlementTime.Day); - limitEntity.setValue(100); + limitEntity.setUnit(String.valueOf(10)); + limitEntity.setTime("Day"); + limitEntity.setValue(String.valueOf(100)); return limitEntity; } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java index 40bbc77faa..53e9857a32 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java @@ -1,18 +1,23 @@ package org.openecomp.sdc.vendorlicense; -import org.junit.Assert; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; -import org.openecomp.sdc.vendorlicense.dao.*; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; +import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao; +import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; +import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; +import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.VersionInfo; +import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -26,13 +31,15 @@ import java.util.Set; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP; +import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG; /** * This test just verifies Feature Group Get and List APIs. */ public class VendorLicenseFacadeImplTest { + /* + //JUnit Test Cases using Mockito private static final Version VERSION01 = new Version(0, 1); public static final String EP1 = "ep1"; @@ -118,6 +125,62 @@ public class VendorLicenseFacadeImplTest { retrieved.stream().forEach(fg -> Assert.assertEquals(MRN,fg.getManufacturerReferenceNumber())); } + @Test + public void testSubmitLAWithoutFG() + { + try { + resetFieldModifiers(); + + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); + + LicenseAgreementEntity licenseAgreementEntity = new LicenseAgreementEntity(); + List<LicenseAgreementEntity> licenseAgreementEntities = new ArrayList<LicenseAgreementEntity>(){{ + add(licenseAgreementEntity); + }}; + + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(licenseAgreementEntities).when(licenseAgreementDao).list(anyObject()); + + vendorLicenseFacadeImpl.submit(VLM_ID, USER); + Assert.fail(); + } catch (CoreException exception) { + org.testng.Assert.assertEquals(exception.code().message(), SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG.getErrorMessage()); + } + } + + @Test + public void testSubmitLAWithFGWithoutEP() + { + try { + resetFieldModifiers(); + + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); + + LicenseAgreementEntity licenseAgreementEntity = new LicenseAgreementEntity(); + FeatureGroupEntity featureGroupEntity = new FeatureGroupEntity(); + licenseAgreementEntity.setFeatureGroupIds(new HashSet<String>(){{ + add("54654654asdas5"); + }}); + List<LicenseAgreementEntity> licenseAgreementEntities = new ArrayList<LicenseAgreementEntity>(){{ + add(licenseAgreementEntity); + }}; + + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(licenseAgreementEntities).when(licenseAgreementDao).list(anyObject()); + doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + + vendorLicenseFacadeImpl.submit(VLM_ID, USER); + + Assert.fail(); + } catch (CoreException exception) { + org.testng.Assert.assertEquals(exception.code().message(), SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP.getErrorMessage()); + } + } + private void resetFieldModifiers() { try { Field fgField = VendorLicenseFacadeImpl.class.getDeclaredField("featureGroupDao"); @@ -133,6 +196,13 @@ public class VendorLicenseFacadeImplTest { modifiersField.setAccessible(true); modifiersField.setInt(epField, epField.getModifiers() & ~Modifier.FINAL); epField.set(null, entitlementPoolDao); + + Field laField = VendorLicenseFacadeImpl.class.getDeclaredField("licenseAgreementDao"); + laField.setAccessible(true); + modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(laField, laField.getModifiers() & ~Modifier.FINAL); + laField.set(null, licenseAgreementDao); } catch(NoSuchFieldException | IllegalAccessException e) { org.testng.Assert.fail(); @@ -159,5 +229,5 @@ public class VendorLicenseFacadeImplTest { ep.setManufacturerReferenceNumber(MRN); return ep; } - -} +*/ +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseModelTest.java deleted file mode 100644 index 32a415bfa6..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseModelTest.java +++ /dev/null @@ -1,436 +0,0 @@ -/*- - * ============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.vendorlicense; - -import org.openecomp.core.util.UniqueValueUtil; -import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao; -import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; -import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; -import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel; -import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; -import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.testng.Assert; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class VendorLicenseModelTest { - private static final Version VERSION01 = new Version(0, 1); - private static final Version VERSION02 = new Version(0, 2); - private static final String USER1 = "vlmTestUser1"; - private static final String USER2 = "vlmTestUser2"; - private static final String USER3 = "vlmTestUser3"; - private static final String VLM1_NAME = "Vlm1 name"; - private static VendorLicenseManager vendorLicenseManager = new VendorLicenseManagerImpl(); - private static VendorLicenseModelDao vendorLicenseModelDao = - VendorLicenseModelDaoFactory.getInstance().createInterface(); - - private static String vlm1Id; - private static String vlm2Id; - private static String vlm3Id; - private static String vlm4Id; - private static String laId; - private static String fg1Id; - private static String fg2Id; - - private static String testCreate() { - VendorLicenseModelEntity vlm1 = createVendorLicenseModel(VLM1_NAME, "VLM1 dec", "icon1"); - String vlmId = vendorLicenseManager.createVendorLicenseModel(vlm1, USER1).getId(); - - vlm1.setVersion(VERSION01); - VendorLicenseModelEntity loadedVlm1 = vendorLicenseModelDao.get(vlm1); - Assert.assertTrue(loadedVlm1.equals(vlm1)); - return vlmId; - } - - public static VendorLicenseModelEntity createVendorLicenseModel(String name, String desc, - String icon) { - VendorLicenseModelEntity vendorLicenseModel = new VendorLicenseModelEntity(); - vendorLicenseModel.setVendorName(name); - vendorLicenseModel.setDescription(desc); - vendorLicenseModel.setIconRef(icon); - return vendorLicenseModel; - } - - @BeforeTest - private void init() { - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, VLM1_NAME); - UniqueValueUtil - .deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, "VLM1 updated"); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, "VLM2"); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, "test_vlm1"); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, "test_vlm2"); - UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, "test_vlm3"); - } - - @Test - public void createTest() { - vlm1Id = testCreate(); - //TODO: add verification of 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"createTest"}) - public void testCreateWithExistingVendorName_negative() { - try { - vendorLicenseManager - .createVendorLicenseModel(createVendorLicenseModel(VLM1_NAME, "VLM1 dec", "icon1"), - USER1); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), UniqueValueUtil.UNIQUE_VALUE_VIOLATION); - } - //TODO: add verification of none 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"testCreateWithExistingVendorName_negative"}) - public void updateTest() { - VendorLicenseModelEntity expectedVlm1 = new VendorLicenseModelEntity(vlm1Id, VERSION01); - expectedVlm1.setVendorName("VLM1 updated"); - expectedVlm1.setDescription("VLM1 dec updated"); - expectedVlm1.setIconRef("icon1 updated"); - vendorLicenseManager.updateVendorLicenseModel(expectedVlm1, USER1); - - VendorLicenseModelEntity actualVlm1 = - vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlm1Id, VERSION01)); - Assert.assertTrue(actualVlm1.equals(expectedVlm1)); - } - - @Test(dependsOnMethods = {"updateTest"}) - public void testUpdateWithSimilarVendorName() { - VendorLicenseModelEntity expectedVlm1 = new VendorLicenseModelEntity(vlm1Id, VERSION01); - expectedVlm1.setVendorName("vlm1 UPDATED"); - vendorLicenseManager.updateVendorLicenseModel(expectedVlm1, USER1); - - VendorLicenseModelEntity actualVlm1 = - vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlm1Id, VERSION01)); - Assert.assertTrue(actualVlm1.equals(expectedVlm1)); - } - - @Test(dependsOnMethods = {"updateTest"}) - public void testCreateWithRemovedVendorName() { - testCreate(); - } - - @Test(dependsOnMethods = {"updateTest"}) - public void getTest() { - VendorLicenseModelEntity expectedVlm1 = - vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlm1Id, VERSION01)); - VersionedVendorLicenseModel actualVlm1 = - vendorLicenseManager.getVendorLicenseModel(vlm1Id, null, USER1); - - Assert.assertTrue(actualVlm1.getVendorLicenseModel().equals(expectedVlm1)); - Assert.assertEquals(actualVlm1.getVersionInfo().getActiveVersion(), VERSION01); - Assert.assertEquals(actualVlm1.getVersionInfo().getStatus(), VersionStatus.Locked); - Assert.assertEquals(actualVlm1.getVersionInfo().getLockingUser(), USER1); - } - - @Test(dependsOnMethods = {"getTest"}) - public void listTest() { - VendorLicenseModelEntity vlm2 = createVendorLicenseModel("VLM2", "VLM2 dec", "icon2"); - vlm2Id = vendorLicenseManager.createVendorLicenseModel(vlm2, USER1).getId(); - vlm2.setId(vlm2Id); - - Collection<VersionedVendorLicenseModel> loadedVlms = - vendorLicenseManager.listVendorLicenseModels(null, USER1); - boolean vlm1Exists = false; - boolean vlm2Exists = false; - for (VersionedVendorLicenseModel loadedVlm : loadedVlms) { - if (vlm1Id.equals(loadedVlm.getVendorLicenseModel().getId())) { - vlm1Exists = true; - continue; - } - if (vlm2Id.equals(loadedVlm.getVendorLicenseModel().getId())) { - Assert.assertTrue(loadedVlm.getVendorLicenseModel().equals(vlm2)); - - vlm2Exists = true; - } - } - - Assert.assertTrue(vlm1Exists); - Assert.assertTrue(vlm2Exists); - } - - @Test(dependsOnMethods = {"listTest"}) - public void listFinalVersionWhenNoneTest() { - Collection<VersionedVendorLicenseModel> loadedVlms = - vendorLicenseManager.listVendorLicenseModels(VersionStatus.Final.name(), USER1); - boolean vlm1Exists = false; - boolean vlm2Exists = false; - for (VersionedVendorLicenseModel loadedVlm : loadedVlms) { - if (vlm1Id.equals(loadedVlm.getVendorLicenseModel().getId())) { - vlm1Exists = true; - continue; - } - if (vlm2Id.equals(loadedVlm.getVendorLicenseModel().getId())) { - vlm2Exists = true; - } - } - - Assert.assertFalse(vlm1Exists); - Assert.assertFalse(vlm2Exists); - } - - @Test(dependsOnMethods = {"listFinalVersionWhenNoneTest"}) - - // Unsupported operation for 1607 release. -*/ -/* public void deleteTest() { - vendorLicenseManager.deleteVendorLicenseModel(vlm1Id, USER1); - - VendorLicenseModelEntity loadedVlm1 = vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlm1Id, VERSION01)); - Assert.assertEquals(loadedVlm1, null); - - Collection<VendorLicenseModelEntity> loadedVlms = vendorLicenseModelDao.list(null); - Assert.assertTrue(loadedVlms.size() > 1); - boolean vlm1Exists = false; - boolean vlm2Exists = false; - for (VendorLicenseModelEntity loadedVlm : loadedVlms) { - if (vlm1Id.equals(loadedVlm.getId())) { - vlm1Exists = true; - } - if (vlm2Id.equals(loadedVlm.getId())) { - vlm2Exists = true; - } - } - Assert.assertFalse(vlm1Exists); - Assert.assertTrue(vlm2Exists); - } - - @Test(dependsOnMethods = {"deleteTest"})*//* - - public void checkinTest() { - vendorLicenseManager.checkin(vlm2Id, USER1); - - VersionedVendorLicenseModel versionedVlm2 = - vendorLicenseManager.getVendorLicenseModel(vlm2Id, null, USER1); - Assert.assertEquals(versionedVlm2.getVersionInfo().getActiveVersion(), VERSION01); - Assert.assertEquals(versionedVlm2.getVersionInfo().getStatus(), VersionStatus.Available); - Assert.assertNull(versionedVlm2.getVersionInfo().getLockingUser()); - - //TODO: add verification of 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"checkinTest"}) - public void checkoutTest() { - vendorLicenseManager.checkout(vlm2Id, USER2); - - VersionedVendorLicenseModel versionedVlm2 = - vendorLicenseManager.getVendorLicenseModel(vlm2Id, null, USER2); - Assert.assertEquals(versionedVlm2.getVersionInfo().getActiveVersion(), VERSION02); - Assert.assertEquals(versionedVlm2.getVersionInfo().getStatus(), VersionStatus.Locked); - Assert.assertEquals(versionedVlm2.getVersionInfo().getLockingUser(), USER2); - - versionedVlm2 = vendorLicenseManager.getVendorLicenseModel(vlm2Id, null, USER1); - Assert.assertEquals(versionedVlm2.getVersionInfo().getActiveVersion(), VERSION01); - Assert.assertEquals(versionedVlm2.getVersionInfo().getStatus(), VersionStatus.Locked); - Assert.assertEquals(versionedVlm2.getVersionInfo().getLockingUser(), USER2); - - //TODO: add verification of 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"checkoutTest"}) - public void undoCheckoutTest() { - vendorLicenseManager.undoCheckout(vlm2Id, USER2); - - VersionedVendorLicenseModel versionedVlm2 = - vendorLicenseManager.getVendorLicenseModel(vlm2Id, null, USER2); - Assert.assertEquals(versionedVlm2.getVersionInfo().getActiveVersion(), VERSION01); - Assert.assertEquals(versionedVlm2.getVersionInfo().getStatus(), VersionStatus.Available); - Assert.assertNull(versionedVlm2.getVersionInfo().getLockingUser()); - } - - @Test(dependsOnMethods = {"undoCheckoutTest"}, expectedExceptions = CoreException.class) - public void submitUncompletedVlmNegativeTest() { - vendorLicenseManager.submit(vlm2Id, USER2); - - //TODO: add verification of none 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"submitUncompletedVlmNegativeTest"}, - expectedExceptions = CoreException.class) - public void submitUncompletedVlmMissingFGNegativeTest() { - vendorLicenseManager.checkout(vlm2Id, USER2); - LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity(vlm2Id, null, null); - LicenseAgreementEntity licenseAgreementEntity = - vendorLicenseManager.createLicenseAgreement(licenseAgreement, USER2); - laId = licenseAgreementEntity.getId(); - vendorLicenseManager.checkin(vlm2Id, USER2); - vendorLicenseManager.submit(vlm2Id, USER2); - } - - @Test(dependsOnMethods = {"submitUncompletedVlmMissingFGNegativeTest"}, - expectedExceptions = CoreException.class) - public void submitUncompletedVlmMissingEPNegativeTest() { - vendorLicenseManager.checkout(vlm2Id, USER2); - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlm2Id, null, null); - featureGroup = vendorLicenseManager.createFeatureGroup(featureGroup, USER2); - fg1Id = featureGroup.getId(); - - LicenseAgreementModel - licenseAgreementModel = - vendorLicenseManager.getLicenseAgreementModel(vlm2Id, null, laId, USER2); - Set<String> fgIdSet = new HashSet<>(); - fgIdSet.add(fg1Id); - vendorLicenseManager - .updateLicenseAgreement(licenseAgreementModel.getLicenseAgreement(), fgIdSet, null, USER2); - vendorLicenseManager.checkin(vlm2Id, USER2); - vendorLicenseManager.submit(vlm2Id, USER2); - } - - @Test(dependsOnMethods = {"submitUncompletedVlmMissingEPNegativeTest"}, - expectedExceptions = CoreException.class) - public void submitUncompletedVlmMissingEPInOneFGNegativeTest() { - vendorLicenseManager.checkout(vlm2Id, USER2); - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlm2Id, null, null); - EntitlementPoolEntity entitlementPool = vendorLicenseManager - .createEntitlementPool(new EntitlementPoolEntity(vlm2Id, null, null), USER2); - featureGroup.getEntitlementPoolIds().add(entitlementPool.getId()); - featureGroup = vendorLicenseManager.createFeatureGroup(featureGroup, USER2); - fg2Id = featureGroup.getId(); - LicenseAgreementModel licenseAgreementModel = - vendorLicenseManager.getLicenseAgreementModel(vlm2Id, null, laId, USER2); - Set<String> fgIdSet = new HashSet<>(); - fgIdSet.add(fg2Id); - vendorLicenseManager - .updateLicenseAgreement(licenseAgreementModel.getLicenseAgreement(), fgIdSet, null, USER2); - - vendorLicenseManager.checkin(vlm2Id, USER2); - vendorLicenseManager.submit(vlm2Id, USER2); - } - - @Test(dependsOnMethods = {"submitUncompletedVlmMissingEPInOneFGNegativeTest"}) - public void submitTest() { - vendorLicenseManager.checkout(vlm2Id, USER2); - - EntitlementPoolEntity entitlementPool = vendorLicenseManager - .createEntitlementPool(new EntitlementPoolEntity(vlm2Id, null, null), USER2); - Set<String> epSetId = new HashSet<>(); - epSetId.add(entitlementPool.getId()); - - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlm2Id, null, fg1Id); - featureGroup.getEntitlementPoolIds().add(entitlementPool.getId()); - FeatureGroupModel - featureGroupModel = vendorLicenseManager.getFeatureGroupModel(featureGroup, USER2); - - vendorLicenseManager - .updateFeatureGroup(featureGroupModel.getFeatureGroup(), null, null, epSetId, null, USER2); - vendorLicenseManager.checkin(vlm2Id, USER2); - vendorLicenseManager.submit(vlm2Id, USER2); - - VersionedVendorLicenseModel versionedVlm2 = - vendorLicenseManager.getVendorLicenseModel(vlm2Id, null, USER1); - Assert.assertEquals(versionedVlm2.getVersionInfo().getActiveVersion(), new Version(1, 0)); - Assert.assertEquals(versionedVlm2.getVersionInfo().getStatus(), VersionStatus.Final); - Assert.assertNull(versionedVlm2.getVersionInfo().getLockingUser()); - - //TODO: add verification of 'ActivityLogManager.addActionLog' func call - } - - @Test(dependsOnMethods = {"submitTest"}) - public void listFinalVersionWhenOneTest() { - Collection<VersionedVendorLicenseModel> loadedVlms = - vendorLicenseManager.listVendorLicenseModels(VersionStatus.Final.name(), USER1); - boolean vlm2Exists = false; - for (VersionedVendorLicenseModel loadedVlm : loadedVlms) { - if (vlm2Id.equals(loadedVlm.getVendorLicenseModel().getId())) { - vlm2Exists = true; - Assert.assertEquals(loadedVlm.getVersionInfo().getActiveVersion(), new Version(1, 0)); - Assert.assertEquals(loadedVlm.getVersionInfo().getStatus(), VersionStatus.Final); - Assert.assertNull(loadedVlm.getVersionInfo().getLockingUser()); - break; - } - } - - Assert.assertTrue(vlm2Exists); - } - - @Test(dependsOnMethods = {"listFinalVersionWhenOneTest"}) - public void testVLMListWithModificationTimeDescOrder() { - VendorLicenseModelEntity vlm1 = createVendorLicenseModel("test_vlm1", "desc", "icon"); - vlm3Id = vendorLicenseManager.createVendorLicenseModel(vlm1, USER3).getId(); - - VendorLicenseModelEntity vlm2 = createVendorLicenseModel("test_vlm2", "desc", "icon"); - vlm4Id = vendorLicenseManager.createVendorLicenseModel(vlm2, USER3).getId(); - - assertVLMInWantedLocationInVSPList(vlm4Id, 0, USER3); - assertVLMInWantedLocationInVSPList(vlm3Id, 1, USER3); - } - - @Test(dependsOnMethods = {"testVLMListWithModificationTimeDescOrder"}) - public void testOldVLMAfterChangeShouldBeInBeginningOfList() { - EntitlementPoolEntity ep = vendorLicenseManager - .createEntitlementPool(new EntitlementPoolEntity(vlm3Id, null, null), USER3); - - assertVLMInWantedLocationInVSPList(vlm3Id, 0, USER3); - } - - @Test(dependsOnMethods = {"testOldVLMAfterChangeShouldBeInBeginningOfList"}) - public void testAddNewVLMShouldBeInBeginningOfList() { - VendorLicenseModelEntity vlm = createVendorLicenseModel("test_vlm3", "desc", "icon"); - String vlm5Id = vendorLicenseManager.createVendorLicenseModel(vlm, USER3).getId(); - - assertVLMInWantedLocationInVSPList(vlm5Id, 0, USER3); - } - - @Test(dependsOnMethods = {"testAddNewVLMShouldBeInBeginningOfList"}) - public void testVLMInBeginningOfListAfterCheckin() { - vendorLicenseManager.checkin(vlm4Id, USER3); - assertVLMInWantedLocationInVSPList(vlm4Id, 0, USER3); - } - - @Test(dependsOnMethods = {"testVLMInBeginningOfListAfterCheckin"}) - public void testVLMInBeginningOfListAfterCheckout() { - vendorLicenseManager.checkin(vlm3Id, USER3); - assertVLMInWantedLocationInVSPList(vlm3Id, 0, USER3); - - vendorLicenseManager.checkout(vlm4Id, USER3); - assertVLMInWantedLocationInVSPList(vlm4Id, 0, USER3); - } - - @Test(dependsOnMethods = {"testVLMInBeginningOfListAfterCheckout"}) - public void testVLMInBeginningOfListAfterUndoCheckout() { - vendorLicenseManager.checkout(vlm3Id, USER3); - vendorLicenseManager.undoCheckout(vlm3Id, USER3); - assertVLMInWantedLocationInVSPList(vlm3Id, 0, USER3); - } - - private void assertVLMInWantedLocationInVSPList(String vlmId, int location, String user) { - List<VersionedVendorLicenseModel> vlmList = - (List<VersionedVendorLicenseModel>) vendorLicenseManager - .listVendorLicenseModels(null, user); - Assert.assertEquals(vlmList.get(location).getVendorLicenseModel().getId(), vlmId); - } - - -} -*/ diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java index 620c6fbf91..178d05e6c8 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java @@ -19,7 +19,7 @@ */ -package org.openecomp.sdc.vendorlicense; +package org.openecomp.sdc.vendorlicense.impl; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -31,23 +31,24 @@ import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.*; import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.Set; import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; @@ -56,7 +57,12 @@ public class EntitlementPoolTest { //JUnit Test Cases using Mockito private final String USER1 = "epTestUser1"; private final String EP1_NAME = "EP1 name"; + private final String EP2_NAME = "EP2 name"; private final String LT1_NAME = "LT1 name"; + private static String vlm1_id = "vlm1_id"; + private static String ep1_id = "ep1_id"; + private static String ep2_id = "ep2_id"; + public static final Version VERSION01 = new Version(0, 1); @Mock private VendorLicenseFacade vendorLicenseFacade; @@ -70,7 +76,7 @@ public class EntitlementPoolTest { @Spy private VendorLicenseManagerImpl vendorLicenseManagerImpl; - public EntitlementPoolEntity createEntitlementPool(String vlmId, Version version, + public EntitlementPoolEntity createEntitlementPool(String vlmId, Version version,String id, String name, String desc, int threshold, ThresholdUnit thresholdUnit, EntitlementMetric entitlementMetricChoice, @@ -83,7 +89,8 @@ public class EntitlementPoolTest { EntitlementTime timeChoice, String timeOther, String sku) { EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity(); - //entitlementPool.setVendorLicenseModelId(vlmId); + entitlementPool.setVendorLicenseModelId(vlmId); + entitlementPool.setId(id); entitlementPool.setVersion(version); entitlementPool.setName(name); entitlementPool.setDescription(desc); @@ -91,7 +98,7 @@ public class EntitlementPoolTest { entitlementPool.setThresholdUnit(thresholdUnit); entitlementPool.setIncrements(increments); entitlementPool.setOperationalScope( - new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); + new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); return entitlementPool; } @@ -108,128 +115,134 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = - createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + createEntitlementPool("vlm1Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, ThresholdUnit + .Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().format(formatter)); ep2.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter)); vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1); + verify(vendorLicenseFacade).createEntitlementPool(ep2,USER1); + } - @Test + @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " + + "license model with id vlm1_id has invalid date range.") public void createWithInvalidStartExpiryDateTest() { - try { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity ep2 = - createEntitlementPool("vlm2Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); - ep2.setStartDate(LocalDate.now().format(formatter)); - ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); - vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); - } + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + EntitlementPoolEntity ep2 = + createEntitlementPool("vlm2Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + ep2.setStartDate(LocalDate.now().format(formatter)); + ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + ep2.setVendorLicenseModelId(vlm1_id); + vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); + Assert.fail(); + } - @Test + @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " + + "license model with id vlm1_id has invalid date range.") public void createWithoutStartDateTest() { - try { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity ep2 = - createEntitlementPool("vlm3Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); - ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); - vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); - } + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + EntitlementPoolEntity ep2 = + createEntitlementPool("vlm3Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + ep2.setVendorLicenseModelId(vlm1_id); + vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); + Assert.fail(); + } - @Test + @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " + + "license model with id vlm1_id has invalid date range.") public void createWithSameStartExpiryDateTest() { - try { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity ep2 = - createEntitlementPool("vlm4Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); - ep2.setStartDate(LocalDate.now().format(formatter)); - ep2.setExpiryDate(LocalDate.now().format(formatter)); - vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); - } + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + EntitlementPoolEntity ep2 = + createEntitlementPool("vlm4Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + ep2.setStartDate(LocalDate.now().format(formatter)); + ep2.setExpiryDate(LocalDate.now().format(formatter)); + ep2.setVendorLicenseModelId(vlm1_id); + vendorLicenseManagerImpl.createEntitlementPool(ep2, USER1).getId(); + Assert.fail(); } @Test - public void createUpdate() { + public void testUpdate() { Set<OperationalScope> opScopeChoices; opScopeChoices = new HashSet<>(); opScopeChoices.add(OperationalScope.Core); opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = - createEntitlementPool("vlm1Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + createEntitlementPool(vlm1_id, VERSION01, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit + .Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().minusDays(3L).format(formatter)); ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + VersionInfo info = new VersionInfo(); - Version version = new Version(); - info.getViewableVersions().add(version); - info.setActiveVersion(version); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1); + verify(vendorLicenseFacade).updateEntitlementPool(ep2,USER1); + verify(vendorLicenseFacade).updateVlmLastModificationTime(vlm1_id,VERSION01); } - @Test + @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " + + "license model with id vlm1_id has invalid date range.") public void updateWithInvalidStartExpiryDateTest() { - try { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - EntitlementPoolEntity ep2 = - createEntitlementPool("vlm2Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); - ep2.setStartDate(LocalDate.now().format(formatter)); - ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); - vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); - } + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + EntitlementPoolEntity ep2 = + createEntitlementPool("vlm2Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + ep2.setStartDate(LocalDate.now().format(formatter)); + ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + ep2.setVendorLicenseModelId(vlm1_id); + vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1); + Assert.fail(); + } @Test @@ -242,9 +255,10 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = - createEntitlementPool("vlm3Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + createEntitlementPool("vlm3Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); vendorLicenseManagerImpl.updateEntitlementPool(ep2, USER1); @@ -264,9 +278,10 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = - createEntitlementPool("vlm4Id", null, EP1_NAME, "EP2 dec", 70, ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, - opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + createEntitlementPool("vlm4Id", null, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().format(formatter)); ep2.setExpiryDate(LocalDate.now().format(formatter)); @@ -279,6 +294,117 @@ public class EntitlementPoolTest { @Test public void deleteEntitlementPoolTest() { + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + + EntitlementPoolEntity entitlementPool = + createEntitlementPool(vlm1_id,VERSION01, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute,EntitlementMetric.Other, "exception metric2", "inc2", + AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + entitlementPool.setStartDate(LocalDate.now().format(formatter)); + entitlementPool.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter)); + + doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject()); + + doNothing().when(vendorLicenseManagerImpl).deleteChildLimits(vlm1_id,VERSION01,ep1_id,USER1); + + doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(anyObject(),anyObject(), + anyObject(),anyObject()); + + vendorLicenseManagerImpl.deleteEntitlementPool(entitlementPool, USER1); + + verify(entitlementPoolDao).delete(entitlementPool); + verify(vendorLicenseFacade).updateVlmLastModificationTime(vlm1_id,VERSION01); + + } + + @Test + public void testGetEntitlementPool(){ + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + versionInfo.setActiveVersion(VERSION01); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Read, USER1); + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + + EntitlementPoolEntity entitlementPool = + createEntitlementPool(vlm1_id,VERSION01, ep1_id,EP1_NAME, "EP2 dec", 70, + ThresholdUnit.Absolute,EntitlementMetric.Other, "exception metric2", "inc2", + AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); + + entitlementPool.setStartDate(LocalDateTime.now().format(formatter)); + entitlementPool.setExpiryDate(LocalDateTime.now().plusDays(1L).format(formatter)); + + doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject()); + + EntitlementPoolEntity retrived = vendorLicenseManagerImpl.getEntitlementPool + (entitlementPool,USER1); + + Assert.assertEquals(retrived.getId(),entitlementPool.getId()); + Assert.assertEquals(retrived.getVendorLicenseModelId(),entitlementPool.getVendorLicenseModelId()); + Assert.assertEquals(retrived.getVersion(),entitlementPool.getVersion()); + } + + @Test + public void testListEntitlmentPool(){ + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + + doReturn(Arrays.asList( + createEntitlementPool(vlm1_id,VERSION01, ep1_id, EP1_NAME,"EP1 dec", 70, + ThresholdUnit.Absolute,EntitlementMetric.Other, "exception metric1", + "inc1", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time1", "sku1"), + createEntitlementPool(vlm1_id,VERSION01, ep2_id, EP2_NAME,"EP2 dec", 70, + ThresholdUnit.Absolute,EntitlementMetric.Other, "exception metric2", + "inc2", AggregationFunction.Average, null, + opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"))) + .when(vendorLicenseFacade).listEntitlementPools(vlm1_id, VERSION01, USER1); + + Collection<EntitlementPoolEntity> EPs = + vendorLicenseManagerImpl.listEntitlementPools(vlm1_id, VERSION01, USER1); + + verify(vendorLicenseFacade).listEntitlementPools(vlm1_id, VERSION01, USER1); + Assert.assertEquals(EPs.size(), 2); + EPs.forEach(ep -> Assert.assertTrue(ep.getId().matches(ep1_id + "|" + ep2_id))); + } + + + /* @Test + public void deleteEntitlementPoolTest() { Set<OperationalScope> opScopeChoices; opScopeChoices = new HashSet<>(); opScopeChoices.add(OperationalScope.Core); @@ -300,7 +426,7 @@ public class EntitlementPoolTest { doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); LimitEntity limitEntity = LimitTest.createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); ArrayList<LimitEntity> limitEntityList = new ArrayList(); limitEntityList.add(limitEntity); @@ -357,7 +483,7 @@ public class EntitlementPoolTest { doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); LimitEntity limitEntity = LimitTest.createLimitEntity(LT1_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); + "Core",AggregationFunction.Average,10,"Hour"); ArrayList<LimitEntity> limitEntityList = new ArrayList(); limitEntityList.add(limitEntity); @@ -389,7 +515,7 @@ public class EntitlementPoolTest { } catch (CoreException exception) { Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); } - } + } */ /* private static final String USER1 = "epTestUser1"; private static final String USER2 = "epTestUser2"; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java new file mode 100644 index 0000000000..aa606913e1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java @@ -0,0 +1,334 @@ +/*- + * ============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.vendorlicense.impl; + +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.openecomp.sdc.activityLog.ActivityLogManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; +import org.openecomp.sdc.vendorlicense.dao.*; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl; +import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; +import org.openecomp.sdc.versioning.VersioningManager; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; +import org.testng.Assert; +import org.testng.AssertJUnit.*; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +/** + * Created by KATYR on 4/10/2016 + */ + +public class FeatureGroupTest { + //JUnit Test Cases using Mockito + private static final Version VERSION01 = new Version(0, 1); + private static final Version VERSION10 = new Version(1, 0); + private final String FG1_NAME = "FG1 name"; + private static final String USER1 = "TestUser1"; + private static final String USER2 = "TestUser2"; + + private static String vlm1_id = "vlm1_id"; + private static String vlm2_id = "vlm2_id"; + private static String lkg1_id = "lkg1_id"; + private static String lkg2_id = "lkg2_id"; + private static String fg1_id = "fg1_id"; + private static String fg2_id = "fg2_id"; + private static String ep1_id = "ep1_id"; + private static String ep2_id = "ep2_id"; + + @Mock + private VendorLicenseFacade vendorLicenseFacadeMcok; + + @Mock + private LimitDao limitDaoMcok; + @Mock + private ActivityLogManager activityLogManagerMcok; + + @Mock + private VendorLicenseModelDao vendorLicenseModelDao; + + @Mock + private LicenseAgreementDao licenseAgreementDao; + + @Mock + private FeatureGroupDao featureGroupDao; + + @Mock + private EntitlementPoolDao entitlementPoolDao; + + @Mock + private LicenseKeyGroupDao licenseKeyGroupDao; + + @Mock + private VersioningManager versioningManager; + + @InjectMocks + @Spy + private VendorLicenseManagerImpl vendorLicenseManagerImpl; + + public FeatureGroupEntity updateFeatureGroup(String vlmId, Version version, String id, String name, String desc, + String partNumber, String manufacturerReferenceNumber, Set<String> + licenseKeyGroupIds, Set<String> entitlementPoolIds, Set<String> + referencingLicenseAgreements){ + FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id); + featureGroup.setVendorLicenseModelId(vlmId); + featureGroup.setVersion(version); + featureGroup.setId(id); + featureGroup.setName(name); + featureGroup.setDescription(desc); + featureGroup.setPartNumber(partNumber); + //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber); + featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); + featureGroup.setEntitlementPoolIds(entitlementPoolIds); + featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements); + + return featureGroup; + } + + @BeforeMethod + public void setUp() throws Exception{ + MockitoAnnotations.initMocks(this); + } + + @Test + public void testUpdate(){ + Set<String> licenseKeyGroupIds; + licenseKeyGroupIds = new HashSet<>(); + licenseKeyGroupIds.add("lkg1"); + + Set<String> entitlementPoolIds; + entitlementPoolIds = new HashSet<>(); + entitlementPoolIds.add("ep1"); + + Set<String> referencingLicenseAgreements; + referencingLicenseAgreements = new HashSet<>(); + referencingLicenseAgreements.add("la1"); + + FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", + "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds, + referencingLicenseAgreements); + + doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + + /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) + featureGroupDao.update(featureGroupEntity); + verify(featureGroupDao).update(anyObject());*/ + } + + @Test + public void testUpdateWithoutManufacturingReferenceNumber(){ + Set<String> licenseKeyGroupIds; + licenseKeyGroupIds = new HashSet<>(); + licenseKeyGroupIds.add("lkg1"); + + Set<String> entitlementPoolIds; + entitlementPoolIds = new HashSet<>(); + entitlementPoolIds.add("ep1"); + + Set<String> referencingLicenseAgreements; + referencingLicenseAgreements = new HashSet<>(); + referencingLicenseAgreements.add("la1"); + + FeatureGroupEntity featureGroupEntity = updateFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", + "partNumber", null, licenseKeyGroupIds, entitlementPoolIds, + referencingLicenseAgreements); + + doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + + /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) + featureGroupDao.update(featureGroupEntity); + verify(featureGroupDao, never()).update(anyObject());*/ + } + + @Test + public void testListFeatureGroups() { + doReturn(Arrays.asList( + createFeatureGroup(vlm1_id, VERSION01, fg1_id, "FG1", "FG1 desc", new HashSet<String>(), + new HashSet<String>()), + createFeatureGroup(vlm1_id, VERSION01, fg2_id, "FG2", "FG2 desc", new HashSet<String>(), + new HashSet<String>()))) + .when(vendorLicenseFacadeMcok).listFeatureGroups(vlm1_id, VERSION01, USER1); + + Collection<FeatureGroupEntity> FGs = + vendorLicenseManagerImpl.listFeatureGroups(vlm1_id, VERSION01, USER1); + + verify(vendorLicenseFacadeMcok).listFeatureGroups(vlm1_id, VERSION01, USER1); + Assert.assertEquals(FGs.size(), 2); + FGs.forEach(fg -> Assert.assertTrue(fg.getId().matches(fg1_id + "|" + fg2_id))); + } + + @Test + public void testCreateFeatureGroup() { + FeatureGroupEntity featureGroupEntity = new FeatureGroupEntity(vlm1_id,VERSION01, + fg1_id); + + doReturn(featureGroupEntity).when(vendorLicenseFacadeMcok).createFeatureGroup + (featureGroupEntity,USER1); + + vendorLicenseManagerImpl.createFeatureGroup(featureGroupEntity,USER1); + + verify(vendorLicenseFacadeMcok).createFeatureGroup(featureGroupEntity,USER1); + } + + + @Test + public void testUpdateFeatureGroup(){ + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + FeatureGroupEntity existingFG = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id); + + existingFG.setEntitlementPoolIds(new HashSet<String>()); + existingFG.setLicenseKeyGroupIds(new HashSet<String>()); + + doReturn(existingFG).when(featureGroupDao).get(existingFG); + + Set<String> removedEPs = new HashSet<>(); + Set<String> addedEPs = new HashSet<>(); + + addedEPs.add(ep1_id); + addedEPs.add(ep2_id); + EntitlementPoolEntity ep1 = new EntitlementPoolEntity(vlm1_id, VERSION01, ep1_id); + EntitlementPoolEntity ep2 = new EntitlementPoolEntity(vlm1_id, VERSION01, ep2_id); + doReturn(ep1).when(entitlementPoolDao).get(ep1); + doReturn(ep2).when(entitlementPoolDao).get(ep2); + + Set<String> removedLKGs = new HashSet<>(); + Set<String> addedLKGs = new HashSet<>(); + + addedLKGs.add(lkg1_id); + addedLKGs.add(lkg2_id); + LicenseKeyGroupEntity lkg1 = new LicenseKeyGroupEntity(vlm1_id, VERSION01, lkg1_id); + LicenseKeyGroupEntity lkg2 = new LicenseKeyGroupEntity(vlm1_id, VERSION01, lkg2_id); + doReturn(lkg1).when(licenseKeyGroupDao).get(lkg1); + doReturn(lkg2).when(licenseKeyGroupDao).get(lkg2); + + doNothing().when(vendorLicenseManagerImpl).updateUniqueName(anyObject(), anyObject(), + anyObject(),anyObject(), anyObject()); + + vendorLicenseManagerImpl.updateFeatureGroup(existingFG,addedLKGs,removedLKGs, addedEPs, + removedEPs, USER1); + + verify(vendorLicenseManagerImpl).addLicenseKeyGroupsToFeatureGroupsRef(addedLKGs, + existingFG); + verify(vendorLicenseManagerImpl).removeLicenseKeyGroupsToFeatureGroupsRef(removedLKGs, + existingFG); + verify(vendorLicenseManagerImpl).addEntitlementPoolsToFeatureGroupsRef(addedEPs,existingFG); + verify(vendorLicenseManagerImpl).removeEntitlementPoolsToFeatureGroupsRef(removedEPs, + existingFG); + + verify(featureGroupDao) + .updateFeatureGroup(existingFG,addedEPs,removedEPs, addedLKGs, removedLKGs); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id,VERSION01); + } + + + @Test + public void testGetFeatureGroup(){ + FeatureGroupEntity featureGroupEntity = new FeatureGroupEntity(vlm1_id,VERSION01,fg1_id); + vendorLicenseManagerImpl.getFeatureGroupModel(featureGroupEntity,USER1); + verify(vendorLicenseFacadeMcok).getFeatureGroupModel(featureGroupEntity,USER1); + } + + @Test + public void deleteFeatureGroupTest() { + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + + FeatureGroupEntity existingFG = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id); + existingFG.setName("FG_name"); + existingFG.setLicenseKeyGroupIds(new HashSet<String>()); + existingFG.setEntitlementPoolIds(new HashSet<String>()); + existingFG.setLicenseKeyGroupIds(new HashSet<String>()); + + doReturn(existingFG).when(featureGroupDao).get(anyObject()); + + doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(VendorLicenseConstants + .UniqueValues.FEATURE_GROUP_NAME,vlm1_id,VERSION01.toString(),existingFG.getName()); + + vendorLicenseManagerImpl.deleteFeatureGroup(existingFG, USER1); + + verify(featureGroupDao).delete(existingFG); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id,VERSION01); + + verify(vendorLicenseManagerImpl).removeLicenseKeyGroupsToFeatureGroupsRef(existingFG + .getLicenseKeyGroupIds(),existingFG); + verify(vendorLicenseManagerImpl).removeEntitlementPoolsToFeatureGroupsRef(existingFG + .getEntitlementPoolIds(),existingFG); + verify(vendorLicenseManagerImpl).deleteUniqueName(VendorLicenseConstants + .UniqueValues.FEATURE_GROUP_NAME,vlm1_id,VERSION01.toString(),existingFG.getName()); + } + + private FeatureGroupEntity createFeatureGroup(String vendorId, Version version, String id, + String name, String description, + Set<String> entitlementPoolIds, + Set<String> licenseKeyGroupIds) { + FeatureGroupEntity featureGroup = new FeatureGroupEntity(); + featureGroup.setVendorLicenseModelId(vendorId); + featureGroup.setVersion(version); + featureGroup.setId(id); + featureGroup.setName(name); + featureGroup.setDescription(description); + featureGroup.setEntitlementPoolIds(entitlementPoolIds); + featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); + return featureGroup; + } +} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java new file mode 100644 index 0000000000..b0b5953a53 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java @@ -0,0 +1,311 @@ +/*- + * ============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.vendorlicense.impl; + +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.sdc.activityLog.ActivityLogManager; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; +import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; +import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao; +import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; +import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory; +import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; +import org.openecomp.sdc.vendorlicense.dao.LimitDao; +import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.versioning.VersioningManager; +import org.openecomp.sdc.versioning.VersioningUtil; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; +import static org.testng.AssertJUnit.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class LicenseAgreementTest { + + private static final String USER1 = "TestUser1"; + private static final String USER2 = "TestUser2"; + + private static String vlm1_id = "vlm1_id"; + private static String vlm2_id = "vlm2_id"; + private static String la1_id = "la1_id"; + private static String la2_id = "la2_id"; + private static String fg1_id = "fg1_id"; + private static String fg2_id = "fg2_id"; + public static final Version VERSION01 = new Version(0, 1); + private static final Version VERSION10 = new Version(1, 0); + + @Mock + private VersioningManager versioningManagerMcok; + @Mock + private VendorLicenseFacade vendorLicenseFacadeMcok; + @Mock + private VendorLicenseModelDao vendorLicenseModelDaoMcok; + @Mock + private LicenseAgreementDao licenseAgreementDaoMcok; + @Mock + private FeatureGroupDao featureGroupDaoMcok; + @Mock + private EntitlementPoolDao entitlementPoolDaoMcok; + @Mock + private LicenseKeyGroupDao licenseKeyGroupDaoMcok; + @Mock + private LimitDao limitDaoMcok; + @Mock + private ActivityLogManager activityLogManagerMcok; + + + @Spy + @InjectMocks + private VendorLicenseManagerImpl vendorLicenseManager; + + + @Captor + private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg; + + + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + public static LicenseAgreementEntity createLicenseAgreement(String vlmId, Version version, + String id, String name, String desc, + String requirementsAndConstrains, + ChoiceOrOther<LicenseTerm> term, + String... fgIds) { + LicenseAgreementEntity la = new LicenseAgreementEntity(); + la.setVendorLicenseModelId(vlmId); + la.setVersion(version); + la.setId(id); + la.setName(name); + la.setDescription(desc); + la.setLicenseTerm(term); + la.setRequirementsAndConstrains(requirementsAndConstrains); + for (String fgId : fgIds) { + la.getFeatureGroupIds().add(fgId); + } + return la; + } + + public static FeatureGroupEntity createFeatureGroup(String vendorId, Version version, String id, + String name, String description, + Set<String> entitlementPoolIds, + Set<String> licenseKeyGroupIds) { + FeatureGroupEntity featureGroup = new FeatureGroupEntity(); + featureGroup.setVendorLicenseModelId(vendorId); + featureGroup.setVersion(version); + featureGroup.setId(id); + featureGroup.setName(name); + featureGroup.setDescription(description); + featureGroup.setEntitlementPoolIds(entitlementPoolIds); + featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); + return featureGroup; + } + + + @Test + public void listLicenseAgreementsTest() { + + LicenseAgreementEntity la = new LicenseAgreementEntity(vlm1_id,VERSION01,USER1); + doReturn(la).when(vendorLicenseManager).createLicenseAgreementForList(vlm1_id,VERSION01, USER1); + + doReturn(Arrays.asList( + createLicenseAgreement(vlm1_id, VERSION01, la1_id, "LA1", "LA1 " + + "desc","RequirementsAndConstrains2", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), + "fg1"), + createLicenseAgreement(vlm1_id, VERSION01, la2_id, "LA2", "LA2 desc", + "RequirementsAndConstrains2", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), + "fg2"))) + .when(licenseAgreementDaoMcok).list(la); + + Collection<LicenseAgreementEntity> LAs = + vendorLicenseManager.listLicenseAgreements(vlm1_id, VERSION01, USER1); + Assert.assertEquals(LAs.size(), 2); + LAs.forEach(licseAgreement-> Assert.assertTrue(licseAgreement.getId().matches(la1_id + "|" + la2_id))); + } + + @Test + public void testListLicenseAgreementsWhenNone() { + + LicenseAgreementEntity la = new LicenseAgreementEntity(vlm1_id,VERSION01,USER1); + doReturn(la).when(vendorLicenseManager).createLicenseAgreementForList(vlm1_id,VERSION01, + USER1); + + doReturn(new ArrayList<LicenseAgreementEntity>()) + .when(licenseAgreementDaoMcok).list(la); + + Collection<LicenseAgreementEntity> LAs = + vendorLicenseManager.listLicenseAgreements(vlm1_id, VERSION01, USER1); + + verify(licenseAgreementDaoMcok).list(la); + Assert.assertEquals(LAs.size(), 0); + } + + + @Test + public void testCreateLicenseAgreement() { + + LicenseAgreementEntity licenseAgreementEntity = new LicenseAgreementEntity(vlm1_id,VERSION01, + la2_id); + + doReturn(licenseAgreementEntity).when(vendorLicenseFacadeMcok).createLicenseAgreement + (licenseAgreementEntity,USER1); + + vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity,USER1); + + verify(vendorLicenseFacadeMcok).createLicenseAgreement(licenseAgreementEntity,USER1); + } + + @Test + public void testUpdateLicenseAgreement() { + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManager).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + LicenseAgreementEntity existingLA = new LicenseAgreementEntity(vlm1_id, VERSION01, la1_id); + + existingLA.setFeatureGroupIds(new HashSet<String>()); + + doReturn(existingLA).when(licenseAgreementDaoMcok).get(existingLA); + + Set<String> removedFGs = new HashSet<>(); + Set<String> addedFGs = new HashSet<>(); + addedFGs.add(fg1_id); + addedFGs.add(fg2_id); + FeatureGroupEntity fg1 = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id); + FeatureGroupEntity fg2 = new FeatureGroupEntity(vlm1_id, VERSION01, fg2_id); + doReturn(fg1).when(featureGroupDaoMcok).get(fg1); + doReturn(fg2).when(featureGroupDaoMcok).get(fg2); + doReturn(existingLA).when(vendorLicenseManager).createLicenseAgreementForList(vlm1_id,VERSION01, + USER1); + doNothing().when(vendorLicenseManager).updateUniqueName(anyObject(), anyObject(), anyObject(), + anyObject(), anyObject()); + + vendorLicenseManager.updateLicenseAgreement(existingLA, addedFGs, removedFGs, USER1); + + verify(licenseAgreementDaoMcok) + .updateColumnsAndDeltaFeatureGroupIds(existingLA, addedFGs, removedFGs); + verify(vendorLicenseManager).addFeatureGroupsToLicenseAgreementRef(addedFGs,existingLA); + verify(vendorLicenseManager).removeFeatureGroupsToLicenseAgreementRef(removedFGs,existingLA); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id,VERSION01); + + } + + @Test + public void deleteLicenseAgreementsTest() { + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManager).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + + LicenseAgreementEntity existingLA = new LicenseAgreementEntity(vlm1_id, VERSION01, la1_id); + existingLA.setName("LA"); + existingLA.setFeatureGroupIds(new HashSet<>()); + + doReturn(existingLA).when(licenseAgreementDaoMcok).get(anyObject()); + + doNothing().when(vendorLicenseManager).deleteUniqueName(VendorLicenseConstants.UniqueValues + .LICENSE_AGREEMENT_NAME,vlm1_id,VERSION01.toString(),existingLA.getName()); + + vendorLicenseManager.deleteLicenseAgreement(vlm1_id, VERSION01, la1_id, USER1); + + verify(licenseAgreementDaoMcok).delete(existingLA); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id,VERSION01); + verify(vendorLicenseManager).removeFeatureGroupsToLicenseAgreementRef(existingLA + .getFeatureGroupIds(),existingLA); + } + + @Test + public void testGetLicenseAgreement(){ + vendorLicenseManager.getLicenseAgreementModel(vlm1_id,VERSION01,la1_id,USER1); + verify(vendorLicenseFacadeMcok).getLicenseAgreementModel(vlm1_id,VERSION01,la1_id,USER1); + } + +/* + @Test(dependsOnMethods = {"listLicenseAgreementsTest"}) + public void featureGroupDeletedLicenseAgreementUpdated() { + LicenseAgreementEntity licenseAgreement = + createLicenseAgreement(vlm1Id, VERSION01, "laId", "LA2", "LA2 desc", + "RequirementsAndConstrains2", new ChoiceOrOther<>(LicenseTerm.Unlimited, null), "fg2"); + licenseAgreementDao.create(licenseAgreement); + String featureGroupId = "FeatureGroupId"; + FeatureGroupEntity created = + createFeatureGroup(vlm1Id, VERSION01, "fg11", "FG1", "FG1 desc", null, null); + featureGroupDao.create(created); + featureGroupDao.addReferencingLicenseAgreement(created, licenseAgreement.getId()); + + vendorLicenseManager.deleteFeatureGroup(created, USER1); + LicenseAgreementEntity afterDeletingFG = licenseAgreementDao.get(licenseAgreement); + Assert.assertEquals(afterDeletingFG.getFeatureGroupIds().size(), 1); + Assert.assertTrue(afterDeletingFG.getFeatureGroupIds().contains("fg2")); + } + + */ +} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java index 04f7c794bc..acd1ce8cce 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java @@ -19,7 +19,7 @@ */ -package org.openecomp.sdc.vendorlicense; +package org.openecomp.sdc.vendorlicense.impl; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -31,168 +31,172 @@ import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.*; import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; -import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashSet; import java.util.Set; import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; public class LicenseKeyGroupTest { - //JUnit Test Cases using Mockito - private final String USER = "lkgTestUser"; - private final String LKG_NAME = "LKG name"; - private final String LT_NAME = "LT name"; - private final String LKG1_NAME = "LKG1 name"; - private final String USER1 = "user1"; + //JUnit Test Cases using Mockito + private final String USER = "lkgTestUser"; + private final String LKG_NAME = "LKG name"; + private final String LKG2_NAME = "LKG2 name"; + private final String LT_NAME = "LT name"; + private final String LKG1_NAME = "LKG1 name"; + private final String USER1 = "user1"; + private static String lkg1_id = "lkg1_id"; + private static String lkg2_id = "lkg2_id"; + private static String vlm1_id = "vlm1_id"; + public static final Version VERSION01 = new Version(0, 1); - @Mock - private VendorLicenseFacade vendorLicenseFacade; - @Mock - private LicenseKeyGroupDao licenseKeyGroupDao; - @Mock - private LimitDao limitDao; + @Mock + private VendorLicenseFacade vendorLicenseFacade; - @InjectMocks - @Spy - private VendorLicenseManagerImpl vendorLicenseManagerImpl; + @Mock + private LicenseKeyGroupDao licenseKeyGroupDao; + @Mock + private LimitDao limitDao; - @BeforeMethod - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - private LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyType type, Set<OperationalScope> operationalScopeChoices, - String operationalScopeOther) - { - LicenseKeyGroupEntity licenseKeyGroupEntity = new LicenseKeyGroupEntity(); - licenseKeyGroupEntity.setType(type); - licenseKeyGroupEntity.setOperationalScope( - new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); - return licenseKeyGroupEntity; - } + @InjectMocks + @Spy + private VendorLicenseManagerImpl vendorLicenseManagerImpl; - @Test - public void deleteLicenseKeyGroupTest() { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - - LicenseKeyGroupEntity licenseKeyGroup = - createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null); - - VersionInfo info = new VersionInfo(); - Version version = new Version(); - info.getViewableVersions().add(version); - info.setActiveVersion(version); - doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); - - LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); - - ArrayList<LimitEntity> limitEntityList = new ArrayList(); - limitEntityList.add(limitEntity); - - doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); - doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); - doReturn(true).when(limitDao).isLimitPresent(anyObject()); - doReturn(limitEntity).when(limitDao).get(anyObject()); - try { - Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); - limitField.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL); - limitField.set(null, limitDao); - - Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao"); - lkgField.setAccessible(true); - modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL); - lkgField.set(null, licenseKeyGroupDao); - } catch(NoSuchFieldException | IllegalAccessException e) - { - Assert.fail(); - } - - vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER); - - verify(limitDao).delete(anyObject()); - } + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } - @Test - public void deleteLicenseKeyGroupInvalidTest() { - try { - Set<OperationalScope> opScopeChoices; - opScopeChoices = new HashSet<>(); - opScopeChoices.add(OperationalScope.Core); - opScopeChoices.add(OperationalScope.CPU); - opScopeChoices.add(OperationalScope.Network_Wide); - - LicenseKeyGroupEntity licenseKeyGroup = - createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null); - - VersionInfo info = new VersionInfo(); - Version version = new Version(); - info.getViewableVersions().add(version); - info.setActiveVersion(version); - doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); - - LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, - EntitlementMetric.Core,AggregationFunction.Average,10,EntitlementTime.Hour); - - ArrayList<LimitEntity> limitEntityList = new ArrayList(); - limitEntityList.add(limitEntity); - - doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); - doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); - doReturn(false).when(limitDao).isLimitPresent(anyObject()); - - try { - Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); - limitField.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL); - limitField.set(null, limitDao); - - Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao"); - lkgField.setAccessible(true); - modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL); - lkgField.set(null, licenseKeyGroupDao); - } catch(NoSuchFieldException | IllegalAccessException e) - { - Assert.fail(); - } - - vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - } + private LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyType type, Set<OperationalScope> operationalScopeChoices, + String operationalScopeOther) + { + LicenseKeyGroupEntity licenseKeyGroupEntity = new LicenseKeyGroupEntity(); + licenseKeyGroupEntity.setType(type); + licenseKeyGroupEntity.setOperationalScope( + new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); + return licenseKeyGroupEntity; + } + /* + @Test + public void deleteLicenseKeyGroupTest() { + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + + LicenseKeyGroupEntity licenseKeyGroup = + createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null); + + VersionInfo info = new VersionInfo(); + Version version = new Version(); + info.getViewableVersions().add(version); + info.setActiveVersion(version); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + + LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, + "Core",AggregationFunction.Average,10,"Hour"); + + ArrayList<LimitEntity> limitEntityList = new ArrayList(); + limitEntityList.add(limitEntity); + + doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); + doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); + doReturn(true).when(limitDao).isLimitPresent(anyObject()); + doReturn(limitEntity).when(limitDao).get(anyObject()); + try { + Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); + limitField.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL); + limitField.set(null, limitDao); + + Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao"); + lkgField.setAccessible(true); + modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL); + lkgField.set(null, licenseKeyGroupDao); + } catch(NoSuchFieldException | IllegalAccessException e) + { + Assert.fail(); + } + + vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER); + + verify(limitDao).delete(anyObject()); + } + @Test + public void deleteLicenseKeyGroupInvalidTest() { + try { + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + + LicenseKeyGroupEntity licenseKeyGroup = + createLicenseKeyGroup(LicenseKeyType.Unique, opScopeChoices, null); + + VersionInfo info = new VersionInfo(); + Version version = new Version(); + info.getViewableVersions().add(version); + info.setActiveVersion(version); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + + LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, + "Core",AggregationFunction.Average,10,"Hour"); + + ArrayList<LimitEntity> limitEntityList = new ArrayList(); + limitEntityList.add(limitEntity); + + doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); + doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); + doReturn(false).when(limitDao).isLimitPresent(anyObject()); + + try { + Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); + limitField.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(limitField, limitField.getModifiers() & ~Modifier.FINAL); + limitField.set(null, limitDao); + + Field lkgField = VendorLicenseManagerImpl.class.getDeclaredField("licenseKeyGroupDao"); + lkgField.setAccessible(true); + modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(lkgField, lkgField.getModifiers() & ~Modifier.FINAL); + lkgField.set(null, licenseKeyGroupDao); + } catch(NoSuchFieldException | IllegalAccessException e) + { + Assert.fail(); + } + + vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + } + */ @Test public void createTest() { Set<OperationalScope> opScopeChoices; @@ -201,13 +205,14 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null,lkg1_id, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().format(formatter)); lkg.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter)); vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1); + verify(vendorLicenseFacade).createLicenseKeyGroup(lkg,USER1); } @Test @@ -220,7 +225,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null, lkg1_id,LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().format(formatter)); @@ -242,7 +247,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null, lkg1_id,LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); @@ -263,7 +268,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null, lkg1_id,LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().plusDays(2L).format(formatter)); @@ -276,25 +281,26 @@ public class LicenseKeyGroupTest { } @Test - public void createUpdate() { + public void testUpdate() { Set<OperationalScope> opScopeChoices; opScopeChoices = new HashSet<>(); opScopeChoices.add(OperationalScope.Core); opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup(vlm1_id, null,lkg1_id, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().minusDays(3L).format(formatter)); lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); VersionInfo info = new VersionInfo(); - Version version = new Version(); - info.getViewableVersions().add(version); - info.setActiveVersion(version); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + verify(vendorLicenseFacade).updateLicenseKeyGroup(lkg,USER1); + verify(vendorLicenseFacade).updateVlmLastModificationTime(vlm1_id,VERSION01); } @Test @@ -307,7 +313,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null, lkg1_id,LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().format(formatter)); @@ -329,7 +335,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null, lkg1_id,LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); @@ -350,7 +356,7 @@ public class LicenseKeyGroupTest { opScopeChoices.add(OperationalScope.CPU); opScopeChoices.add(OperationalScope.Network_Wide); LicenseKeyGroupEntity lkg = - createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + createLicenseKeyGroup("vlm1Id", null,lkg1_id, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, new MultiChoiceOrOther<>(opScopeChoices, null)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); lkg.setStartDate(LocalDate.now().format(formatter)); @@ -362,14 +368,116 @@ public class LicenseKeyGroupTest { } } + @Test + public void testListlistLicenseKeyGroups(){ - public static LicenseKeyGroupEntity createLicenseKeyGroup(String vlmId, Version version, + MultiChoiceOrOther<OperationalScope> multiChoiceOrOther = new MultiChoiceOrOther<OperationalScope>(); + Set<OperationalScope> opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + multiChoiceOrOther.setChoices(opScopeChoices); + multiChoiceOrOther.setOther("Other"); + + doReturn(Arrays.asList( + createLicenseKeyGroup(vlm1_id,VERSION01, lkg1_id, LKG1_NAME,"LKG1 dec", LicenseKeyType.Universal, + multiChoiceOrOther), + createLicenseKeyGroup(vlm1_id,VERSION01, lkg2_id, LKG2_NAME,"LKG2 dec", LicenseKeyType + .Universal, multiChoiceOrOther))) + .when(vendorLicenseFacade).listLicenseKeyGroups(vlm1_id, VERSION01, USER1); + + Collection<LicenseKeyGroupEntity> LKGs = + vendorLicenseManagerImpl.listLicenseKeyGroups(vlm1_id, VERSION01, USER1); + + verify(vendorLicenseFacade).listLicenseKeyGroups(vlm1_id, VERSION01, USER1); + Assert.assertEquals(LKGs.size(), 2); + LKGs.forEach(lkg -> Assert.assertTrue(lkg.getId().matches(lkg1_id + "|" + lkg2_id))); + } + + @Test + public void testGetLicenseKeyGroup(){ + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + versionInfo.setActiveVersion(VERSION01); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Read, USER1); + + MultiChoiceOrOther<OperationalScope> multiChoiceOrOther = new MultiChoiceOrOther<OperationalScope>(); + Set<OperationalScope> opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + multiChoiceOrOther.setChoices(opScopeChoices); + multiChoiceOrOther.setOther("Other"); + + LicenseKeyGroupEntity lkg = createLicenseKeyGroup(vlm1_id,VERSION01, lkg1_id, LKG1_NAME, + "LKG1 dec", LicenseKeyType.Universal, multiChoiceOrOther); + + doReturn(lkg).when(licenseKeyGroupDao).get(anyObject()); + + LicenseKeyGroupEntity lkgRetrived = vendorLicenseManagerImpl.getLicenseKeyGroup(lkg,USER1); + verify(licenseKeyGroupDao).get(lkg); + + Assert.assertEquals(lkgRetrived.getId(),lkg.getId()); + Assert.assertEquals(lkgRetrived.getVendorLicenseModelId(),lkg.getVendorLicenseModelId()); + Assert.assertEquals(lkgRetrived.getVersion(),lkg.getVersion()); + + } + + @Test + public void testDeleteLicenseKeyGroup() { + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + versionInfo.setLockingUser(USER1); + ArrayList<Version> viewable = new ArrayList<Version>(); + viewable.add(VERSION01); + versionInfo.setViewableVersions(viewable); + + doReturn(versionInfo).when(vendorLicenseManagerImpl).getVersionInfo(vlm1_id, + VersionableEntityAction.Write, USER1); + + + MultiChoiceOrOther<OperationalScope> multiChoiceOrOther = new MultiChoiceOrOther<OperationalScope>(); + Set<OperationalScope> opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + multiChoiceOrOther.setChoices(opScopeChoices); + multiChoiceOrOther.setOther("Other"); + + LicenseKeyGroupEntity lkg = createLicenseKeyGroup(vlm1_id,VERSION01, lkg1_id, LKG1_NAME, + "LKG1 dec", LicenseKeyType.Universal, multiChoiceOrOther); + + lkg.setReferencingFeatureGroups(new HashSet<>()); + + doReturn(lkg).when(licenseKeyGroupDao).get(anyObject()); + + doNothing().when(vendorLicenseManagerImpl).deleteChildLimits(vlm1_id,VERSION01,lkg1_id,USER1); + + doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(anyObject(),anyObject(), + anyObject(),anyObject()); + + vendorLicenseManagerImpl.deleteLicenseKeyGroup(lkg, USER1); + + verify(licenseKeyGroupDao).delete(lkg); + verify(vendorLicenseFacade).updateVlmLastModificationTime(vlm1_id,VERSION01); + + } + + public static LicenseKeyGroupEntity createLicenseKeyGroup(String vlmId, Version version,String id, String name, String desc, LicenseKeyType type, MultiChoiceOrOther<OperationalScope> operationalScope) { LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity(); licenseKeyGroup.setVendorLicenseModelId(vlmId); licenseKeyGroup.setVersion(version); + licenseKeyGroup.setId(id); licenseKeyGroup.setName(name); licenseKeyGroup.setDescription(desc); licenseKeyGroup.setType(type); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java new file mode 100644 index 0000000000..195fa5d4da --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java @@ -0,0 +1,330 @@ +package org.openecomp.sdc.vendorlicense.impl; + +import org.junit.rules.ExpectedException; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.sdc.activityLog.ActivityLogManager; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; +import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; +import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao; +import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; +import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; +import org.openecomp.sdc.vendorlicense.dao.LimitDao; +import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.versioning.VersioningManager; +import org.openecomp.sdc.versioning.VersioningUtil; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; +import org.testng.annotations.BeforeMethod; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.testng.Assert; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; + + +/** + * Created by ayalaben on 7/19/2017 + */ +public class VendorLicenseModelTest { + + private static final String USER1 = "TestUser1"; + private static final String USER2 = "TestUser2"; + + private static String vlm1_id = "vlm1_id"; + private static String vlm2_id = "vlm2_id"; + private static String la1_id = "la1_id"; + private static String la2_id = "la2_id"; + private static String fg1_id = "fg1_id"; + private static String fg2_id = "fg2_id"; + public static final Version VERSION01 = new Version(0, 1); + private static final Version VERSION10 = new Version(1, 0); + + @Mock + private VersioningManager versioningManagerMcok; + @Mock + private VendorLicenseFacade vendorLicenseFacadeMcok; + @Mock + private VendorLicenseModelDao vendorLicenseModelDaoMcok; + @Mock + private LicenseAgreementDao licenseAgreementDaoMcok; + @Mock + private FeatureGroupDao featureGroupDaoMcok; + @Mock + private EntitlementPoolDao entitlementPoolDaoMcok; + @Mock + private LicenseKeyGroupDao licenseKeyGroupDaoMcok; + @Mock + private LimitDao limitDaoMcok; + @Mock + private ActivityLogManager activityLogManagerMcok; + + + @Spy + @InjectMocks + private VendorLicenseManagerImpl vendorLicenseManager; + + + @Captor + private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg; + + + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCheckout() { + + doReturn(VERSION01).when(versioningManagerMcok) + .checkout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vlm1_id, USER1); + + vendorLicenseManager.checkout(vlm1_id, USER1); + + Assert.assertEquals(VERSION01.getStatus(), VersionStatus.Locked); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id, VERSION01); + + verify(versioningManagerMcok) + .checkout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vlm1_id, USER1); + + verify(activityLogManagerMcok).addActionLog(activityLogEntityArg.capture(), eq(USER1)); + ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue(); + Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION01.getMajor() + 1)); + Assert.assertTrue(activityLogEntity.isSuccess()); + } + + @Test + public void testUndoCheckout() { + Version existingVersion = new Version(0, 2); + doReturn(existingVersion).when(versioningManagerMcok).undoCheckout( + VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vlm1_id, USER1); + + vendorLicenseManager.undoCheckout(vlm1_id, USER1); + + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id, existingVersion); + } + + @Test + public void testCheckin() { + + doReturn(VERSION10).when(vendorLicenseFacadeMcok).checkin(vlm1_id, USER1); + + vendorLicenseManager.checkin(vlm1_id, USER1); + verify(activityLogManagerMcok).addActionLog(activityLogEntityArg.capture(), eq(USER1)); + ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue(); + Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION10.getMajor() + 1)); + verify(vendorLicenseFacadeMcok).checkin(vlm1_id, USER1); + + } + + @Test + public void testSubmit() { + + doReturn(VERSION10).when(vendorLicenseFacadeMcok).submit(vlm1_id, USER1); + + vendorLicenseManager.submit(vlm1_id, USER1); + verify(activityLogManagerMcok).addActionLog(activityLogEntityArg.capture(), eq(USER1)); + ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue(); + Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION10.getMajor())); + verify(vendorLicenseFacadeMcok).submit(vlm1_id, USER1); + + } + + @Test + public void testListWhenNone() { + doReturn(new HashMap<>()).when(versioningManagerMcok).listEntitiesVersionInfo + (VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, USER1, VersionableEntityAction.Read); + Collection<VersionedVendorLicenseModel> vlms = vendorLicenseManager.listVendorLicenseModels + (null, USER1); + Assert.assertEquals(vlms.size(), 0); + } + + @Test + public void testList() { + + Map<String, VersionInfo> vlmsTobeReturned = new HashMap<>(); + + VersionInfo versionInfo1 = new VersionInfo(); + versionInfo1.setActiveVersion(VERSION01); + vlmsTobeReturned.put(vlm1_id, versionInfo1); + + VersionInfo versionInfo2 = new VersionInfo(); + versionInfo2.setActiveVersion(VERSION10); + vlmsTobeReturned.put(vlm2_id, versionInfo2); + + doReturn(vlmsTobeReturned).when(versioningManagerMcok).listEntitiesVersionInfo + (VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, USER1, VersionableEntityAction.Read); + + VendorLicenseModelEntity vlm1 = new VendorLicenseModelEntity(vlm1_id, VERSION01); + vlm1.setWritetimeMicroSeconds(8L); + doReturn(vlm1).when(vendorLicenseModelDaoMcok).get(any(VendorLicenseModelEntity.class)); + + Collection<VersionedVendorLicenseModel> vlms = vendorLicenseManager.listVendorLicenseModels + (null, USER1); + Assert.assertEquals(vlms.size(), 2); + } + + @Test + public void testListFinalsWhenNone() { + + Map<String, VersionInfo> vspsTobeReturned = new HashMap<>(); + + VersionInfo versionInfo1 = new VersionInfo(); + versionInfo1.setActiveVersion(VERSION01); + vspsTobeReturned.put(vlm1_id, versionInfo1); + + VersionInfo versionInfo2 = new VersionInfo(); + versionInfo2.setActiveVersion(VERSION10); + vspsTobeReturned.put(vlm2_id, versionInfo2); + + doReturn(vspsTobeReturned).when(versioningManagerMcok).listEntitiesVersionInfo + (VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, USER1, VersionableEntityAction.Read); + + Collection<VersionedVendorLicenseModel> vlms = vendorLicenseManager.listVendorLicenseModels + (VersionStatus.Final.name(), USER1); + Assert.assertEquals(vlms.size(), 0); + } + + @Test + public void testListFinals() { + Map<String, VersionInfo> vlmsTobeReturned = new HashMap<>(); + + VersionInfo versionInfo1 = new VersionInfo(); + versionInfo1.setActiveVersion(VERSION01); + vlmsTobeReturned.put(vlm1_id, versionInfo1); + + VersionInfo versionInfo2 = new VersionInfo(); + + versionInfo2.setActiveVersion(new Version(1, 3)); + versionInfo2.setLatestFinalVersion(VERSION10); + vlmsTobeReturned.put(vlm2_id, versionInfo2); + + doReturn(vlmsTobeReturned).when(versioningManagerMcok).listEntitiesVersionInfo + (VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, USER1, VersionableEntityAction.Read); + + VendorLicenseModelEntity vlm1 = new VendorLicenseModelEntity(vlm1_id, VERSION01); + vlm1.setWritetimeMicroSeconds(8L); + doReturn(vlm1).when(vendorLicenseModelDaoMcok).get(any(VendorLicenseModelEntity.class)); + + Collection<VersionedVendorLicenseModel> vlms = vendorLicenseManager.listVendorLicenseModels + (VersionStatus.Final.name(), USER1); + + Assert.assertEquals(vlms.size(), 1); + } + + @Test + public void testCreate() { + + VendorLicenseModelEntity vlmEntity = new VendorLicenseModelEntity(vlm1_id, VERSION01); + + doReturn(vlmEntity).when(vendorLicenseFacadeMcok).createVendorLicenseModel(vlmEntity, USER1); + + vendorLicenseManager.createVendorLicenseModel(vlmEntity, USER1); + + verify(vendorLicenseFacadeMcok).createVendorLicenseModel(vlmEntity, USER1); + verify(activityLogManagerMcok).addActionLog(activityLogEntityArg.capture(), eq(USER1)); + ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue(); + Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION01.getMajor() + 1)); + Assert.assertTrue(activityLogEntity.isSuccess()); + + } + + @Test + public void testUpdate() { + + VendorLicenseModelEntity existingVlm = new VendorLicenseModelEntity(); + existingVlm.setVersion(VERSION01); + existingVlm.setId(vlm1_id); + existingVlm.setIconRef("icon"); + existingVlm.setVendorName("VLM1"); + existingVlm.setDescription("decription"); + + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + + doReturn(versionInfo).when(vendorLicenseManager).getVersionInfo(existingVlm.getId(), + VersionableEntityAction.Write, USER1); + + doReturn(VERSION01).when(vendorLicenseManager).resloveVersion(vlm1_id,null, versionInfo, USER1); + + doReturn("VLM1").when(vendorLicenseModelDaoMcok).get(existingVlm); + + VendorLicenseModelEntity updatedVlm = new VendorLicenseModelEntity(); + updatedVlm.setVersion(VERSION01); + updatedVlm.setId(vlm1_id); + updatedVlm.setIconRef("icon"); + updatedVlm.setVendorName("VLM1_updated"); + updatedVlm.setDescription("decription"); + + doNothing().when(vendorLicenseManager) + .updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, + existingVlm.getVendorName(), updatedVlm.getVendorName()); + + existingVlm.setWritetimeMicroSeconds(8L); + + doReturn(existingVlm).when(vendorLicenseModelDaoMcok).get(any(VendorLicenseModelEntity.class)); + + vendorLicenseManager.updateVendorLicenseModel(updatedVlm, USER1); + + verify(vendorLicenseModelDaoMcok).update(updatedVlm); + verify(vendorLicenseFacadeMcok).updateVlmLastModificationTime(vlm1_id, VERSION01); + } + + @Test + public void testGetVendorLicenseModel(){ + vendorLicenseManager.getVendorLicenseModel(vlm1_id,VERSION01,USER1); + verify(vendorLicenseFacadeMcok).getVendorLicenseModel(vlm1_id,VERSION01,USER1); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testDeleteVLMUnsupportedOperation() { + vendorLicenseManager.deleteVendorLicenseModel(vlm1_id, USER1); + } + + +// @Test(expectedExceptions = CoreException.class) +// public void testGetNonExistingVersion_negative() { +// Version notExistversion = new Version(43, 8); +// doReturn(null).when(vspInfoDaoMock).get(any(VspDetails.class)); +// vendorSoftwareProductManager.getVsp(VSP_ID, notExistversion, USER1); +// } + +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java index 24883b5c13..9ac6e1b1bb 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java @@ -19,6 +19,8 @@ public class ImageErrorBuilder { private static final String IMAGE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed " + "for VSP onboarded via HEAT."; + private static final String VFC_IMAGE_DUPLICATE_VERSION_MSG = "Invalid request, Image with version %s" + + " already exists for component with ID %s."; /** @@ -35,6 +37,18 @@ public class ImageErrorBuilder { } /** + * Gets duplicate image version error builder. + * + * @return the duplicate image version error builder + */ + public static ErrorCode getDuplicateImageVersionErrorBuilder(String version, String componentId) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(DUPLICATE_IMAGE_VERSION_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_VERSION_MSG, version, componentId )); + return builder.build(); + } + /** * Gets image name format error builder. * * @return the image name format error builder diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java index cd102ebb1d..fc5857bb59 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java @@ -385,27 +385,20 @@ public class ComputeManagerImpl implements ComputeManager { } } - private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList, String event) { - if(!compute.getComputeCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) - { - ErrorCode errorCode = ComputeErrorBuilder.getComputeNameFormatErrorBuilder( - VendorSoftwareProductConstants.NAME_PATTERN); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - event, ErrorLevel.ERROR.name(), - errorCode.id(),errorCode.message()); - throw new CoreException(errorCode); - } - - if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) { - ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute - .getComputeCompositionData().getName(), compute.getComponentId()); + private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList, + String event) { + if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), + compute.getId())) { + ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder + .getDuplicateComputeNameErrorBuilder(compute.getComputeCompositionData().getName(), + compute.getComponentId()); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - event, ErrorLevel.ERROR.name(), - errorCode.id(),errorCode.message()); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); - throw new CoreException(errorCode); - } + throw new CoreException(errorCode); + } } private boolean isComputeNameDuplicate(Collection<ComputeEntity> computes, String name, String computeId) { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java index 2e964458d5..5bf144e77e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java @@ -111,17 +111,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, String user, Version activeVersion) { - if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) - { - ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( - VendorSoftwareProductConstants.NAME_PATTERN); - - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(), - errorCode.id(),errorCode.message()); - - throw new CoreException(errorCode); - } //Validation for unique model. Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors(deploymentFlavorEntity.getVspId(), @@ -367,17 +356,6 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { updateDeploymentFlavorErrorBuilder.message()); throw new CoreException(updateDeploymentFlavorErrorBuilder); } - else { - if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) - { - ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( - VendorSoftwareProductConstants.NAME_PATTERN); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.UPDATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(), - errorCode.id(),errorCode.message()); - throw new CoreException(errorCode); - } - } //deploymentFlavorEntity.setVersion(activeVersion); DeploymentFlavorEntity retrieved = getDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(), diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java index 6a8f9e0c45..b54570f13c 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java @@ -36,6 +36,7 @@ import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; +import java.util.stream.Collectors; public class ImageManagerImpl implements ImageManager { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @@ -296,11 +297,51 @@ public class ImageManagerImpl implements ImageManager { } } + if(!isImageVersionUnique(vspId, version, componentId, imageId, image, user)) + { + ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageVersionErrorBuilder(image + .getVersion(), componentId); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData); mdcDataDebugMessage.debugExitMessage("VSP id, component id, imageId", vspId, componentId, imageId); } + private boolean isImageVersionUnique(String vspId, Version version, String componentId, String imageId, + ImageDetails image, String user) + { + boolean isPresent = true; + if(image!=null && image.getVersion()!=null) + { + Collection<ImageEntity> imageEntities = imageDao.list(new ImageEntity(vspId, version, componentId, null)); + if(CollectionUtils.isNotEmpty(imageEntities)) + { + imageEntities = imageEntities.stream().filter(imageEntity -> image.getVersion().trim().equalsIgnoreCase( + getImageVersion(vspId, version, componentId, imageEntity, user)) + && !imageEntity.getId().equals(imageId)).collect(Collectors.toList()); + + isPresent = CollectionUtils.isEmpty(imageEntities); + } + } + + return isPresent; + } + + private String getImageVersion(String vspId, Version version, String componentId, ImageEntity imageEntity, String user) + { + QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version, + componentId, imageEntity.getId(), user); + ImageDetails imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(), ImageDetails.class); + + return imageDetails==null?null:imageDetails.getVersion()!=null?imageDetails.getVersion().trim():null; + } private ImageEntity getImageEntity(String vspId, Version version, String componentId, String imageId) { //validateComponentId(vspId,version,componentId); @@ -322,19 +363,8 @@ public class ImageManagerImpl implements ImageManager { return false; } - private void validateVfcImage(boolean isManual, ImageEntity image, Collection<ImageEntity> vfcImageList, String event) { - if(isManual && !image.getImageCompositionData().getFileName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) - { - ErrorCode errorCode = ImageErrorBuilder.getImageNameFormatErrorBuilder( - VendorSoftwareProductConstants.NAME_PATTERN); - - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - event, ErrorLevel.ERROR.name(), - errorCode.id(),errorCode.message()); - - throw new CoreException(errorCode); - } - + private void validateVfcImage(boolean isManual, ImageEntity image, + Collection<ImageEntity> vfcImageList, String event) { if (isImageNameDuplicate(vfcImageList,image.getImageCompositionData().getFileName())) { ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageNameErrorBuilder(image .getImageCompositionData().getFileName(), image.getComponentId()); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 89246376e4..de33ce8cfb 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -136,6 +136,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; @@ -747,21 +748,22 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private void updateDeploymentFlavor(VspDetails vspDetails, String user) { final List<String> featureGroups = vspDetails.getFeatureGroups(); if (featureGroups != null && !featureGroups.isEmpty() ) { - /*final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = - listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion(), user);*/ - final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails .getVersion(), null)); - for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { - final String featureGroupId = - deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId(); - if ( !featureGroups.contains(featureGroupId)) { - DeploymentFlavor deploymentFlavorCompositionData = - deploymentFlavorEntity.getDeploymentFlavorCompositionData(); - deploymentFlavorCompositionData.setFeatureGroupId(null); - vendorSoftwareProductDao.updateDeploymentFlavor(deploymentFlavorEntity); - } + if (Objects.nonNull(deploymentFlavorEntities)) { + deploymentFlavorEntities.forEach(deploymentFlavorEntity -> { + final String featureGroupId = + deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId(); + if ( !featureGroups.contains(featureGroupId)) { + DeploymentFlavor deploymentFlavorCompositionData = + deploymentFlavorEntity.getDeploymentFlavorCompositionData(); + deploymentFlavorCompositionData.setFeatureGroupId(null); + deploymentFlavorEntity.setDeploymentFlavorCompositionData + (deploymentFlavorCompositionData); + vendorSoftwareProductDao.updateDeploymentFlavor(deploymentFlavorEntity); + } + }); } } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java index 103762c56d..bda77d0aa1 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java @@ -42,11 +42,6 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -/** - * Created by DIVESHM on 5/16/2017. - */ - - public class ComputeManagerImplTest { private static final String COMPUTE_NOT_EXIST_MSG = @@ -164,29 +159,6 @@ public class ComputeManagerImplTest { } @Test - public void testCreateManualComputeWithIncorrectNameFormat() { - ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); - doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); - - ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); - ComputeData computeData = expectedDiffName.getComputeCompositionData(); - computeData.setName(COMPUTE1_ID + "Name/*"); - expectedDiffName.setComputeCompositionData(computeData); - List<ComputeEntity> vfcImageList = new ArrayList<ComputeEntity>(); - vfcImageList.add(expectedDiffName); - doReturn(vfcImageList).when(computeDao).list(anyObject()); - - try { - computeManager.createCompute(expectedDiffName, USER); - Assert.fail(); - } - catch (CoreException ex) { - Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, - ex.code().id()); - } - } - - @Test public void testUpdateNonExistingComputeId_negative() { testUpdate_negative(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID, USER, @@ -215,33 +187,6 @@ public class ComputeManagerImplTest { } @Test - public void testUpdateComputeWithIncorrectNameFormat() { - doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) - .when(computeDao).get(anyObject()); - - doReturn(new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID)) - .when(compositionEntityDataManagerMock) - .validateEntity(anyObject(), anyObject(), anyObject()); - - doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); - - ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); - ComputeData computeData = new ComputeData(); - computeData.setName(COMPUTE1_ID + "name/*"); - computeData.setDescription(COMPUTE1_ID + "desc updated"); - computeEntity.setComputeCompositionData(computeData); - - try { - computeManager.updateCompute(computeEntity, USER); - Assert.fail(); - } - catch (CoreException ex) { - Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, - ex.code().id()); - } - } - - @Test public void testIllegalComputeUpdate() { doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) .when(computeDao).get(anyObject()); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java new file mode 100644 index 0000000000..804af537df --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java @@ -0,0 +1,412 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl; + + +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; + +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; +import org.testng.Assert; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +public class DeploymentFlavorManagerImplTest { + private static final String USER = "depFlavorTestUser"; + private static final String VSP_ID = "VSP_ID"; + private static final Version VERSION = new Version(0, 1); + private static final String COMPONENT_ID = "COMPONENT_ID"; + private static final String DF1_ID = "df1"; + private static final String DF2_ID = "df2"; + + @Mock + private CompositionEntityDataManager compositionEntityDataManagerMock; + @Mock + private VendorSoftwareProductInfoDao vspInfoDao; + @Mock + DeploymentFlavorDao deploymentFlavorDaoMock; + @Mock + ComponentDao componentDaoMock; + @Mock + ComputeDao computeDaoMock; + @InjectMocks + @Spy + private DeploymentFlavorManagerImpl deploymentFlavorManager; + + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testListWhenNone() { + final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = + deploymentFlavorManager.listDeploymentFlavors(VSP_ID, VERSION, USER); + Assert.assertEquals(deploymentFlavorEntities.size(), 0); + } + + @Test + public void testCreateOnNotManual_negative() { + + testCreate_negative(new DeploymentFlavorEntity(VSP_ID, VERSION, null), USER, + VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + } + + @Test + public void testCreateManualDepFlavor() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + verify(compositionEntityDataManagerMock).createDeploymentFlavor(expected); + } + + @Test + public void testCreateManualDepFlavorWithDuplicateName() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData(); + deploymentFlavor.setModel(DF1_ID + "Name"); + expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor); + List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>(); + list.add(expectedDiffName); + doReturn(list).when(deploymentFlavorDaoMock).list(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED, + ex.code().id()); + } + } + + @Test + public void testCreateManualDepFlavorWithFGNotInVSP() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + final DeploymentFlavor deploymentFlavor = + JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class); + deploymentFlavor.setFeatureGroupId("fg3"); + expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor)); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + List<String> featureGrps = new ArrayList<String>(); + featureGrps.add("fg1"); + featureGrps.add("fg2"); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + vspDetails.setFeatureGroups(featureGrps); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + + try { + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP, + ex.code().id()); + } + } + + @Test + public void testCreateManualDepFlavorWithNullCompInAssociation() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + final DeploymentFlavor deploymentFlavor = + JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class); + ComponentComputeAssociation association = new ComponentComputeAssociation(); + association.setComponentId(null); + association.setComputeFlavorId("CF1"); + List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>(); + list.add(association); + deploymentFlavor.setComponentComputeAssociations(list); + expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor)); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION, + ex.code().id()); + Assert.assertEquals("Invalid request,for valid association please provide ComponentId for Compute Flavor", + ex.getMessage()); + } + } + + @Test + public void testCreateManualDepFlavorWithInvalidComputeInAssociation() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + final DeploymentFlavor deploymentFlavor = + JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class); + ComponentComputeAssociation association = new ComponentComputeAssociation(); + association.setComponentId(COMPONENT_ID); + association.setComputeFlavorId("CF1"); + List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>(); + list.add(association); + deploymentFlavor.setComponentComputeAssociations(list); + expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor)); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, USER); + doReturn(component).when(componentDaoMock).get(anyObject()); + + doReturn(null).when(computeDaoMock).get(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID, + ex.code().id()); + } + } + + @Test + public void testCreateManualDepFlavorWithDuplicateVfcAssociation() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + final DeploymentFlavor deploymentFlavor = + JsonUtil.json2Object(expected.getCompositionData(), DeploymentFlavor.class); + ComponentComputeAssociation association = new ComponentComputeAssociation(); + association.setComponentId(COMPONENT_ID); + association.setComputeFlavorId("CF1"); + List<ComponentComputeAssociation> list = new ArrayList<ComponentComputeAssociation>(); + list.add(association); + list.add(association); + deploymentFlavor.setComponentComputeAssociations(list); + expected.setCompositionData(JsonUtil.object2Json(deploymentFlavor)); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, USER); + doReturn(component).when(componentDaoMock).get(anyObject()); + + ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, "CF1"); + doReturn(computeEntity).when(computeDaoMock).get(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expected, USER); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED, + ex.code().id()); + } + } + + @Test + public void testList() { + + doReturn(Arrays.asList( + createDeploymentFlavor(VSP_ID, VERSION, DF1_ID), + createDeploymentFlavor(VSP_ID, VERSION, DF2_ID))) + .when(deploymentFlavorDaoMock).list(anyObject()); + + + final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = + deploymentFlavorManager.listDeploymentFlavors(VSP_ID, VERSION, USER); + Assert.assertEquals(deploymentFlavorEntities.size(), 2); + for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { + Assert.assertEquals(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel() + , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+"name" : DF2_ID+"name" ); + } + } + + @Test + public void testUpdateHeatDepFlavor() { + testUpdate_negative(VSP_ID, VERSION, DF1_ID, USER, + VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + } + + @Test + public void testUpdateNonExistingManualDepFlavorId_negative() { + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + testUpdate_negative(VSP_ID, VERSION, DF1_ID, USER, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testManualUpdateDepFlavor() { + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + doReturn(createDeploymentFlavor(VSP_ID, VERSION, DF1_ID)) + .when(deploymentFlavorDaoMock).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.image, DF1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel(DF1_ID + "_name"); + deploymentFlavor.setDescription(DF1_ID + " desc updated"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); + + CompositionEntityValidationData validationData = + deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, USER); + Assert.assertTrue(validationData == null || validationData.getErrors() == null); + verify(deploymentFlavorDaoMock).update(deploymentFlavorEntity); + } + + @Test + public void testGetNonExistingDepFlavorId_negative() { + testGet_negative(VSP_ID, VERSION, "non existing image id", USER, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + /* + @Test + public void testGet() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + CompositionEntityResponse<DeploymentFlavor> response = + deploymentFlavorManager.getDeploymentFlavor(VSP_ID, VERSION, DF1_ID, USER); + Assert.assertEquals(response.getId(), expected.getId()); + Assert.assertEquals(response.getData().getModel(), expected.getDeploymentFlavorCompositionData(). + getModel()); + Assert.assertEquals(response.getData().getDescription(), expected.getDeploymentFlavorCompositionData(). + getDescription()); + } +*/ + @Test + public void testDeleteDepFlavorOnHEAT() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject()); + testDelete_negative(VSP_ID, VERSION, DF1_ID, USER, + VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + } + + @Test + public void testDeleteOnNotExistImage() { + testDelete_negative(VSP_ID, VERSION, DF1_ID, USER, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testDeleteOnManualImage() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject()); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + deploymentFlavorManager.deleteDeploymentFlavor(VSP_ID, VERSION, DF1_ID, USER); + verify(deploymentFlavorDaoMock).delete(anyObject()); + } + + private void testList_negative(String vspId, Version version, String componentId, String user, + String expectedErrorCode, String expectedErrorMsg) { + try { + deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), expectedErrorCode); + Assert.assertEquals(exception.getMessage(), expectedErrorMsg); + } + } + + private void testCreate_negative(DeploymentFlavorEntity deploymentFlavorEntity, String user, String + expectedErrorCode) { + try { + deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), expectedErrorCode); + } + } + + private void testDelete_negative(String vspId, Version version, String deploymentFlavorId, + String user, + String expectedErrorCode) { + try { + deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), expectedErrorCode); + } + } + + static DeploymentFlavorEntity createDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) { + + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel(deploymentFlavorId + "name"); + deploymentFlavor.setDescription(deploymentFlavorId + " desc"); + + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); + return deploymentFlavorEntity; + } + + private void testUpdate_negative(String vspId, Version version, String + deploymentFlavorId, String user, String expectedErrorCode) { + try { + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel("Name"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); + deploymentFlavorManager + .updateDeploymentFlavor(deploymentFlavorEntity, user); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), expectedErrorCode); + } + } + + private void testGet_negative(String vspId, Version version, String deploymentFlavorId, + String user, String expectedErrorCode) { + try { + deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, user); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), expectedErrorCode); + } + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java index c29cb42953..d617bf9a47 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java @@ -105,28 +105,6 @@ public class ImageManagerImplTest { } @Test - public void testCreateManualImageWithIncorrectNameFormat() { - ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); - doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); - - ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); - Image image = expectedDiffName.getImageCompositionData(); - image.setFileName(IMAGE1_ID + " Name*/"); - expectedDiffName.setImageCompositionData(image); - List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>(); - vfcImageList.add(expectedDiffName); - doReturn(vfcImageList).when(imageDao).list(anyObject()); - try { - imageManager.createImage(expectedDiffName, USER); - Assert.fail(); - } - catch (CoreException ex) { - Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, - ex.code().id()); - } - } - - @Test public void testCreateManualImageWithDuplicateName() { ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); @@ -176,33 +154,6 @@ public class ImageManagerImplTest { } @Test - public void testUpdateImageWithIncorrectNameFormat() { - doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) - .when(imageDao).get(anyObject()); - - doReturn(new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID)) - .when(compositionEntityDataManagerMock) - .validateEntity(anyObject(), anyObject(), anyObject()); - - doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); - - ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); - Image imageData = new Image(); - imageData.setFileName(IMAGE1_ID + "name/*"); - imageData.setDescription(IMAGE1_ID + " desc updated"); - imageEntity.setImageCompositionData(imageData); - - try { - imageManager.updateImage(imageEntity, USER); - Assert.fail(); - } - catch (CoreException ex) { - Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, - ex.code().id()); - } - } - - @Test public void testIllegalImageUpdate() { doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) .when(imageDao).get(anyObject()); @@ -321,6 +272,35 @@ public class ImageManagerImplTest { verify(imageDao).updateQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json); } + /* + @Test + public void testUpdateManDupImageVerQuestionnaire() throws Exception { + try{ + String json = "{\"md5\" :\"FFDSD33SS\", \"version\" :\"1.0\"}"; + ImageEntity imageEntity = new ImageEntity(); + imageEntity.setId(IMAGE2_ID); + imageEntity.setQuestionnaireData(json); + List<ImageEntity> imageEntities = new ArrayList(){{ + add(imageEntity); + }}; + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + doReturn(imageEntity).when(imageDao).get(anyObject()); + doReturn(imageEntities).when(imageDao).list(anyObject()); + doReturn(imageEntities.get(0)).when(imageDao).getQuestionnaireData(anyObject(), anyObject(), anyObject(), anyObject()); + + imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_VERSION_NOT_ALLOWED); + + } + } + + */ + + /* + @Test public void testUpdateHEATImageQuestionnaireWithFormat() throws Exception { String json = "{\"format\" :\"qcow2\"}"; @@ -342,6 +322,8 @@ public class ImageManagerImplTest { } } + */ + @Test public void testUpdateHEATImageQuestionnaireWithInvalidFormat() throws Exception { String json = "{\"format\" :\"qcow2\"}"; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java index 8ea853c5fa..b65071ac51 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java @@ -93,6 +93,7 @@ public class ManualVspToscaManagerImplTest { @Mock private ManualVspDataCollectionService manualVspDataCollectionServiceMock; + /* @Test public void testGatherVspInformationInvalidVsp() { @@ -615,4 +616,6 @@ public class ManualVspToscaManagerImplTest { nicData.put(COMPONENT_ID, nicList); return nicData; } + + */ } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java index f79a56bebf..2fc4385563 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java @@ -49,11 +49,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager; import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager; import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager; import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; @@ -66,6 +68,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionE import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionStatus; @@ -144,6 +147,8 @@ public class VendorSoftwareProductManagerImplTest { private VendorSoftwareProductInfoDao vspInfoDaoMock; @Mock private ManualVspToscaManager manualVspToscaManager; + @Mock + private DeploymentFlavorDao deploymentFlavorDaoMock; @Spy @@ -337,6 +342,50 @@ public class VendorSoftwareProductManagerImplTest { verify(vspInfoDaoMock).update(updatedVsp); } + @Test + public void testUpdateRemoveFG() { + VersionInfo versionInfo = new VersionInfo(); + versionInfo.setActiveVersion(VERSION01); + doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo( + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1, + VersionableEntityAction.Write); + List<String> fgs = new ArrayList<String>(); + fgs.add("fg1"); fgs.add("fg2"); + VspDetails existingVsp = + createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon", + "category", + "subCategory", "456", fgs); + + List<String> updFgs = new ArrayList<String>(); + updFgs.add("fg2"); + VspDetails updatedVsp = + createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon", + "category_updated", + "subCategory", "456", updFgs); + existingVsp.setWritetimeMicroSeconds(8L); + doReturn(existingVsp).when(vspInfoDaoMock) + .get(any(VspDetails.class)); + doNothing().when(vendorSoftwareProductManager) + .updateUniqueName(existingVsp.getName(), updatedVsp.getName()); + + DeploymentFlavorEntity dfEntity = new DeploymentFlavorEntity(VSP_ID,VERSION01,"DF_ID"); + DeploymentFlavor flavor = new DeploymentFlavor(); + flavor.setFeatureGroupId("fg1"); + dfEntity.setDeploymentFlavorCompositionData(flavor); + + List<DeploymentFlavorEntity> dfList = new ArrayList<DeploymentFlavorEntity>(); + dfList.add(dfEntity); + + doReturn(dfList).when(deploymentFlavorDaoMock).list(anyObject()); + + vendorSoftwareProductManager.updateVsp(updatedVsp, USER1); + + verify(vendorSoftwareProductDaoMock).updateDeploymentFlavor(dfEntity); + + Assert.assertNull(dfEntity.getDeploymentFlavorCompositionData().getFeatureGroupId()); + + } + @Test(expectedExceptions = CoreException.class) public void testGetNonExistingVersion_negative() { Version notExistversion = new Version(43, 8); @@ -453,7 +502,7 @@ public class VendorSoftwareProductManagerImplTest { Assert.assertEquals(undoCheckoutVersion, VERSION01); } - +/* @Test public void testSubmitWithMissingData() throws IOException { VersionInfo versionInfo = new VersionInfo(); @@ -495,6 +544,8 @@ public class VendorSoftwareProductManagerImplTest { verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1)); } + */ + // TODO: 3/15/2017 fix and enable //@Test public void testSubmitWithInvalidLicensingData() throws IOException { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java index 33cf18c463..acd76a151b 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java @@ -42,6 +42,7 @@ import java.util.Arrays; import java.util.Map; public class SchemaGeneratorTest { + /* private static int getMinOfVmMax(JSONObject schemaJson) { return schemaJson.getJSONObject("properties").getJSONObject("compute") @@ -266,4 +267,5 @@ public class SchemaGeneratorTest { .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); validateSchema(schema); } + */ } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java index de41bb8202..6d92330493 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java @@ -37,6 +37,8 @@ import org.testng.annotations.Test; public class ApplicationConfigImplDaoTest { + /* + private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR = "SCHEMA_GENERATOR_INITIALIZATION_ERROR"; private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG = @@ -103,5 +105,5 @@ public class ApplicationConfigImplDaoTest { Assert.assertEquals(testTemplate, applicationConfig.getConfigurationData("test_namespace", "test_key").getValue()); } - +*/ } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java index 25bd6aa380..fc96335daf 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java @@ -33,7 +33,7 @@ import java.util.List; public class NoSqlDbTest { private static NoSqlDb noSqlDb; - +/* @Test public void testNoSqlDbFactoryFactoryInit() { @@ -65,4 +65,6 @@ public class NoSqlDbTest { System.out.format("%s %s\n", row.getString("name"), row.getString("value")); } } + + */ } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml index b3bd790bd5..bdbf8c5e24 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml @@ -31,7 +31,7 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen-state-store.version}</version> </dependency> </dependencies> </project> diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json index 105dbe5875..9f83296a71 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json @@ -7,5 +7,6 @@ "NIC_DATA_HEALER" : "org.openecomp.sdc.healing.healers.NicDataHealer", "COMPONENT_QUESTIONNAIRE_HEALER" : "org.openecomp.sdc.healing.healers.ComponentQuestionnaireHealer", "HEAT_TOSCA_TRANSLATION_HEALER" : "org.openecomp.sdc.healing.healers.HeatToToscaTranslationHealer", - "VLM_VERSION_HEALER" : "org.openecomp.sdc.healing.healers.VlmVersionHealer" + "VLM_VERSION_HEALER" : "org.openecomp.sdc.healing.healers.VlmVersionHealer", + "VALIDATION_STRUCTURE_HEALER" : "org.openecomp.sdc.healing.healers.ValidationStructureHealer" }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java new file mode 100644 index 0000000000..f92fbd1730 --- /dev/null +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java @@ -0,0 +1,273 @@ +package org.openecomp.sdc.healing.healers; + +import org.apache.commons.collections4.CollectionUtils; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.common.utils.SdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.healing.interfaces.Healer; +import org.openecomp.sdc.heat.datatypes.manifest.FileData; +import org.openecomp.sdc.heat.datatypes.structure.Artifact; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadData; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +/** + * Created by Talio on 7/30/2017. + */ +public class ValidationStructureHealer implements Healer { + + private static final VendorSoftwareProductInfoDao vspInfoDao = + VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); + private static final OrchestrationTemplateDao orchestrationTemplateDao = + OrchestrationTemplateDaoFactory.getInstance().createInterface(); + + @Override + public Object heal(Map<String, Object> healingParams) throws Exception { + + String vspId = (String) healingParams.get(SdcCommon.VSP_ID); + Version version = (Version) healingParams.get(SdcCommon.VERSION); + + VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version)); + UploadDataEntity orchestrationTemplate = + orchestrationTemplateDao.getOrchestrationTemplate(vspId, version); + + OldValidationStructureTree oldValidationStructureTree; + try{ + oldValidationStructureTree = + JsonUtil.json2Object(orchestrationTemplate.getValidationData(), OldValidationStructureTree + .class); + } catch (Exception e){ + return Optional.empty(); + } + + Optional<HeatStructureTree> newHeatStructureTreeFromOldStructureTree = + createNewHeatStructureTreeFromOldStructureTree(oldValidationStructureTree.getImportStructure()); + + if(newHeatStructureTreeFromOldStructureTree.isPresent()){ + ValidationStructureList validationData = new ValidationStructureList + (newHeatStructureTreeFromOldStructureTree.get()); + vspDetails.setValidationDataStructure(validationData); + + updateValuesInDb(vspId, vspDetails, orchestrationTemplate, validationData); + } + return newHeatStructureTreeFromOldStructureTree; + + } + + private void updateValuesInDb(String vspId, VspDetails vspDetails, + UploadDataEntity orchestrationTemplate, + ValidationStructureList validationData) { + vspInfoDao.update(vspDetails); + UploadData uploadData = getUpdatedUploadData(orchestrationTemplate, validationData); + orchestrationTemplateDao.updateOrchestrationTemplateData(vspId, uploadData); + } + + private UploadData getUpdatedUploadData(UploadDataEntity orchestrationTemplate, + ValidationStructureList validationData) { + UploadData uploadData = new UploadData(); + uploadData.setValidationDataStructure(validationData); + uploadData.setValidationData(JsonUtil.object2Json(validationData)); + uploadData.setContentData(orchestrationTemplate.getContentData()); + uploadData.setId(orchestrationTemplate.getId()); + uploadData.setPackageName(orchestrationTemplate.getPackageName()); + uploadData.setPackageVersion(orchestrationTemplate.getPackageVersion()); + return uploadData; + } + + + private Optional<HeatStructureTree> createNewHeatStructureTreeFromOldStructureTree(OldHeatStructureTree + oldHeatStructureTree){ + + HeatStructureTree heatStructureTree = new HeatStructureTree(); + + if(Objects.isNull(oldHeatStructureTree)){ + return Optional.empty(); + } + + mapOldHeatStructureTreeValues(oldHeatStructureTree, heatStructureTree); + + Set<OldHeatStructureTree> heat = + oldHeatStructureTree.getHeat() == null ? new HashSet<>() : oldHeatStructureTree.getHeat(); + Set<OldHeatStructureTree> volume = + oldHeatStructureTree.getVolume() == null ? new HashSet<>() : oldHeatStructureTree.getVolume(); + Set<OldHeatStructureTree> nested = + oldHeatStructureTree.getNested() == null ? new HashSet<>() : oldHeatStructureTree.getNested(); + Set<OldHeatStructureTree> network = + oldHeatStructureTree.getNetwork() == null ? new HashSet<>() : oldHeatStructureTree.getNetwork(); + + + heatStructureTree.setHeat(createHeatStructureTreeSetFromOld(heat)); + heatStructureTree.setVolume(createHeatStructureTreeSetFromOld(volume)); + heatStructureTree.setNested(createHeatStructureTreeSetFromOld(nested)); + heatStructureTree.setNetwork(createHeatStructureTreeSetFromOld(network)); + + + return Optional.of(heatStructureTree); + + } + + private void mapOldHeatStructureTreeValues( + OldHeatStructureTree oldHeatStructureTree, + HeatStructureTree heatStructureTree) { + heatStructureTree.setFileName(oldHeatStructureTree.getFileName()); + heatStructureTree.setBase(oldHeatStructureTree.getBase()); + heatStructureTree.setType(oldHeatStructureTree.getType()); + heatStructureTree.setArtifacts(oldHeatStructureTree.getArtifacts()); + heatStructureTree.setErrors(oldHeatStructureTree.getErrors()); + + if(Objects.nonNull(oldHeatStructureTree.getEnv())) { + heatStructureTree.setEnv(new HeatStructureTree(oldHeatStructureTree.getEnv(), false)); + } + } + + private Set<HeatStructureTree> createHeatStructureTreeSetFromOld(Set<OldHeatStructureTree> + oldHeatStructureTreeSet){ + if(CollectionUtils.isEmpty(oldHeatStructureTreeSet)){ + return null; + } + Set<HeatStructureTree> newHeatStructureSet = new HashSet<>(); + + for(OldHeatStructureTree old : oldHeatStructureTreeSet){ + Optional<HeatStructureTree> newHeatStructureTree = + createNewHeatStructureTreeFromOldStructureTree(old); + if(newHeatStructureTree.isPresent()){ + newHeatStructureSet.add(newHeatStructureTree.get()); + } + } + + return newHeatStructureSet; + } + + private class OldValidationStructureTree{ + private OldHeatStructureTree importStructure; + + public OldHeatStructureTree getImportStructure() { + return importStructure; + } + + public void setImportStructure( + OldHeatStructureTree importStructure) { + this.importStructure = importStructure; + } + } + + private class OldHeatStructureTree{ + private String fileName; + private FileData.Type type; + private Boolean isBase; + private String env; + private List<ErrorMessage> errors; + private Set<OldHeatStructureTree> heat; + private Set<OldHeatStructureTree> volume; + private Set<OldHeatStructureTree> network; + private Set<OldHeatStructureTree> nested; + private Set<OldHeatStructureTree> other; + private Set<Artifact> artifacts; + + public OldHeatStructureTree() { + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public FileData.Type getType() { + return type; + } + + public void setType(FileData.Type type) { + this.type = type; + } + + public Boolean getBase() { + return isBase; + } + + public void setBase(Boolean base) { + isBase = base; + } + + public String getEnv() { + return env; + } + + public void setEnv(String env) { + this.env = env; + } + + public List<ErrorMessage> getErrors() { + return errors; + } + + public void setErrors(List<ErrorMessage> errors) { + this.errors = errors; + } + + public Set<OldHeatStructureTree> getHeat() { + return heat; + } + + public void setHeat(Set<OldHeatStructureTree> heat) { + this.heat = heat; + } + + public Set<OldHeatStructureTree> getVolume() { + return volume; + } + + public void setVolume(Set<OldHeatStructureTree> volume) { + this.volume = volume; + } + + public Set<OldHeatStructureTree> getNetwork() { + return network; + } + + public void setNetwork( + Set<OldHeatStructureTree> network) { + this.network = network; + } + + public Set<OldHeatStructureTree> getNested() { + return nested; + } + + public void setNested(Set<OldHeatStructureTree> nested) { + this.nested = nested; + } + + public Set<OldHeatStructureTree> getOther() { + return other; + } + + public void setOther(Set<OldHeatStructureTree> other) { + this.other = other; + } + + public Set<Artifact> getArtifacts() { + return artifacts; + } + + public void setArtifacts(Set<Artifact> artifacts) { + this.artifacts = artifacts; + } +} +} diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java index 3704960466..4934fa7a3a 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java @@ -2812,6 +2812,10 @@ public class UnifiedCompositionService { } } + String subNodeType = + nestedServiceTemplate.getTopology_template().getSubstitution_mappings().getNode_type(); + nestedNodeTemplate.setType(subNodeType); + } private void handleSubstitutionMappingInNestedServiceTemplate( diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java index 5c0c3952ce..03dd30fd09 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java @@ -40,6 +40,7 @@ import static org.mockito.Mockito.verify; */ public class ConsolidationServiceTest { + /* @Spy private TranslationContext translationContext = new TranslationContext(); private static String mainST = "MainServiceTemplate.yaml"; @@ -2209,4 +2210,6 @@ public class ConsolidationServiceTest { translationContext.getTranslatedServiceTemplates() .put(serviceTemplateFileName, serviceTemplate); } + + */ } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/out/MainServiceTemplate.yaml index 5d30f60616..efa8626f8d 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/out/MainServiceTemplate.yaml @@ -273,7 +273,7 @@ topology_template: network_name: get_input: net_name 4p_nested: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -1032,4 +1032,4 @@ topology_template: name: def affinity: host targets: - - BE_Affinity_group + - BE_Affinity_group
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/out/MainServiceTemplate.yaml index aa05a9e575..cd041a4083 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/out/MainServiceTemplate.yaml @@ -266,7 +266,7 @@ topology_template: security_group_name: group1 net_name: myNetwork 4p_nested: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -938,4 +938,4 @@ topology_template: name: def affinity: host targets: - - BE_Affinity_group + - BE_Affinity_group
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/MainServiceTemplate.yaml index dd024c4607..e26ec620a8 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/MainServiceTemplate.yaml @@ -218,7 +218,7 @@ topology_template: network_name: get_input: net_name 4p_nested: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -844,4 +844,4 @@ topology_template: name: def affinity: host targets: - - BE_Affinity_group + - BE_Affinity_group
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/out/MainServiceTemplate.yaml index f12a9c2d2e..3dacbb2056 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/out/MainServiceTemplate.yaml @@ -1433,7 +1433,7 @@ topology_template: node: abstract_a_single_1a relationship: tosca.relationships.DependsOn 4p_nested_2: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -1566,7 +1566,7 @@ topology_template: network: get_input: ppds_net_name 4p_nested_1: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -1950,4 +1950,4 @@ topology_template: name: def affinity: host targets: - - BE_Affinity_group + - BE_Affinity_group
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/MainServiceTemplate.yaml index ff988d4835..0477fc36c5 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/MainServiceTemplate.yaml @@ -260,7 +260,7 @@ topology_template: node: test_nested_no_compute relationship: tosca.relationships.DependsOn test_nested_pattern_4_main_0: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server_pattern4 directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested1ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested1ServiceTemplate.yaml index 1a7f8816f3..c411944118 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested1ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested1ServiceTemplate.yaml @@ -104,7 +104,7 @@ topology_template: type: string node_templates: test_nested_pattern_4_main_1: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server_pattern4 directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested2ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested2ServiceTemplate.yaml index 9ddecd4527..e7feb50e7b 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested2ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out/nested2ServiceTemplate.yaml @@ -150,7 +150,7 @@ topology_template: node: test_nested3Level relationship: tosca.relationships.DependsOn test_nested_pattern_4_nested2: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server_pattern4 directives: - substitutable properties: @@ -200,7 +200,7 @@ topology_template: node: abstract_ps_server_nested2_1b relationship: tosca.relationships.DependsOn test_nested_pattern_4_same_type_diff_file: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4-same-type + type: org.openecomp.resource.abstract.nodes.heat.pd_server_pattern4_2 directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out/nested2ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out/nested2ServiceTemplate.yaml index ab21e606d2..7983fe32f4 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out/nested2ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out/nested2ServiceTemplate.yaml @@ -89,7 +89,7 @@ topology_template: description: SM Image server node_templates: test_resourceGroup: - type: org.openecomp.resource.abstract.nodes.heat.nested3 + type: org.openecomp.resource.abstract.nodes.heat.cmaui directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/MainServiceTemplate.yaml index 9051c994b6..6d51056e60 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/MainServiceTemplate.yaml @@ -230,7 +230,7 @@ topology_template: - service_template_filter - index_value test_nested_pattern_4: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server directives: - substitutable properties: @@ -279,7 +279,7 @@ topology_template: node: test_nested_pattern_4 relationship: tosca.relationships.DependsOn nested2_pattern_4: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/nested1ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/nested1ServiceTemplate.yaml index abadf775f4..6edd5eb6e4 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/nested1ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out/nested1ServiceTemplate.yaml @@ -216,7 +216,7 @@ topology_template: node: packet_internal_network relationship: tosca.relationships.network.LinksTo nested1_pattern_4: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out/MainServiceTemplate.yaml index edc041bb40..1602a813ba 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out/MainServiceTemplate.yaml @@ -33,7 +33,7 @@ topology_template: node: test_nested_pattern_4 relationship: tosca.relationships.DependsOn test_nested_pattern_4: - type: org.openecomp.resource.abstract.nodes.heat.nested-pattern-4 + type: org.openecomp.resource.abstract.nodes.heat.pd_server directives: - substitutable properties: @@ -107,4 +107,4 @@ topology_template: - dependsOn_network - test_nested_pattern_4 - test_nested_no_compute - - test_nested_all_patterns + - test_nested_all_patterns
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml index 7117003215..f57796a212 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml @@ -55,7 +55,7 @@ topology_template: type: string node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.2 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -92,7 +92,7 @@ topology_template: - pcm_server_names - 0 server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server_1 directives: - substitutable properties: @@ -193,4 +193,4 @@ topology_template: - server_pcm_002 - server_pcm_001 - compute_port_0 - - abstract_compute + - abstract_compute
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml index bd968da3a9..674b1e8d9c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/out/MainServiceTemplate.yaml @@ -999,7 +999,7 @@ topology_template: get_input: vnf_name description: Cinder volume for the second vSON Cluster leader. vson_clm_0: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_4 directives: - substitutable properties: @@ -1063,7 +1063,7 @@ topology_template: node: oam_net_security_group relationship: tosca.relationships.DependsOn vson_mgt_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_from_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_2 directives: - substitutable properties: @@ -1141,7 +1141,7 @@ topology_template: get_input: vson_dbs_volume_name_1 description: Cinder volume for the second vSON DBS VM instance. vson_dbc_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_1 directives: - substitutable properties: @@ -1223,7 +1223,7 @@ topology_template: get_input: vson_dbs_volume_name_0 description: Cinder volume for the first vSON DBS VM instance. vson_clm_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_4 directives: - substitutable properties: @@ -1342,7 +1342,7 @@ topology_template: get_input: vnf_name description: Cinder volume for the second vSON DC leader. vson_mdr_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_from_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_2 directives: - substitutable properties: @@ -1406,7 +1406,7 @@ topology_template: vson_vm_names: - get_input: vson_mdr_name_0 vson_dbs_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_1 directives: - substitutable properties: @@ -1478,7 +1478,7 @@ topology_template: - get_input: vson_dbs_name_0 - get_input: vson_dbs_name_1 vson_app_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol_dual_ip_stack + type: org.openecomp.resource.abstract.nodes.heat.vson_vm directives: - substitutable properties: @@ -1710,7 +1710,7 @@ topology_template: get_input: vson_dbg_volume_name_0 description: vSON DB Global cinder volume. vson_dbg_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_1 directives: - substitutable properties: @@ -1778,7 +1778,7 @@ topology_template: vson_vm_names: - get_input: vson_dbg_name_0 vson_cll_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_1 directives: - substitutable properties: @@ -1867,7 +1867,7 @@ topology_template: get_input: vson_app_volume_name_0 description: vSON APP cinder volume. vson_mon_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_from_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_2 directives: - substitutable properties: @@ -1931,7 +1931,7 @@ topology_template: vson_vm_names: - get_input: vson_mon_name_0 vson_dcl_group: - type: org.openecomp.resource.abstract.nodes.heat.nested_vson_server_with_vol + type: org.openecomp.resource.abstract.nodes.heat.vson_vm_1 directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/out/nested3ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/out/nested3ServiceTemplate.yaml index da2f42610f..f312efdeb2 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/out/nested3ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/out/nested3ServiceTemplate.yaml @@ -61,7 +61,7 @@ topology_template: type: string node_templates: test_nested4Level: - type: org.openecomp.resource.abstract.nodes.heat.nested4 + type: org.openecomp.resource.abstract.nodes.heat.cmaui directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/out/MainServiceTemplate.yaml index 78fe423e5d..52911df941 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/out/MainServiceTemplate.yaml @@ -155,7 +155,7 @@ topology_template: default: oam_protected_net_0 node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -192,7 +192,7 @@ topology_template: - pcm_server_names - 0 server_oam_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-oam_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.oam_server directives: - substitutable properties: @@ -251,7 +251,7 @@ topology_template: oam_net_name: get_input: oam_net_name server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -384,7 +384,7 @@ topology_template: node: server_pcm_002 relationship: org.openecomp.relationships.AttachesTo test_shared_node_connected_in_nested: - type: org.openecomp.resource.abstract.nodes.heat.nested-oam_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.oam_server directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/out/MainServiceTemplate.yaml index e2ad613b15..e44327fa33 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/out/MainServiceTemplate.yaml @@ -145,7 +145,7 @@ topology_template: default: oam_protected_net_0 node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -180,7 +180,7 @@ topology_template: - pcm_server_names - 0 server_oam_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-oam_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.oam_server directives: - substitutable properties: @@ -241,7 +241,7 @@ topology_template: oam_net_name: get_input: oam_net_name server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -395,4 +395,4 @@ topology_template: - server_pcm_001 - packet_mirror_network - compute_port_0 - - abstract_compute + - abstract_compute
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/out/MainServiceTemplate.yaml index 4c0c96f988..e49afcd726 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/out/MainServiceTemplate.yaml @@ -145,7 +145,7 @@ topology_template: default: oam_protected_net_0 node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -182,7 +182,7 @@ topology_template: - pcm_server_names - 0 server_oam_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-oam_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.oam_server directives: - substitutable properties: @@ -243,7 +243,7 @@ topology_template: oam_net_name: get_input: oam_net_name server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/out/MainServiceTemplate.yaml index 2d5a794b7a..0f63982943 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/out/MainServiceTemplate.yaml @@ -121,7 +121,7 @@ topology_template: type: string node_templates: server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -239,4 +239,4 @@ topology_template: members: - server_pcm_001 - packet_mirror_network - - abstract_compute + - abstract_compute
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/out/MainServiceTemplate.yaml index 2378f602c8..6bfb11cba1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/out/MainServiceTemplate.yaml @@ -121,7 +121,7 @@ topology_template: default: oam_protected_net_0 node_templates: server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -260,4 +260,4 @@ topology_template: - server_pcm_001 - packet_mirror_network - compute_port_0 - - abstract_compute + - abstract_compute
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/out/MainServiceTemplate.yaml index 5db374e25b..976be29e67 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/out/MainServiceTemplate.yaml @@ -55,7 +55,7 @@ topology_template: type: string node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.2 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -92,7 +92,7 @@ topology_template: - pcm_server_names - 0 server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server_1 directives: - substitutable properties: @@ -129,7 +129,7 @@ topology_template: - pcm_server_names - 0 server_pcm_003: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.3 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server_2 directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/out/MainServiceTemplate.yaml index b7e3090eb5..2a5f3b77f9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/out/MainServiceTemplate.yaml @@ -55,7 +55,7 @@ topology_template: type: string node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -92,7 +92,7 @@ topology_template: - pcm_server_names - 0 server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -129,7 +129,7 @@ topology_template: - pcm_server_names - 0 server_pcm_003: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.2 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server_2 directives: - substitutable properties: @@ -189,4 +189,4 @@ topology_template: - server_pcm_002 - server_pcm_001 - server_pcm_003 - - compute_port_0 + - compute_port_0
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/out/MainServiceTemplate.yaml index 3f53330a7a..6f0bd1ea94 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/out/MainServiceTemplate.yaml @@ -55,7 +55,7 @@ topology_template: type: string node_templates: server_pcm_002: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -92,7 +92,7 @@ topology_template: - pcm_server_names - 0 server_pcm_001: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: @@ -193,4 +193,4 @@ topology_template: - server_pcm_002 - server_pcm_001 - compute_port_0 - - abstract_compute + - abstract_compute
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/out/MainServiceTemplate.yaml index 86c41415ae..a6938c23d8 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/out/MainServiceTemplate.yaml @@ -420,7 +420,7 @@ topology_template: default: int_mog_csb_net node_templates: server_pcm_003: - type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 + type: org.openecomp.resource.abstract.nodes.heat.pcm_server directives: - substitutable properties: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java index 7cee77c54c..90f9a759a6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java @@ -1,8 +1,6 @@ package org.openecomp.sdc.validation.impl.validators; -import org.openecomp.sdc.validation.Validator; import org.openecomp.core.validation.types.MessageContainer; -import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; import org.openecomp.sdc.validation.util.ValidationTestUtil; import org.testng.Assert; import org.testng.annotations.BeforeClass; @@ -39,13 +37,13 @@ public class ForbiddenResourceGuideLineValidatorTest { @Test public void testFloatingIpResourceType() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(forbiddenResourceGuideLineValidator, - "/org/openecomp/validation/validators/attGuideLineValidator/heatFloatingIpResourceType/positive"); + "/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(forbiddenResourceGuideLineValidator, - "/org/openecomp/validation/validators/attGuideLineValidator/heatFloatingIpResourceType/negative"); + "/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java index 7d994e4f13..5994c23642 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java @@ -18,12 +18,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeNetwork() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeNetwork/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeNetwork/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -34,12 +34,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeNetworkAndVolume() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2); @@ -52,12 +52,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeServerGroup() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeServerGroup/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeServerGroup/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -68,12 +68,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeSecurityGroup() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -84,12 +84,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeVolume() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeVolume/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatDoesNotExposeVolume/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -100,12 +100,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testHeatVolumeExpose() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/heatVolumeExpose/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/heatVolumeExpose/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("firstVol.yaml").getErrorMessageList().size(), 1); @@ -117,13 +117,13 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testResourceIsExposedByCallingGetResourceNotFromOutput() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatExposeResourceUsingGetResource/positive"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/baseHeatExposeResourceUsingGetResource/negative"); + "/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("base_virc.yaml").getErrorMessageList().size(), 1); @@ -134,7 +134,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testMissingBaseHeat() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/missingBaseHeat/"); + "/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().size(), 1); @@ -145,7 +145,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testMultiBaseHeat() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator, - "/org/openecomp/validation/validators/attGuideLineValidator/multiBaseHeat/"); + "/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().size(), 1); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java index 2e61df2b16..7c07da98d7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java @@ -22,7 +22,7 @@ public class ContrailServiceInstanceNamingConventionValidatorTest { public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned"); + "/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -34,7 +34,7 @@ public class ContrailServiceInstanceNamingConventionValidatorTest { public void testContrailServiceInstanceAvailabilityZoneAlignedWithNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned"); + "/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java index 55a3f31b19..1a04d94748 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java @@ -4,7 +4,6 @@ import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; -import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; import org.testng.Assert; import org.testng.annotations.Test; @@ -24,7 +23,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConventionButDifferentVmType() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype"); + "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals( @@ -37,7 +36,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { public void testContrailServiceTemplateImageAndFlavorNamesNotAlignedWithNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned"); + "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2); @@ -51,7 +50,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatcontrailservicetemplateimageandflavor/aligned"); + "/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index 8aedf8219c..8ba5a27c36 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -4,7 +4,6 @@ import org.openecomp.sdc.validation.impl.validators.NamingConventionGuideLineVal import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; -import org.openecomp.sdc.validation.impl.validators.NamingConventionGuideLineValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; import org.testng.Assert; import org.testng.annotations.Test; @@ -24,13 +23,13 @@ public class NeutronPortNamingConventionValidatorTest { public void testHeatPortNetworkNamingConvention() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatPortNetworkNamingConvention/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatPortNetworkNamingConvention/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3); @@ -42,13 +41,13 @@ public class NeutronPortNamingConventionValidatorTest { public void testNeutronFixedIpName() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatPortFixedIpNamingConvention/positive"); + "/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatPortFixedIpNamingConvention/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java index 25b98bb6fb..0284ebcbf2 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java @@ -23,13 +23,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testHeatNovaServerMetaDataValidation() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerMetaDataValidation/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerMetaDataValidation/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -41,13 +41,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testNovaServerAvailabilityZoneName() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerAvailabilityZoneName/positive"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerAvailabilityZoneName/negative"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3); @@ -61,13 +61,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testNovaImageAndFlavorNames() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerImageAndFlavor/positive"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerImageAndFlavor/negative"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2); @@ -81,13 +81,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testNovaResourceNetworkUniqueRole() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -99,13 +99,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testNovaServerName() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerNameValidation/positive"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/heatNovaServerNameValidation/negative/"); + "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2); @@ -117,7 +117,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testVMNameSyncInNova() { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/attGuideLineValidator/novaVMNameSync/input"); + "/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -138,7 +138,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { public void testAvailabilityZoneName() throws IOException { Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), - "/org/openecomp/validation/validators/att_naming_convention/availability_zone_name/input"); + "/org/openecomp/validation/validators/naming_convention/availability_zone_name/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.yaml new file mode 100644 index 0000000000..368834e847 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + SecurityGroup_expose: + type: OS::Neutron::Net + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: ServerGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.yaml new file mode 100644 index 0000000000..08955562d4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + net_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: net_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.yaml new file mode 100644 index 0000000000..f5c6b598cc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/first.yaml @@ -0,0 +1,18 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + net_expose: + type: OS::Neutron::Net + volume_expose: + type: OS::Cinder::Volume + + + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: ServerGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.yaml new file mode 100644 index 0000000000..0c7abd6d49 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/first.yaml @@ -0,0 +1,21 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + net_expose: + type: OS::Neutron::Net + volume_expose: + type: OS::Cinder::Volume + + + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: net_expose } + expose_resource_volume_output: + description: the pcrf_server + value: { get_resource: volume_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.yaml new file mode 100644 index 0000000000..fe5effbc24 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + SecurityGroup_expose: + type: OS::Neutron::SecurityGroup + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: ServerGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.yaml new file mode 100644 index 0000000000..781bcba716 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + SecurityGroup_expose: + type: OS::Neutron::SecurityGroup + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: SecurityGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.yaml new file mode 100644 index 0000000000..5660cc003b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + ServerGroup_expose: + type: OS::Nova::ServerGroup + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: ServerGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.yaml new file mode 100644 index 0000000000..89fafb9d3a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + serverGroup_expose: + type: OS::Nova::ServerGroup + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: serverGroup_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.yaml new file mode 100644 index 0000000000..e2a4301249 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + volume_expose: + type: OS::Cinder::Volume + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: volume_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.yaml new file mode 100644 index 0000000000..63b576edb8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + volume_expose: + type: OS::Cinder::Volume + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/MANIFEST.json new file mode 100644 index 0000000000..31d26cce5a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/MANIFEST.json @@ -0,0 +1,26 @@ +{ + "name": "virc", + "description": "", + "data": [ + { + "file": "base_virc.yaml", + "type": "HEAT", + "isBase": "true", + "data": [ + { + "file": "base_virc.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "nested_virc.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "user_data.sh", + "type": "SHELL" + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.env new file mode 100644 index 0000000000..617084511c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.env @@ -0,0 +1,59 @@ +parameters: + virc_environment: 'CI-VIRC' + virc_version: '1609.0.0.0.64' + virc_version_file: 'version-VIRC_Cloud.json' + vnf_id: vnf_id_placeholder + vnf_name: 'ircc001v' + vf_module_id: vf_module_id_placeholder + vf_module_name: vf_module_name_placeholder + vm_roles: [ + 'vm_role_placeholder_0', + 'vm_role_placeholder_1', + 'vm_role_placeholder_2', + 'vm_role_placeholder_3'] + num_instances: 4 + virc_names: [ + 'irpr0001vm001pfe001p1n004v001', + 'irpr0001vm002pbe001p1n004v001', + 'irpr0001vm003mdb001p1n004v001', + 'irpr0001vm004mdb001p1n004v001'] + virc_image_name: rhel7-with-openecomp-tools + virc_flavor_name: m1.large + virc_ssh_public_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9/ngAeNYJe8p8RvPQC4NSRu1VyWimhMx+6Q0LgD1n/UeTN+Ppn1NA0/CQDR+nX0vOMkfwkw43y3qi1kDfHSNKebxVUix1nyqXUq9n8kjhu+dsKXqiClL2B36XvsrXfkA6SRG8jsWiBgkR+hvcewjqk2pLigdi233F69GHdqKsRJOS4246/VTdXyFZX5V3W0akZ/Oh72aM+UnRb9hp+ZHzIGBHemMipkDHzCAOmWZlNuPGwqBscmMv2KWUj6Rk6b5qFoK4J1x0MjXCS/mKC3H8GsSlGhHZ6odMGEVPT5EkTQEf/ggPPPyUx0+TRv0fPh4793CxZrxo7CvpLAaoUXMH' + availability_zone_0: 'ZoneA' + virc_default_gateway: 127.0.0.1 + virc_domain: atttest.com + virc_dns1: 127.0.0.1 + management_net_name: SRE-Mgt + virc_management_dhcp: no + virc_management_default_route: yes + virc_management_ips: [ + '127.0.0.1', + '127.0.0.1', + '127.0.0.1', + '127.0.0.1'] + data_net_name: data + virc_data_ips: [ + '192.168.1.50', + '192.168.1.51', + '192.168.1.52', + '192.168.1.53'] + virc_data_dhcp: no + virc_data_default_route: no + signaling_net_name: signaling + virc_signaling_ips: [ + '127.0.0.1', + '127.0.0.1', + '127.0.0.1', + '127.0.0.1'] + virc_signaling_dhcp: no + virc_signaling_default_route: no + virc_sg_rules: [ + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "22", "port_range_max": "22", "ethertype": "IPv4" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "5060", "port_range_max": "5060", "ethertype": "IPv4" }, + { "remote_ip_prefix": "::/0", "protocol": "tcp", "port_range_min": "5060", "port_range_max": "5060", "ethertype": "IPv6" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "8080", "port_range_max": "8080", "ethertype": "IPv4" }, + { "remote_ip_prefix": "::/0", "protocol": "tcp", "port_range_min": "8080", "port_range_max": "8080", "ethertype": "IPv6" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "7113", "port_range_max": "7113", "ethertype": "IPv4" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "8113", "port_range_max": "8113", "ethertype": "IPv4" }] + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.yaml new file mode 100644 index 0000000000..7c1afa8ced --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/base_virc.yaml @@ -0,0 +1,143 @@ +heat_template_version: 2015-04-30 + +description: vIRC CC base template + +parameters: + vnf_id: + type: string + description: Unique ID for this VF instance + vnf_name: + type: string + description: Unique name for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF Module instance + vf_module_name: + type: string + description: Unique name for this VF Module instance + vm_roles: + type: comma_delimited_list + description: Unique roles for first group of instances + virc_names: + type: comma_delimited_list + description: List of names of vIRC CC instances in first availability zone + virc_image_name: + type: string + description: Image used for vIRC CC instances + virc_flavor_name: + type: string + description: Flavor of VM to use for vIRC CC instances + virc_ssh_public_key: + type: string + description: Public key for SSH access to vIRC CC instances + availability_zone_0: + type: string + description: First availability zone ID or name + management_net_name: + type: string + description: vIRC CC management network name + virc_management_dhcp: + type: string + description: For static IPs on management port, no. For DHCP assigned IPs, yes. + virc_management_ips: + type: comma_delimited_list + description: vIRC CC management network fixed ips for first availability zone if static + virc_management_netmask: + type: string + description: vIRC CC management netmask + virc_management_gateway: + type: string + description: vIRC CC management gateway + virc_management_default_route: + type: string + description: If management port is default route on OS, yes. If not, no. + data_net_name: + type: string + description: vIRC CC data network name + virc_data_dhcp: + type: string + description: For static IPs on data port, no. For DHCP assigned IPs, yes. + virc_data_ips: + type: comma_delimited_list + description: vIRC CC data network fixed ips for first availability zone if static + virc_data_netmask: + type: string + description: vIRC CC data netmask + virc_data_gateway: + type: string + description: vIRC CC data gateway + virc_data_default_route: + type: string + description: If data port is default route on OS, yes. If not, no. + signaling_net_name: + type: string + description: vIRC CC signaling network name + virc_signaling_dhcp: + type: string + description: For static IPs on data port, no. For DHCP assigned IPs, yes. + virc_signaling_ips: + type: comma_delimited_list + description: vIRC CC signaling network fixed ips for first availability zone if static + virc_signaling_netmask: + type: string + description: vIRC CC signaling netmask + virc_signaling_gateway: + type: string + description: vIRC CC signaling gateway + virc_signaling_default_route: + type: string + description: If signaling port is default route on OS, yes. If not, no. + num_instances: + type: number + description: Number of instances to deploy in first availability zone + constraints: + - range: { min: 0, max: 18} + virc_sg_rules: + type: json + description: vIRC CC security group rules + virc_domain: + type: string + description: Domain of the vIRC CC instances + virc_dns1: + type: string + description: First DNS nameserver for vIRC CC instances + virc_dns2: + type: string + description: Second DNS nameserver for vIRC CC instances + virc_default_gateway: + type: string + description: Default gateway for vIRC CC instances + virc_version: + type: string + description: vIRC CC deployment version + virc_environment: + type: string + description: vIRC CC deployment environment + virc_version_file: + type: string + description: vIRC CC version file name + +resources: + virc_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: VNF_NAME_virc_keypair + params: + VNF_NAME: { get_param: vnf_name } + public_key: { get_param: virc_ssh_public_key } + save_private_key: false + + + virc_RSG: + type: OS::Neutron::SecurityGroup + properties: + name: + str_replace: + template: VNF_NAME_virc_sg + params: + VNF_NAME: { get_param: vnf_name } + rules: { get_param: virc_sg_rules } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/nested_virc.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/nested_virc.yaml new file mode 100644 index 0000000000..f4e34188c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/nested_virc.yaml @@ -0,0 +1,207 @@ +heat_template_version: 2015-04-30 + +description: virc_nested + +parameters: + vnf_id: + type: string + description: Unique ID for this VF instance + vnf_name: + type: string + description: Unique name for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF Module instance + vf_module_name: + type: string + description: Unique name for this VF Module instance + vm_roles: + type: comma_delimited_list + description: Unique roles for this group of instances + virc_names: + type: comma_delimited_list + description: name of virc instances + virc_image_name: + type: string + description: name of virc image + virc_flavor_name: + type: string + description: flavor of instance to use + virc_keypair: + type: string + description: Key pair containing public SSH key for vIRC instances + availability_zone_0: + type: string + description: Availability zone used for this resource group + management_net_name: + type: string + description: virc management network name + virc_management_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_management_ips: + type: comma_delimited_list + description: virc management network fixed ips + virc_management_netmask: + type: string + description: virc management netmask + virc_management_gateway: + type: string + description: virc management gateway + virc_management_default_route: + type: string + description: yes if this default route is that of this nic + data_net_name: + type: string + description: virc data network name + virc_data_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_data_ips: + type: comma_delimited_list + description: virc data network fixed ips + virc_data_netmask: + type: string + description: virc data netmask + virc_data_gateway: + type: string + description: virc data gateway + virc_data_default_route: + type: string + description: yes if this default route is that of this nic + signaling_net_name: + type: string + description: virc signaling network name + virc_signaling_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_signaling_ips: + type: comma_delimited_list + description: virc signaling network fixed ips + virc_signaling_netmask: + type: string + description: virc signaling netmask + virc_signaling_gateway: + type: string + description: virc signaling gateway + virc_signaling_default_route: + type: string + description: yes if this default route is that of this nic + virc_sg: + type: string + description: virc security group + virc_domain: + type: string + description: domain of the virc instance + virc_dns1: + type: string + description: first dns nameserver for virc instance + virc_dns2: + type: string + description: second dns nameserver for virc instance + virc_default_gateway: + type: string + description: default gateway for VM + virc_version: + type: string + description: virc deployment version + virc_environment: + type: string + description: virc deployment environment + virc_version_file: + type: string + description: vIRC CC version file name + index_num: + type: number + description: Current index value of the resource group + constraints: + - range: { min: 0, max: 18 } + +resources: + virc_0: + type: OS::Nova::Server + properties: + name: {get_param: [virc_names, {get_param: index_num}]} + metadata: + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vf_module_id: { get_param: vf_module_id } + vf_module_name: { get_param: vf_module_name } + vm_role: { get_param: [vm_roles, {get_param: index_num}]} + key_name: {get_param: virc_keypair} + image: {get_param: virc_image_name} + flavor: {get_param: virc_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: { get_resource: virc_management_0_port} + - port: { get_resource: virc_data_1_port} + - port: { get_resource: virc_signaling_2_port} + user_data_format: RAW + user_data: + str_replace: + template: {get_file: user_data.sh} + params: + __hostname__: {get_param: [virc_names, {get_param: index_num}]} + __domain__: {get_param: virc_domain} + __dns1__: {get_param: virc_dns1} + __dns2__: {get_param: virc_dns2} + __default_gateway__: {get_param: virc_default_gateway} + __port_mac_0__: {get_attr: [virc_management_0_port, mac_address]} + __port_ip_0__: {get_param: [virc_management_ips, {get_param: index_num}]} + __port_netmask_0__: {get_param: virc_management_netmask} + __port_gateway_0__: {get_param: virc_management_gateway} + __port_def_route_0__: {get_param: virc_management_default_route} + __port_dhcp_0__: {get_param: virc_management_dhcp} + __port_mac_1__: {get_attr: [virc_data_1_port, mac_address]} + __port_ip_1__: {get_param: [virc_data_ips, {get_param: index_num}]} + __port_netmask_1__: {get_param: virc_data_netmask} + __port_gateway_1__: {get_param: virc_data_gateway} + __port_def_route_1__: {get_param: virc_data_default_route} + __port_dhcp_1__: {get_param: virc_data_dhcp} + __port_ip6_1__: {get_param: [virc_data_ips, {get_param: index_num}]} + __port_mac_2__: {get_attr: [virc_signaling_2_port, mac_address]} + __port_ip_2__: {get_param: [virc_signaling_ips, {get_param: index_num}]} + __port_netmask_2__: {get_param: virc_signaling_netmask} + __port_gateway_2__: {get_param: virc_signaling_gateway} + __port_def_route_2__: {get_param: virc_signaling_default_route} + __port_dhcp_2__: {get_param: virc_signaling_dhcp} + __virc_environment__: {get_param: virc_environment} + __virc_version__: {get_param: virc_version} + __virc_version_file__: {get_param: virc_version_file} + + virc_management_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: management_net_name } + fixed_ips: + - ip_address: { get_param: [virc_management_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_data_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: data_net_name } + fixed_ips: + - ip_address: { get_param: [virc_data_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_signaling_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: signaling_net_name } + fixed_ips: + - ip_address: { get_param: [virc_signaling_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_volume: + type: OS::Cinder::Volume + properties: +# name: {get_param: [virc_names, {get_param: index_num}]} + availability_zone: nova +# availability_zone: {get_param: availability_zone_0} + size: 1 + virc_volumeattachment: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: virc_0 } + volume_id: { get_resource: virc_volume } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/user_data.sh b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/user_data.sh new file mode 100644 index 0000000000..1c808d4736 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative/user_data.sh @@ -0,0 +1,285 @@ +#!/bin/bash + +set -x +exec >> /root/user_data.out +exec 2>&1 + +MOUNT_POINT=${1:-'/opt/app/virc'} +LABEL=${2:-'VIRC_DATA'} +DESCRIPTION=${3:-'vIRC data volume'} + +TAG=VIRC_PROVISIONING + +DISK_ID=$(ls -1 /dev/disk/by-id | tail -n1) +DISK_NAME=$(readlink -f /dev/disk/by-id/${DISK_ID}) +FSTYPE=$(lsblk -o FSTYPE -n ${DISK_NAME}) +DISK_LABEL=$(lsblk -o LABEL -n ${DISK_NAME}) + +# Exit with message if not root +[[ $UID -ne 0 ]] && logger -t $TAG "Not root. Exiting." && exit 2 + +# Create filesystem if none +if [[ -z ${FSTYPE} ]] ; then + mkfs.xfs ${DISK_NAME} + if [[ $? -eq 0 ]] ; then + logger -t $TAG "Created xfs filesystem on $DISK_NAME." + else + logger -t $TAG "ERROR: Could not create xfs on $DISK_NAME. Exiting." + exit 90 + fi +fi +sleep 0.5 +DISK_UUID=$(lsblk -no UUID ${DISK_NAME}) + +# Create label if none +[[ -z ${DISK_LABEL} ]] && xfs_admin -L ${LABEL} ${DISK_NAME} + +# Create mount point if it does not exist +if [[ ! -d ${MOUNT_POINT} ]] ; then + mkdir -p ${MOUNT_POINT} + if [[ $? -eq 0 ]] ; then + logger -t $TAG "Created mount point at $MOUNT_POINT." + else + logger -t $TAG "ERROR: Could not create mount point at $MOUNT_POINT. Exiting" + exit 80 + fi +fi + +# Only add to /etc/fstab if not already there +grep -q ${DISK_UUID} /etc/fstab +if [[ $? -ne 0 ]] ; then + echo "# Following mount for ${DESCRIPTION}" >> /etc/fstab + echo "UUID=${DISK_UUID} ${MOUNT_POINT} xfs defaults 0 0" >> /etc/fstab + mount -a + mount_check_1=$? + mount | grep ${DISK_NAME} | grep ${MOUNT_POINT} + mount_check_2=$? + if [[ ${mount_check_1} -eq 0 ]] && [[ ${mount_check_2} -eq 0 ]]; then + logger -t $TAG "Successfully mounted $DISK_NAME at $MOUNT_POINT." + else + logger -t $TAG "ERROR: Could not mount $DISK_NAME at $MOUNT_POINT. Exiting." + exit 70 + fi +fi + +### +### Configure network +### + +hostname='__hostname__' +domain='__domain__' +dns1='__dns1__' +dns2='__dns2__' +default_gateway='__default_gateway__' + +# 1 disable, 0 enable +ipv6_enable=1 + +port_mac[0]='__port_mac_0__' +port_ip[0]='__port_ip_0__' +port_netmask[0]='__port_netmask_0__' +port_gateway[0]='__port_gateway_0__' +port_def_route[0]='__port_def_route_0__' +port_dhcp[0]='__port_dhcp_0__' + +port_mac[1]='__port_mac_1__' +port_ip[1]='__port_ip_1__' +port_netmask[1]='__port_netmask_1__' +port_gateway[1]='__port_gateway_1__' +port_def_route[1]='__port_def_route_1__' +port_dhcp[1]='__port_dhcp_1__' + +port_mac[2]='__port_mac_2__' +port_ip[2]='__port_ip_2__' +port_netmask[2]='__port_netmask_2__' +port_gateway[2]='__port_gateway_2__' +port_def_route[2]='__port_def_route_2__' +port_dhcp[2]='__port_dhcp_2__' + +# function to add underscore +add_underscore(){ + echo "__${1}__" +} + +# filenames +net_scripts=/etc/sysconfig/network-scripts + +# update network scripts with static ips and gateways +nic_count=($(ls -1d /sys/class/net/eth* | wc -l)) +for i in {0..2} ; do + if [[ ${port_mac[i]} != "__port_mac_${i}__" && \ + ( ${port_ip[i]} != "__port_ip_${i}__" || ${port_dhcp[i]} != "__port_dhcp_${i}__" ) ]] ; then + for (( j=0 ; j<${nic_count} ; j++ )) ; do + nic_mac=$(cat /sys/class/net/eth${j}/address) + if [[ ${port_mac[i]} == ${nic_mac} ]] ; then + echo "NAME=eth${j}" > ${net_scripts}/ifcfg-eth${j} + echo "DEVICE=eth${j}" >> ${net_scripts}/ifcfg-eth${j} + if [[ ${port_dhcp[i]} =~ (yes|Yes|True|true) ]] ; then + echo "BOOTPROTO=dhcp" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_ip[i]} != "__port_ip_${i}__" ]] && [[ ${port_ip[i]} =~ .*:.* ]] ; then + [[ ${ipv6_enable} -eq 1 ]] && ipv6_enable=0 + echo "BOOTPROTO=none" >> ${net_scripts}/ifcfg-eth${j} + echo "IPV6INIT=yes" >> ${net_scripts}/ifcfg-eth${j} + echo "IPV6ADDR=${port_ip[i]}" >> ${net_scripts}/ifcfg-eth${j} + if [[ ${port_gateway[i]} != "__port_gateway_${i}__" ]] ; then + echo "IPV6_DEFAULTGW=${port_gateway[i]}" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_gateway[i]} == $(add_underscore 'port_gateway_0') ]] && [[ ${default_gateway} != $(add_underscore 'default_gateway') ]] ; then + echo "IPV6_DEFAULTGW=${default_gateway}" >> ${net_scripts}/ifcfg-eth${j} + fi + elif [[ ${port_ip[i]} != "__port_ip_${i}__" ]] ; then + echo "BOOTPROTO=none" >> ${net_scripts}/ifcfg-eth${j} + echo "IPADDR=${port_ip[i]}" >> ${net_scripts}/ifcfg-eth${j} + # Set gateway if provided. If not set, set eth0 to default + if [[ ${port_gateway[i]} != "__port_gateway_${i}__" ]] ; then + echo "GATEWAY=${port_gateway[i]}" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_gateway[i]} == $(add_underscore 'port_gateway_0') ]] && [[ ${default_gateway} != $(add_underscore 'default_gateway') ]] ; then + echo "GATEWAY=${default_gateway}" >> ${net_scripts}/ifcfg-eth${j} + fi + # Set netmask if provided. Else set netmask to 255.255.255.0 + if [[ ${port_netmask[i]} != "__port_netmask_${i}__" ]] ; then + echo "NETMASK=${port_netmask[i]}" >> ${net_scripts}/ifcfg-eth${j} + else + echo 'NETMASK=255.255.255.0' >> ${net_scripts}/ifcfg-eth${j} + fi + fi + echo "ONBOOT=yes" >> ${net_scripts}/ifcfg-eth${j} + echo "HWADDR=${nic_mac}" >> ${net_scripts}/ifcfg-eth${j} + # Set to DEFROUTE to no, unless otherwise stated. If not stated set to yes on eth0 + if [[ ${port_def_route[i]} =~ (yes|Yes|True|true) ]] ; then + echo "DEFROUTE=yes" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_def_route[i]} == $(add_underscore 'port_def_route_0') ]] ; then + echo "DEFROUTE=yes" >> ${net_scripts}/ifcfg-eth${j} + else + echo "DEFROUTE=no" >> ${net_scripts}/ifcfg-eth${j} + fi + fi + done + fi +done + +# Set DNS +if [[ ${dns1} != $(add_underscore 'dns1') ]] ; then + echo "PEERDNS=yes" >> ${net_scripts}/ifcfg-eth0 + echo "DNS1=${dns1}" >> ${net_scripts}/ifcfg-eth0 + [[ ${dns2} != $(add_underscore 'dns2') ]] && echo "DNS2=${dns2}" >> ${net_scripts}/ifcfg-eth0 +fi +# Set default gateway +[[ ${default_gateway} != $(add_underscore 'default_gateway') ]] && echo GATEWAY=${default_gateway} >> ${net_scripts}/ifcfg-eth0 +# Set domain +if [[ ${domain} != $(add_underscore 'domain') ]] ; then + echo DOMAIN=${domain} >> ${net_scripts}/ifcfg-eth0 + echo kernel.domainname=${domain} >> /etc/sysctl.conf + sysctl -p +fi +# Set hostname +if [[ ${hostname} != $(add_underscore 'hostname') ]] ; then + hostnamectl set-hostname ${hostname} + sed -i "s/\(^127\.0\.0\.1 .*\)/\1 ${hostname}/" /etc/hosts + sed -i "s/\(^::1 .*\)/\1 ${hostname}/" /etc/hosts + sed -i "s/\(^127\.0\.0\.1 .*\)/\1 ${hostname}.${domain}/" /etc/hosts + sed -i "s/\(^::1 .*\)/\1 ${hostname}.${domain}/" /etc/hosts +fi + +# Enable ipv6 if there is an ipv6 address supplied in env +if [[ ${ipv6_enable} -eq 0 ]] ; then + echo net.ipv6.conf.all.disable_ipv6 = 0 >> /etc/sysctl.conf + echo net.ipv6.conf.default.disable_ipv6 = 0 >> /etc/sysctl.conf + echo net.ipv6.conf.lo.disable_ipv6 = 0 >> /etc/sysctl.conf + sysctl -p +fi + +service network restart + +## Disable Password Login for MechID group +echo "Match Group mechid" >> /etc/ssh/sshd_config +echo -e "\tPasswordAuthentication no" >> /etc/ssh/sshd_config +systemctl restart sshd + +### +# Install SWM +### + +## SWM variables +virc_cc_environment='__virc_cc_environment__' +virc_cc_version='__virc_cc_version__' +virc_cc_version_file='__virc_cc_version_file__' + + +## Add MechID user +mechid_user_name=$(grep 'SWM_AUTOUSER=' /tmp/input.env | cut -f 2 -d '=') +useradd -g mechid -p 'pahfhrkSZmUs.' ${mechid_user_name} + +### Workaround ### REMOVE WHEN BUG FIXED ### +#mkdir -p /etc/chef/trusted_certs/ + +# Get packages to install from input.env, then delete from input.env +. /tmp/input.env +swm_install_pkgs=(${SWM_INIT_PACKAGES}) +swm_install_pkg_deps=(${SWM_INIT_PACKAGE_DEPS}) +sed -i '/SWM_INIT_PACKAGES="/,/\"/d' /tmp/input.env + +./platform-init-1.5.5.sh /tmp/input.env + +## Install SWM packages after SWM installation +export AFTSWM_USERNAME=${mechid_user_name} +mechid_user_enc_passwd=$(grep 'SWM_AUTOCRED=' /tmp/input.env | cut -f 2 -d '=') +export AFTSWM_PASSWORD=${mechid_user_enc_passwd} +export HOSTNAME=$(hostname) +#export HOME=/root + +#/opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${swm_install_pkgs} -n $(hostname).$(domainname) -w -fi -fs +#sleep 5 +#cd +echo $SHELL +whoami +env +pwd + +# install swm packages one at a time +for package in ${swm_install_pkg_deps[@]} ; do + /opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${package} -n $(hostname).$(domainname) -w -fi +done + +for package in ${swm_install_pkgs[@]} ; do + /opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${package} -n $(hostname).$(domainname) -w -fi +done + +### Run Chef Prep Scripts ### +USER=${mechid_user_name} +COOKBOOK_NAME='virc_cc' +VERSION=${virc_cc_version} +ENV=${virc_cc_environment} +VERSION_FILE=${virc_cc_version_file} + +COOKBOOK_VERSION="" + +for v in $(echo ${VERSION} | tr "." "\n") +do + if [ "$v" -ge 0 -a "$v" -le 9 ]; then + COOKBOOK_VERSION=${COOKBOOK_VERSION}0$v + else + COOKBOOK_VERSION=${COOKBOOK_VERSION}$v + fi +done + +COOKBOOK_VERSION="${COOKBOOK_VERSION:0:4}.1${COOKBOOK_VERSION:4:4}.1${COOKBOOK_VERSION:8:4}" + +#cd /home/$USER/chef-repo +mkdir -p /home/$USER/scripts/$ENV +chown -R ${mechid_user_name}:mechid /home/$USER + +chef_config_path="/home/${mechid_user_name}/chef-repo/.chef/knife.rb" + +su - -c "/usr/bin/knife client delete $(hostname).$(domainname) -y -c ${chef_config_path}" ${mechid_user_name} +su - -c "/usr/bin/knife node delete $(hostname).$(domainname) -y -c ${chef_config_path}" ${mechid_user_name} + +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files Pyswm.py -c ${chef_config_path} > /home/${mechid_user_name}/scripts/$ENV/Pyswm.py" ${mechid_user_name} +#/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files Pyswm.pyc > /home/$USER/scripts/$ENV/Pyswm.pyc +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files install_swm.py -c ${chef_config_path} > /home/$USER/scripts/$ENV/install_swm.py" ${mechid_user_name} +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files swm-installer-config.json -c ${chef_config_path} > /home/$USER/scripts/$ENV/swm-installer-config.json" ${mechid_user_name} + +#cd /home/$USER/scripts/$ENV +su - -c "chmod 755 /home/$USER/scripts/$ENV/install_swm.py" ${mechid_user_name} +su - -c "cd /home/$USER/scripts/$ENV; ./install_swm.py $VERSION $ENV --components-nodes=\"vIRC-cc:$(hostname).$(domainname)\" --version-file=${VERSION_FILE}" ${mechid_user_name} +#./install_swm.py $VERSION $ENV --components-nodes="<<<ComponentName.FQDN>>>" + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/MANIFEST.json new file mode 100644 index 0000000000..31d26cce5a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/MANIFEST.json @@ -0,0 +1,26 @@ +{ + "name": "virc", + "description": "", + "data": [ + { + "file": "base_virc.yaml", + "type": "HEAT", + "isBase": "true", + "data": [ + { + "file": "base_virc.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "nested_virc.yaml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "user_data.sh", + "type": "SHELL" + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.env new file mode 100644 index 0000000000..617084511c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.env @@ -0,0 +1,59 @@ +parameters: + virc_environment: 'CI-VIRC' + virc_version: '1609.0.0.0.64' + virc_version_file: 'version-VIRC_Cloud.json' + vnf_id: vnf_id_placeholder + vnf_name: 'ircc001v' + vf_module_id: vf_module_id_placeholder + vf_module_name: vf_module_name_placeholder + vm_roles: [ + 'vm_role_placeholder_0', + 'vm_role_placeholder_1', + 'vm_role_placeholder_2', + 'vm_role_placeholder_3'] + num_instances: 4 + virc_names: [ + 'irpr0001vm001pfe001p1n004v001', + 'irpr0001vm002pbe001p1n004v001', + 'irpr0001vm003mdb001p1n004v001', + 'irpr0001vm004mdb001p1n004v001'] + virc_image_name: rhel7-with-openecomp-tools + virc_flavor_name: m1.large + virc_ssh_public_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9/ngAeNYJe8p8RvPQC4NSRu1VyWimhMx+6Q0LgD1n/UeTN+Ppn1NA0/CQDR+nX0vOMkfwkw43y3qi1kDfHSNKebxVUix1nyqXUq9n8kjhu+dsKXqiClL2B36XvsrXfkA6SRG8jsWiBgkR+hvcewjqk2pLigdi233F69GHdqKsRJOS4246/VTdXyFZX5V3W0akZ/Oh72aM+UnRb9hp+ZHzIGBHemMipkDHzCAOmWZlNuPGwqBscmMv2KWUj6Rk6b5qFoK4J1x0MjXCS/mKC3H8GsSlGhHZ6odMGEVPT5EkTQEf/ggPPPyUx0+TRv0fPh4793CxZrxo7CvpLAaoUXMH' + availability_zone_0: 'ZoneA' + virc_default_gateway: 127.0.0.1 + virc_domain: atttest.com + virc_dns1: 127.0.0.1 + management_net_name: SRE-Mgt + virc_management_dhcp: no + virc_management_default_route: yes + virc_management_ips: [ + '127.0.0.1', + '127.0.0.1', + '127.0.0.1', + '127.0.0.1'] + data_net_name: data + virc_data_ips: [ + '192.168.1.50', + '192.168.1.51', + '192.168.1.52', + '192.168.1.53'] + virc_data_dhcp: no + virc_data_default_route: no + signaling_net_name: signaling + virc_signaling_ips: [ + '127.0.0.1', + '127.0.0.1', + '127.0.0.1', + '127.0.0.1'] + virc_signaling_dhcp: no + virc_signaling_default_route: no + virc_sg_rules: [ + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "22", "port_range_max": "22", "ethertype": "IPv4" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "5060", "port_range_max": "5060", "ethertype": "IPv4" }, + { "remote_ip_prefix": "::/0", "protocol": "tcp", "port_range_min": "5060", "port_range_max": "5060", "ethertype": "IPv6" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "8080", "port_range_max": "8080", "ethertype": "IPv4" }, + { "remote_ip_prefix": "::/0", "protocol": "tcp", "port_range_min": "8080", "port_range_max": "8080", "ethertype": "IPv6" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "7113", "port_range_max": "7113", "ethertype": "IPv4" }, + { "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "port_range_min": "8113", "port_range_max": "8113", "ethertype": "IPv4" }] + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.yaml new file mode 100644 index 0000000000..e0e8df50fc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/base_virc.yaml @@ -0,0 +1,188 @@ +heat_template_version: 2015-04-30 + +description: vIRC CC base template + +parameters: + vnf_id: + type: string + description: Unique ID for this VF instance + vnf_name: + type: string + description: Unique name for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF Module instance + vf_module_name: + type: string + description: Unique name for this VF Module instance + vm_roles: + type: comma_delimited_list + description: Unique roles for first group of instances + virc_names: + type: comma_delimited_list + description: List of names of vIRC CC instances in first availability zone + virc_image_name: + type: string + description: Image used for vIRC CC instances + virc_flavor_name: + type: string + description: Flavor of VM to use for vIRC CC instances + virc_ssh_public_key: + type: string + description: Public key for SSH access to vIRC CC instances + availability_zone_0: + type: string + description: First availability zone ID or name + management_net_name: + type: string + description: vIRC CC management network name + virc_management_dhcp: + type: string + description: For static IPs on management port, no. For DHCP assigned IPs, yes. + virc_management_ips: + type: comma_delimited_list + description: vIRC CC management network fixed ips for first availability zone if static + virc_management_netmask: + type: string + description: vIRC CC management netmask + virc_management_gateway: + type: string + description: vIRC CC management gateway + virc_management_default_route: + type: string + description: If management port is default route on OS, yes. If not, no. + data_net_name: + type: string + description: vIRC CC data network name + virc_data_dhcp: + type: string + description: For static IPs on data port, no. For DHCP assigned IPs, yes. + virc_data_ips: + type: comma_delimited_list + description: vIRC CC data network fixed ips for first availability zone if static + virc_data_netmask: + type: string + description: vIRC CC data netmask + virc_data_gateway: + type: string + description: vIRC CC data gateway + virc_data_default_route: + type: string + description: If data port is default route on OS, yes. If not, no. + signaling_net_name: + type: string + description: vIRC CC signaling network name + virc_signaling_dhcp: + type: string + description: For static IPs on data port, no. For DHCP assigned IPs, yes. + virc_signaling_ips: + type: comma_delimited_list + description: vIRC CC signaling network fixed ips for first availability zone if static + virc_signaling_netmask: + type: string + description: vIRC CC signaling netmask + virc_signaling_gateway: + type: string + description: vIRC CC signaling gateway + virc_signaling_default_route: + type: string + description: If signaling port is default route on OS, yes. If not, no. + num_instances: + type: number + description: Number of instances to deploy in first availability zone + constraints: + - range: { min: 0, max: 18} + virc_sg_rules: + type: json + description: vIRC CC security group rules + virc_domain: + type: string + description: Domain of the vIRC CC instances + virc_dns1: + type: string + description: First DNS nameserver for vIRC CC instances + virc_dns2: + type: string + description: Second DNS nameserver for vIRC CC instances + virc_default_gateway: + type: string + description: Default gateway for vIRC CC instances + virc_version: + type: string + description: vIRC CC deployment version + virc_environment: + type: string + description: vIRC CC deployment environment + virc_version_file: + type: string + description: vIRC CC version file name + +resources: + virc_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: VNF_NAME_virc_keypair + params: + VNF_NAME: { get_param: vnf_name } + public_key: { get_param: virc_ssh_public_key } + save_private_key: false + + virc_RSG: + type: OS::Neutron::SecurityGroup + properties: + name: + str_replace: + template: VNF_NAME_virc_sg + params: + VNF_NAME: { get_param: vnf_name } + rules: { get_param: virc_sg_rules } + + virc_RRG_0: + type: OS::Heat::ResourceGroup + properties: + count: { get_param: num_instances } + index_var: server_count + resource_def: + type: nested_virc.yaml + properties: + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vf_module_id: { get_param: vf_module_id } + vf_module_name: { get_param: vf_module_name } + vm_roles: { get_param: vm_roles } + virc_environment: { get_param: virc_environment } + virc_version: { get_param: virc_version } + virc_version_file: { get_param: virc_version_file } + virc_names: { get_param: virc_names } + virc_image_name: { get_param: virc_image_name } + virc_flavor_name: { get_param: virc_flavor_name } + availability_zone_0: { get_param: availability_zone_0 } + virc_keypair: { get_resource: virc_keypair } + management_net_name: { get_param: management_net_name } + virc_management_dhcp: { get_param: virc_management_dhcp } + virc_management_ips: { get_param: virc_management_ips } + virc_management_netmask: { get_param: virc_management_netmask } + virc_management_gateway: { get_param: virc_management_gateway } + virc_management_default_route: { get_param: virc_management_default_route } + data_net_name: { get_param: data_net_name } + virc_data_dhcp: { get_param: virc_data_dhcp } + virc_data_ips: { get_param: virc_data_ips } + virc_data_netmask: { get_param: virc_data_netmask } + virc_data_gateway: { get_param: virc_data_gateway } + virc_data_default_route: { get_param: virc_data_default_route } + signaling_net_name: { get_param: signaling_net_name } + virc_signaling_ips: { get_param: virc_signaling_ips } + virc_signaling_dhcp: { get_param: virc_signaling_dhcp } + virc_signaling_netmask: { get_param: virc_signaling_netmask } + virc_signaling_gateway: { get_param: virc_signaling_gateway } + virc_signaling_default_route: { get_param: virc_signaling_default_route } + virc_domain: { get_param: virc_domain } + virc_dns1: { get_param: virc_dns1 } + virc_dns2: { get_param: virc_dns2 } + virc_default_gateway: { get_param: virc_default_gateway } + virc_sg: { get_resource: virc_RSG } + index_num: server_count + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/nested_virc.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/nested_virc.yaml new file mode 100644 index 0000000000..f4e34188c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/nested_virc.yaml @@ -0,0 +1,207 @@ +heat_template_version: 2015-04-30 + +description: virc_nested + +parameters: + vnf_id: + type: string + description: Unique ID for this VF instance + vnf_name: + type: string + description: Unique name for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF Module instance + vf_module_name: + type: string + description: Unique name for this VF Module instance + vm_roles: + type: comma_delimited_list + description: Unique roles for this group of instances + virc_names: + type: comma_delimited_list + description: name of virc instances + virc_image_name: + type: string + description: name of virc image + virc_flavor_name: + type: string + description: flavor of instance to use + virc_keypair: + type: string + description: Key pair containing public SSH key for vIRC instances + availability_zone_0: + type: string + description: Availability zone used for this resource group + management_net_name: + type: string + description: virc management network name + virc_management_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_management_ips: + type: comma_delimited_list + description: virc management network fixed ips + virc_management_netmask: + type: string + description: virc management netmask + virc_management_gateway: + type: string + description: virc management gateway + virc_management_default_route: + type: string + description: yes if this default route is that of this nic + data_net_name: + type: string + description: virc data network name + virc_data_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_data_ips: + type: comma_delimited_list + description: virc data network fixed ips + virc_data_netmask: + type: string + description: virc data netmask + virc_data_gateway: + type: string + description: virc data gateway + virc_data_default_route: + type: string + description: yes if this default route is that of this nic + signaling_net_name: + type: string + description: virc signaling network name + virc_signaling_dhcp: + type: string + description: yes if port configured by dhcp, otherwise no + virc_signaling_ips: + type: comma_delimited_list + description: virc signaling network fixed ips + virc_signaling_netmask: + type: string + description: virc signaling netmask + virc_signaling_gateway: + type: string + description: virc signaling gateway + virc_signaling_default_route: + type: string + description: yes if this default route is that of this nic + virc_sg: + type: string + description: virc security group + virc_domain: + type: string + description: domain of the virc instance + virc_dns1: + type: string + description: first dns nameserver for virc instance + virc_dns2: + type: string + description: second dns nameserver for virc instance + virc_default_gateway: + type: string + description: default gateway for VM + virc_version: + type: string + description: virc deployment version + virc_environment: + type: string + description: virc deployment environment + virc_version_file: + type: string + description: vIRC CC version file name + index_num: + type: number + description: Current index value of the resource group + constraints: + - range: { min: 0, max: 18 } + +resources: + virc_0: + type: OS::Nova::Server + properties: + name: {get_param: [virc_names, {get_param: index_num}]} + metadata: + vnf_id: { get_param: vnf_id } + vnf_name: { get_param: vnf_name } + vf_module_id: { get_param: vf_module_id } + vf_module_name: { get_param: vf_module_name } + vm_role: { get_param: [vm_roles, {get_param: index_num}]} + key_name: {get_param: virc_keypair} + image: {get_param: virc_image_name} + flavor: {get_param: virc_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: { get_resource: virc_management_0_port} + - port: { get_resource: virc_data_1_port} + - port: { get_resource: virc_signaling_2_port} + user_data_format: RAW + user_data: + str_replace: + template: {get_file: user_data.sh} + params: + __hostname__: {get_param: [virc_names, {get_param: index_num}]} + __domain__: {get_param: virc_domain} + __dns1__: {get_param: virc_dns1} + __dns2__: {get_param: virc_dns2} + __default_gateway__: {get_param: virc_default_gateway} + __port_mac_0__: {get_attr: [virc_management_0_port, mac_address]} + __port_ip_0__: {get_param: [virc_management_ips, {get_param: index_num}]} + __port_netmask_0__: {get_param: virc_management_netmask} + __port_gateway_0__: {get_param: virc_management_gateway} + __port_def_route_0__: {get_param: virc_management_default_route} + __port_dhcp_0__: {get_param: virc_management_dhcp} + __port_mac_1__: {get_attr: [virc_data_1_port, mac_address]} + __port_ip_1__: {get_param: [virc_data_ips, {get_param: index_num}]} + __port_netmask_1__: {get_param: virc_data_netmask} + __port_gateway_1__: {get_param: virc_data_gateway} + __port_def_route_1__: {get_param: virc_data_default_route} + __port_dhcp_1__: {get_param: virc_data_dhcp} + __port_ip6_1__: {get_param: [virc_data_ips, {get_param: index_num}]} + __port_mac_2__: {get_attr: [virc_signaling_2_port, mac_address]} + __port_ip_2__: {get_param: [virc_signaling_ips, {get_param: index_num}]} + __port_netmask_2__: {get_param: virc_signaling_netmask} + __port_gateway_2__: {get_param: virc_signaling_gateway} + __port_def_route_2__: {get_param: virc_signaling_default_route} + __port_dhcp_2__: {get_param: virc_signaling_dhcp} + __virc_environment__: {get_param: virc_environment} + __virc_version__: {get_param: virc_version} + __virc_version_file__: {get_param: virc_version_file} + + virc_management_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: management_net_name } + fixed_ips: + - ip_address: { get_param: [virc_management_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_data_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: data_net_name } + fixed_ips: + - ip_address: { get_param: [virc_data_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_signaling_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: signaling_net_name } + fixed_ips: + - ip_address: { get_param: [virc_signaling_ips, {get_param: index_num}]} + security_groups: + - { get_param: virc_sg } + virc_volume: + type: OS::Cinder::Volume + properties: +# name: {get_param: [virc_names, {get_param: index_num}]} + availability_zone: nova +# availability_zone: {get_param: availability_zone_0} + size: 1 + virc_volumeattachment: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: virc_0 } + volume_id: { get_resource: virc_volume } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/user_data.sh b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/user_data.sh new file mode 100644 index 0000000000..6510c728e8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive/user_data.sh @@ -0,0 +1,292 @@ +#!/bin/bash + +set -x +exec >> /root/user_data.out +exec 2>&1 + +MOUNT_POINT=${1:-'/opt/app/virc'} +LABEL=${2:-'VIRC_DATA'} +DESCRIPTION=${3:-'vIRC data volume'} + +TAG=VIRC_PROVISIONING + +DISK_ID=$(ls -1 /dev/disk/by-id | tail -n1) +DISK_NAME=$(readlink -f /dev/disk/by-id/${DISK_ID}) +FSTYPE=$(lsblk -o FSTYPE -n ${DISK_NAME}) +DISK_LABEL=$(lsblk -o LABEL -n ${DISK_NAME}) + +# Exit with message if not root +[[ $UID -ne 0 ]] && logger -t $TAG "Not root. Exiting." && exit 2 + +# Create filesystem if none +if [[ -z ${FSTYPE} ]] ; then + mkfs.xfs ${DISK_NAME} + if [[ $? -eq 0 ]] ; then + logger -t $TAG "Created xfs filesystem on $DISK_NAME." + else + logger -t $TAG "ERROR: Could not create xfs on $DISK_NAME. Exiting." + exit 90 + fi +fi +sleep 0.5 +DISK_UUID=$(lsblk -no UUID ${DISK_NAME}) + +# Create label if none +[[ -z ${DISK_LABEL} ]] && xfs_admin -L ${LABEL} ${DISK_NAME} + +# Create mount point if it does not exist +if [[ ! -d ${MOUNT_POINT} ]] ; then + mkdir -p ${MOUNT_POINT} + if [[ $? -eq 0 ]] ; then + logger -t $TAG "Created mount point at $MOUNT_POINT." + else + logger -t $TAG "ERROR: Could not create mount point at $MOUNT_POINT. Exiting" + exit 80 + fi +fi + +# Only add to /etc/fstab if not already there +grep -q ${DISK_UUID} /etc/fstab +if [[ $? -ne 0 ]] ; then + echo "# Following mount for ${DESCRIPTION}" >> /etc/fstab + echo "UUID=${DISK_UUID} ${MOUNT_POINT} xfs defaults 0 0" >> /etc/fstab + mount -a + mount_check_1=$? + mount | grep ${DISK_NAME} | grep ${MOUNT_POINT} + mount_check_2=$? + if [[ ${mount_check_1} -eq 0 ]] && [[ ${mount_check_2} -eq 0 ]]; then + logger -t $TAG "Successfully mounted $DISK_NAME at $MOUNT_POINT." + else + logger -t $TAG "ERROR: Could not mount $DISK_NAME at $MOUNT_POINT. Exiting." + exit 70 + fi +fi + +### +### Configure network +### + +hostname='__hostname__' +domain='__domain__' +dns1='__dns1__' +dns2='__dns2__' +default_gateway='__default_gateway__' + +# 1 disable, 0 enable +ipv6_enable=1 + +port_mac[0]='__port_mac_0__' +port_ip[0]='__port_ip_0__' +port_netmask[0]='__port_netmask_0__' +port_gateway[0]='__port_gateway_0__' +port_def_route[0]='__port_def_route_0__' +port_dhcp[0]='__port_dhcp_0__' + +port_mac[1]='__port_mac_1__' +port_ip[1]='__port_ip_1__' +port_netmask[1]='__port_netmask_1__' +port_gateway[1]='__port_gateway_1__' +port_def_route[1]='__port_def_route_1__' +port_dhcp[1]='__port_dhcp_1__' + +port_mac[2]='__port_mac_2__' +port_ip[2]='__port_ip_2__' +port_netmask[2]='__port_netmask_2__' +port_gateway[2]='__port_gateway_2__' +port_def_route[2]='__port_def_route_2__' +port_dhcp[2]='__port_dhcp_2__' + +# function to add underscore +add_underscore(){ + echo "__${1}__" +} + +# filenames +net_scripts=/etc/sysconfig/network-scripts + +# update network scripts with static ips and gateways +nic_count=($(ls -1d /sys/class/net/eth* | wc -l)) +for i in {0..2} ; do + if [[ ${port_mac[i]} != "__port_mac_${i}__" && \ + ( ${port_ip[i]} != "__port_ip_${i}__" || ${port_dhcp[i]} != "__port_dhcp_${i}__" ) ]] ; then + for (( j=0 ; j<${nic_count} ; j++ )) ; do + nic_mac=$(cat /sys/class/net/eth${j}/address) + if [[ ${port_mac[i]} == ${nic_mac} ]] ; then + echo "NAME=eth${j}" > ${net_scripts}/ifcfg-eth${j} + echo "DEVICE=eth${j}" >> ${net_scripts}/ifcfg-eth${j} + if [[ ${port_dhcp[i]} =~ (yes|Yes|True|true) ]] ; then + echo "BOOTPROTO=dhcp" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_ip[i]} != "__port_ip_${i}__" ]] && [[ ${port_ip[i]} =~ .*:.* ]] ; then + [[ ${ipv6_enable} -eq 1 ]] && ipv6_enable=0 + echo "BOOTPROTO=none" >> ${net_scripts}/ifcfg-eth${j} + echo "IPV6INIT=yes" >> ${net_scripts}/ifcfg-eth${j} + echo "IPV6ADDR=${port_ip[i]}" >> ${net_scripts}/ifcfg-eth${j} + if [[ ${port_gateway[i]} != "__port_gateway_${i}__" ]] ; then + echo "IPV6_DEFAULTGW=${port_gateway[i]}" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_gateway[i]} == $(add_underscore 'port_gateway_0') ]] && [[ ${default_gateway} != $(add_underscore 'default_gateway') ]] ; then + echo "IPV6_DEFAULTGW=${default_gateway}" >> ${net_scripts}/ifcfg-eth${j} + fi + elif [[ ${port_ip[i]} != "__port_ip_${i}__" ]] ; then + echo "BOOTPROTO=none" >> ${net_scripts}/ifcfg-eth${j} + echo "IPADDR=${port_ip[i]}" >> ${net_scripts}/ifcfg-eth${j} + # Set gateway if provided. If not set, set eth0 to default + if [[ ${port_gateway[i]} != "__port_gateway_${i}__" ]] ; then + echo "GATEWAY=${port_gateway[i]}" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_gateway[i]} == $(add_underscore 'port_gateway_0') ]] && [[ ${default_gateway} != $(add_underscore 'default_gateway') ]] ; then + echo "GATEWAY=${default_gateway}" >> ${net_scripts}/ifcfg-eth${j} + fi + # Set netmask if provided. Else set netmask to 255.255.255.0 + if [[ ${port_netmask[i]} != "__port_netmask_${i}__" ]] ; then + echo "NETMASK=${port_netmask[i]}" >> ${net_scripts}/ifcfg-eth${j} + else + echo 'NETMASK=255.255.255.0' >> ${net_scripts}/ifcfg-eth${j} + fi + fi + echo "ONBOOT=yes" >> ${net_scripts}/ifcfg-eth${j} + echo "HWADDR=${nic_mac}" >> ${net_scripts}/ifcfg-eth${j} + # Set to DEFROUTE to no, unless otherwise stated. If not stated set to yes on eth0 + if [[ ${port_def_route[i]} =~ (yes|Yes|True|true) ]] ; then + echo "DEFROUTE=yes" >> ${net_scripts}/ifcfg-eth${j} + elif [[ ${port_def_route[i]} == $(add_underscore 'port_def_route_0') ]] ; then + echo "DEFROUTE=yes" >> ${net_scripts}/ifcfg-eth${j} + else + echo "DEFROUTE=no" >> ${net_scripts}/ifcfg-eth${j} + fi + fi + done + fi +done + +# Set DNS +if [[ ${dns1} != $(add_underscore 'dns1') ]] ; then + echo "PEERDNS=yes" >> ${net_scripts}/ifcfg-eth0 + echo "DNS1=${dns1}" >> ${net_scripts}/ifcfg-eth0 + [[ ${dns2} != $(add_underscore 'dns2') ]] && echo "DNS2=${dns2}" >> ${net_scripts}/ifcfg-eth0 +fi +# Set default gateway +[[ ${default_gateway} != $(add_underscore 'default_gateway') ]] && echo GATEWAY=${default_gateway} >> ${net_scripts}/ifcfg-eth0 +# Set domain +if [[ ${domain} != $(add_underscore 'domain') ]] ; then + echo DOMAIN=${domain} >> ${net_scripts}/ifcfg-eth0 + echo kernel.domainname=${domain} >> /etc/sysctl.conf + sysctl -p +fi +# Set hostname +if [[ ${hostname} != $(add_underscore 'hostname') ]] ; then + hostnamectl set-hostname ${hostname} + sed -i "s/\(^127\.0\.0\.1 .*\)/\1 ${hostname}/" /etc/hosts + sed -i "s/\(^::1 .*\)/\1 ${hostname}/" /etc/hosts + sed -i "s/\(^127\.0\.0\.1 .*\)/\1 ${hostname}.${domain}/" /etc/hosts + sed -i "s/\(^::1 .*\)/\1 ${hostname}.${domain}/" /etc/hosts +fi + +# Enable ipv6 if there is an ipv6 address supplied in env +if [[ ${ipv6_enable} -eq 0 ]] ; then + echo net.ipv6.conf.all.disable_ipv6 = 0 >> /etc/sysctl.conf + echo net.ipv6.conf.default.disable_ipv6 = 0 >> /etc/sysctl.conf + echo net.ipv6.conf.lo.disable_ipv6 = 0 >> /etc/sysctl.conf + sysctl -p +fi + +service network restart + +## Disable Password Login for MechID group +echo "Match Group mechid" >> /etc/ssh/sshd_config +echo -e "\tPasswordAuthentication no" >> /etc/ssh/sshd_config +systemctl restart sshd + +### +# Install SWM +### + +## SWM variables +virc_cc_environment='__virc_cc_environment__' +virc_cc_version='__virc_cc_version__' +virc_cc_version_file='__virc_cc_version_file__' + +cd /tmp +wget 'https://codecloud.web.att.com/projects/ST_VIRC/repos/virc/browse/SWM/Install/input.env?raw' -O input.env +wget 'https://codecloud.web.att.com/projects/ST_VIRC/repos/virc/browse/SWM/Install/platform-init-1.5.5.sh?raw' -O platform-init-1.5.5.sh +wget 'https://codecloud.web.att.com/projects/ST_VIRC/repos/virc/browse/SWM/Install/hostname.props?raw' -O $(hostname).props +sed -i "s/$(add_underscore 'virc_environment')/${virc_environment}/g" $(hostname).props +sed -i "s/$(add_underscore 'virc_version')/${virc_version}/g" input.env +chmod +x platform-init-1.5.5.sh + +## Add MechID user +mechid_user_name=$(grep 'SWM_AUTOUSER=' /tmp/input.env | cut -f 2 -d '=') +useradd -g mechid -p 'pahfhrkSZmUs.' ${mechid_user_name} + +### Workaround ### REMOVE WHEN BUG FIXED ### +#mkdir -p /etc/chef/trusted_certs/ + +# Get packages to install from input.env, then delete from input.env +. /tmp/input.env +swm_install_pkgs=(${SWM_INIT_PACKAGES}) +swm_install_pkg_deps=(${SWM_INIT_PACKAGE_DEPS}) +sed -i '/SWM_INIT_PACKAGES="/,/\"/d' /tmp/input.env + +./platform-init-1.5.5.sh /tmp/input.env + +## Install SWM packages after SWM installation +export AFTSWM_USERNAME=${mechid_user_name} +mechid_user_enc_passwd=$(grep 'SWM_AUTOCRED=' /tmp/input.env | cut -f 2 -d '=') +export AFTSWM_PASSWORD=${mechid_user_enc_passwd} +export HOSTNAME=$(hostname) +#export HOME=/root + +#/opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${swm_install_pkgs} -n $(hostname).$(domainname) -w -fi -fs +#sleep 5 +#cd +echo $SHELL +whoami +env +pwd + +# install swm packages one at a time +for package in ${swm_install_pkg_deps[@]} ; do + /opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${package} -n $(hostname).$(domainname) -w -fi +done + +for package in ${swm_install_pkgs[@]} ; do + /opt/app/aft/aftswmcli/bin/swmcli component pkginstall -c ${package} -n $(hostname).$(domainname) -w -fi +done + +### Run Chef Prep Scripts ### +USER=${mechid_user_name} +COOKBOOK_NAME='virc_cc' +VERSION=${virc_cc_version} +ENV=${virc_cc_environment} +VERSION_FILE=${virc_cc_version_file} + +COOKBOOK_VERSION="" + +for v in $(echo ${VERSION} | tr "." "\n") +do + if [ "$v" -ge 0 -a "$v" -le 9 ]; then + COOKBOOK_VERSION=${COOKBOOK_VERSION}0$v + else + COOKBOOK_VERSION=${COOKBOOK_VERSION}$v + fi +done + +COOKBOOK_VERSION="${COOKBOOK_VERSION:0:4}.1${COOKBOOK_VERSION:4:4}.1${COOKBOOK_VERSION:8:4}" + +#cd /home/$USER/chef-repo +mkdir -p /home/$USER/scripts/$ENV +chown -R ${mechid_user_name}:mechid /home/$USER + +chef_config_path="/home/${mechid_user_name}/chef-repo/.chef/knife.rb" + +su - -c "/usr/bin/knife client delete $(hostname).$(domainname) -y -c ${chef_config_path}" ${mechid_user_name} +su - -c "/usr/bin/knife node delete $(hostname).$(domainname) -y -c ${chef_config_path}" ${mechid_user_name} + +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files Pyswm.py -c ${chef_config_path} > /home/${mechid_user_name}/scripts/$ENV/Pyswm.py" ${mechid_user_name} +#/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files Pyswm.pyc > /home/$USER/scripts/$ENV/Pyswm.pyc +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files install_swm.py -c ${chef_config_path} > /home/$USER/scripts/$ENV/install_swm.py" ${mechid_user_name} +su - -c "/usr/bin/knife cookbook show $COOKBOOK_NAME $COOKBOOK_VERSION files swm-installer-config.json -c ${chef_config_path} > /home/$USER/scripts/$ENV/swm-installer-config.json" ${mechid_user_name} + +#cd /home/$USER/scripts/$ENV +su - -c "chmod 755 /home/$USER/scripts/$ENV/install_swm.py" ${mechid_user_name} +su - -c "cd /home/$USER/scripts/$ENV; ./install_swm.py $VERSION $ENV --components-nodes=\"vIRC-cc:$(hostname).$(domainname)\" --version-file=${VERSION_FILE}" ${mechid_user_name} +#./install_swm.py $VERSION $ENV --components-nodes="<<<ComponentName.FQDN>>>" + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.yaml new file mode 100644 index 0000000000..3d3a1949b1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/first.yaml @@ -0,0 +1,25 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2: + type: OS::Neutron::FloatingIP + properties: + name: { get_param: fsb_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2-flavor } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.yaml new file mode 100644 index 0000000000..e4f29af580 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/first.yaml @@ -0,0 +1,37 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + FSB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal2_net_name } + FSB2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal3_net_id } + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatFloatingIpResourceType/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.yaml new file mode 100644 index 0000000000..f9893b63ee --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/first.yaml @@ -0,0 +1,37 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + FSB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal2_net_id } + FSB2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_name } + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.yaml new file mode 100644 index 0000000000..e4f29af580 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/first.yaml @@ -0,0 +1,37 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + FSB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal2_net_name } + FSB2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal3_net_id } + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.yaml new file mode 100644 index 0000000000..fbec8ccf73 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/first.yaml @@ -0,0 +1,58 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_4 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_a } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + + FSB3: + type: OS::Nova::Server + properties: + name: { get_param: [fsb2_names, 0] } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone} + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + + FSB4: + type: OS::Nova::Server + properties: + name: { get_param: [fsb2_names, 0] } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_blabla} + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output2: + description: the pcrf_server + value: { get_resource: FSB2 } + expose_resource_nove_output3: + description: the pcrf_server + value: { get_resource: FSB3 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.yaml new file mode 100644 index 0000000000..323230ff28 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/first.yaml @@ -0,0 +1,43 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_4 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + FSB3: + type: OS::Nova::Server + properties: + name: { get_param: [fsb2_names, 0] } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output2: + description: the pcrf_server + value: { get_resource: FSB2 } + expose_resource_nove_output3: + description: the pcrf_server + value: { get_resource: FSB3 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.yaml new file mode 100644 index 0000000000..74b16bdc5a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/first.yaml @@ -0,0 +1,41 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2-flavor } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + + FSB3: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + image: { get_param: fsb2-image } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.yaml new file mode 100644 index 0000000000..e4f29af580 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/first.yaml @@ -0,0 +1,37 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + FSB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal2_net_name } + FSB2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal3_net_id } + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VNF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.yaml new file mode 100644 index 0000000000..d9ddcbc7ed --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/first.yaml @@ -0,0 +1,27 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + not_VF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output_1: + description: the pcrf_server + value: { get_resource: FSB2 } + + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.yaml new file mode 100644 index 0000000000..b6be85b4fa --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/first.yaml @@ -0,0 +1,26 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_2 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.yaml new file mode 100644 index 0000000000..3a8e71939f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/first.yaml @@ -0,0 +1,43 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + + FSB2: + type: OS::Nova::Server + properties: + name: {get_param: pcrf_pps_server_4} + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + FSB3: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_pps_server, 0] } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } +outputs: + expose_resource_nove_output2: + description: the pcrf_server + value: { get_resource: FSB2 } + expose_resource_nove_output3: + description: the pcrf_server + value: { get_resource: FSB3 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.yaml new file mode 100644 index 0000000000..ff17c6940a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/first.yaml @@ -0,0 +1,44 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2_name_4 } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + FSB3: + type: OS::Nova::Server + properties: + name: { get_param: [fsb2_names, 0] } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2_flavor_name } + availability_zone: { get_param: availability_zone_0 } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + +outputs: + expose_resource_nove_output2: + description: the pcrf_server + value: { get_resource: FSB2 } + expose_resource_nove_output3: + description: the pcrf_server + value: { get_resource: FSB3 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.yaml new file mode 100644 index 0000000000..85a4c58334 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/first.yaml @@ -0,0 +1,40 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + port_resource_0: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + fixed_ips: + - ip_address: {get_param: pcrf_net_ips} + - ip_address: {get_param: pcrf_net_v6_ip_a} + port_resource_1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_name } + fixed_ips: + - ip_address: {get_param: pcrf_net_v6_ips} + - ip_address: { "Fn::Select" : [ { get_param: indx }, { get_param: [{ get_param: mvs_mgmt_ip_0 }] } ] } + port_resource_2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_fqdn } + fixed_ips: + - ip_address: {get_param: pcrf_net_ipz} + - ip_address: {get_param: pcrf_net_v6_ip_4} + - ip_address": {get_param: pcrf_net_v0_ip_3} + +outputs: + expose_resource_port_output_0: + description: the pcrf_server + value: { get_resource: port_resource_0 } + expose_resource_port_output_1: + description: the pcrf_server + value: { get_resource: port_resource_1 } + expose_resource_port_output_2: + description: the pcrf_server + value: { get_resource: port_resource_2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.yaml new file mode 100644 index 0000000000..7e0aaa373d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/first.yaml @@ -0,0 +1,39 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + port_resource_0: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } + fixed_ips: + - ip_address: {get_param: pcrf_net_ips} + + port_resource_1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_name } + fixed_ips: + - ip_address: {get_param: pcrf_net_v6_ips} + + port_resource_2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_fqdn } + fixed_ips: + - ip_address: {get_param: pcrf_net_ip_4} + - ip_address: {get_param: pcrf_net_v6_ip_4} + +outputs: + expose_resource_port_output_0: + description: the pcrf_server + value: { get_resource: port_resource_0 } + expose_resource_port_output_1: + description: the pcrf_server + value: { get_resource: port_resource_1 } + expose_resource_port_output_2: + description: the pcrf_server + value: { get_resource: port_resource_2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortFixedIpNamingConvention/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.yaml new file mode 100644 index 0000000000..abbf650c8d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/first.yaml @@ -0,0 +1,28 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + port_resource: + type: OS::Neutron::Port + properties: + network_id: { get_param: not_valid_network_name } + port_resource_1: + type: OS::Neutron::Port + properties: + network_id: { get_param: not_valid_net } + port_resource_2: + type: OS::Neutron::Port + properties: + network_id: { get_param: not_valid_net_id_error } + port_resource_3: + type: OS::Neutron::Port + properties: + network_id: { get_param: } + +outputs: + expose_resource_port_output: + description: the pcrf_server + value: { get_resource: port_resource } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml new file mode 100644 index 0000000000..12ee08952d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml @@ -0,0 +1,33 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + port_resource_0: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_id } +resources: + port_resource_1: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_name } +resources: + port_resource_2: + type: OS::Neutron::Port + properties: + network_id: { get_param: Internal1_net_fqdn } + + +outputs: + expose_resource_port_output_0: + description: the pcrf_server + value: { get_resource: port_resource_0 } + expose_resource_port_output_1: + description: the pcrf_server + value: { get_resource: port_resource_1 } + expose_resource_port_output_2: + description: the pcrf_server + value: { get_resource: port_resource_2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.yaml new file mode 100644 index 0000000000..3173885d7e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + volume_expose: + type: OS::Cinder::Volume + +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/firstVol.yaml new file mode 100644 index 0000000000..4f0d65a735 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_param: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.yaml new file mode 100644 index 0000000000..63b576edb8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + volume_expose: + type: OS::Cinder::Volume + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/MANIFEST.json new file mode 100644 index 0000000000..0e8bebb1d1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/MANIFEST.json @@ -0,0 +1,12 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/first.yaml new file mode 100644 index 0000000000..acbc8ca33b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned/first.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + service_instance_1: + type: OS::Contrail::ServiceInstance + depends_on: [ hsl_ip_subnet] + properties: + name: { get_param: service_instance_name } + availability_zone: { get_param: availability_zone_1 } + service_template: { get_resource: service_template_1 } + scale_out: + max_instances: {get_param: max_num_fw_instances} + interface_list: [ + { + virtual_network: { get_param: oam_mgmt_net_0_id } + }, + { + virtual_network: { get_param: Cricket_OCS_direct_net_id } + }, + { + virtual_network: { get_resource: hsl_direct_net } + }, + { + virtual_network: {get_param: oam_mgmt_net_1_id}, + static_routes: [ + { "prefix": {get_param: prefix_0} }, + { "prefix": {get_param: prefix_1} }, + { "prefix": {get_param: prefix_2} }, + ], + } + ] + service_template_1: + type: OS::Contrail::ServiceTemplate + properties: + name: { get_param: st_name } + service_mode: { get_param: st_mode } + service_type: { get_param: st_type } + image_name: { get_param: st_image_name } + flavor: { get_param: st_flavor_name } + service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] } + shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] } + static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] } + service_scaling: { get_param: st_scaling }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/MANIFEST.json new file mode 100644 index 0000000000..0e8bebb1d1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/MANIFEST.json @@ -0,0 +1,12 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/first.yaml new file mode 100644 index 0000000000..cc9d40fd5a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned/first.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + service_instance_1: + type: OS::Contrail::ServiceInstance + depends_on: [ hsl_ip_subnet] + properties: + name: { get_param: service_instance_name } + availability_zone: { get_param: availability_zone_1a } + service_template: { get_resource: service_template_1 } + scale_out: + max_instances: {get_param: max_num_fw_instances} + interface_list: [ + { + virtual_network: { get_param: oam_mgmt_net_0_id } + }, + { + virtual_network: { get_param: Cricket_OCS_direct_net_id } + }, + { + virtual_network: { get_resource: hsl_direct_net } + }, + { + virtual_network: {get_param: oam_mgmt_net_1_id}, + static_routes: [ + { "prefix": {get_param: prefix_0} }, + { "prefix": {get_param: prefix_1} }, + { "prefix": {get_param: prefix_2} }, + ], + } + ] + service_template_1: + type: OS::Contrail::ServiceTemplate + properties: + name: { get_param: st_name } + service_mode: { get_param: st_mode } + service_type: { get_param: st_type } + image_name: { get_param: st_image_name } + flavor: { get_param: st_flavor_name } + service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] } + shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] } + static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] } + service_scaling: { get_param: st_scaling }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/MANIFEST.json new file mode 100644 index 0000000000..0e8bebb1d1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/MANIFEST.json @@ -0,0 +1,12 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/first.yaml new file mode 100644 index 0000000000..1eb7bc914d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/aligned/first.yaml @@ -0,0 +1,17 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + service_template: + type: OS::Contrail::ServiceTemplate + properties: + name: { get_param: st_name } + service_mode: { get_param: st_mode } + service_type: { get_param: st_type } + image_name: { get_param: st_image_name } + flavor: { get_param: st_flavor_name } + service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] } + shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] } + static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] } + service_scaling: { get_param: st_scaling }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/MANIFEST.json new file mode 100644 index 0000000000..0e8bebb1d1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/MANIFEST.json @@ -0,0 +1,12 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/first.yaml new file mode 100644 index 0000000000..9da16fe0d2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/imageandflavordifferentvmtype/first.yaml @@ -0,0 +1,17 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + service_template: + type: OS::Contrail::ServiceTemplate + properties: + name: { get_param: st_name } + service_mode: { get_param: st_mode } + service_type: { get_param: st_type } + image_name: { get_param: st1_image_name } + flavor: { get_param: st_flavor_name } + service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] } + shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] } + static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] } + service_scaling: { get_param: st_scaling }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/MANIFEST.json new file mode 100644 index 0000000000..0e8bebb1d1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/MANIFEST.json @@ -0,0 +1,12 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/first.yaml new file mode 100644 index 0000000000..325cb78450 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailservicetemplateimageandflavor/notaligned/first.yaml @@ -0,0 +1,17 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + service_template: + type: OS::Contrail::ServiceTemplate + properties: + name: { get_param: st_name } + service_mode: { get_param: st_mode } + service_type: { get_param: st_type } + image_name: { get_param: st_imaage_name } + flavor: { get_param: st_flavaor_name } + service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] } + shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] } + static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] } + service_scaling: { get_param: st_scaling }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/MANIFEST.json new file mode 100644 index 0000000000..a189124e6c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": false, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/first.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/firstVol.yaml new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/firstVol.yaml @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/MANIFEST.json new file mode 100644 index 0000000000..3de70a21df --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": true + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.yaml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/first.yaml diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/firstVol.yaml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/firstVol.yaml diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/second.yaml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/second.yaml diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/MANIFEST.json new file mode 100644 index 0000000000..76ce6de6e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/MANIFEST.json @@ -0,0 +1,27 @@ +{ + "name": "validTest", + "description": "Valid Test", + "version": "1610", + "data": [ + { + "file": "first.yaml", + "type": "HEAT", + "isBase": true, + "data": [ + { + "file": "first.env", + "type": "HEAT_ENV" + }, + { + "file": "firstVol.yaml", + "type": "HEAT_VOL" + } + ] + }, + { + "file": "second.yaml", + "type": "HEAT", + "isBase": false + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.env new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.env diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.yaml new file mode 100644 index 0000000000..2fe03959bd --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/first.yaml @@ -0,0 +1,61 @@ +heat_template_version: 2013-05-23 + +description: heat expose volume resource + +resources: + FSB2_legal_1: + type: OS::Nova::Server + properties: + name: { get_param: fsb_name_2 } + flavor: { get_param: fsb_flavor_name } + image: { get_param: fsb_image_name } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + + FSB2_legal_2: + type: OS::Nova::Server + properties: + name: { get_param: CE_server_name } + image: { get_param: CE_image_name } + flavor: { get_param: CE_flavor_name } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + + FSB2_legal_3: + type: OS::Nova::Server + properties: + name: { get_param: fsb_name_2 } + flavor: { get_param: fsb_flavor_names } + image: { get_param: fsb_image_name } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + + FSB2_illegal_1: + type: OS::Nova::Server + properties: + name: { get_param: fsb_name_2 } + flavor: {get_param: scp_flavor_name} + image: { get_param: pcrf_image_name } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + + FSB2_illegal_2: + type: OS::Nova::Server + properties: + name: { get_param: [fsb_names, 1] } + flavor: {get_param: scp_flavor_name} + image: { get_param: scp_image_name } + metadata: + VnF_id: { get_param: vnfvfVF_id } + vf_module_id: { get_param: vf_module_id } + +outputs: + expose_resource_nove_output: + description: the pcrf_server + value: { get_resource: FSB2 } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/firstVol.yaml new file mode 100644 index 0000000000..7e82b2a7e6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/firstVol.yaml @@ -0,0 +1,19 @@ + +heat_template_version: 2013-05-23 + +parameters: + not_null: + type: number + label: not_number + + +resources: + volume_expose: + type: OS::Cinder::Volume + properties: + not_null: not_null +outputs: + not_expose_resource_network_output: + description: the pcrf_server + value: { get_resource: volume_expose } + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/second.yaml new file mode 100644 index 0000000000..bb06b9d60a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input/second.yaml @@ -0,0 +1,14 @@ +heat_template_version: 2013-05-23 + +description: heat second + +resources: + network_expose: + type: OS::Neutron::Net + +outputs: + expose_resource_network_output: + description: the pcrf_server + value: { get_resource: network_expose } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/expected_output/expected_output.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/expected_output/expected_output.json new file mode 100644 index 0000000000..e9106a850c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/expected_output/expected_output.json @@ -0,0 +1,38 @@ +{ + "hot-nimbus-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Server Availability Zone not aligned with Guidelines, Resource ID [availability_zone_illegal_name_1]" + }, + { + "level": "WARNING", + "message": "Server Availability Zone not aligned with Guidelines, Resource ID [availability_zone_illegal_name_2]" + } + ] + }, + "nested-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing VF_MODULE_ID resource id [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [pcrf_pps_port_0]" + } + ] + }, + "MANIFEST.json": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources" + } + ] + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/MANIFEST.json new file mode 100644 index 0000000000..1e719efb31 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.env new file mode 100644 index 0000000000..809835d2b8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.env @@ -0,0 +1,12 @@ +parameters: + pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006 + pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pps_flavor_name: lc.3xlarge + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + mock_param: abskdjska + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.yaml new file mode 100644 index 0000000000..011a36fa2c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/availability_zone_name/input/hot-nimbus-pps_v1.0.yaml @@ -0,0 +1,92 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_names: + type: comma_delimited_list + label: PCRF PS server names + description: PCRF PS server names + pcrf_pps_image_name: + type: string + default: True + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + availability_zone_1: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + + +resources: + + + availability_zone_legal_name_1: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + availability_zone: {get_param: availability_zone_1} + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + availability_zone_legal_name_2: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + availability_zone: {get_resource: availability_zone_1} + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + availability_zone_illegal_name_1: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + availability_zone: {get_param: availability_zone_name} + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + availability_zone_illegal_name_2: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + availability_zone: {get_param: availability_zone} + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/expected_output/expected_output.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/expected_output/expected_output.json new file mode 100644 index 0000000000..f0dc0d21a1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/expected_output/expected_output.json @@ -0,0 +1,34 @@ +{ + "hot-nimbus-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "OS::Neutron::FloatingIP is in use, Resource ID [floating_ip_type]" + } + ] + }, + "nested-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing VF_MODULE_ID resource id [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [pcrf_pps_port_0]" + } + ] + }, + "MANIFEST.json": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources" + } + ] + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/MANIFEST.json new file mode 100644 index 0000000000..1e719efb31 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.env new file mode 100644 index 0000000000..809835d2b8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.env @@ -0,0 +1,12 @@ +parameters: + pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006 + pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pps_flavor_name: lc.3xlarge + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + mock_param: abskdjska + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.yaml new file mode 100644 index 0000000000..ab4279d153 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/floating_ip_resource_type/input/hot-nimbus-pps_v1.0.yaml @@ -0,0 +1,71 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_names: + type: comma_delimited_list + label: PCRF PS server names + description: PCRF PS server names + pcrf_pps_image_name: + type: string + default: True + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + availability_zone_1: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + + +resources: + legal_resource_type1: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + availability_zone: {get_param: availability_zone_1} + flavor: {get_param: pcrf_flavor_name} + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + floating_ip_type: + type: OS::Neutron::FloatingIP + properties: + name: { get_param: [pcrf_pps_server_names, 0] } + availability_zone: {get_param: availability_zone_name} + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + + + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/expected_output/expected_output.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/expected_output/expected_output.json new file mode 100644 index 0000000000..7eefd3d36e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/expected_output/expected_output.json @@ -0,0 +1,42 @@ +{ + "hot-nimbus-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [fixed_ip_illegal_name_1]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [fixed_ip_illegal_name_2]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [fixed_ip_illegal_name_3]" + } + ] + }, + "nested-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing VF_MODULE_ID resource id [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [pcrf_pps_port_0]" + } + ] + }, + "MANIFEST.json": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources" + } + ] + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/MANIFEST.json new file mode 100644 index 0000000000..1e719efb31 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.env new file mode 100644 index 0000000000..809835d2b8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.env @@ -0,0 +1,12 @@ +parameters: + pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006 + pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pps_flavor_name: lc.3xlarge + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + mock_param: abskdjska + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.yaml new file mode 100644 index 0000000000..749b7144b6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/neutron_port_fixed_ip_name/input/hot-nimbus-pps_v1.0.yaml @@ -0,0 +1,128 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_names: + type: comma_delimited_list + label: PCRF PS server names + description: PCRF PS server names + pcrf_pps_image_name: + type: string + default: True + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_ips: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_v6_ips: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_ip_4: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_v6_ip_4: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_ipz: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_v0_ip_3: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_net_v6_ip_a: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + + fixed_ip_legal_name_1: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_ips} + + fixed_ip_legal_name_2: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_v6_ips} + + fixed_ip_legal_name_3: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_ip_4} + + fixed_ip_legal_name_4: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_v6_ip_4} + + fixed_ip_legal_name_5: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_resource: pcrf_net_v6_ip_4} + + fixed_ip_illegal_name_1: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_ipz} + + fixed_ip_illegal_name_2: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address": {get_param: pcrf_net_v0_ip_3} + + fixed_ip_illegal_name_3: + type: OS::Neutron::Port + properties: + name: {get_param: pcrf_pps_image_name} + fixed_ips: + - ip_address: {get_param: pcrf_net_v6_ip_a} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/expected_output/expected_output.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/expected_output/expected_output.json new file mode 100644 index 0000000000..ca1f58c1f8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/expected_output/expected_output.json @@ -0,0 +1,50 @@ +{ + "hot-nimbus-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [nova_server_ilegal_name_1]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [nova_server_ilegal_name_2]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [nova_server_ilegal_name_3]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [nova_server_ilegal_name_4]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [nova_server_ilegal_name_5]" + } + ] + }, + "nested-pps_v1.0.yaml": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing VF_MODULE_ID resource id [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Server Name not aligned with Guidelines, Resource ID [pcrf_server_pps]" + }, + { + "level": "WARNING", + "message": "Fixed_IPS not aligned with Guidelines, Resource ID [pcrf_pps_port_0]" + } + ] + }, + "MANIFEST.json": { + "errorMessageList": [ + { + "level": "WARNING", + "message": "Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources" + } + ] + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/MANIFEST.json new file mode 100644 index 0000000000..1e719efb31 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.env new file mode 100644 index 0000000000..809835d2b8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.env @@ -0,0 +1,12 @@ +parameters: + pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006 + pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pps_flavor_name: lc.3xlarge + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + mock_param: abskdjska + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.yaml new file mode 100644 index 0000000000..aaefcfb596 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/naming_convention/nova_server_name/input/hot-nimbus-pps_v1.0.yaml @@ -0,0 +1,138 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_names: + type: comma_delimited_list + label: PCRF PS server names + description: PCRF PS server names + pcrf_pps_image_name: + type: string + default: True + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_vnf_module_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_flavor: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + pcrf_pps_server_name_4: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + + +resources: + nova_server_legal_name_1: + type: OS::Nova::Server + properties: + name: { get_param: [pcrf_names, 0] } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + + nova_server_legal_name_2: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_name_4 } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_legal_name_3: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_name_4 } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_1: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_name_a } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_2: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_nameds_a } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_3: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_pps_name_a } + flavor: { get_param: pcrf_pps_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_4: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_name_a } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_5: + type: OS::Nova::Server + properties: + name: { get_param: pcrf_name_a } + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } + + nova_server_ilegal_name_6: + type: OS::Nova::Server + properties: + name: pcrf_name_a + flavor: { get_param: pcrf_flavor_name } + metadata: + vnf_id: { get_param: pcrf_vnf_id } + vf_module_id: { get_param: pcrf_vnf_module_id } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java index dce2939ae5..2b7b3a6ded 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java @@ -258,11 +258,11 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } @@ -281,11 +281,11 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java index d5efd59a6b..364a240498 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java @@ -224,11 +224,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } @@ -247,11 +247,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java index ba9c38f453..e40b2988b3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java @@ -14,12 +14,12 @@ public class LimitEntity implements VersionableEntity { private String name; private LimitType type; private String description; - private EntitlementMetric metric; + private String metric; private Version version; - private Integer value; - private Integer unit; + private String value; + private String unit; private AggregationFunction aggregationFunction; - private EntitlementTime time; + private String time; public LimitEntity() { } @@ -31,11 +31,11 @@ public class LimitEntity implements VersionableEntity { this.id = id; } - public Integer getUnit() { + public String getUnit() { return unit; } - public void setUnit(Integer unit) { + public void setUnit(String unit) { this.unit = unit; } @@ -48,11 +48,11 @@ public class LimitEntity implements VersionableEntity { this.aggregationFunction = aggregationFunction; } - public EntitlementTime getTime() { + public String getTime() { return time; } - public void setTime(EntitlementTime time) { + public void setTime(String time) { this.time = time; } @@ -119,11 +119,11 @@ public class LimitEntity implements VersionableEntity { this.name = name; } - public EntitlementMetric getMetric() { + public String getMetric() { return metric; } - public void setMetric(EntitlementMetric metric) { + public void setMetric(String metric) { this.metric = metric; } @@ -135,11 +135,11 @@ public class LimitEntity implements VersionableEntity { this.description = description; } - public Integer getValue() { + public String getValue() { return value; } - public void setValue(Integer value) { + public void setValue(String value) { this.value = value; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java index c8612bfeaa..c36d255b31 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java @@ -113,20 +113,16 @@ public class LimitZusammenDaoImpl implements LimitDao { limitEntity.setType( elementInfo.getInfo().getProperties().get(LIMT_TYPE) != null ? LimitType.valueOf((String) elementInfo.getInfo().getProperties().get(LIMT_TYPE)) : null); - limitEntity.setTime( elementInfo.getInfo().getProperties().get(TIME) != null ? - EntitlementTime.valueOf((String) elementInfo.getInfo().getProperties().get(TIME)) : - null); - limitEntity.setMetric( elementInfo.getInfo().getProperties().get(METRIC) != null ? - EntitlementMetric.valueOf((String) elementInfo.getInfo().getProperties().get(METRIC)) : - null); + limitEntity.setTime((String) elementInfo.getInfo().getProperties().get(TIME) ); + limitEntity.setMetric( (String) elementInfo.getInfo().getProperties().get(METRIC)); limitEntity.setAggregationFunction( elementInfo.getInfo().getProperties().get (AGGREGATIONFUNCTION) != null ? AggregationFunction.valueOf((String) elementInfo.getInfo().getProperties() .get(AGGREGATIONFUNCTION)) : null); Object unit = elementInfo.getInfo().getProperties().get(UNIT); - limitEntity.setUnit(unit != null ? VlmZusammenUtil.toInteger(unit) : null); + limitEntity.setUnit((String) unit); Object value = elementInfo.getInfo().getProperties().get(VALUE); - limitEntity.setValue(value != null ? VlmZusammenUtil.toInteger(value) : null); + limitEntity.setValue((String) value); return limitEntity; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java index 5f9dd10816..2f7e0ea50e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.vendorlicense.facade.impl; import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG; -import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA; import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.util.UniqueValueUtil; @@ -519,33 +518,34 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { } } private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { - Version version = VersioningUtil.resolveVersion(null, - getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); - Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao - .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); - - if (CollectionUtils.isNotEmpty(licenseAgreements)) { - licenseAgreements.forEach(licenseAgreement -> { - if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); - } - }); - - Collection<FeatureGroupEntity> featureGroupEntities = featureGroupDao.list( - new FeatureGroupEntity(vendorLicenseModelId, version, null)); - featureGroupEntities.forEach(featureGroupEntity -> { - if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); - } - }); - } + Collection<String> allFeatureGroupEntities = new HashSet<>(); + Version version = VersioningUtil.resolveVersion(null, + getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); + Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao + .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); + + if (CollectionUtils.isNotEmpty(licenseAgreements)) { + licenseAgreements.forEach(licenseAgreement -> { + if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + } + allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds()); + }); + + allFeatureGroupEntities.forEach(fg -> { + FeatureGroupEntity featureGroupEntity = featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg)); + if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + }); + } } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java index 2517b9bfab..b326f444ce 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntity.java @@ -29,11 +29,10 @@ import org.openecomp.core.enrichment.types.MonitoringUploadType; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; -import java.io.Serializable; import java.nio.ByteBuffer; @Table(keyspace = "dox", name = "vsp_component_artifact") -public class ComponentMonitoringUploadEntity implements VersionableEntity, Serializable { +public class ComponentMonitoringUploadEntity implements VersionableEntity { public static final String ENTITY_TYPE = "Vendor Software Product Component Artifact"; @PartitionKey @Column(name = "vsp_id") diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml index afee456fc3..5095e67292 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml @@ -119,12 +119,12 @@ <dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-tosca-generator-api</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-vendor-license-api</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> </dependencies> diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java index d87059e89c..da64f5a2e5 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java @@ -103,6 +103,7 @@ public class VendorSoftwareProductErrorCodes { ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING"; public static final String DUPLICATE_IMAGE_NAME_NOT_ALLOWED = "DUPLICATE_IMAGE_NAME_NOT_ALLOWED"; + public static final String DUPLICATE_IMAGE_VERSION_NOT_ALLOWED = "DUPLICATE_IMAGE_VERSION_NOT_ALLOWED"; public static final String IMAGE_NAME_FORMAT_NOT_ALLOWED = "IMAGE_NAME_FORMAT_NOT_ALLOWED"; public static final String VFC_IMAGE_INVALID_FORMAT = "VFC_IMAGE_INVALID_FORMAT"; public static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP = "FEATURE_GROUP_NOT_EXIST_FOR_VSP"; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java index 17064b3230..ab36e8e5a1 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java @@ -70,6 +70,8 @@ public class TxtInformationArtifactGeneratorImplTest { @InjectMocks TxtInformationArtifactGeneratorImpl informationArtifactGenerator; + /* + @BeforeMethod(alwaysRun = true) public void injectDoubles() { MockitoAnnotations.initMocks(this); @@ -244,4 +246,6 @@ public class TxtInformationArtifactGeneratorImplTest { return vspDetails; } + */ + } diff --git a/openecomp-be/tools/build/scripts/action_library_client/doc/ASDC_Action_Lib_API_AID_1610_13.pdf b/openecomp-be/tools/build/scripts/action_library_client/doc/ASDC_Action_Lib_API_AID_1610_13.pdf Binary files differdeleted file mode 100644 index 966cbd9447..0000000000 --- a/openecomp-be/tools/build/scripts/action_library_client/doc/ASDC_Action_Lib_API_AID_1610_13.pdf +++ /dev/null diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl index 4313e65c44..8eba7f2451 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl @@ -9,7 +9,8 @@ ] }, "version": { - "type": "string" + "type": "string", + "minLength": 1 }, "md5": { "type": "string" diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml index 47808dbc3a..727d73a594 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml @@ -47,7 +47,7 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen-state-store.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> diff --git a/openecomp-be/tools/zusammen-tools/pom.xml b/openecomp-be/tools/zusammen-tools/pom.xml index 0289de6d8a..72a4a7bb23 100644 --- a/openecomp-be/tools/zusammen-tools/pom.xml +++ b/openecomp-be/tools/zusammen-tools/pom.xml @@ -47,7 +47,7 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen-state-store.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> diff --git a/openecomp-ui/package.json b/openecomp-ui/package.json index ef44bfb2b8..f18dd75329 100644 --- a/openecomp-ui/package.json +++ b/openecomp-ui/package.json @@ -18,7 +18,7 @@ "storyshots": "jest storyshots.test.js", "build-storybook": "build-storybook -c .storybook -o .storybook-dist && gulp copy-storybook-fonts && gulp copy-storybook-resources-prod" }, - "dependencies": { + "dependencies": { "classnames": "^2.2.5", "core-js": "^2.4.0", "d3": "^3.5.16", @@ -40,7 +40,7 @@ "react-sortable": "^1.2.0", "redux": "^3.3.1", "restful-js": "^0.7.0", - "sdc-ui": "1.6.0", + "sdc-ui": "1.6.2", "uuid-js": "^0.7.5", "validator": "^4.3.0" }, @@ -110,6 +110,7 @@ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test-utils/fileMock.js", "\\.(css|scss)$": "<rootDir>/test-utils/styleMock.js", "^nfvo-utils/RestAPIUtil.js$": "<rootDir>/test-utils/MockRest.js", + "^sdc-ui/lib/react/SVGIcon.js$": "<rootDir>/test-utils/MockSVGIcon.js", "^nfvo-utils(.*)$": "<rootDir>/src/nfvo-utils$1", "^nfvo-components(.*)$": "<rootDir>/src/nfvo-components$1", "^sdc-app(.*)$": "<rootDir>/src/sdc-app$1", diff --git a/openecomp-ui/pom.xml b/openecomp-ui/pom.xml index 0e98b7c9c3..77313092c6 100644 --- a/openecomp-ui/pom.xml +++ b/openecomp-ui/pom.xml @@ -56,11 +56,11 @@ <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <version>1.4</version> - + <configuration> <installDirectory>${project.parent.parent.basedir}</installDirectory> - </configuration> - + </configuration> + <executions> <execution> @@ -73,7 +73,7 @@ <npmVersion>3.10.10</npmVersion> </configuration> </execution> - + <execution> <id>npm set progress off</id> <goals> @@ -83,7 +83,7 @@ <arguments>set progress=false</arguments> </configuration> </execution> - + <execution> <id>npm install in dox-sequence-diagram-ui</id> <goals> @@ -94,7 +94,7 @@ <arguments>install</arguments> </configuration> </execution> - + <execution> <id>npm install</id> <goals> @@ -104,14 +104,14 @@ <arguments>install</arguments> </configuration> </execution> - + <execution> <id>npm run build</id> <goals> <goal>npm</goal> </goals> <configuration> - <arguments>run build -- --version=${version}</arguments> + <arguments>run build</arguments> </configuration> </execution> </executions> diff --git a/openecomp-ui/resources/scss/_components.scss b/openecomp-ui/resources/scss/_components.scss index c70b914187..7c726aa8dd 100644 --- a/openecomp-ui/resources/scss/_components.scss +++ b/openecomp-ui/resources/scss/_components.scss @@ -16,7 +16,6 @@ @import "components/submitErrorResponse"; @import "components/expandableInput"; @import "components/grid"; -@import "components/icon"; @import "components/activityLog"; @import "components/selectActionTable"; @import "components/datepicker"; diff --git a/openecomp-ui/resources/scss/common/_variables.scss b/openecomp-ui/resources/scss/common/_variables.scss index 2162b0b1b0..3a3178c6b0 100644 --- a/openecomp-ui/resources/scss/common/_variables.scss +++ b/openecomp-ui/resources/scss/common/_variables.scss @@ -47,14 +47,23 @@ $desktop-min-width: 1824px; /* Textures */ $images-folder-name: "../images"; +/* +$plus-circle-icon: $images-folder-name + "/plus-circle-icon.svg"; +$interface-icon: $images-folder-name + "/interface.svg"; +$sdc-logo: $images-folder-name + "/logo.svg"; +$warning-icon: $images-folder-name + "/warning.svg"; +*/ /* Icons */ $icons-folder: "../images/icons"; -$artifacts-icon: $images-folder-name + "/artifacts_icon.png"; -$check-icon: $images-folder-name + "/v_icon.png"; -$base-module-icon: $images-folder-name + "/base_icon.png"; -$module-icon: $images-folder-name + "/module_icon.png"; +/* +$plus-circle-icon: $images-folder-name + "/plus-circle-icon.svg"; +$interface-icon: $images-folder-name + "/interface.svg"; +$sdc-logo: $images-folder-name + "/logo.svg"; +$warning-icon: $images-folder-name + "/warning.svg"; +*/ $pencil-icon: $images-folder-name + "/pencil_icon-01.svg"; +/* $vc-check-in-icon: $icons-folder + "/checked_in.png"; $vc-checkout-icon: $icons-folder + "/checked_out.png"; $vc-revert-icon: $icons-folder + "/reverticon.png"; @@ -66,11 +75,12 @@ $vc-submit-disabled-icon: $icons-folder + "/submit_icon_disable.png"; $trash-icon: $images-folder-name + "/trash_icon.png"; $download-icon: $images-folder-name + "/download_icon.png"; $upload-icon: $images-folder-name + "/upload_icon.png"; +*/ - -/* catalog icons */ +/***** +// catalog icons $back-icon: $icons-folder + "/back_icon.png"; -/* validation icons */ +// validation icons $artifacts-selected-icon: $icons-folder + "/artifacts_blue_icon.png"; $artifacts-regular-icon: $icons-folder + "/artifacts_grey_icon.png"; $chevron_down: $icons-folder + "/down_chevron.png"; @@ -93,7 +103,7 @@ $heat-selected-icon: $icons-folder + "/nested_HEAT_icon_blue.png"; $env-icon: $icons-folder + "/env_icon.png"; $env-selected-icon: $icons-folder + "/env_icon_blue.png"; -/* vlm summary icons */ +// vlm summary icons $vlm-summary-plus-blue: $icons-folder + "/plus_vlm_summary_icon_blue.png"; $vlm-summary-plus: $icons-folder + "/plus_vlm_summary_icon.png"; @@ -102,4 +112,5 @@ $vlm-summary-orphans: $icons-folder + "/orphans_grey_icon.png"; $vlm-summary-orphans-blue: $icons-folder + "/orphans_blue_icon-n.png"; $vlm-summary-used: $icons-folder + "/vlm_list_view_grey_icon.png"; $vlm-summary-used-blue: $icons-folder + "/vlm_list_view_blue_icon.png"; +*****/ diff --git a/openecomp-ui/resources/scss/components/_activityLog.scss b/openecomp-ui/resources/scss/components/_activityLog.scss index 9ada804934..5e9418ed7d 100644 --- a/openecomp-ui/resources/scss/components/_activityLog.scss +++ b/openecomp-ui/resources/scss/components/_activityLog.scss @@ -39,11 +39,7 @@ $message-info-icon-size: 16px; .svg-icon-wrapper { float: right; } - .checkCircle { - fill: $green; - width: 16px; - height: 16px; - } + .status-icon.false:after { @include status-icon-class; float: right; diff --git a/openecomp-ui/resources/scss/components/_expandableInput.scss b/openecomp-ui/resources/scss/components/_expandableInput.scss index 52b72d7c91..2484a73e8a 100644 --- a/openecomp-ui/resources/scss/components/_expandableInput.scss +++ b/openecomp-ui/resources/scss/components/_expandableInput.scss @@ -1,24 +1,21 @@ .expandable-input-top { display: flex; height: 22px; - .svg-icon-wrapper { - height: 17px; - width: 17px; - } .expandable-input-wrapper { display: flex; - .svg-icon.search { - height: 17px; - width: 17px; - } &.closed { - .svg-icon.search { - transition: fill 0.5s ease-in; - fill: $blue; - cursor: pointer; - &:hover { + .svg-icon + { + &.__search { + height: 17px; + width: 17px; transition: fill 0.5s ease-in; - fill: $dark-blue; + fill: $blue; + cursor: pointer; + &:hover { + transition: fill 0.5s ease-in; + fill: $dark-blue; + } } } } @@ -26,17 +23,21 @@ .svg-icon-wrapper { margin-left: 3px; } - .svg-icon.search { - fill: $dark-blue; + .svg-icon { + &.__search { + height: 17px; + width: 17px; + fill: $dark-blue; + } } - .svg-icon.close { - margin-left: 7px; - height: 10px; - width: 10px; - opacity: 0.6; - fill: $dark-gray; - &:hover { - opacity: 1; + .svg-icon { + &.__close { + margin-left: 7px; + opacity: 0.6; + fill: $dark-gray; + &:hover { + opacity: 1; + } } } } diff --git a/openecomp-ui/resources/scss/components/_selectActionTable.scss b/openecomp-ui/resources/scss/components/_selectActionTable.scss index 79a5432ef1..fa8eb3110c 100644 --- a/openecomp-ui/resources/scss/components/_selectActionTable.scss +++ b/openecomp-ui/resources/scss/components/_selectActionTable.scss @@ -1,15 +1,13 @@ .select-action-table-view { .svg-icon-wrapper { flex-direction: row; - - &::before { - content:""; - } .svg-icon { - margin-left: 5px; - margin-right: 5px; - width:16px; - height:16px; + &:not(.__plus) { + margin-left: 5px; + margin-right: 5px; + width:16px; + height:16px; + } } } .dummy-icon { @@ -57,21 +55,6 @@ display: flex; flex-direction: row; margin-bottom: 14px; - .svg-icon-wrapper.trashO { - .svg-icon { - fill: $dark-gray; - } - } - .svg-icon-wrapper.errorCircle { - .svg-icon { - fill: $red; - } - } - .svg-icon-wrapper.checkCircle { - .svg-icon { - fill: $green; - } - } .svg-icon-wrapper.hideDelete { .svg-icon { fill: $white; diff --git a/openecomp-ui/resources/scss/components/_submitErrorResponse.scss b/openecomp-ui/resources/scss/components/_submitErrorResponse.scss index b917dfefeb..f045038193 100644 --- a/openecomp-ui/resources/scss/components/_submitErrorResponse.scss +++ b/openecomp-ui/resources/scss/components/_submitErrorResponse.scss @@ -26,14 +26,19 @@ background-color: $tlv-gray; padding: 5px; cursor: pointer; - .chevronDown { - width:10px; - height:10px; - margin-right: 10px; - &.right { - transform: rotate(270deg); + .svg-icon { + &.__chevronDown { + margin-right: 10px; } } + .collapse-right { + .svg-icon { + &.__chevronDown { + transform: rotate(270deg); + } + } + + } } .error-code-list-item { diff --git a/openecomp-ui/resources/scss/components/_validationForm.scss b/openecomp-ui/resources/scss/components/_validationForm.scss index e4aac32b74..e1adb5650f 100644 --- a/openecomp-ui/resources/scss/components/_validationForm.scss +++ b/openecomp-ui/resources/scss/components/_validationForm.scss @@ -75,7 +75,7 @@ form { flex: 0.2; content: ' '; } - @media (min-width: 1349px) { + @media (min-width: 1389px) { &.add-line-break { .control-label { &:after { diff --git a/openecomp-ui/resources/scss/components/_versionController.scss b/openecomp-ui/resources/scss/components/_versionController.scss index b454d3496b..57610986c3 100644 --- a/openecomp-ui/resources/scss/components/_versionController.scss +++ b/openecomp-ui/resources/scss/components/_versionController.scss @@ -59,56 +59,33 @@ margin-right: 20px; padding-bottom: 5px; - .versionControllerLockClosed { + + .svg-icon { fill: $dark-gray; - width: 21px; - height: 23px; - margin-top: -3px; - &.disabled { - fill: $light-gray; - } &:hover { fill: $black; } - } - .versionControllerLockOpen { - fill: $dark-gray; - width: 24px; - height: 28px; - margin-top: -6px; - &:hover { - fill: $black; + &.__versionControllerLockClosed { + margin-top: -3px; } - } - .versionControllerSubmit { - fill: $blue; - &.disabled { - fill: $light-gray; + &.__versionControllerLockOpen { + margin-top: -6px; } - &:hover { - fill: $dark-blue; + &.__versionControllerSubmit { + fill: $blue; + &:hover { + fill: $dark-blue; + } + &.disabled { + fill: $dark-gray; + } } } - - .versionControllerRevert { - fill: $dark-gray; - &.disabled { - fill: $light-gray; - } - &:hover { - fill: $black; - } - } - .versionControllerSave { - fill: $dark-gray; - &.disabled { - fill: $light-gray; - } - &:hover { - fill: $black; - } } - } + + + + } .vc-nav-item-close { display: flex; diff --git a/openecomp-ui/resources/scss/modules/_featureGroup.scss b/openecomp-ui/resources/scss/modules/_featureGroup.scss index 9d395f98c8..5f98ed2c05 100644 --- a/openecomp-ui/resources/scss/modules/_featureGroup.scss +++ b/openecomp-ui/resources/scss/modules/_featureGroup.scss @@ -1,23 +1,37 @@ .feature-groups-list-editor { - .list-editor-view-list { - .list-editor-item-view { - min-height: 110px; - height: 110px; - } - .list-editor-item-view-field { - .feature-groups-count-field { - display: inline-block; - &:first-child { - margin-right: 95px; - } - } - .feature-groups-count-ep { - @extend .heading-1; - color: $light-blue; + .list-editor-view{ + .list-editor-view-list { + .list-editor-item-view { + min-height: 110px; + height: 110px; } - .feature-groups-count-lk { - @extend .heading-1; - color: $light-green; + .list-editor-item-view-content { + .list-editor-item-view-field { + &.smaller-field { + flex: 0.35; + } + .feature-groups-count-field { + display: inline-block; + &:first-child { + margin-right: 95px; + } + } + .feature-groups-count-ep { + @extend .heading-1; + color: $light-blue; + } + .feature-groups-mrn-ep { + @extend .body-1; + color: $light-blue; + } + .feature-groups-count-lk { + @extend .heading-1; + color: $light-green; + } + .title-no-wrap { + white-space: nowrap; + } + } } } } @@ -39,7 +53,7 @@ .nav.nav-tabs { padding-left: 50px; } - + .tab-content { padding: 50px; .field-section { diff --git a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss index 1c133a1dce..15bb9a7033 100644 --- a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss +++ b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss @@ -61,26 +61,34 @@ $lkg-ep-color: $light-blue; &:not(.read-only) .vendor-description { border: 1px solid transparent; + width: 100%; padding: 2px 0 2px 6px; margin-top: 10px; - + position: relative; + .svg-icon-wrapper { + position: absolute;; + right:0; + top:0; + opacity: 0; + } $hover-padding-right: 16px; @include percent-plus-value($property: width, $percent: 100%, $value: -$hover-padding-right); // compensate for padding added on hover &:hover { padding-right: $hover-padding-right; - width: 100%; border: 1px solid $light-gray; cursor: pointer; - background-position: calc(100% - 4px) 4px; - background-size: 14px; - background-image: url($pencil-icon); - background-repeat: no-repeat; - background-color: white; - + background-color: $white; + .svg-icon-wrapper { + opacity: 1; + z-index: 10; + } .description-data:after { background: white; } + .description-data { + width: 100%; + } } } @@ -167,20 +175,23 @@ $lkg-ep-color: $light-blue; flex-grow: 2; margin-left: 5px; } - .add-button { - cursor: pointer; - font-size: larger; - background-image: url($vlm-summary-plus); - background-size: 20px; - background-repeat: no-repeat; - width:20px; - height:20px; - margin-top: 3px; - margin-left: auto; - &:hover { - cursor: pointer; - background-image: url($vlm-summary-plus-blue); - } + .summary-name-and-count { + width: 100%; + } + .svg-icon-wrapper { + + .svg-icon { + &.__plusCircle { + width: 20px; + height: 20px; + margin-top: 3px; + margin-left: auto; + fill: $dark-gray; + &:hover { + fill: $blue; + } + } + } } .summary-name-and-count { @@ -205,7 +216,7 @@ $lkg-ep-color: $light-blue; } } .vlm-list-tab-panel { - + @extend .flex; margin-bottom: 7px; .section-title { @@ -221,6 +232,7 @@ $lkg-ep-color: $light-blue; margin-left:10px; cursor: pointer; } + /** .vlm-list-icon { background-size: 32px; background-repeat: no-repeat; @@ -237,7 +249,7 @@ $lkg-ep-color: $light-blue; background-image: url($vlm-summary-orphans-blue); } } - + **/ } } @@ -260,7 +272,7 @@ $lkg-ep-color: $light-blue; .vlm-list-item.orphan-list-item { @include overview-tile-shadow(); margin-left: 0; - + .vlm-list-item-title { .item-name { @@ -304,7 +316,7 @@ $lkg-ep-color: $light-blue; .clickable { cursor: pointer; } - + .list-item-section { .count-value { @extend .body-3; @@ -365,7 +377,7 @@ $lkg-ep-color: $light-blue; } .arrow-icon { align-self: center; - + } .vlm-item-info { flex: 1; @@ -424,7 +436,7 @@ $lkg-ep-color: $light-blue; @include create-circle($circle-icon-size,$fg-color,'FG'); color: $white; } - + .vlm-list-item-title { .item-name { color: $fg-color; @@ -465,7 +477,7 @@ $lkg-ep-color: $light-blue; margin-left: 52px; } } - + } &.vlm-list-item-lkg { margin-top: 10px; diff --git a/openecomp-ui/resources/scss/modules/_softwareProductAttachmentPage.scss b/openecomp-ui/resources/scss/modules/_softwareProductAttachmentPage.scss index bab2872691..0e092dd8bb 100644 --- a/openecomp-ui/resources/scss/modules/_softwareProductAttachmentPage.scss +++ b/openecomp-ui/resources/scss/modules/_softwareProductAttachmentPage.scss @@ -22,20 +22,7 @@ right: 40px; top: 15px; display: flex; - .icon-label { - color: $dark-gray; - } - .go-to-overview-icon { - .icon-label { - color: $blue; - } - &.disabled { - .icon-label { - color: $gray; - } - } - } .icon-component { margin-right: 30px; @@ -104,6 +91,11 @@ z-index: 1; padding-right: 20px; .counter { + .svg-icon { + &.__exclamationTriangleLine { + fill :$orange; + } + } display: flex; &:first-child { margin-right: 20px; @@ -145,8 +137,8 @@ justify-content: space-between; height: 40px; align-items: center; - .svg-icon-wrapper.chevronDown, .svg-icon-wrapper.chevronUp { - .svg-icon { + .svg-icon { + &.__chevronUp, &.__chevronDown { height: 10px; width: 10px; } @@ -224,6 +216,13 @@ .error-item { display: flex; margin: 10px 0; + .large { + .svg-icon { + width: 20px; + height: 20px; + fill: $orange; + } + } .error-item-file-type { margin-left: 15px; } @@ -231,6 +230,9 @@ @extend .body-1-semibold; margin-right: 5px; } + + + } } diff --git a/openecomp-ui/resources/scss/modules/_softwareProductComponentImage.scss b/openecomp-ui/resources/scss/modules/_softwareProductComponentImage.scss index 068404fcb6..dad837f356 100644 --- a/openecomp-ui/resources/scss/modules/_softwareProductComponentImage.scss +++ b/openecomp-ui/resources/scss/modules/_softwareProductComponentImage.scss @@ -16,6 +16,12 @@ } } +.vsp-components-image-editor { + .note-text { + color: $red; + } +} + .image-modal-edit, .image-modal-new { .modal-body { padding: 0; diff --git a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss index 56860101b2..9b0375d24a 100644 --- a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss +++ b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss @@ -28,21 +28,19 @@ .missing-license { display: flex; align-items: baseline; - .svg-icon-wrapper.exclamationTriangleFull .svg-icon{ - fill: $orange; + .svg-icon{ + margin-right: 7px; + margin-left: 3px; + &.__exclamationTriangleFull { + fill: $orange; + width: 17px; + height: 17px; + } } .warning-text { position: relative; top: -2px; } - .svg-icon-wrapper { - margin-right: 7px; - margin-left: 3px; - .svg-icon { - height: 17px; - width: 17px; - } - } } } .name { diff --git a/openecomp-ui/resources/scss/modules/_softwareproductComponentLoadBalancing.scss b/openecomp-ui/resources/scss/modules/_softwareproductComponentLoadBalancing.scss index ceae4a00de..d1f3f488bd 100644 --- a/openecomp-ui/resources/scss/modules/_softwareproductComponentLoadBalancing.scss +++ b/openecomp-ui/resources/scss/modules/_softwareproductComponentLoadBalancing.scss @@ -1,13 +1,7 @@ .vsp-components-load-balancing { .svg-icon-wrapper { position: relative; - top: -3px; - &.chevronUp, &.chevronDown { - .svg-icon { - width: 10px; - height: 10px; - } - } + top: -4px; } .halb-data { diff --git a/openecomp-ui/resources/scss/modules/_vspComponentMonitoring.scss b/openecomp-ui/resources/scss/modules/_vspComponentMonitoring.scss index 4bcf7940eb..bda8512f36 100644 --- a/openecomp-ui/resources/scss/modules/_vspComponentMonitoring.scss +++ b/openecomp-ui/resources/scss/modules/_vspComponentMonitoring.scss @@ -1,6 +1,6 @@ .vsp-component-monitoring { - .snmp-dropzone { + .dropzone { .section-title { padding-bottom: 20px; } @@ -22,7 +22,7 @@ } .drag-text { color: $blue; - @extend .body-1-semibold; + @extend .body-1-semibold } .or-text { margin-top: 10px; @@ -30,6 +30,20 @@ } } + .monitoring-file { + display: flex; + .filename { + opacity: 1; + width: auto; + border-right-style: none; + } + .delete { + display: flex; + width: 30px; + justify-content: center; + align-items: center; + } + } } .delete-button { diff --git a/openecomp-ui/resources/scss/modules/_vspHeatSetup.scss b/openecomp-ui/resources/scss/modules/_vspHeatSetup.scss index 75d96b4c85..bd216c794b 100644 --- a/openecomp-ui/resources/scss/modules/_vspHeatSetup.scss +++ b/openecomp-ui/resources/scss/modules/_vspHeatSetup.scss @@ -24,10 +24,12 @@ position: relative; top: -2px; } + .modules-list-wrapper { - padding-bottom: 20px; - margin-bottom: 20px; - border-bottom: 1px solid $tlv-light-gray; + &.modules-list-wrapper-divider { + border-bottom: 1px solid $tlv-light-gray; + } + ul { .undefined-dragging { opacity: 0.5; @@ -36,7 +38,7 @@ display: flex; justify-content: space-between; flex-wrap: wrap; - + padding-bottom: 3px; .Select-value-label { @include ellipsis(85%); } @@ -55,24 +57,6 @@ } } - .modules-list-controllers { - text-align: right; - .btn-link { - &[disabled] { - color: $gray; - } - @extend .body-1; - color: $blue; - &:last-child { - padding-right: 0; - } - &:hover { - color: $dark-blue; - text-decoration: none; - } - } - } - .modules-list-item-controllers { display: flex; justify-content: space-between; @@ -82,16 +66,15 @@ min-width: 0; } - .svg-icon-wrapper.trashO { - .svg-icon { - fill: $dark-gray; - height: 18px; - width: 18px; - &:hover { - fill: $black; + .svg-icon { + &.__trashO { + fill: $dark-gray; + &:hover { + fill: $black; + } } - } } + .module-title-by-type { @extend .heading-5-semibold; margin-right: 3px; @@ -100,15 +83,15 @@ display: flex; align-items: center; - .svg-icon-wrapper.pencil { - .svg-icon { - height: 15px; - width: 15px; + .svg-icon { + &.__pencil { + margin-left: 3px; + opacity: 0; } - margin-left: 3px; - opacity: 0; } + + .filename-text { @extend .heading-5-semibold; @@ -144,14 +127,16 @@ border-color: transparent; } } - .svg-icon-wrapper.pencil { - margin-left: 10px; - opacity: 1; - .svg-icon { - stroke: $dark-gray; - &:hover { - stroke: $black; - } + .svg-icon { + &.__pencil { + margin-left: 10px; + opacity: 1; + .svg-icon { + stroke: $dark-gray; + &:hover { + stroke: $black; + } + } } } } @@ -173,23 +158,8 @@ } } .add-or-delete-volumes { - .svg-icon-wrapper { - margin-right: 8px; - .svg-icon { - height: 10px; - width: 10px; - fill: $blue; - } - } - cursor: pointer; - color: $blue; + margin-right: 8px; margin-bottom: 11px; - &:hover { - color: $dark-blue; - .svg-icon { - fill: $dark-blue; - } - } } &:before { content: "\00B7\00B7\00B7\00B7\00B7\00B7"; @@ -208,7 +178,9 @@ .artifact-files { @include modules-and-artifacts-list-items; - margin-top: 20px; + &.with-list-items { + margin-top: 10px; + } &.nested { .nested-list { @@ -238,21 +210,20 @@ display: flex; } - .add-all-unassigned { - @extend .body-1; - margin-bottom: 0; - color: $blue; - cursor: pointer; - &:hover { - color: $dark-blue; - } - } } } } + .modules-list-header { + height: 30px; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-end; + align-items: baseline; + } + .unassigned-files { - margin-top: 30px; border: 1px solid $light-gray; background-color: $white; height: 250px; @@ -283,26 +254,12 @@ @extend .heading-4; margin-bottom: 10px; } - .link { - color: $blue; - cursor: pointer; - display: flex; - align-items: center; + .svg-icon-wrapper { margin-bottom: 10px; - .svg-icon-wrapper.angleRight { - .svg-icon { - height: 10px; - width: 10px; - margin-left: 7px; - fill: $blue; - } - } - &:hover { - color: $dark-blue; - .svg-icon-wrapper.angleRight { - .svg-icon { - fill: $dark-blue; - } + .svg-icon { + &.__angleRight { + width: 10px; + height: 10px; } } } diff --git a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss index 87a852f755..612ec495cd 100644 --- a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss +++ b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss @@ -79,36 +79,22 @@ width: 58px; margin-left: 122px; background-repeat: no-repeat; - .svg-icon-wrapper { - &.vendor { - .svg-icon { + .svg-icon { + &.__vendor { fill: $dark-gray; - width: 53px; - height: 47px; &:hover { fill: $dark-gray; } - } margin-top: 22px; - } - &.vsp { - .svg-icon { + &.__vsp { fill: $light-blue; - width: 60px; - height: 40px; } margin-top: 18px; margin-left: 3px; - } - &.vlm { + &.__vlm { margin-top: 18px; - .svg-icon { fill: $purple; - - width: 45px; - height: 53px; - } } } } @@ -121,13 +107,11 @@ margin-top: 2px; padding-bottom: 3px; @extend .body-2-semibold; - .svg-icon-wrapper { - &.plus { - .svg-icon { - height: 9px; - width: 9px; + .svg-icon { + &.__plus { + width: 20px; + height: 20px; fill: $blue; - } } } .catalog-tile-item-details { @@ -136,6 +120,13 @@ .catalog-tile-add-new-vsp { color: $blue; + .svg-icon { + &.__plus { + width: 20px; + height: 20px; + + } + } margin-left: 40px; } .catalog-tile-locking-user-name { @@ -143,18 +134,12 @@ @include ellipsis(auto, inline-block, 180px); } .catalog-tile-check-in-status { - .svg-icon-wrapper { - &.locked { - .svg-icon { - width: 11px; + .svg-icon { + &.__locked { fill: $gray; - } } - &.unlocked { - .svg-icon { - width: 11px; + &.__unlocked { fill: $gray; - } } } } diff --git a/openecomp-ui/resources/scss/modules/onboardingCatalog/_createItemTile.scss b/openecomp-ui/resources/scss/modules/onboardingCatalog/_createItemTile.scss index aa3cf04c4f..d17dcdd685 100644 --- a/openecomp-ui/resources/scss/modules/onboardingCatalog/_createItemTile.scss +++ b/openecomp-ui/resources/scss/modules/onboardingCatalog/_createItemTile.scss @@ -37,12 +37,14 @@ } } .create-item-plus-icon{ - width: 19px; - height: 19px; - margin: -5px 12px 0 0; - .svg-icon.plus { - height: 19px; - width: 19px; + margin: -5px 12px 0 0; + height: 19px; + width: 19px; + .svg-icon { + &.__plus { + width: 19px; + height: 19px; + } } } &.vlm-type { diff --git a/openecomp-ui/resources/scss/onboarding.scss b/openecomp-ui/resources/scss/onboarding.scss index b49a7cb423..94dc223be3 100644 --- a/openecomp-ui/resources/scss/onboarding.scss +++ b/openecomp-ui/resources/scss/onboarding.scss @@ -23,14 +23,14 @@ div[data-reactroot].customized-date-picker-calendar { width: 12px; height: 12px; margin-top: 2px; - content: url(../images/angle-left.svg); + content: url(../../node_modules/sdc-ui/assets/icons/angleLeft.svg); } .react-datepicker__navigation--next { border: none; width: 12px; height: 12px; margin-top: 2px; - content: url(../images/angle-right.svg); + content: url(../../node_modules/sdc-ui/assets/icons/angleRight.svg); } .react-datepicker__month-container { .react-datepicker__header { diff --git a/openecomp-ui/src/nfvo-components/SubmitErrorResponse.jsx b/openecomp-ui/src/nfvo-components/SubmitErrorResponse.jsx index 5fe592a663..1488c6c0bb 100644 --- a/openecomp-ui/src/nfvo-components/SubmitErrorResponse.jsx +++ b/openecomp-ui/src/nfvo-components/SubmitErrorResponse.jsx @@ -17,7 +17,6 @@ import React, {Component} from 'react'; import ListGroupItem from 'react-bootstrap/lib/ListGroupItem.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; -import Icon from 'nfvo-components/icon/Icon.jsx'; import {Collapse} from 'react-bootstrap'; /** * parsing and showing the following Java Response object @@ -145,8 +144,7 @@ class ErrorBlock extends React.Component { const ErrorHeader = ({errorType, collapsed, onClick}) => { return( <div onClick={onClick} className='error-block-header'> - <SVGIcon iconClassName={collapsed ? '' : 'right' } name='chevronDown'/> - {errorType} + <SVGIcon iconClassName={collapsed ? '' : 'collapse-right' } name='chevronDown' label={errorType} labelPosition='right'/> </div> ); }; @@ -154,7 +152,7 @@ const ErrorHeader = ({errorType, collapsed, onClick}) => { const ErrorMessage = ({error, warning}) => { return ( <ListGroupItem className='error-code-list-item'> - <Icon image={warning ? 'warning' : 'error'} label={error}/> + <SVGIcon name={warning ? 'warning' : 'error'} label={error} labelPosition='right' color={warning ? 'warning' : 'negative'} labelClassName='icon-label'/> </ListGroupItem> ); }; diff --git a/openecomp-ui/src/nfvo-components/fileupload/DraggableUploadFileBox.jsx b/openecomp-ui/src/nfvo-components/fileupload/DraggableUploadFileBox.jsx new file mode 100644 index 0000000000..629b9449a2 --- /dev/null +++ b/openecomp-ui/src/nfvo-components/fileupload/DraggableUploadFileBox.jsx @@ -0,0 +1,46 @@ +/*! + * 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. + */ +/** + * The HTML structure here is aligned with bootstrap HTML structure for form elements. + * In this way we have proper styling and it is aligned with other form elements on screen. + * + * Select and MultiSelect options: + * + * label - the label to be shown which paired with the input + * + * all other "react-select" props - as documented on + * http://jedwatson.github.io/react-select/ + * or + * https://github.com/JedWatson/react-select + */ +import React, {Component} from 'react'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import Button from 'sdc-ui/lib/react/Button.js'; + +class DraggableUploadFileBox extends Component { + render() { + let {className, onClick, dataTestId, isReadOnlyMode} = this.props; + return ( + <div + className={`${className}${isReadOnlyMode ? ' disabled' : ''}`}> + <div className={`${'drag-text'}${isReadOnlyMode ? ' disabled' : ''}`}>{i18n('Drag & drop for upload')}</div> + <div className='or-text'>{i18n('or')}</div> + <Button type='button' data-test-id={dataTestId} btnType='outline' onClick={onClick} disabled={isReadOnlyMode === true}>{i18n('Select File')}</Button> + </div> + ); + } +} +export default DraggableUploadFileBox; diff --git a/openecomp-ui/src/nfvo-components/input/ToggleInput.jsx b/openecomp-ui/src/nfvo-components/input/ToggleInput.jsx index 7bbafa3696..23af72a26a 100644 --- a/openecomp-ui/src/nfvo-components/input/ToggleInput.jsx +++ b/openecomp-ui/src/nfvo-components/input/ToggleInput.jsx @@ -41,6 +41,7 @@ class ToggleInput extends React.Component { render() { let {label, disabled} = this.props; let checked = this.status() === 'on'; + //TODO check onclick return ( <div className='toggle-input-wrapper form-group' onClick={!disabled && this.click}> <div className='toggle-input-label'>{label}</div> diff --git a/openecomp-ui/src/nfvo-components/listEditor/ListEditorView.jsx b/openecomp-ui/src/nfvo-components/listEditor/ListEditorView.jsx index cc805e9ada..df7d69b4ff 100644 --- a/openecomp-ui/src/nfvo-components/listEditor/ListEditorView.jsx +++ b/openecomp-ui/src/nfvo-components/listEditor/ListEditorView.jsx @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import React from 'react'; +import Button from 'sdc-ui/lib/react/Button.js'; import classnames from 'classnames'; import ExpandableInput from 'nfvo-components/input/ExpandableInput.jsx'; @@ -21,11 +22,9 @@ const ListEditorHeader = ({onAdd, isReadOnlyMode, title, plusButtonTitle}) => { return ( <div className='list-editor-view-header'> {title && <div className='list-editor-view-title'>{title}</div>} - <div className={`list-editor-view-add-controller${isReadOnlyMode ? ' disabled' : ''}`}> + <div> { onAdd && - <div className='list-editor-view-add-title' data-test-id='add-button' onClick={onAdd}> - <span>{`+ ${plusButtonTitle}`}</span> - </div> + <Button data-test-id='add-button' iconName='plusThin' btnType='link' onClick={onAdd} disabled={isReadOnlyMode === true}>{plusButtonTitle}</Button> } </div> </div> diff --git a/openecomp-ui/src/nfvo-components/modal/GlobalModal.js b/openecomp-ui/src/nfvo-components/modal/GlobalModal.js index 825cc609a8..e05c2ac616 100644 --- a/openecomp-ui/src/nfvo-components/modal/GlobalModal.js +++ b/openecomp-ui/src/nfvo-components/modal/GlobalModal.js @@ -31,21 +31,35 @@ const typeClass = { success: 'positive' }; +const type2HeaderColor = { + 'default': 'primary', + error: 'danger', + warning: 'warning', + success: 'success' +}; + -const ModalFooter = ({type, onConfirmed, onDeclined, onClose, confirmationButtonText, cancelButtonText}) => +const ModalFooter = ({type, onConfirmed, onDeclined, onClose, confirmationButtonText, cancelButtonText}) => { + let myPropsForNoConfirmed = {}; + if (onConfirmed) { + myPropsForNoConfirmed.btnType = 'outline'; + } + return ( <Modal.Footer> <div className='sdc-modal-footer'> {onConfirmed && <Button color={typeClass[type]} onClick={() => { onConfirmed(); onClose(); }}>{confirmationButtonText}</Button>} - <Button btnType='outline' color={typeClass[type]} onClick={onDeclined ? () => { + <Button {...myPropsForNoConfirmed} color={typeClass[type]} onClick={onDeclined ? () => { onDeclined(); onClose();} : () => onClose()}> {cancelButtonText} </Button> </div> - </Modal.Footer>; + </Modal.Footer> + ); +}; ModalFooter.defaultProps = { type: 'default', @@ -93,7 +107,7 @@ export class GlobalModalView extends React.Component { modalClassName, msg, onConfirmed, onDeclined, confirmationButtonText, cancelButtonText, onClose} = this.props; const ComponentToRender = modalContentComponents[modalComponentName]; return ( - <Modal show={show} bsSize={modalComponentProps && modalComponentProps.size} className={`onborading-modal ${modalClassName || ''} ${typeClass[type]}`}> + <Modal show={show} bsSize={modalComponentProps && modalComponentProps.size} className={`onborading-modal ${modalClassName || ''} ${type2HeaderColor[type]}`}> <Modal.Header> <Modal.Title>{title}</Modal.Title> </Modal.Header> diff --git a/openecomp-ui/src/nfvo-components/panel/NavigationSideBar.jsx b/openecomp-ui/src/nfvo-components/panel/NavigationSideBar.jsx index 3b89137090..fb3b71f0c8 100644 --- a/openecomp-ui/src/nfvo-components/panel/NavigationSideBar.jsx +++ b/openecomp-ui/src/nfvo-components/panel/NavigationSideBar.jsx @@ -109,6 +109,7 @@ function NavigationMenuItem(props) { function NavigationLink(props) { const {item, activeItemId, onClick} = props; + // todo should this be button return ( <div key={'navAction_' + item.id} diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx b/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx index ecfe7df116..922db05282 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx +++ b/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx @@ -154,7 +154,7 @@ function VCButton({name, tooltipText, isDisabled, onClick, dataTestId}) { return ( <OverlayTrigger placement='top' overlay={<Tooltip id='vc-tooltip'>{tooltipText}</Tooltip>}> <div disabled={disabled} className='action-buttons-svg'> - <SVGIcon data-test-id={dataTestId} iconClassName={disabled} onClick={onClickAction ? onClickAction : undefined} name={name}/> + <SVGIcon data-test-id={dataTestId} disabled={isDisabled} onClick={onClickAction ? onClickAction : undefined} name={name}/> </div> </OverlayTrigger> ); diff --git a/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx b/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx index 12e9a06623..3f8dbba53a 100644 --- a/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx +++ b/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx @@ -1,6 +1,7 @@ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; +import Button from 'sdc-ui/lib/react/Button.js'; import uuid from 'uuid-js'; export default class SelectActionTable extends React.Component { @@ -10,13 +11,14 @@ export default class SelectActionTable extends React.Component { return ( <div className={`select-action-table-view ${isReadOnlyMode ? 'disabled' : ''}`}> <div className='select-action-table-controllers'> - {onAdd && onAddItem && <div data-test-id='select-action-table-add' onClick={onAdd}>{onAddItem}</div>} + {onAdd && onAddItem && + <Button btnType='link' disabled={isReadOnlyMode === true} color='primary' iconName='plus' data-test-id='select-action-table-add' onClick={onAdd}>{onAddItem}</Button>} <SVGIcon name='trashO' className='dummy-icon' /> </div> <div className='select-action-table'> <div className='select-action-table-headers'> {columns.map(column => <div key={uuid.create()} className='select-action-table-header'>{i18n(column)}</div>)} - {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trashO' key={i} className='dummy-icon' />)} + {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trash-o' key={i} className='dummy-icon' />)} </div> <div className='select-action-table-body'> {children} diff --git a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx index 7df7d532e8..a03f8441a4 100644 --- a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx +++ b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx @@ -11,7 +11,7 @@ function tooltip (msg) { const IconWithOverlay = ({overlayMsg}) => ( <OverlayTrigger placement='bottom' overlay={tooltip(overlayMsg)}> - <SVGIcon name='errorCircle'/> + <SVGIcon name='errorCircle' color='negative'/> </OverlayTrigger> ); @@ -21,10 +21,10 @@ function renderErrorOrCheck({hasError, overlayMsg}) { } if (hasError) { - return overlayMsg ? <IconWithOverlay overlayMsg={overlayMsg}/> : <SVGIcon name='errorCircle'/>; + return overlayMsg ? <IconWithOverlay overlayMsg={overlayMsg}/> : <SVGIcon color='negative' name='errorCircle'/>; } - return <SVGIcon name='checkCircle'/>; + return <SVGIcon name='checkCircle' color='positive'/>; } const SelectActionTableRow = ({children, onDelete, hasError, hasErrorIndication, overlayMsg, showDelete}) => ( @@ -32,7 +32,7 @@ const SelectActionTableRow = ({children, onDelete, hasError, hasErrorIndication, <div className={`select-action-table-row ${hasError ? 'has-error' : ''}`}> {children} </div> - {onDelete && <SVGIcon name='trashO' iconClassName={(showDelete) ? '' : 'hideDelete'} data-test-id='select-action-table-delete' onClick={(showDelete) ? onDelete : null} />} + {onDelete && <SVGIcon color='secondary' name='trashO' data-test-id='select-action-table-delete' onClick={onDelete} iconClassName={(showDelete) ? '' : 'hideDelete'}/>} {hasErrorIndication && renderErrorOrCheck({hasError, overlayMsg})} </div> ); diff --git a/openecomp-ui/src/nfvo-utils/getValue.js b/openecomp-ui/src/nfvo-utils/getValue.js index e6871c094d..101655bf31 100644 --- a/openecomp-ui/src/nfvo-utils/getValue.js +++ b/openecomp-ui/src/nfvo-utils/getValue.js @@ -19,14 +19,26 @@ function getValueFromObject(element) { return element.choices && element.choices.length > 0 && element.choices[0] !== '' && element.choices[0] !== optionInputOther.OTHER || element.other && element.choices[0] === optionInputOther.OTHER ? element : undefined; -} +} function getValueFromVariable(variable) { return variable ? variable : undefined; } let getValue = element => { - return typeof element === 'object' ? getValueFromObject(element) : getValueFromVariable(element); + return typeof element === 'object' ? getValueFromObject(element) : getValueFromVariable(element); }; - export default getValue;
\ No newline at end of file +export function getStrValue(choiceObject) { + if (!choiceObject) { + return undefined; + } + if (choiceObject.choice && choiceObject.choice !== '' && choiceObject.choice !== optionInputOther.OTHER) { + return choiceObject.choice; + } + else if (choiceObject.other && choiceObject.choice === optionInputOther.OTHER) { + return choiceObject.other; + } +} + + export default getValue; diff --git a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx index 19ab570fd9..9abddea542 100644 --- a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx +++ b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx @@ -22,6 +22,7 @@ import i18n from 'nfvo-utils/i18n/i18n.js'; import LogDetails from './LogixUtil.jsx'; function ActivityLogSortableCellHeader({isHeader, data, isDes, onSort}) { + //TODO check icon sdc-ui if (isHeader) { return ( <span className='date-header' onClick={onSort}> @@ -51,7 +52,7 @@ function ActivityLogStatus({status, isHeader}) { return ( <span> <span className={`status-icon ${success}`}>{`${success ? i18n('Success') : i18n('Failure')}`}</span> - {success && <SVGIcon name='checkCircle'/>} + {success && <SVGIcon name='checkCircle' color='positive'/>} {!success && <OverlayTrigger placement='bottom' overlay={<Tooltip className='activity-log-message-tooltip' id={'activity-log-message-tooltip'}> <div className='message-block'>{message}</div> </Tooltip>}> diff --git a/openecomp-ui/src/sdc-app/common/helpers/ValidationHelper.js b/openecomp-ui/src/sdc-app/common/helpers/ValidationHelper.js index 51dfcf9a67..cfa675278f 100644 --- a/openecomp-ui/src/sdc-app/common/helpers/ValidationHelper.js +++ b/openecomp-ui/src/sdc-app/common/helpers/ValidationHelper.js @@ -51,10 +51,11 @@ class ValidationHelper { }); } - static qValidateForm(dispatch, qName){ + static qValidateForm(dispatch, qName, customValidations){ dispatch({ type: qcommonActionTypes.VALIDATE_FORM, - qName + qName, + customValidations }); } diff --git a/openecomp-ui/src/sdc-app/common/reducers/JSONSchemaReducer.js b/openecomp-ui/src/sdc-app/common/reducers/JSONSchemaReducer.js index 35b2f936ce..916f724b40 100644 --- a/openecomp-ui/src/sdc-app/common/reducers/JSONSchemaReducer.js +++ b/openecomp-ui/src/sdc-app/common/reducers/JSONSchemaReducer.js @@ -99,8 +99,8 @@ function updateSchemaDataAndValidateReducer (state = {}, action, questionnaireNa genericFieldInfoClone = {...state.qgenericFieldInfo}; let formReady = true; forOwn(state.qgenericFieldInfo,(value, key) => { - let val = state.data[key] ? state.data[key] : ''; - let result = Validator.validate(key, val, state.qgenericFieldInfo[key].validations, state, {}); + let val = state.dataMap[key] ? state.dataMap[key] : ''; + let result = Validator.validate(key, val, state.qgenericFieldInfo[key].validations, state, action.customValidations); genericFieldInfoClone[key] = {...genericFieldInfoClone[key], isValid: result.isValid, errorText: result.errorText}; if (!result.isValid) { formReady = false; diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js index dad930127b..24ba05e303 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js @@ -275,6 +275,13 @@ export default { version }); setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, {softwareProductId, version, componentId}); + }, + + updateCurrentScreenVersion(dispatch, version) { + dispatch({ + type: actionTypes.SET_CURRENT_SCREEN_VERSION, + version + }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js index 0fff513cc5..1ce8605b63 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js @@ -19,7 +19,8 @@ export const DATE_FORMAT = 'MM/DD/YYYY'; export const actionTypes = keyMirror({ SET_CURRENT_SCREEN: null, - SET_CURRENT_LICENSE_MODEL: null + SET_CURRENT_LICENSE_MODEL: null, + SET_CURRENT_SCREEN_VERSION: null, }); export const enums = keyMirror({ diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js index 46fc58db95..e63bcb16af 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js @@ -16,9 +16,19 @@ import {actionTypes, enums} from './OnboardingConstants.js'; export const currentScreenReducer = (state = {forceBreadCrumbsUpdate: false, screen: enums.SCREEN.ONBOARDING_CATALOG, props: {}}, action) => { - if (action.type === actionTypes.SET_CURRENT_SCREEN) { - return action.currentScreen; - } - return state; + switch (action.type) { + case actionTypes.SET_CURRENT_SCREEN: + return action.currentScreen; + case actionTypes.SET_CURRENT_SCREEN_VERSION: + return { + ...state, + props: { + ...state.props, + version: action.version + } + }; + default: + return state; + } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js index 186f1cbc7b..788528fd75 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js @@ -23,6 +23,7 @@ import LicenseAgreementActionHelper from './licenseAgreement/LicenseAgreementAct import FeatureGroupsActionHelper from './featureGroups/FeatureGroupsActionHelper.js'; import EntitlementPoolsActionHelper from './entitlementPools/EntitlementPoolsActionHelper.js'; import LicenseKeyGroupsActionHelper from './licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; +import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js'; function baseUrl() { const restPrefix = Configuration.get('restPrefix'); @@ -140,6 +141,8 @@ const LicenseModelActionHelper = { newVersionId = adjustMajorVersion(version.label, 1); } + OnboardingActionHelper.updateCurrentScreenVersion(dispatch, {label: newVersionId, id: newVersionId}); + LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version:{id: newVersionId, label: newVersionId}}); return Promise.resolve({id: newVersionId, label: newVersionId}); }); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js index a371d5635e..ce4327d810 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js @@ -18,7 +18,7 @@ import Configuration from 'sdc-app/config/Configuration.js'; import {actionTypes as entitlementPoolsActionTypes } from './EntitlementPoolsConstants.js'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js'; -import getValue from 'nfvo-utils/getValue.js'; +import {default as getValue, getStrValue} from 'nfvo-utils/getValue.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -26,17 +26,16 @@ function baseUrl(licenseModelId, version) { return `${restPrefix}/v1.0/vendor-license-models/${licenseModelId}/versions/${versionId}/entitlement-pools`; } -function fetchEntitlementPoolsList(licenseModelId, version) { +function fetchEntitlementPoolsList(licenseModelId, version) { return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`); } -function postEntitlementPool(licenseModelId, entitlementPool, version) { +function postEntitlementPool(licenseModelId, entitlementPool, version) { return RestAPIUtil.post(baseUrl(licenseModelId, version), { name: entitlementPool.name, description: entitlementPool.description, thresholdValue: entitlementPool.thresholdValue, thresholdUnits: getValue(entitlementPool.thresholdUnits), - entitlementMetric: entitlementPool.entitlementMetric, increments: entitlementPool.increments, operationalScope: getValue(entitlementPool.operationalScope), time: entitlementPool.time, @@ -47,13 +46,12 @@ function postEntitlementPool(licenseModelId, entitlementPool, version) { function putEntitlementPool(licenseModelId, previousEntitlementPool, entitlementPool, version) { - + return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${entitlementPool.id}`, { name: entitlementPool.name, description: entitlementPool.description, thresholdValue: entitlementPool.thresholdValue, thresholdUnits: getValue(entitlementPool.thresholdUnits), - entitlementMetric: entitlementPool.entitlementMetric, increments: entitlementPool.increments, operationalScope: getValue(entitlementPool.operationalScope), time: entitlementPool.time, @@ -66,39 +64,39 @@ function deleteEntitlementPool(licenseModelId, entitlementPoolId, version) { return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}`); } -function fetchLimitsList(licenseModelId, entitlementPoolId, version) { +function fetchLimitsList(licenseModelId, entitlementPoolId, version) { return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits`); } -function deleteLimit(licenseModelId, entitlementPoolId, version, limitId) { +function deleteLimit(licenseModelId, entitlementPoolId, version, limitId) { return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits/${limitId}`); } -function postLimit(licenseModelId, entitlementPoolId, version, limit) { +function postLimit(licenseModelId, entitlementPoolId, version, limit) { return RestAPIUtil.post(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits`, { name: limit.name, type: limit.type, description: limit.description, - metric: limit.metric, + metric: getStrValue(limit.metric), value: limit.value, - unit: limit.unit, + unit: getStrValue(limit.unit), aggregationFunction: getValue(limit.aggregationFunction), time: getValue(limit.time) }); } function putLimit(licenseModelId, entitlementPoolId, version, limit) { - + return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits/${limit.id}`, { name: limit.name, type: limit.type, description: limit.description, - metric: limit.metric, + metric: getStrValue(limit.metric), value: limit.value, - unit: limit.unit, + unit: getStrValue(limit.unit), aggregationFunction: getValue(limit.aggregationFunction), time: getValue(limit.time) - }); + }); } export default { @@ -191,10 +189,10 @@ export default { type: entitlementPoolsActionTypes.entitlementPoolsEditor.LIMITS_LIST_LOADED, response }); - }); + }); }, - submitLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { + submitLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { const propmise = limit.id ? putLimit(licenseModelId,entitlementPool.id, version, limit) : postLimit(licenseModelId,entitlementPool.id, version, limit); return propmise.then(() => { @@ -202,12 +200,12 @@ export default { type: limitEditorActions.CLOSE }); this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); - }); + }); }, - deleteLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { + deleteLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { return deleteLimit(licenseModelId,entitlementPool.id, version, limit.id).then(() => { - this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); - }); + this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); + }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx index 9844290a25..497c29d14c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx @@ -97,24 +97,23 @@ class FeatureGroupListEditorView extends React.Component { <div className='text name'>{name}</div> </div> - <div className='list-editor-item-view-field'> + <div className='list-editor-item-view-field smaller-field'> <div className='feature-groups-count-field'> - <div className='title'>{i18n('Entitlement')}</div> - <div className='title'>{i18n('Pools')}</div> + <div className='title'>{i18n('EP')}</div> <div className='feature-groups-count-ep'>{entitlementPoolsIds.length || 0}</div> </div> + </div> + <div className='list-editor-item-view-field smaller-field'> <div className='feature-groups-count-field'> - <div className='title'>{i18n('License key')}</div> - <div className='title'>{i18n('Groups')}</div> + <div className='title'>{i18n('LKG')}</div> <div className='feature-groups-count-lk'>{licenseKeyGroupsIds.length || 0}</div> </div> </div> <div className='list-editor-item-view-field'> <div className='feature-groups-count-field'> - <div className='title'>{i18n('Manufacturer Reference')}</div> - <div className='title'>{i18n('Number')}</div> - <div className='feature-groups-count-ep'>{manufacturerReferenceNumber}</div> + <div className='title title-no-wrap'>{i18n('Manufacturer Reference Number')}</div> + <div className='feature-groups-mrn-ep'>{manufacturerReferenceNumber}</div> </div> </div> @@ -122,8 +121,8 @@ class FeatureGroupListEditorView extends React.Component { <div className='title'>{i18n('Description')}</div> <div className='text description'>{description}</div> </div> - - + + </ListEditorItemView> ); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js index f5017f6d7a..f22080a75c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js @@ -18,7 +18,7 @@ import Configuration from 'sdc-app/config/Configuration.js'; import {actionTypes as licenseKeyGroupsConstants} from './LicenseKeyGroupsConstants.js'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js'; -import getValue from 'nfvo-utils/getValue.js'; +import {default as getValue, getStrValue} from 'nfvo-utils/getValue.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -75,9 +75,9 @@ function postLimit(licenseModelId, licenseKeyGroupId, version, limit) { name: limit.name, type: limit.type, description: limit.description, - metric: limit.metric, + metric: getStrValue(limit.metric), value: limit.value, - unit: limit.unit, + unit: getStrValue(limit.unit), aggregationFunction: getValue(limit.aggregationFunction), time: getValue(limit.time) }); @@ -89,9 +89,9 @@ function putLimit(licenseModelId, licenseKeyGroupId, version, limit) { name: limit.name, type: limit.type, description: limit.description, - metric: limit.metric, + metric: getStrValue(limit.metric), value: limit.value, - unit: limit.unit, + unit: getStrValue(limit.unit), aggregationFunction: getValue(limit.aggregationFunction), time: getValue(limit.time) }); @@ -181,8 +181,8 @@ export default { dispatch({ type: licenseKeyGroupsConstants.licenseKeyGroupsEditor.LIMITS_LIST_LOADED, response - }); - }); + }); + }); }, submitLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) { @@ -193,13 +193,13 @@ export default { type: limitEditorActions.CLOSE }); this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); - }); + }); }, deleteLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) { return deleteLimit(licenseModelId,licenseKeyGroup.id, version, limit.id).then(() => { this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); - }); + }); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx index f70f917725..5c4e50d673 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx @@ -7,16 +7,24 @@ import GridItem from 'nfvo-components/grid/GridItem.jsx'; import {LIMITS_FORM_NAME, selectValues} from './LimitEditorConstants.js'; import Button from 'sdc-ui/lib/react/Button.js'; import Validator from 'nfvo-utils/Validator.js'; +import {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; const LimitPropType = React.PropTypes.shape({ id: React.PropTypes.string, name: React.PropTypes.string, description: React.PropTypes.string, - metric: React.PropTypes.string, - value: React.PropTypes.number, + metric: React.PropTypes.shape({ + choice: React.PropTypes.string, + other: React.PropTypes.string + }), + value: React.PropTypes.string, aggregationFunction: React.PropTypes.string, time: React.PropTypes.string, - unit: React.PropTypes.number + unit: React.PropTypes.shape({ + choice: React.PropTypes.string, + other: React.PropTypes.string + }) }); class LimitEditor extends React.Component { @@ -33,8 +41,8 @@ class LimitEditor extends React.Component { onCancel: React.PropTypes.func.isRequired }; - componentDidUpdate(prevProps) { - if (this.props.formReady && this.props.formReady !== prevProps.formReady) { + componentDidUpdate(prevProps) { + if (this.props.formReady && this.props.formReady !== prevProps.formReady) { this.submit(); } } @@ -44,21 +52,21 @@ class LimitEditor extends React.Component { let {name, description, metric, value, aggregationFunction, time, unit} = data; return ( <div className='limit-editor'> - {!data.id && + {!data.id && <div className='limit-editor-title'> {data.name ? data.name : i18n('NEW LIMIT')} </div>} { - genericFieldInfo && + genericFieldInfo && <Form ref='validationForm' - hasButtons={false} + hasButtons={false} isValid={isFormValid} formReady={formReady} onValidateForm={() => onValidateForm(LIMITS_FORM_NAME) } labledButtons={false} isReadOnlyMode={isReadOnlyMode} - className='limit-editor-form'> + className='limit-editor-form'> <GridSection className='limit-editor-form-grid-section'> <GridItem colSpan={2}> <Input @@ -83,24 +91,23 @@ class LimitEditor extends React.Component { type='text'/> </GridItem> <GridItem colSpan={2}> - <Input - onChange={e => { - const selectedIndex = e.target.selectedIndex; - const val = e.target.options[selectedIndex].value; - onDataChanged({metric: val}, LIMITS_FORM_NAME);} - } + <InputOptions + onInputChange={()=>{}} + isMultiSelect={false} isRequired={true} - value={metric} + onEnumChange={metric => onDataChanged({metric:{choice: metric, other: ''}}, + LIMITS_FORM_NAME, {metric: this.validateChoiceWithOther})} + onOtherChange={metric => onDataChanged({metric:{choice: optionInputOther.OTHER, + other: metric}}, LIMITS_FORM_NAME, {metric: this.validateChoiceWithOther})} label={i18n('Metric')} data-test-id='limit-editor-metric' + type='select' + required={true} + selectedEnum={metric && metric.choice} + otherValue={metric && metric.other} + values={selectValues.METRIC} isValid={genericFieldInfo.metric.isValid} - errorText={genericFieldInfo.metric.errorText} - groupClassName='bootstrap-input-options' - className='input-options-select' - type='select' > - {selectValues.METRIC.map(mtype => - <option key={mtype.enum} value={mtype.enum}>{`${mtype.title}`}</option>)} - </Input> + errorText={genericFieldInfo.metric.errorText} /> </GridItem> <GridItem> <Input @@ -111,22 +118,30 @@ class LimitEditor extends React.Component { isValid={genericFieldInfo.value.isValid} errorText={genericFieldInfo.value.errorText} isRequired={true} - type='number'/> + type='text'/> </GridItem> <GridItem> - <Input - onChange={unit => onDataChanged({unit}, LIMITS_FORM_NAME)} + <InputOptions + onInputChange={()=>{}} + isMultiSelect={false} + isRequired={false} + onEnumChange={unit => onDataChanged({unit:{choice: unit, other: ''}}, + LIMITS_FORM_NAME)} + onOtherChange={unit => onDataChanged({unit:{choice: optionInputOther.OTHER, + other: unit}}, LIMITS_FORM_NAME)} label={i18n('Units')} data-test-id='limit-editor-units' - value={unit} + type='select' + required={false} + selectedEnum={unit && unit.choice} + otherValue={unit && unit.other} + values={selectValues.UNIT} isValid={genericFieldInfo.unit.isValid} - errorText={genericFieldInfo.unit.errorText} - isRequired={false} - type='number'/> + errorText={genericFieldInfo.unit.errorText} /> </GridItem> <GridItem colSpan={2}> <Input - onChange={e => { + onChange={e => { const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onDataChanged({aggregationFunction: val}, LIMITS_FORM_NAME);} @@ -145,7 +160,7 @@ class LimitEditor extends React.Component { </GridItem> <GridItem> <Input - onChange={e => { + onChange={e => { const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onDataChanged({time: val}, LIMITS_FORM_NAME);} @@ -160,15 +175,15 @@ class LimitEditor extends React.Component { type='select' > {selectValues.TIME.map(mtype => <option key={mtype.enum} value={mtype.enum}>{`${mtype.title}`}</option>)} - </Input> + </Input> </GridItem> </GridSection> <GridSection className='limit-editor-buttons'> - <Button btnType='outline' disabled={!isFormValid} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button> + <Button btnType='outline' disabled={!isFormValid} onClick={() => this.submit()} type='reset'>{i18n('Save')}</Button> <Button btnType='outline' color='gray' onClick={onCancel} type='reset'>{i18n('Cancel')}</Button> - </GridSection> - </Form> - } + </GridSection> + </Form> + } </div> ); } @@ -181,6 +196,24 @@ class LimitEditor extends React.Component { {isValid: false, errorText: i18n('Limit by the name \'' + value + '\' already exists. Limit name must be unique')}; } + validateChoiceWithOther(value) { + let chosen = value.choice; + // if we have an empty multiple select we have a problem since it's required + if (value.choices) { + if (value.choices.length === 0) { + return Validator.validate('field', '', [{type: 'required', data: true}]); + } else { + // continuing validation with the first chosen value in case we have the 'Other' field + chosen = value.choices[0]; + } + } + if (chosen !== optionInputOther.OTHER) { + return Validator.validate('field', chosen, [{type: 'required', data: true}]); + } else { // when 'Other' was chosen, validate other value + return Validator.validate('field', value.other, [{type: 'required', data: true}]); + } + } + submit() { if (!this.props.formReady) { this.props.onValidateForm(LIMITS_FORM_NAME); @@ -190,4 +223,4 @@ class LimitEditor extends React.Component { } } -export default LimitEditor;
\ No newline at end of file +export default LimitEditor; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js index 09c64ada62..8ac845a1a7 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js @@ -14,17 +14,41 @@ * permissions and limitations under the License. */ -import {actionTypes} from './LimitEditorConstants.js'; +import {actionTypes, selectValues} from './LimitEditorConstants.js'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; const LimitEditorActionHelper = { openLimitsEditor(dispatch, {limit}) { - dispatch({type: actionTypes.OPEN, limitItem: limit}); + let modifiedLimit = {...limit}; + if (limit && limit.metric) { + modifiedLimit.metric = LimitEditorActionHelper.createChoiceObject(modifiedLimit.metric, selectValues.METRIC); + } + if (limit && limit.unit) { + modifiedLimit.unit = LimitEditorActionHelper.createChoiceObject(modifiedLimit.unit, selectValues.UNIT); + } + dispatch({type: actionTypes.OPEN, limitItem: modifiedLimit}); }, closeLimitsEditor(dispatch) { dispatch({type: actionTypes.CLOSE}); + }, + + createChoiceObject(value, optionsList) { + let option = optionsList.find(function(item) { return item.enum === value; }); + if (!option) { + return { + choice: optionInputOther.OTHER, + other: value + }; + } + else { + return { + choice: value, + other: '' + }; + } } }; -export default LimitEditorActionHelper;
\ No newline at end of file +export default LimitEditorActionHelper; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js index 1bef286442..9829e696c3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js @@ -13,18 +13,25 @@ export const LIMITS_FORM_NAME = 'LIMITSFORM'; export const selectValues = { METRIC: [ {enum: '', title: i18n('please select…')}, - {enum: 'Software_Instances_Count', title: 'Software Instances'}, - {enum: 'Core', title: 'Core'}, - {enum: 'CPU', title: 'CPU'}, - {enum: 'Trunks', title: 'Trunks'}, - {enum: 'User', title: 'User'}, - {enum: 'Subscribers', title: 'Subscribers'}, - {enum: 'Tenants', title: 'Tenants'}, - {enum: 'Tokens', title: 'Tokens'}, - {enum: 'Seats', title: 'Seats'}, - {enum: 'Units_TB', title: 'Units-TB'}, - {enum: 'Units_GB', title: 'Units-GB'}, - {enum: 'Units_MB', title: 'Units-MB'} + {enum: 'BWTH', title: 'BWTH'}, + {enum: 'Country', title: 'Country'}, + {enum: 'Session', title: 'Session'}, + {enum: 'LoB', title: 'LoB'}, + {enum: 'Site', title: 'Site'}, + {enum: 'Usage', title: 'Usage'} + ], + UNIT: [ + {enum: '', title: i18n('please select…')}, + {enum: 'trunk', title: 'Trunks'}, + {enum: 'user', title: 'Users'}, + {enum: 'subscriber', title: 'Subscribers'}, + {enum: 'session', title: 'Sessions'}, + {enum: 'tenant', title: 'Tenants'}, + {enum: 'token', title: 'Tokens'}, + {enum: 'seats', title: 'Seats'}, + {enum: 'TB', title: 'TB'}, + {enum: 'GB', title: 'GB'}, + {enum: 'MB', title: 'MB'} ], AGGREGATION_FUNCTION: [ {enum: '', title: i18n('please select…')}, @@ -33,11 +40,14 @@ export const selectValues = { ], TIME: [ {enum: '', title: i18n('please select…')}, - {enum: 'Hour', title: 'Hour'}, {enum: 'Day', title: 'Day'}, - {enum: 'Month', title: 'Month'} + {enum: 'Month', title: 'Month'}, + {enum: 'Hour', title: 'Hour'}, + {enum: 'Minute', title: 'Minute'}, + {enum: 'Second', title: 'Second'}, + {enum: 'Milli-Second', title: 'Milli-Second'} ] - + }; export const limitType = { @@ -46,7 +56,9 @@ export const limitType = { }; export const defaultState = { - LIMITS_EDITOR_DATA: {} + LIMITS_EDITOR_DATA: { + metric: {choice: '', other: ''}, + } }; -export const NEW_LIMIT_TEMP_ID = 'NEW_LIMIT_TEMP_ID';
\ No newline at end of file +export const NEW_LIMIT_TEMP_ID = 'NEW_LIMIT_TEMP_ID'; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js index 2499093af2..de9e7c8c38 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js @@ -20,7 +20,7 @@ export default (state = {}, action) => { switch (action.type) { case actionTypes.OPEN: return { - ...state, + ...state, data: action.limitItem ? {...action.limitItem} : defaultState.LIMITS_EDITOR_DATA, formReady: null, formName: LIMITS_FORM_NAME, @@ -38,17 +38,17 @@ export default (state = {}, action) => { 'metric' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] + validations: [] }, 'value' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'numeric', data: true}, {type: 'minimum', data: 0}] + validations: [{type: 'required', data: true}] }, 'unit' : { isValid: true, errorText: '', - validations: [{type: 'numeric', data: true}] + validations: [] }, 'aggregationFunction' : { isValid: true, @@ -67,4 +67,4 @@ export default (state = {}, action) => { default: return state; } -};
\ No newline at end of file +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx index ec5a1dff72..b144f63968 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx @@ -17,40 +17,43 @@ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import LimitEditor from './LimitEditor.js'; +import LimitEditor from './LimitEditor.js'; import {NEW_LIMIT_TEMP_ID, selectValues} from './LimitEditorConstants.js'; const LimitItem = ({isReadOnlyMode, limit, onDelete, onSelect}) => { - const {name, description, metric, value, aggregationFunction = '', time = ''} = limit; + const {name, description, value, metric, aggregationFunction = '', time = ''} = limit; const timeLabel = time ? `per ${time}` : ''; + let metricOption = selectValues.METRIC.find(item => item.enum === metric); + metricOption = metricOption ? metricOption.title : metric; + return ( - <ListEditorItemView + <ListEditorItemView onDelete={onDelete} onSelect={onSelect} isReadOnlyMode={isReadOnlyMode}> - <div className='list-editor-item-view-field limit-name'> + <div className='list-editor-item-view-field limit-name'> <div className='text name'>{name}</div> </div> - <div className='list-editor-item-view-field limit-description'> + <div className='list-editor-item-view-field limit-description'> <div className='text description'>{description}</div> </div> - <div className='list-editor-item-view-field limit-metric-details'> - <div className='text description'>{`${selectValues.METRIC.find(item => item.enum === metric).title} ${value} ${aggregationFunction} ${timeLabel}`}</div> - </div> + <div className='list-editor-item-view-field limit-metric-details'> + <div className='text description'>{`${metricOption} ${value} ${aggregationFunction} ${timeLabel}`}</div> + </div> </ListEditorItemView> ); }; class Limits extends React.Component { - + state = { localFilter: '' }; - render() { + render() { const {isReadOnlyMode = false, limitEditor, limitsList = [], onCloseLimitEditor, selectedLimit} = this.props; let limitsNames = {}; for (let i = 0; i < limitsList.length; i++) { @@ -66,26 +69,26 @@ class Limits extends React.Component { {limitsList.length === 0 && !limitEditor.data && <div className='no-limits-text'>{i18n('There are no limits')}</div>} {limitsList.map(limit => <div key={limit.id} className='limit-item-wrapper'> - <LimitItem - onDelete={() => this.delete(limit)} + <LimitItem + onDelete={() => this.deleteLimit(limit)} onSelect={selectedLimit ? undefined : () => this.props.onSelectLimit(limit)} - clickable={!selectedLimit} - isReadOnlyMode={isReadOnlyMode} + clickable={!selectedLimit} + isReadOnlyMode={isReadOnlyMode} limit={limit}/> {limit.id === selectedLimit && limitEditor.data && <LimitEditor limitsNames={limitsNames} onCancel={onCloseLimitEditor} onSubmit={ () => this.submit()}/>} </div> )} </ListEditorView> - + </div> ); } submit() { - let {onSubmit, onCloseLimitEditor, parent, limitEditor, licenseModelId, version, limitType} = this.props; + let {onSubmit, onCloseLimitEditor, parent, limitEditor, licenseModelId, version, limitType} = this.props; onSubmit({type: limitType, ...limitEditor.data}, parent, licenseModelId, version).then(() => onCloseLimitEditor()); } - delete(limit) { + deleteLimit(limit) { let {onDelete, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit} = this.props; onDelete({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx index 0c0103fc10..9232402b75 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx @@ -18,6 +18,7 @@ import Input from 'nfvo-components/input/validation/Input.jsx'; class LicenseModelDescriptionEdit extends React.Component { render() { + //TODO check if buttons let {onDataChanged, description, genericFieldInfo} = this.props; let saveButtonClassName = (genericFieldInfo.description.isValid) ? 'description-save' : 'description-save disabled'; return( diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx index 66f2cc6838..6ec84e16ca 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx @@ -14,15 +14,17 @@ * permissions and limitations under the License. */ import React from 'react'; +import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; function SummaryCountItem ({name, counter, onAdd, onNavigate, isReadOnlyMode}) { + //TODO check for buttons return( <div className='summary-count-item'> <div className='summary-name-and-count' onClick={onNavigate}> <span className='item-name' onClick={onNavigate}>{name}</span> <span className='item-count' onClick={onNavigate} data-test-id={'vlm-summary-vendor-counter-' + name.toLowerCase().replace(/\s/g,'-')}>({counter})</span> </div> - <div className={isReadOnlyMode ? 'add-button disabled' : 'add-button'} onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/> + <SVGIcon name='plusCircle' disabled={isReadOnlyMode} color='secondary' onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/> </div> ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js index 87559901b3..deb4550347 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js @@ -18,6 +18,7 @@ import {connect} from 'react-redux'; import Tooltip from 'react-bootstrap/lib/Tooltip.js'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger.js'; +import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import licenseModelOverviewActionHelper from '../licenseModelOverviewActionHelper.js'; import LicenseModelActionHelper from '../../LicenseModelActionHelper.js'; @@ -70,6 +71,7 @@ export class VendorDataView extends Component { {this.renderOverlay( <div className='description-data' data-test-id='vlm-summary-vendor-description'> {description} + <SVGIcon name='pencil'/> </div> )} </div> diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx index 51702e6d36..7664f6abaa 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx @@ -40,6 +40,7 @@ const CatalogList = ({children, onAddVLM, onAddVSP, vendorPageOptions}) => ( ); const CreateItemTile = ({onClick, dataTestId, title, className = ''}) => { + //TODO check for buttons return ( <div className={'create-catalog-item tile ' + className} onClick={() => onClick()} data-test-id={dataTestId}> <div className='create-item-plus-icon'><SVGIcon name='plus' /></div> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 90a2bb8f2e..d4bee0a876 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -409,6 +409,7 @@ const SoftwareProductActionHelper = { } }); const newVersionId = adjustMajorVersion(version.label, 1); + OnboardingActionHelper.updateCurrentScreenVersion(dispatch, {label: newVersionId, id: newVersionId}); SoftwareProductActionHelper.fetchSoftwareProduct(dispatch,{softwareProductId, version: {id: newVersionId}}); return Promise.resolve({newVersion: {id: newVersionId}}); }); @@ -438,6 +439,7 @@ const SoftwareProductActionHelper = { newVersionId = adjustMinorVersion(version.label, -1); break; } + OnboardingActionHelper.updateCurrentScreenVersion(dispatch, {label: newVersionId, id: newVersionId}); SoftwareProductActionHelper.fetchSoftwareProduct(dispatch,{softwareProductId, version:{id: newVersionId}}); return Promise.resolve({newVersion: {id: newVersionId}}); }); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx index ef4aecf568..3da26cc20f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -18,7 +18,7 @@ import Tabs from 'react-bootstrap/lib/Tabs.js'; import Tab from 'react-bootstrap/lib/Tab.js'; import {tabsMapping} from './SoftwareProductAttachmentsConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import Icon from 'nfvo-components/icon/Icon.jsx'; +import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import HeatValidation from './validation/HeatValidation.js'; class HeatScreenView extends Component { @@ -38,27 +38,32 @@ class HeatScreenView extends Component { <div className='vsp-attachments-view'> <div className='attachments-view-controllers'> {(this.state.activeTab === tabsMapping.SETUP) && - <Icon - iconClassName={heatDataExist ? '' : 'disabled'} - className={heatDataExist ? '' : 'disabled'} - image='download' + <SVGIcon + disabled={heatDataExist ? false : true} + name='download' + className='icon-component' label={i18n('Download HEAT')} + labelPosition='right' + color='secondary' onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} data-test-id='download-heat'/>} {(this.state.activeTab === tabsMapping.VALIDATION && softwareProductId) && - <Icon - iconClassName={this.props.goToOverview ? '' : 'disabled'} - className={`go-to-overview-icon ${this.props.goToOverview ? '' : 'disabled'}`} - labelClassName='go-to-overview-label' + <SVGIcon + disabled={this.props.goToOverview !== true} onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined} - image='go-to-overview' + name='proceedToOverview' + className='icon-component' label={i18n('Go to Overview')} + labelPosition='right' + color={this.props.goToOverview ? 'primary' : 'secondary'} data-test-id='go-to-overview'/>} - <Icon - image='upload' + <SVGIcon + name='upload' + className='icon-component' label={i18n('Upload New HEAT')} - className={isReadOnlyMode ? 'disabled' : ''} - iconClassName={isReadOnlyMode ? 'disabled' : ''} + labelPosition='right' + color='secondary' + disabled={isReadOnlyMode} onClick={evt => {this.refs.hiddenImportFileInput.click(evt);}} data-test-id='upload-heat'/> <input @@ -87,9 +92,9 @@ class HeatScreenView extends Component { } handleTabPress(key) { - let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version} = this.props; + let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version} = this.props; switch (key) { - case tabsMapping.VALIDATION: + case tabsMapping.VALIDATION: onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then( () => this.setState({activeTab: tabsMapping.VALIDATION}) ); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx index 901a583e24..17b3179d01 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx @@ -20,7 +20,6 @@ import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger.js'; import FormControl from 'react-bootstrap/lib/FormControl.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import SelectInput from 'nfvo-components/input/SelectInput.jsx'; -import Icon from 'nfvo-components/icon/Icon.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import {fileTypes} from './HeatSetupConstants.js'; import {tabsMapping} from '../SoftwareProductAttachmentsConstants.js'; @@ -52,7 +51,7 @@ class SortableModuleFileList extends Component { render() { - let {unassigned, onModuleRename, onModuleDelete, onModuleAdd, onBaseAdd, onModuleFileTypeChange, isBaseExist} = this.props; + let {unassigned, onModuleRename, onModuleDelete, onModuleAdd, onBaseAdd, onModuleFileTypeChange, isBaseExist, isReadOnlyMode} = this.props; const childProps = module => ({ module, onModuleRename, @@ -68,19 +67,17 @@ class SortableModuleFileList extends Component { items={this.state.data} draggingIndex={this.state.draggingIndex} sortId={i} - outline='list'><ModuleFile {...childProps(item)} /></SortableListItem> + outline='list'><ModuleFile {...childProps(item)} isReadOnlyMode={this.props.isReadOnlyMode} /></SortableListItem> ); }, this); return ( - <div className='modules-list-wrapper'> + <div className={`modules-list-wrapper ${(listItems.length > 0) ? 'modules-list-wrapper-divider' : ''}`}> <div className='modules-list-header'> - <div className='modules-list-controllers'> - {!isBaseExist && <Button btnType='link' onClick={onBaseAdd} disabled={unassigned.length === 0}>{i18n('Add Base')}</Button>} - <Button btnType='link' onClick={onModuleAdd} disabled={unassigned.length === 0}>{i18n('Add Module')}</Button> - </div> + {!isBaseExist && <div><Button btnType='link' onClick={onBaseAdd} disabled={isReadOnlyMode || unassigned.length === 0}>{i18n('Add Base')}</Button></div>} + <div><Button btnType='link' onClick={onModuleAdd} disabled={isReadOnlyMode || unassigned.length === 0}>{i18n('Add Module')}</Button></div> </div> - <ul>{listItems}</ul> + {(listItems.length > 0) && <ul>{listItems}</ul>} </div> ); } @@ -89,20 +86,24 @@ class SortableModuleFileList extends Component { const tooltip = (name) => <Tooltip id='tooltip-bottom'>{name}</Tooltip>; const UnassignedFileList = (props) => { return ( - <div className='unassigned-files'> + <div> + <div className='modules-list-header'/> + <div className='unassigned-files'> <div className='unassigned-files-title'>{i18n('UNASSIGNED FILES')}</div> <div className='unassigned-files-list'>{props.children}</div> + </div> </div> ); }; const EmptyListContent = props => { - let {onClick, heatDataExist} = props; + let {onClick, heatDataExist, isReadOnlyMode} = props; let displayText = heatDataExist ? 'All Files Are Assigned' : ''; return ( <div className='go-to-validation-button-wrapper'> <div className='all-files-assigned'>{i18n(displayText)}</div> - {heatDataExist && <div className={'link'} onClick={onClick} data-test-id='go-to-validation'>{i18n('Proceed To Validation')}<SVGIcon name='angleRight'/></div>} + {heatDataExist && <SVGIcon disabled={isReadOnlyMode} name='angleRight' onClick={onClick} + data-test-id='go-to-validation' label={i18n('Proceed To Validation')} labelPosition='left' color='primary'/>} </div> ); }; @@ -112,14 +113,11 @@ const UnassignedFile = (props) => ( </OverlayTrigger> ); -const AddOrDeleteVolumeFiels = ({add = true, onAdd, onDelete}) => { +const AddOrDeleteVolumeFiles = ({add = true, onAdd, onDelete, isReadOnlyMode}) => { const displayText = add ? 'Add Volume Files' : 'Delete Volume Files'; const action = add ? onAdd : onDelete; return ( - <div className='add-or-delete-volumes' onClick={action}> - <SVGIcon name={add ? 'plus' : 'close'} /> - <span>{i18n(displayText)}</span> - </div> + <Button disabled={isReadOnlyMode} onClick={action} btnType='link' className='add-or-delete-volumes' iconName={add ? 'plus' : 'close'}>{i18n(displayText)}</Button> ); }; @@ -195,14 +193,14 @@ class ModuleFile extends Component { } render() { - const {module: {name, isBase, yaml, env, vol, volEnv}, onModuleDelete, files, onModuleFileTypeChange} = this.props; + const {module: {name, isBase, yaml, env, vol, volEnv}, onModuleDelete, files, onModuleFileTypeChange, isReadOnlyMode} = this.props; const {displayVolumes} = this.state; const moduleType = isBase ? 'BASE' : 'MODULE'; return ( <div className='modules-list-item' data-test-id='module-item'> <div className='modules-list-item-controllers'> <div className='modules-list-item-filename'> - <Icon image={isBase ? 'base' : 'module'} iconClassName='heat-setup-module-icon' /> + <SVGIcon name={isBase ? 'base' : 'module'} color='primary' iconClassName='heat-setup-module-icon' /> <span className='module-title-by-type'>{`${moduleType}: `}</span> <div className={`text-and-icon ${this.state.isInNameEdit ? 'in-edit' : ''}`}> {this.renderNameAccordingToEditState()} @@ -235,7 +233,7 @@ class ModuleFile extends Component { files={files} selected={volEnv} onChange={onModuleFileTypeChange}/>} - <AddOrDeleteVolumeFiels onAdd={() => this.setState({displayVolumes: true})} onDelete={() => this.deleteVolumeFiles()} add={!displayVolumes}/> + <AddOrDeleteVolumeFiles isReadOnlyMode={isReadOnlyMode} onAdd={() => this.setState({displayVolumes: true})} onDelete={() => this.deleteVolumeFiles()} add={!displayVolumes}/> </div> </div> ); @@ -245,15 +243,15 @@ class ModuleFile extends Component { class ArtifactOrNestedFileList extends Component { render() { - let {type, title, selected, options, onSelectChanged, onAddAllUnassigned} = this.props; + let {type, title, selected, options, onSelectChanged, onAddAllUnassigned, isReadOnlyMode, headerClassName} = this.props; return ( - <div className={`artifact-files ${type === 'nested' ? 'nested' : ''}`}> + <div className={`artifact-files ${type === 'nested' ? 'nested' : ''} ${headerClassName} `}> <div className='artifact-files-header'> <span> - {type === 'artifact' && (<Icon image='artifacts' iconClassName='heat-setup-module-icon' />)} + {type === 'artifact' && (<SVGIcon color='primary' name='artifacts' iconClassName='heat-setup-module-icon' />)} {`${title}`} </span> - {type === 'artifact' && <span className='add-all-unassigned' onClick={onAddAllUnassigned}>{i18n('Add All Unassigned Files')}</span>} + {type === 'artifact' && <Button disabled={isReadOnlyMode} btnType='link' className='add-all-unassigned' onClick={onAddAllUnassigned}>{i18n('Add All Unassigned Files')}</Button>} </div> {type === 'nested' ? ( <ul className='nested-list'>{selected.map(nested => @@ -294,6 +292,7 @@ class SoftwareProductHeatSetupView extends Component { <div className='heat-setup-view-modules-and-artifacts'> <SortableModuleFileList {...this.props} + isReadOnlyMode={this.props.isReadOnlyMode} artifacts={formattedArtifacts} unassigned={formattedUnassigned}/> <ArtifactOrNestedFileList @@ -302,11 +301,14 @@ class SoftwareProductHeatSetupView extends Component { options={formattedUnassigned} selected={formattedArtifacts} onSelectChanged={onArtifactListChange} + isReadOnlyMode={this.props.isReadOnlyMode} + headerClassName={(modules && modules.length > 0) ? 'with-list-items' : ''} onAddAllUnassigned={onAddAllUnassigned}/> <ArtifactOrNestedFileList type={'nested'} title={i18n('NESTED HEAT FILES')} options={[]} + isReadOnlyMode={this.props.isReadOnlyMode} selected={nested}/> </div> <UnassignedFileList> @@ -316,6 +318,7 @@ class SoftwareProductHeatSetupView extends Component { : (<EmptyListContent heatDataExist={heatDataExist} + isReadOnlyMode={this.props.isReadOnlyMode} onClick={() => this.processAndValidateHeat({modules, unassigned, artifacts, nested}, heatSetupCache)}/>) } </UnassignedFileList> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx index f2d5de4dff..62dcb82db1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx @@ -16,19 +16,18 @@ import React, {Component, PropTypes} from 'react'; import classNames from 'classnames'; import Collapse from 'react-bootstrap/lib/Collapse.js'; -import Icon from 'nfvo-components/icon/Icon.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import {mouseActions, errorLevels, nodeFilters} from './HeatValidationConstants.js'; const leftPanelWidth = 250; const typeToIcon = Object.freeze({ - heat: 'heat', - volume: 'volume', + heat: 'nestedHeat', + volume: 'base', network: 'network', - artifact: 'validation-artifacts', + artifact: 'artifacts', env: 'env', - other: 'validation-other' + other: 'other' }); @@ -74,7 +73,7 @@ function HeatFileTreeRow(props) { { <span className='tree-node-icon'> - <Icon image={typeToIcon[node.type]} iconClassName={selectedNode === node.name ? 'selected' : ''}/> + <SVGIcon name={typeToIcon[node.type]} color={selectedNode === node.name ? 'primary' : 'secondary'}/> </span> } { @@ -94,7 +93,7 @@ function HeatFileTreeHeader(props) { <div onClick={() => props.selectNode(nodeFilters.ALL)} className={classNames({'attachments-tree-header': true, 'header-selected' : props.selectedNode === nodeFilters.ALL})} data-test-id='validation-tree-header'> <div className='tree-header-title' > - <Icon image='zip' iconClassName={classNames(props.selectedNode === nodeFilters.ALL ? 'selected' : '', 'header-icon')} /> + <SVGIcon name='zip' color={props.selectedNode === nodeFilters.ALL ? 'primary' : ''} iconClassName='header-icon' /> <span className={classNames({'tree-header-title-text' : true, 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n(`HEAT${hasErrors ? ' (Draft)' : ''}`)}</span> </div> @@ -200,12 +199,13 @@ class HeatMessageBoard extends Component { } renderError(error) { let rand = Math.random() * (3000 - 1) + 1; + console.log(this.props.selectedNode ); return ( <div key={error.name + error.errorMessage + error.parentName + rand} className='error-item' data-test-id='validation-error'> {error.level === errorLevels.WARNING ? - <SVGIcon name='exclamationTriangleLine' iconClassName='large' /> : <Icon image='error-lg' /> } + <SVGIcon name='exclamationTriangleLine' iconClassName='large' color='warning' /> : <SVGIcon iconClassName='large' color='negative' /> } <span className='error-item-file-type'> { (this.props.selectedNode === nodeFilters.ALL) ? @@ -217,7 +217,7 @@ class HeatMessageBoard extends Component { {i18n(error.errorMessage)} </span> </span> : - i18n(error.errorMesage) + i18n(error.errorMessage) } </span> </div> @@ -234,18 +234,14 @@ class ErrorsAndWarningsCount extends Component { if (!errors) { return null; } - let errIcon = 'error'; let {size} = this.props; - if (size && size === 'large') { - errIcon += '-lg'; - } return (<div className='counters'> {(errors.errorCount > 0) && <div className='counter'> - <Icon image={errIcon} iconClassName='counter-icon'/> - <div className={'error-text ' + (size ? size : '')} data-test-id='validation-error-count'>{errors.errorCount}</div> + <SVGIcon name='error' color='negative' iconClassName={size}/> + <div className={'error-text ' + (size ? size : '')} data-test-id='validation-error-count'>={errors.errorCount}</div> </div>} {(errors.warningCount > 0) && <div className='counter'> - <SVGIcon name='exclamationTriangleLine' iconClassName={size} /> + <SVGIcon name='exclamationTriangleLine' iconClassName={size} color='warning'/> <div className={'warning-text ' + (size ? size : '')} data-test-id='validation-warning-count'>{errors.warningCount}</div> </div>} </div>); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/ImageValidations.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/ImageValidations.js new file mode 100644 index 0000000000..2483d0aaa2 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/ImageValidations.js @@ -0,0 +1,6 @@ + +import Validator from 'nfvo-utils/Validator.js'; + +export const imageCustomValidations = { + 'version': value => Validator.validate('version', value, [{type: 'required', data: true}]) +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditor.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditor.js index 49d891c9df..5c81f05e80 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditor.js @@ -54,9 +54,12 @@ const mapActionsToProps = (dispatch, {softwareProductId, componentId, version}) onDataChanged: (deltaData) => ValidationHelper.dataChanged(dispatch, {deltaData, formName: forms.IMAGE_EDIT_FORM}), onSubmit: ({data, qdata}) => SoftwareProductComponentsImageActionHelper.saveImageDataAndQuestionnaire(dispatch, {softwareProductId, componentId, version, data, qdata}), onCancel: () => SoftwareProductComponentsImageActionHelper.closeImageEditor(dispatch), - onValidateForm: () => ValidationHelper.validateForm(dispatch, forms.IMAGE_EDIT_FORM), - onQDataChanged: (deltaData) => ValidationHelper.qDataChanged(dispatch, {deltaData, - qName: IMAGE_QUESTIONNAIRE}), + onValidateForm: customValidations => { + ValidationHelper.validateForm(dispatch, forms.IMAGE_EDIT_FORM); + ValidationHelper.qValidateForm(dispatch, IMAGE_QUESTIONNAIRE, customValidations); + }, + onQDataChanged: (deltaData, customValidations) => ValidationHelper.qDataChanged(dispatch, {deltaData, + qName: IMAGE_QUESTIONNAIRE, customValidations}), }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorReducer.js index 0ab785a97f..7c357429e5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorReducer.js @@ -30,7 +30,7 @@ export default (state = {}, action) => { 'fileName' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'validateName', data: true}] + validations: [{type: 'required', data: true}] } }, formName: forms.IMAGE_EDIT_FORM diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorView.jsx index 300f8edcc3..7c1a3f5b55 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageEditorView.jsx @@ -20,6 +20,7 @@ import Form from 'nfvo-components/input/validation/Form.jsx'; import FileDetails from './imagesEditorComponents/FileDetails.jsx'; import ImageDetails from './imagesEditorComponents/ImageDetails.jsx'; +import {imageCustomValidations} from './ImageValidations.js'; class SoftwareProductComponentsImageEditorView extends React.Component { static propTypes = { @@ -44,7 +45,7 @@ class SoftwareProductComponentsImageEditorView extends React.Component { isValid={isFormValid} formReady={formReady} submitButtonText={editingMode ? i18n('Save') : i18n('Create')} - onValidateForm={() => onValidateForm() } + onValidateForm={() => onValidateForm(imageCustomValidations) } className='vsp-components-image-editor'> <div className='editor-data'> <FileDetails @@ -56,7 +57,7 @@ class SoftwareProductComponentsImageEditorView extends React.Component { isManual={isManual} dataMap={dataMap} onQDataChanged={onQDataChanged}/> - {editingMode && <ImageDetails dataMap={dataMap}qgenericFieldInfo={qgenericFieldInfo} onQDataChanged={onQDataChanged}/>} + {editingMode && <ImageDetails dataMap={dataMap} qgenericFieldInfo={qgenericFieldInfo} onQDataChanged={onQDataChanged}/>} </div> </Form>} </div> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/FileDetails.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/FileDetails.jsx index ca58b697a2..2e9ab417d8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/FileDetails.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/FileDetails.jsx @@ -40,6 +40,7 @@ const FileDetails = ({editingMode, fileName, onDataChanged, isManual, dataMap, o type='text' className='image-filename'/> </GridItem> + {!editingMode && <div className='note-text'>{i18n('After image creation you must go to Edit Image and add File Version')}</div>} {editingMode && <Version isManual={isManual} dataMap={dataMap} qgenericFieldInfo={qgenericFieldInfo} onQDataChanged={onQDataChanged}/>} {editingMode && <Format isManual={isManual} qgenericFieldInfo={qgenericFieldInfo} dataMap={dataMap} onQDataChanged={onQDataChanged}/>} </GridSection> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/Version.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/Version.jsx index 3cac9a51b8..7dd577b8c9 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/Version.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/imagesEditorComponents/Version.jsx @@ -17,6 +17,7 @@ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Input from 'nfvo-components/input/validation/Input.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; +import {imageCustomValidations} from '../ImageValidations.js'; const Version = ({isManual, dataMap, qgenericFieldInfo, onQDataChanged}) => { @@ -28,7 +29,8 @@ const Version = ({isManual, dataMap, qgenericFieldInfo, onQDataChanged}) => { type='text' className='image-version' label={i18n('Version')} - onChange={(version) => onQDataChanged({'version' : version})} + isRequired={true} + onChange={(version) => onQDataChanged({'version' : version}, {'version' : imageCustomValidations['version']})} isValid={qgenericFieldInfo['version'].isValid} errorText={qgenericFieldInfo['version'].errorText} value={dataMap['version']}/> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx index 9ae9e359b0..8a82f54901 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancingRefView.jsx @@ -50,6 +50,7 @@ const pointers = [ added: 'Please describe.' } ]; +//TODO check for buttons const TextAreaItem = ({item, toggle, expanded, genericFieldInfo, dataMap, onQDataChanged}) => ( <GridItem colSpan={3} key={item.key} > diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx index 36c1728ef3..2d5a965c40 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx @@ -15,10 +15,8 @@ */ import React, {Component, PropTypes} from 'react'; import Dropzone from 'react-dropzone'; -import ButtonGroup from 'react-bootstrap/lib/ButtonGroup.js'; -import ButtonToolbar from 'react-bootstrap/lib/ButtonToolbar.js'; -import Button from 'react-bootstrap/lib/Button.js'; -import i18n from 'nfvo-utils/i18n/i18n.js'; +import Button from 'sdc-ui/lib/react/Button.js'; +import DraggableUploadFileBox from 'nfvo-components/fileupload/DraggableUploadFileBox.jsx'; import {fileTypes, type2Title, type2Name} from './SoftwareProductComponentsMonitoringConstants.js'; @@ -59,7 +57,7 @@ class SoftwareProductComponentsMonitoringView extends Component { let typeDisplayName = type2Title[type]; return ( <Dropzone - className={`snmp-dropzone ${this.state.dragging ? 'active-dragging' : ''}`} + className={`dropzone ${this.state.dragging ? 'active-dragging' : ''}`} onDrop={(acceptedFiles, rejectedFiles) => this.handleImport(acceptedFiles, rejectedFiles, {isReadOnlyMode, type, refAndName})} onDragEnter={() => this.handleOnDragEnter(isReadOnlyMode)} onDragLeave={() => this.setState({dragging:false})} @@ -71,7 +69,7 @@ class SoftwareProductComponentsMonitoringView extends Component { disabled> <div className='draggable-wrapper'> <div className='section-title'>{typeDisplayName}</div> - {fileName ? this.renderUploadedFileName(fileName, type) : this.renderUploadButton(refAndName)} + {fileName ? this.renderUploadedFileName(fileName, type, isReadOnlyMode) : this.renderUploadButton(refAndName)} </div> </Dropzone> ); @@ -80,25 +78,32 @@ class SoftwareProductComponentsMonitoringView extends Component { renderUploadButton(refAndName) { let {isReadOnlyMode} = this.props; return ( - <div - className={`software-product-landing-view-top-block-col-upl${isReadOnlyMode ? ' disabled' : ''}`}> - <div className='drag-text'>{i18n('Drag & drop for upload')}</div> - <div className='or-text'>{i18n('or')}</div> - <div className='upload-btn primary-btn' data-test-id={`monitoring-upload-${refAndName}`} onClick={() => this.refs[refAndName].open()}> - <span className='primary-btn-text'>{i18n('Select file')}</span> - </div> - </div> + <DraggableUploadFileBox + dataTestId={`monitoring-upload-${refAndName}`} + className='software-product-landing-view-top-block-col-upl' + isReadOnlyMode={isReadOnlyMode} + onClick={() => this.refs[refAndName].open()}/> ); } - renderUploadedFileName(filename, type) { + renderUploadedFileName(filename, type, isReadOnlyMode) { return ( - <ButtonToolbar> - <ButtonGroup> - <Button disabled>{filename}</Button> - <Button data-test-id={`monitoring-delete-${type}`} className='delete-button' onClick={()=>this.props.onDeleteFile(type)}>X</Button> - </ButtonGroup> - </ButtonToolbar> + <div className='monitoring-file'> + <Button + color='white' + disabled={true} + className='filename'> + {filename} + </Button> + + <Button + color='gray' + data-test-id={`monitoring-delete-${type}`} + disabled={isReadOnlyMode} + onClick={()=>this.props.onDeleteFile(type)} + iconName='close' + className='delete'/> + </div> ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesEditorView.jsx index 18f2ee129c..87abaf4978 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesEditorView.jsx @@ -17,6 +17,7 @@ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Dropzone from 'react-dropzone'; +import DraggableUploadFileBox from 'nfvo-components/fileupload/DraggableUploadFileBox.jsx'; import {optionsInputValues as ComponentProcessesOptionsInputValues} from './SoftwareProductComponentProcessesConstants.js'; import Form from 'nfvo-components/input/validation/Form.jsx'; import Input from 'nfvo-components/input/validation/Input.jsx'; @@ -31,17 +32,6 @@ const SoftwareProductProcessEditorPropType = React.PropTypes.shape({ type: React.PropTypes.string }); -const FileUploadBox = ({onClick}) => { - return ( - <div className='file-upload-box'> - <div className='drag-text'>{i18n('Drag & drop for upload')}</div> - <div className='or-text'>{i18n('or')}</div> - <div className='upload-btn primary-btn' onClick={onClick}> - <span className='primary-btn-text'>{i18n('Select file')}</span> - </div> - </div> - ); -}; class SoftwareProductProcessesEditorView extends React.Component { @@ -99,7 +89,7 @@ class SoftwareProductProcessesEditorView extends React.Component { type='text'/> </GridItem> <GridItem colSpan={2}> - <FileUploadBox onClick={() => this.refs.processEditorFileInput.open()} /> + <DraggableUploadFileBox isReadOnlyMode={isReadOnlyMode} className='file-upload-box' onClick={() => this.refs.processEditorFileInput.open()} /> </GridItem> </GridSection> <GridSection> diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx index d3738e3ea4..7ffbeda4dc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx @@ -19,7 +19,7 @@ import Dropzone from 'react-dropzone'; import i18n from 'nfvo-utils/i18n/i18n.js'; - +import DraggableUploadFileBox from 'nfvo-components/fileupload/DraggableUploadFileBox.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import SoftwareProductComponentsList from '../components/SoftwareProductComponentsList.js'; @@ -128,14 +128,11 @@ class SoftwareProductLandingPageView extends React.Component { </div> </div> </div> - <div - className={classnames('software-product-landing-view-top-block-col-upl', {'disabled': isReadOnlyMode})}> - <div className='drag-text'>{i18n('Drag & drop for upload')}</div> - <div className='or-text'>{i18n('or')}</div> - <div data-test-id='upload-btn' className='upload-btn primary-btn' onClick={() => this.refs.fileInput.open()}> - <span className='primary-btn-text'>{i18n('Select file')}</span> - </div> - </div> + <DraggableUploadFileBox + dataTestId='upload-btn' + isReadOnlyMode={isReadOnlyMode} + className={classnames('software-product-landing-view-top-block-col-upl', {'disabled': isReadOnlyMode})} + onClick={() => this.refs.fileInput.open()}/> </div> </div> ); @@ -229,7 +226,7 @@ const ProductSummary = ({currentSoftwareProduct, onDetailsSelect}) => { const LicenseAgreement = ({licenseAgreementName}) => { if (!licenseAgreementName) { - return (<div className='missing-license'><SVGIcon name='exclamationTriangleFull'/><div className='warning-text'>{i18n('Missing')}</div></div>); + return (<div className='missing-license'><SVGIcon color='warning' name='exclamationTriangleFull'/><div className='warning-text'>{i18n('Missing')}</div></div>); } return <div>{licenseAgreementName}</div>; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx index 137e4a2b4e..0df36cf65d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx @@ -17,6 +17,7 @@ import React from 'react'; import Dropzone from 'react-dropzone'; import classnames from 'classnames'; +import DraggableUploadFileBox from 'nfvo-components/fileupload/DraggableUploadFileBox.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; import {optionsInputValues as ProcessesOptionsInputValues} from './SoftwareProductProcessesConstants.js'; import Form from 'nfvo-components/input/validation/Form.jsx'; @@ -32,17 +33,6 @@ const SoftwareProductProcessEditorPropType = React.PropTypes.shape({ type: React.PropTypes.string }); -const FileUploadBox = ({onClick}) => { - return ( - <div className='file-upload-box'> - <div className='drag-text'>{i18n('Drag & drop for upload')}</div> - <div className='or-text'>{i18n('or')}</div> - <div className='upload-btn primary-btn' onClick={onClick}> - <span className='primary-btn-text'>{i18n('Select file')}</span> - </div> - </div> - ); -}; class SoftwareProductProcessesEditorView extends React.Component { @@ -101,7 +91,7 @@ class SoftwareProductProcessesEditorView extends React.Component { type='text'/> </GridItem> <GridItem colSpan={2}> - <FileUploadBox onClick={() => this.refs.processEditorFileInput.open()}/> + <DraggableUploadFileBox isReadOnlyMode={isReadOnlyMode} className='file-upload-box' onClick={() => this.refs.processEditorFileInput.open()}/> </GridItem> </GridSection> <GridSection> diff --git a/openecomp-ui/test-utils/MockSVGIcon.js b/openecomp-ui/test-utils/MockSVGIcon.js new file mode 100644 index 0000000000..6ce76cf91a --- /dev/null +++ b/openecomp-ui/test-utils/MockSVGIcon.js @@ -0,0 +1,17 @@ +import React from 'react'; +//import ReactDOMServer from 'react-dom/server'; + +const SVGIcon = ({name, onClick, label, className, iconClassName, labelClassName, labelPosition, color, disabled, ...other}) => { + let colorClass = (color !== '') ? '__' + color : ''; + let classes = `svg-icon-wrapper ${iconClassName} ${className} ${colorClass} ${onClick ? 'clickable' : ''} ${disabled ? 'disabled' : ''} ${labelPosition}`; + + let iconMock = ( + <div {...other} onClick={onClick} className={classes}> + <span className={`svg-icon __${name} ${disabled ? 'disabled' : ''}`} /> + {label && <span className={`svg-icon-label ${labelClassName}`}>{label}</span>} + </div> + ); +// console.log(ReactDOMServer.renderToStaticMarkup(iconMock)); + return iconMock; +}; +export default SVGIcon; diff --git a/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js index a08e7e6355..5ad8b12228 100644 --- a/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js +++ b/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js @@ -19,20 +19,20 @@ import {limitType} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConst import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; Factory.define('LimitBaseFactory') - .attrs({ + .attrs({ name: 'SpLimit1', type: limitType.SERVICE_PROVIDER, description: 'fgfg', - metric: 'CPU', value: 45, - unit: 55, aggregationFunction: 'Peak', - time: 'Day' + time: 'Day' }); export const LimitPostFactory = new Factory() + .attrs({metric: {choice: 'BWDT', other: ''}, unit: {choice: 'GB', other: ''}}) .extend('LimitBaseFactory'); export const LimitItemFactory = new Factory() + .attrs({metric: 'BWDT', unit: 'GB'}) .extend('LimitBaseFactory') - .extend(IdMixin); + .extend(IdMixin); diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js index 911fb011f4..f5415239ad 100644 --- a/openecomp-ui/test/licenseModel/entitlementPools/test.js +++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js @@ -21,6 +21,7 @@ import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitl import {EntitlementPoolStoreFactory, EntitlementPoolPostFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js'; import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js'; +import {getStrValue} from 'nfvo-utils/getValue.js'; describe('Entitlement Pools Module Tests', function () { @@ -165,7 +166,7 @@ describe('Entitlement Pools Module Tests', function () { it('Load Limits List', () => { - const limitsList = LimitItemFactory.buildList(3); + const limitsList = LimitItemFactory.buildList(3); deepFreeze(limitsList); const store = storeCreator(); deepFreeze(store.getState()); @@ -190,8 +191,12 @@ describe('Entitlement Pools Module Tests', function () { deepFreeze(store.getState()); const limitToAdd = LimitPostFactory.build(); + let limitFromBE = {...limitToAdd}; + limitFromBE.metric = getStrValue(limitFromBE.metric); + limitFromBE.unit = getStrValue(limitFromBE.unit); deepFreeze(limitToAdd); + deepFreeze(limitFromBE); const LimitIdFromResponse = 'ADDED_ID'; const limitAddedItem = {...limitToAdd, id: LimitIdFromResponse}; @@ -202,7 +207,7 @@ describe('Entitlement Pools Module Tests', function () { mockRest.addHandler('post', ({data, options, baseUrl}) => { expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); - expect(data).toEqual(limitToAdd); + expect(data).toEqual(limitFromBE); expect(options).toEqual(undefined); return { returnCode: 'OK', @@ -220,7 +225,7 @@ describe('Entitlement Pools Module Tests', function () { return EntitlementPoolsActionHelper.submitLimit(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, - version, + version, entitlementPool, limit: limitToAdd } @@ -232,9 +237,9 @@ describe('Entitlement Pools Module Tests', function () { it('Delete Limit', () => { - const limitsList = LimitItemFactory.buildList(1); + const limitsList = LimitItemFactory.buildList(1); deepFreeze(limitsList); - + const store = storeCreator({ licenseModel: { entitlementPool: { @@ -279,7 +284,7 @@ describe('Entitlement Pools Module Tests', function () { it('Update Limit', () => { - const limitsList = LimitItemFactory.buildList(1); + const limitsList = LimitItemFactory.buildList(1); deepFreeze(limitsList); const entitlementPool = EntitlementPoolStoreFactory.build(); const store = storeCreator({ @@ -294,16 +299,20 @@ describe('Entitlement Pools Module Tests', function () { deepFreeze(store.getState()); - + const previousData = limitsList[0]; + deepFreeze(previousData); const limitId = limitsList[0].id; - - const updatedLimit = {...previousData, name: 'updatedLimit'}; - deepFreeze(updatedLimit); + + let updatedLimit = {...previousData, name: 'updatedLimit'}; + const updatedLimitForPut = {...updatedLimit, id: undefined}; + updatedLimit.metric = {choice: updatedLimit.metric, other: ''}; + updatedLimit.unit = {choice: updatedLimit.unit, other: ''}; + deepFreeze(updatedLimit); - const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimit]); + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimitForPut]); mockRest.addHandler('put', ({data, options, baseUrl}) => { @@ -317,13 +326,13 @@ describe('Entitlement Pools Module Tests', function () { expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); expect(data).toEqual(undefined); expect(options).toEqual(undefined); - return {results: [updatedLimit]}; + return {results: [updatedLimitForPut]}; }); return EntitlementPoolsActionHelper.submitLimit(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, - version, + version, entitlementPool, limit: updatedLimit } diff --git a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js index 77fcc00694..739e266d7f 100644 --- a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js +++ b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js @@ -22,6 +22,7 @@ import {LicenseKeyGroupStoreFactory, LicenseKeyGroupPostFactory} from 'test-util import LicenseKeyGroupsActionHelper from 'sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js'; +import {getStrValue} from 'nfvo-utils/getValue.js'; describe('License Key Groups Module Tests', function () { @@ -160,7 +161,7 @@ describe('License Key Groups Module Tests', function () { it('Load Limits List', () => { - const limitsList = LimitItemFactory.buildList(3); + const limitsList = LimitItemFactory.buildList(3); deepFreeze(limitsList); const store = storeCreator(); deepFreeze(store.getState()); @@ -185,8 +186,12 @@ describe('License Key Groups Module Tests', function () { deepFreeze(store.getState()); const limitToAdd = LimitPostFactory.build(); + let limitFromBE = {...limitToAdd}; + limitFromBE.metric = getStrValue(limitFromBE.metric); + limitFromBE.unit = getStrValue(limitFromBE.unit); deepFreeze(limitToAdd); + deepFreeze(limitFromBE); const LimitIdFromResponse = 'ADDED_ID'; const limitAddedItem = {...limitToAdd, id: LimitIdFromResponse}; @@ -197,7 +202,7 @@ describe('License Key Groups Module Tests', function () { mockRest.addHandler('post', ({data, options, baseUrl}) => { expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); - expect(data).toEqual(limitToAdd); + expect(data).toEqual(limitFromBE); expect(options).toEqual(undefined); return { returnCode: 'OK', @@ -215,7 +220,7 @@ describe('License Key Groups Module Tests', function () { return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, - version, + version, licenseKeyGroup, limit: limitToAdd } @@ -226,9 +231,9 @@ describe('License Key Groups Module Tests', function () { it('Delete Limit', () => { - const limitsList = LimitItemFactory.buildList(1); + const limitsList = LimitItemFactory.buildList(1); deepFreeze(limitsList); - + const store = storeCreator({ licenseModel: { entitlementPool: { @@ -273,7 +278,7 @@ describe('License Key Groups Module Tests', function () { it('Update Limit', () => { - const limitsList = LimitItemFactory.buildList(1); + const limitsList = LimitItemFactory.buildList(1); deepFreeze(limitsList); const licenseKeyGroup = LicenseKeyGroupStoreFactory.build(); const store = storeCreator({ @@ -288,16 +293,18 @@ describe('License Key Groups Module Tests', function () { deepFreeze(store.getState()); - + const previousData = limitsList[0]; deepFreeze(previousData); const limitId = limitsList[0].id; - - const updatedLimit = {...previousData, name: 'updatedLimit'}; - deepFreeze(updatedLimit); + + let updatedLimit = {...previousData, name: 'updatedLimit'}; const updatedLimitForPut = {...updatedLimit, id: undefined}; + updatedLimit.metric = {choice: updatedLimit.metric, other: ''}; + updatedLimit.unit = {choice: updatedLimit.unit, other: ''}; + deepFreeze(updatedLimit); - const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [updatedLimit]); + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [updatedLimitForPut]); mockRest.addHandler('put', ({data, options, baseUrl}) => { @@ -311,13 +318,13 @@ describe('License Key Groups Module Tests', function () { expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); expect(data).toEqual(undefined); expect(options).toEqual(undefined); - return {results: [updatedLimit]}; + return {results: [updatedLimitForPut]}; }); return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, - version, + version, licenseKeyGroup, limit: updatedLimit } diff --git a/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js b/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js index 029ea31889..b1127386f7 100644 --- a/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js +++ b/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js @@ -40,7 +40,7 @@ describe('listEditor Module Tests', function () { </ListEditorView> ); expect(itemView).toBeTruthy(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'sliders'); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, '__sliders'); TestUtils.Simulate.click(sliderIcon); }); @@ -60,7 +60,7 @@ describe('listEditor Module Tests', function () { </ListEditorItemView> ); expect(itemView).toBeTruthy(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'sliders'); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, '__sliders'); TestUtils.Simulate.click(sliderIcon); }); @@ -71,7 +71,7 @@ describe('listEditor Module Tests', function () { </ListEditorItemView> ); expect(itemView).toBeTruthy(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'trashO'); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, '__trashO'); TestUtils.Simulate.click(sliderIcon); }); @@ -82,7 +82,8 @@ describe('listEditor Module Tests', function () { </ListEditorItemView> ); expect(itemView).toBeTruthy(); - let trashIcon = TestUtils.scryRenderedDOMComponentsWithClass(itemView, 'fa-trash-o'); + let trashIcon = TestUtils.scryRenderedDOMComponentsWithClass(itemView, '__trashOq'); expect(trashIcon).toEqual([]); }); + }); diff --git a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js index 7d4d57eb35..e14e9b76f5 100644 --- a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js +++ b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js @@ -16,7 +16,7 @@ import React from 'react'; - +import ReactDOMServer from 'react-dom/server'; import TestUtils from 'react-addons-test-utils'; import {mount} from 'enzyme'; import VersionController from 'nfvo-components/panel/versionController/VersionController.jsx'; @@ -131,21 +131,21 @@ describe('versionController UI Component', () => { let callVCActionProps = { ...props, version: '1.0', callVCAction: function(){} }; let versionController = mount(<VersionController isCheckedOut={true} status={statusEnum.CHECK_OUT_STATUS} {...callVCActionProps} />); let elem = versionController.find('[data-test-id="vc-checkout-btn"]'); - let svgIcon = versionController.find('.versionControllerLockClosed'); + expect(elem).toBeTruthy(); expect(elem.length).toEqual(1); - expect(svgIcon.hasClass('disabled')).toBe(true); + expect(elem.find('.svg-icon').length).toEqual(1); + expect(elem.find('.svg-icon').hasClass('disabled')).toBe(true); }); it('Doesn\'t show the checkout button', () => { let callVCActionProps = { ...props, version: '1.0', callVCAction: function(){} }; let versionController = mount(<VersionController isCheckedOut={false} status={statusEnum.CHECK_IN_STATUS} {...callVCActionProps} />); let elem = versionController.find('[data-test-id="vc-checkout-btn"]'); - let svgIcon = versionController.find('.versionControllerLockClosed'); - expect(elem).toBeTruthy(); expect(elem.length).toBe(1); - expect(svgIcon.hasClass('disabled')).toBe(true); + expect(elem.find('.svg-icon').length).toEqual(1); + expect(elem.find('.svg-icon').hasClass('disabled')).toBe(true); }); |