From: Determe, Sebastien (sd378r) Date: Mon, 30 Oct 2017 17:50:37 +0000 (+0100) Subject: Add encryption for passwords X-Git-Tag: v1.1.0~11 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=clamp.git;a=commitdiff_plain;h=434170f50621917a7fb2cbe7c7b01c4b29a8211e Add encryption for passwords Add encrypted password on all values specified in the properties files, unit tests have been reworked. Change-Id: I619ff67fe1025f69af733b776f055914f949f26a Issue-ID: CLAMP-64 Signed-off-by: Determe, Sebastien (sd378r) --- diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java index 8f80e07c..71e57ded 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; +import java.security.GeneralSecurityException; import java.util.Date; import java.util.List; @@ -52,34 +53,37 @@ import org.onap.clamp.clds.util.LoggingUtils; import org.springframework.beans.factory.annotation.Autowired; /** + * * This class implements the communication with DCAE for the service inventory. * + * + * */ public class DcaeInventoryServices { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class); protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - @Autowired private RefProp refProp; - @Autowired private CldsDao cldsDao; - @Autowired private SdcCatalogServices sdcCatalogServices; /** + * * Set the event inventory. * * @param cldsModel * The CldsModel * @param userId * The user ID + * @throws GeneralSecurityException + * In case of issue when decryting the DCAE password * @throws ParseException - * In case of issues during the parsing of DCAE answer + * In case of DCAE Json parse exception */ - public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException { + public void setEventInventory(CldsModel cldsModel, String userId) throws GeneralSecurityException, ParseException { String artifactName = cldsModel.getControlName(); DcaeEvent dcaeEvent = new DcaeEvent(); String isDcaeInfoAvailable = null; @@ -90,8 +94,11 @@ public class DcaeInventoryServices { } try { /* + * * Below are the properties required for calling the dcae inventory + * * url call + * */ ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null, false, "{}", cldsModel.getPropText()); @@ -105,11 +112,9 @@ public class DcaeInventoryServices { } /* Invemtory service url is called in this method */ isDcaeInfoAvailable = getDcaeInformation(artifactName, serviceUuid, resourceUuid); - /* set dcae events */ dcaeEvent.setArtifactName(artifactName); dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION); - } catch (JsonProcessingException e) { logger.error("Error during JSON decoding", e); } catch (IOException ex) { @@ -159,6 +164,7 @@ public class DcaeInventoryServices { * In case of issues with the stream * @throws ParseException * In case of issues with the Json parsing + * */ public String getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid) throws IOException, ParseException { @@ -167,28 +173,22 @@ public class DcaeInventoryServices { String queryString = "?sdcResourceId=" + resourceUuid + "&sdcServiceId=" + serviceUuid + "&typeName=" + artifactName; String fullUrl = refProp.getStringValue("DCAE_INVENTORY_URL") + "/dcae-service-types" + queryString; - logger.info("Dcae Inventory Service full url - " + fullUrl); String daceInventoryResponse = null; URL inventoryUrl = new URL(fullUrl); - HttpURLConnection conn = (HttpURLConnection) inventoryUrl.openConnection(); conn.setRequestMethod("GET"); String reqid = LoggingUtils.getRequestId(); logger.info("reqid set to " + reqid); conn.setRequestProperty("X-ECOMP-RequestID", reqid); - boolean requestFailed = true; int responseCode = conn.getResponseCode(); if (responseCode == 200) { requestFailed = false; } - StringBuilder response = new StringBuilder(); - try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { String inputLine = null; - while ((inputLine = in.readLine()) != null) { response.append(inputLine); } @@ -203,11 +203,8 @@ public class DcaeInventoryServices { String jsonResponseString = response.toString(); JSONParser parser = new JSONParser(); Object obj0 = parser.parse(jsonResponseString); - JSONObject jsonObj = (JSONObject) obj0; - Long totalCount = (Long) jsonObj.get("totalCount"); - int numServices = totalCount.intValue(); if (numServices == 0) { daceInventoryResponse = null; @@ -221,5 +218,4 @@ public class DcaeInventoryServices { metricsLogger.info("getDcaeInformation complete: number services returned=" + numServices); return daceInventoryResponse; } - } diff --git a/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java index 56f29618..36265e83 100644 --- a/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java +++ b/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java @@ -40,6 +40,7 @@ import java.io.Reader; import java.io.StringReader; import java.net.HttpURLConnection; import java.net.URL; +import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -71,14 +72,16 @@ import org.onap.clamp.clds.util.LoggingUtils; import org.springframework.beans.factory.annotation.Autowired; public class SdcCatalogServices { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcCatalogServices.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - - private static final String RESOURCE_VF_TYPE = "VF"; - private static final String RESOURCE_VFC_TYPE = "VFC"; - + protected static final EELFLogger logger = EELFManager.getInstance() + .getLogger(SdcCatalogServices.class); + protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + private static final String RESOURCE_VF_TYPE = "VF"; + private static final String RESOURCE_VFC_TYPE = "VFC"; + private static final String RESOURCE_CVFC_TYPE = "CVFC"; @Autowired private RefProp refProp; + @Autowired + private SdcReq sdcReq; /** * This method get the SDC services Information with the corresponding @@ -87,31 +90,29 @@ public class SdcCatalogServices { * @param uuid * The service UUID * @return A Json String with all the service list + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password */ - public String getSdcServicesInformation(String uuid) { + public String getSdcServicesInformation(String uuid) throws GeneralSecurityException { Date startTime = new Date(); String baseUrl = refProp.getStringValue("sdc.serviceUrl"); - String basicAuth = SdcReq.getSdcBasicAuth(refProp); + String basicAuth = sdcReq.getSdcBasicAuth(); LoggingUtils.setTargetContext("SDC", "getSdcServicesInformation"); - try { String url = baseUrl; if (uuid != null) { url = baseUrl + "/" + uuid + "/metadata"; } URL urlObj = new URL(url); - HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection(); - conn.setRequestProperty(refProp.getStringValue("sdc.InstanceID"), "CLAMP-Tool"); conn.setRequestProperty("Authorization", basicAuth); conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); conn.setRequestProperty("X-ECOMP-RequestID", LoggingUtils.getRequestId()); conn.setRequestMethod("GET"); - String resp = getResponse(conn); if (resp != null) { - logger.info(resp); + logger.info(resp); // metrics log LoggingUtils.setResponseContext("0", "Get sdc services success", this.getClass().getName()); return resp; @@ -124,13 +125,12 @@ public class SdcCatalogServices { LoggingUtils.setTimeContext(startTime, new Date()); metricsLogger.info("getSdcServicesInformation complete"); } - return ""; } /** * To remove duplicate serviceUUIDs from sdc services List. - * + * * @param rawCldsSdcServiceList * A list of CldsSdcServiceInfo * @return A list of CldsSdcServiceInfo without duplicate service UUID @@ -159,7 +159,7 @@ public class SdcCatalogServices { /** * To remove duplicate serviceUUIDs from sdc resources List. - * + * * @param rawCldsSdcResourceList * @return */ @@ -187,7 +187,7 @@ public class SdcCatalogServices { /** * To remove duplicate basic resources with same resourceUUIDs. - * + * * @param rawCldsSdcResourceListBasicList * @return */ @@ -217,12 +217,14 @@ public class SdcCatalogServices { /** * To get ServiceUUID by using serviceInvariantUUID. - * + * * @param invariantId * The invariant ID * @return The service UUID + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password */ - public String getServiceUuidFromServiceInvariantId(String invariantId) { + public String getServiceUuidFromServiceInvariantId(String invariantId) throws GeneralSecurityException { String serviceUuid = ""; String responseStr = getSdcServicesInformation(null); List rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr); @@ -241,7 +243,7 @@ public class SdcCatalogServices { /** * To get CldsAsdsServiceInfo class by parsing json string. - * + * * @param jsonStr * The Json string that must be decoded * @return The list of CldsSdcServiceInfo, if there is a failure it return @@ -274,7 +276,6 @@ public class SdcCatalogServices { if (StringUtils.isBlank(jsonStr)) { return new ArrayList<>(); } - try { return objectMapper.readValue(jsonStr, objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcResourceBasicInfo.class)); @@ -286,7 +287,7 @@ public class SdcCatalogServices { /** * To get CldsAsdsResource class by parsing json string. - * + * * @param jsonStr * @return * @throws IOException @@ -298,7 +299,7 @@ public class SdcCatalogServices { /** * To get CldsSdcServiceDetail by parsing json string. - * + * * @param jsonStr * @return */ @@ -314,22 +315,24 @@ public class SdcCatalogServices { /** * To upload artifact to sdc based on serviceUUID and resource name on url. - * + * * @param prop * @param userid * @param url * @param formattedSdcReq * @return + * @throws GeneralSecurityException */ - public String uploadArtifactToSdc(ModelProperties prop, String userid, String url, String formattedSdcReq) { + public String uploadArtifactToSdc(ModelProperties prop, String userid, String url, String formattedSdcReq) + throws GeneralSecurityException { // Verify whether it is triggered by Validation Test button from UI if (prop.isTest()) { return "sdc artifact upload not executed for test action"; } try { logger.info("userid=" + userid); - String md5Text = SdcReq.calculateMD5ByString(formattedSdcReq); - byte[] postData = SdcReq.stringToByteArray(formattedSdcReq); + String md5Text = sdcReq.calculateMD5ByString(formattedSdcReq); + byte[] postData = sdcReq.stringToByteArray(formattedSdcReq); int postDataLength = postData.length; HttpURLConnection conn = getSdcHttpUrlConnection(userid, postDataLength, url, md5Text); try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) { @@ -341,7 +344,6 @@ public class SdcCatalogServices { if (responseCode == 200) { requestFailed = false; } - String responseStr = getResponse(conn); if (responseStr != null && requestFailed) { logger.error("requestFailed - responseStr=" + responseStr); @@ -352,13 +354,13 @@ public class SdcCatalogServices { logger.error("Exception when attempting to communicate with SDC", e); throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e); } - } - private HttpURLConnection getSdcHttpUrlConnection(String userid, int postDataLength, String url, String md5Text) { + private HttpURLConnection getSdcHttpUrlConnection(String userid, int postDataLength, String url, String md5Text) + throws GeneralSecurityException { try { logger.info("userid=" + userid); - String basicAuth = SdcReq.getSdcBasicAuth(refProp); + String basicAuth = sdcReq.getSdcBasicAuth(); String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID"); URL urlObj = new URL(url); HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection(); @@ -426,7 +428,14 @@ public class SdcCatalogServices { } } - public boolean isCldsSdcCacheDataExpired(CldsServiceData cldsServiceData) { + /** + * Check if the SDC Info in cache has expired. + * + * @param cldsServiceData + * @return + * @throws GeneralSecurityException + */ + public boolean isCldsSdcCacheDataExpired(CldsServiceData cldsServiceData) throws GeneralSecurityException { boolean expired = false; if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) { String cachedServiceUuid = cldsServiceData.getServiceUUID(); @@ -442,7 +451,16 @@ public class SdcCatalogServices { return expired; } - public CldsServiceData getCldsServiceDataWithAlarmConditions(String invariantServiceUuid) { + /** + * Get the Service Data with Alarm Conditions for a given + * invariantServiceUuid. + * + * @param invariantServiceUuid + * @return + * @throws GeneralSecurityException + */ + public CldsServiceData getCldsServiceDataWithAlarmConditions(String invariantServiceUuid) + throws GeneralSecurityException { String url = refProp.getStringValue("sdc.serviceUrl"); String catalogUrl = refProp.getStringValue("sdc.catalog.url"); String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid); @@ -460,7 +478,6 @@ public class SdcCatalogServices { } cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid()); cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID()); - // To remove duplicate resources from serviceDetail and add valid // vfs to service if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null) { @@ -488,13 +505,15 @@ public class SdcCatalogServices { return cldsServiceData; } - private void getAllVfcForVfList(List cldsVfDataList, String catalogUrl) { + private void getAllVfcForVfList(List cldsVfDataList, String catalogUrl) + throws GeneralSecurityException { // todo : refact this.. if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) { List allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType( RESOURCE_VF_TYPE); List allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType( RESOURCE_VFC_TYPE); + allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE)); for (CldsVfData currCldsVfData : cldsVfDataList) { if (currCldsVfData != null && currCldsVfData.getVfInvariantResourceUUID() != null) { String resourceUuid = getResourceUuidFromResourceInvariantUuid( @@ -507,7 +526,6 @@ public class SdcCatalogServices { // associated with the VF's List cldsVfKPIDataList = getFieldPathFromVF(vfResponse); currCldsVfData.setCldsKPIList(cldsVfKPIDataList); - List vfcDataListFromVfResponse = getVfcDataListFromVfResponse(vfResponse); if (vfcDataListFromVfResponse != null) { currCldsVfData.setCldsVfcs(vfcDataListFromVfResponse); @@ -547,7 +565,7 @@ public class SdcCatalogServices { } } - private List getVfcDataListFromVfResponse(String vfResponse) { + private List getVfcDataListFromVfResponse(String vfResponse) throws GeneralSecurityException { ObjectMapper mapper = new ObjectMapper(); ObjectNode vfResponseNode; try { @@ -570,6 +588,11 @@ public class SdcCatalogServices { currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUuid.textValue()); cldsVfcDataList.add(currCldsVfcData); } else if (resourceTypeNode != null && "CVFC".equalsIgnoreCase(resourceTypeNode.textValue())) { + TextNode vfcResourceName = (TextNode) currVfcNode.get("resourceInstanceName"); + TextNode vfcInvariantResourceUuid = (TextNode) currVfcNode.get("resourceInvariantUUID"); + currCldsVfcData.setVfcName(vfcResourceName.textValue()); + currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUuid.textValue()); + cldsVfcDataList.add(currCldsVfcData); cldsVfcDataList.addAll(getVFCfromCVFC(currVfcNode.get("resourceUUID").textValue())); } } @@ -577,10 +600,9 @@ public class SdcCatalogServices { return cldsVfcDataList; } - private List getVFCfromCVFC(String resourceUUID) { + private List getVFCfromCVFC(String resourceUUID) throws GeneralSecurityException { String catalogUrl = refProp.getStringValue("sdc.catalog.url"); List cldsVfcDataList = new ArrayList<>(); - if (resourceUUID != null) { String vfcResourceUUIDUrl = catalogUrl + "resources" + "/" + resourceUUID + "/metadata"; try { @@ -588,7 +610,6 @@ public class SdcCatalogServices { ObjectMapper mapper = new ObjectMapper(); ObjectNode vfResponseNode = (ObjectNode) mapper.readTree(vfcResponse); ArrayNode vfcArrayNode = (ArrayNode) vfResponseNode.get("resources"); - if (vfcArrayNode != null) { for (JsonNode vfcjsonNode : vfcArrayNode) { CldsVfcData currCldsVfcData = new CldsVfcData(); @@ -614,7 +635,7 @@ public class SdcCatalogServices { return (id != null) ? id.replaceAll("\"", "") : ""; } - private List getAlarmCondtionsFromVfc(String vfcResponse) { + private List getAlarmCondtionsFromVfc(String vfcResponse) throws GeneralSecurityException { List cldsAlarmConditionList = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); ObjectNode vfcResponseNode; @@ -625,7 +646,6 @@ public class SdcCatalogServices { return cldsAlarmConditionList; } ArrayNode artifactsArrayNode = (ArrayNode) vfcResponseNode.get("artifacts"); - if (artifactsArrayNode != null && artifactsArrayNode.size() > 0) { for (int index = 0; index < artifactsArrayNode.size(); index++) { ObjectNode currArtifactNode = (ObjectNode) artifactsArrayNode.get(index); @@ -660,7 +680,7 @@ public class SdcCatalogServices { } // Method to get the artifact for any particular VF - private List getFieldPathFromVF(String vfResponse) { + private List getFieldPathFromVF(String vfResponse) throws GeneralSecurityException { List cldsVfKPIDataList = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); ObjectNode vfResponseNode; @@ -671,7 +691,6 @@ public class SdcCatalogServices { return cldsVfKPIDataList; } ArrayNode artifactsArrayNode = (ArrayNode) vfResponseNode.get("artifacts"); - if (artifactsArrayNode != null && artifactsArrayNode.size() > 0) { for (int index = 0; index < artifactsArrayNode.size(); index++) { ObjectNode currArtifactNode = (ObjectNode) artifactsArrayNode.get(index); @@ -682,7 +701,7 @@ public class SdcCatalogServices { artifactName = artifactNameNode.textValue(); artifactName = artifactName.substring(artifactName.lastIndexOf('.') + 1); } - if (artifactUrlNode != null && "csv".equalsIgnoreCase(artifactName)) { + if (artifactUrlNode != null && "csv".equalsIgnoreCase(artifactName)) { String responsesFromArtifactUrl = getResponsesFromArtifactUrl(artifactUrlNode.textValue()); cldsVfKPIDataList.addAll(parseCsvToGetFieldPath(responsesFromArtifactUrl)); logger.info(responsesFromArtifactUrl); @@ -697,24 +716,19 @@ public class SdcCatalogServices { logger.debug("invalid csv field path Record,total columns less than 6: " + record); return null; } - if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3)) || StringUtils.isBlank(record.get(5))) { logger.debug("Invalid csv field path Record,one of column is having blank value : " + record); return null; } - CldsVfKPIData cldsVfKPIData = new CldsVfKPIData(); cldsVfKPIData.setNfNamingCode(record.get(0).trim()); cldsVfKPIData.setNfNamingValue(record.get(1).trim()); - cldsVfKPIData.setFieldPath(record.get(2).trim()); cldsVfKPIData.setFieldPathValue(record.get(3).trim()); - cldsVfKPIData.setThresholdName(record.get(4).trim()); cldsVfKPIData.setThresholdValue(record.get(5).trim()); return cldsVfKPIData; - } // Method to get the artifactURL Data and set the CldsVfKPIData node @@ -759,7 +773,14 @@ public class SdcCatalogServices { cldsAlarmConditionList.add(cldsAlarmCondition); } - public String getResponsesFromArtifactUrl(String artifactsUrl) { + /** + * Get the responses for the current artifact from the artifacts URL. + * + * @param artifactsUrl + * @return + * @throws GeneralSecurityException + */ + public String getResponsesFromArtifactUrl(String artifactsUrl) throws GeneralSecurityException { String hostUrl = refProp.getStringValue("sdc.hostUrl"); String artifactsUrlReworked = artifactsUrl.replaceAll("\"", ""); String artifactUrl = hostUrl + artifactsUrlReworked; @@ -771,27 +792,29 @@ public class SdcCatalogServices { /** * Service to services/resources/artifacts from sdc.Pass alarmConditions as - * true to get alarmconditons from artifact url and else it is false - * + * true to get alarm conditons from artifact url and else it is false + * * @param url * @param alarmConditions * @return + * @throws GeneralSecurityException + * In case of issue when decrypting the SDC password + * */ - public String getCldsServicesOrResourcesBasedOnURL(String url, boolean alarmConditions) { + public String getCldsServicesOrResourcesBasedOnURL(String url, boolean alarmConditions) + throws GeneralSecurityException { Date startTime = new Date(); try { LoggingUtils.setTargetContext("SDC", "getCldsServicesOrResourcesBasedOnURL"); String urlReworked = removeUnwantedBracesFromString(url); URL urlObj = new URL(urlReworked); - HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection(); - String basicAuth = SdcReq.getSdcBasicAuth(refProp); + String basicAuth = sdcReq.getSdcBasicAuth(); conn.setRequestProperty(refProp.getStringValue("sdc.InstanceID"), "CLAMP-Tool"); conn.setRequestProperty("Authorization", basicAuth); conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); conn.setRequestProperty("X-ECOMP-RequestID", LoggingUtils.getRequestId()); conn.setRequestMethod("GET"); - int responseCode = conn.getResponseCode(); logger.info("Sdc resource url - " + urlReworked + " , responseCode=" + responseCode); StringBuilder response; @@ -818,7 +841,6 @@ public class SdcCatalogServices { LoggingUtils.setTimeContext(startTime, new Date()); metricsLogger.info("getCldsServicesOrResourcesBasedOnURL completed"); } - } /** @@ -833,19 +855,15 @@ public class SdcCatalogServices { ObjectMapper mapper = new ObjectMapper(); ObjectNode globalPropsJson; if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) { - // Objectnode to save all byservice, byvf , byvfc and byalarm nodes ObjectNode byIdObjectNode = mapper.createObjectNode(); - // To create vf ResourceUUID node with serviceInvariantUUID ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(mapper, cldsServiceData); byIdObjectNode.putPOJO("byService", invariantUuidObjectNodeWithVf); - // To create byVf and vfcResourceNode with vfResourceUUID ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(mapper, cldsServiceData.getCldsVfs()); byIdObjectNode.putPOJO("byVf", vfcObjectNodeByVfUuid); - // To create byKpi ObjectNode kpiObjectNode = mapper.createObjectNode(); if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) { @@ -856,7 +874,6 @@ public class SdcCatalogServices { } } byIdObjectNode.putPOJO("byKpi", kpiObjectNode); - // To create byVfc and alarmCondition with vfcResourceUUID ObjectNode vfcResourceUuidObjectNode = mapper.createObjectNode(); if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) { @@ -868,23 +885,17 @@ public class SdcCatalogServices { } } byIdObjectNode.putPOJO("byVfc", vfcResourceUuidObjectNode); - // To create byAlarmCondition with alarmConditionKey List allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData, "alarmCondition"); ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(mapper, allAlarmConditions); - byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey); - // To create byAlertDescription with AlertDescription List allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData, "alertDescription"); ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(mapper, allAlertDescriptions); - byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert); - globalPropsJson = decodeGlobalProp(globalProps, mapper); - globalPropsJson.putPOJO("shared", byIdObjectNode); logger.info("value of objNode:" + globalPropsJson); } else { @@ -940,7 +951,6 @@ public class SdcCatalogServices { */ private List getAllAlarmConditionsFromCldsVfData(CldsVfData currCldsVfData, String eventName) { List alarmCondList = new ArrayList<>(); - if (currCldsVfData != null && currCldsVfData.getCldsVfcs() != null && !currCldsVfData.getCldsVfcs().isEmpty()) { for (CldsVfcData currCldsVfcData : currCldsVfData.getCldsVfcs()) { alarmCondList.addAll(getAllAlarmConditionsFromCldsVfcData(currCldsVfcData, eventName)); @@ -962,7 +972,6 @@ public class SdcCatalogServices { private List getAllAlarmConditionsFromCldsVfcData(CldsVfcData currCldsVfcData, String eventName) { List alarmCondList = new ArrayList<>(); - if (currCldsVfcData != null && currCldsVfcData.getCldsAlarmConditions() != null && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) { for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) { @@ -978,7 +987,6 @@ public class SdcCatalogServices { private ObjectNode createAlarmCondObjectNodeByAlarmKey(ObjectMapper mapper, List cldsAlarmCondList) { ObjectNode alarmCondKeyNode = mapper.createObjectNode(); - if (cldsAlarmCondList != null && !cldsAlarmCondList.isEmpty()) { for (CldsAlarmCondition currCldsAlarmCondition : cldsAlarmCondList) { if (currCldsAlarmCondition != null) { @@ -1022,17 +1030,13 @@ public class SdcCatalogServices { for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) { if (currCldsVfKpiData != null) { ObjectNode thresholdNameObjectNode = mapper.createObjectNode(); - ObjectNode fieldPathObjectNode = mapper.createObjectNode(); ObjectNode nfNamingCodeNode = mapper.createObjectNode(); - fieldPathObjectNode.put(currCldsVfKpiData.getFieldPathValue(), currCldsVfKpiData.getFieldPathValue()); nfNamingCodeNode.put(currCldsVfKpiData.getNfNamingValue(), currCldsVfKpiData.getNfNamingValue()); - thresholdNameObjectNode.putPOJO("fieldPath", fieldPathObjectNode); thresholdNameObjectNode.putPOJO("nfNamingCode", nfNamingCodeNode); - vfResourceUuidObjectNode.putPOJO(currCldsVfKpiData.getThresholdValue(), thresholdNameObjectNode); } } @@ -1050,9 +1054,7 @@ public class SdcCatalogServices { if (currCldsVfcData.getCldsAlarmConditions() != null && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) { for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) { - alarmCondNode.put(currCldsAlarmCondition.getAlarmConditionKey(), - currCldsAlarmCondition.getAlarmConditionKey()); - if ("alarmCondition".equalsIgnoreCase(currCldsAlarmCondition.getEventName())) { + if ("alarmCondition".equalsIgnoreCase(currCldsAlarmCondition.getEventName())) { alarmCondNode.put(currCldsAlarmCondition.getAlarmConditionKey(), currCldsAlarmCondition.getAlarmConditionKey()); } else { @@ -1061,7 +1063,6 @@ public class SdcCatalogServices { } } } - vfcObjectNode.putPOJO("alarmCondition", alarmCondNode); vfcObjectNode.putPOJO("alertDescription", alertDescNode); vfcResourceUuidObjectNode.putPOJO(currCldsVfcData.getVfcInvariantResourceUUID(), vfcObjectNode); @@ -1085,7 +1086,6 @@ public class SdcCatalogServices { */ private ObjectNode createVfcObjectNodeByVfUuid(ObjectMapper mapper, List cldsVfDataList) { ObjectNode vfUuidObjectNode = mapper.createObjectNode(); - if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) { for (CldsVfData currCldsVfData : cldsVfDataList) { if (currCldsVfData != null) { @@ -1094,8 +1094,11 @@ public class SdcCatalogServices { ObjectNode kpiObjectNode = mapper.createObjectNode(); if (currCldsVfData.getCldsVfcs() != null && !currCldsVfData.getCldsVfcs().isEmpty()) { for (CldsVfcData currCldsVfcData : currCldsVfData.getCldsVfcs()) { - vfcUuidNode.put(currCldsVfcData.getVfcInvariantResourceUUID(), - currCldsVfcData.getVfcName()); + if (currCldsVfcData.getCldsAlarmConditions() != null + && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) { + vfcUuidNode.put(currCldsVfcData.getVfcInvariantResourceUUID(), + currCldsVfcData.getVfcName()); + } } } else { vfcUuidNode.put("", ""); @@ -1159,9 +1162,9 @@ public class SdcCatalogServices { } public String updateControlLoopStatusToDcae(String dcaeUrl, String invariantResourceUuid, - String invariantServiceUuid, String artifactName) { + String invariantServiceUuid, String artifactName) throws GeneralSecurityException { String baseUrl = refProp.getStringValue("sdc.serviceUrl"); - String basicAuth = SdcReq.getSdcBasicAuth(refProp); + String basicAuth = sdcReq.getSdcBasicAuth(); String postStatusData = "{ \n" + "\"event\" : \"" + "Created" + "\",\n" + "\"serviceUUID\" : \"" + invariantServiceUuid + "\",\n" + "\"resourceUUID\" :\"" + invariantResourceUuid + "\",\n" + "\"artifactName\" : \"" + artifactName + "\",\n" + "} \n"; @@ -1171,22 +1174,18 @@ public class SdcCatalogServices { url = dcaeUrl + "/closed-loops"; } URL urlObj = new URL(url); - HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection(); conn.setRequestProperty(refProp.getStringValue("sdc.InstanceID"), "CLAMP-Tool"); conn.setRequestProperty("Authorization", basicAuth); conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); conn.setRequestProperty("X-ECOMP-RequestID", LoggingUtils.getRequestId()); conn.setRequestMethod("POST"); - - byte[] postData = SdcReq.stringToByteArray(postStatusData); + byte[] postData = sdcReq.stringToByteArray(postStatusData); try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) { wr.write(postData); } - int responseCode = conn.getResponseCode(); logger.info("responseCode=" + responseCode); - String resp = getResponse(conn); if (resp != null) { return resp; @@ -1203,8 +1202,12 @@ public class SdcCatalogServices { * @param resourceType * The resourceType * @return The list of CldsSdcResourceBasicInfo + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password + * */ - private List getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) { + private List getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) + throws GeneralSecurityException { String catalogUrl = refProp.getStringValue("sdc.catalog.url"); String resourceUrl = catalogUrl + "resources?resourceType=" + resourceType; String allSdcVfcResources = getCldsServicesOrResourcesBasedOnURL(resourceUrl, false); @@ -1260,10 +1263,12 @@ public class SdcCatalogServices { * @param locationArtifactName * The location artifact name from where we can get the Artifact * UUID - * + * @throws GeneralSecurityException + * In case of issues to decrypt the SDC password */ public void uploadToSdc(ModelProperties prop, String userid, List sdcReqUrlsList, String formattedSdcReq, - String formattedSdcLocationReq, String artifactName, String locationArtifactName) { + String formattedSdcLocationReq, String artifactName, String locationArtifactName) + throws GeneralSecurityException { logger.info("userid=" + userid); String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop); if (sdcReqUrlsList != null && !sdcReqUrlsList.isEmpty()) { diff --git a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java index 2d327f5d..90bdcb3a 100644 --- a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java @@ -23,6 +23,9 @@ package org.onap.clamp.clds.client; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + import java.util.List; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -33,27 +36,23 @@ import org.onap.clamp.clds.model.prop.ModelProperties; import org.onap.clamp.clds.model.refprop.RefProp; import org.springframework.beans.factory.annotation.Autowired; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - /** * Send control loop model to dcae proxy. */ public class SdcSendReqDelegate implements JavaDelegate { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSendReqDelegate.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - @Autowired - private RefProp refProp; - + private SdcReq sdcReq; @Autowired - private SdcCatalogServices sdcCatalogServices; - - private String baseUrl; - private String artifactType; - private String locationArtifactType; - private String artifactLabel; - private String locationArtifactLabel; + private RefProp refProp; + @Autowired + private SdcCatalogServices sdcCatalogServices; + private String baseUrl; + private String artifactType; + private String locationArtifactType; + private String artifactLabel; + private String locationArtifactLabel; /** * Perform activity. Send to sdc proxy. @@ -69,36 +68,37 @@ public class SdcSendReqDelegate implements JavaDelegate { execution.setVariable("artifactName", artifactName); getSdcAttributes((String) execution.getVariable("controlName")); ModelProperties prop = ModelProperties.create(execution); - String bluprintPayload = SdcReq.formatBlueprint(refProp, prop, docText); - // no need to upload blueprint for Holmes, thus blueprintPayload for Holmes is empty + String bluprintPayload = sdcReq.formatBlueprint(prop, docText); + // no need to upload blueprint for Holmes, thus blueprintPayload for + // Holmes is empty if (!bluprintPayload.isEmpty()) { - String formattedSdcReq = SdcReq.formatSdcReq(bluprintPayload, artifactName, artifactLabel, artifactType); + String formattedSdcReq = sdcReq.formatSdcReq(bluprintPayload, artifactName, artifactLabel, artifactType); if (formattedSdcReq != null) { execution.setVariable("formattedArtifactReq", formattedSdcReq.getBytes()); } - List sdcReqUrlsList = SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, execution); - - String sdcLocationsPayload = SdcReq.formatSdcLocationsReq(prop, artifactName); + List sdcReqUrlsList = sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, execution); + String sdcLocationsPayload = sdcReq.formatSdcLocationsReq(prop, artifactName); String locationArtifactName = (String) execution.getVariable("controlName") + "-location.json"; - String formattedSdcLocationReq = SdcReq.formatSdcReq(sdcLocationsPayload, locationArtifactName, - locationArtifactLabel, locationArtifactType); + String formattedSdcLocationReq = sdcReq.formatSdcReq(sdcLocationsPayload, locationArtifactName, + locationArtifactLabel, locationArtifactType); if (formattedSdcLocationReq != null) { execution.setVariable("formattedLocationReq", formattedSdcLocationReq.getBytes()); } sdcCatalogServices.uploadToSdc(prop, userid, sdcReqUrlsList, formattedSdcReq, formattedSdcLocationReq, - artifactName, locationArtifactName); + artifactName, locationArtifactName); } } /** * Method to get sdc service values from properties file. + * * @param controlName */ private void getSdcAttributes(String controlName) { baseUrl = refProp.getStringValue("sdc.serviceUrl"); - artifactLabel = SdcReq + artifactLabel = sdcReq .normalizeResourceInstanceName(refProp.getStringValue("sdc.artifactLabel") + "-" + controlName); - locationArtifactLabel = SdcReq + locationArtifactLabel = sdcReq .normalizeResourceInstanceName(refProp.getStringValue("sdc.locationArtifactLabel") + "-" + controlName); artifactType = refProp.getStringValue("sdc.artifactType"); locationArtifactType = refProp.getStringValue("sdc.locationArtifactType"); diff --git a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java index 640d3b0c..38e3b15a 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java +++ b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java @@ -31,15 +31,14 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Base64; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Map.Entry; import org.apache.commons.codec.digest.DigestUtils; @@ -51,19 +50,23 @@ import org.onap.clamp.clds.model.prop.Global; import org.onap.clamp.clds.model.prop.ModelProperties; import org.onap.clamp.clds.model.prop.Tca; import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.util.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; /** * Construct a Sdc request given CLDS objects. */ public class SdcReq { + @Autowired + protected CryptoUtils cryptoUtils; protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcReq.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + @Autowired + protected RefProp refProp; /** * Format the Blueprint from a Yaml * - * @param refProp - * The RefProp instance containing the Clds config * @param prop * The ModelProperties describing the clds model * @param docText @@ -77,14 +80,9 @@ public class SdcReq { * @throws IOException * In case of issues */ - public static String formatBlueprint(RefProp refProp, ModelProperties prop, String docText) + public String formatBlueprint(ModelProperties prop, String docText) throws JsonParseException, JsonMappingException, IOException { - - Global globalProp = prop.getGlobal(); - String service = globalProp.getService(); - String yamlvalue = getYamlvalue(docText); - String updatedBlueprint = ""; Tca tca = prop.getType(Tca.class); if (tca.isFound()) { @@ -94,7 +92,17 @@ public class SdcReq { return updatedBlueprint; } - public static String formatSdcLocationsReq(ModelProperties prop, String artifactName) { + /** + * Format the SDC Locations Request in the JSON Format + * + * @param prop + * The ModelProperties describing the clds model + * @param artifactName + * The name of the artifact + * + * @return SDC Locations request in the JSON Format + */ + public String formatSdcLocationsReq(ModelProperties prop, String artifactName) { ObjectMapper objectMapper = new ObjectMapper(); Global global = prop.getGlobal(); List locationsList = global.getLocation(); @@ -106,12 +114,27 @@ public class SdcReq { locationObject.put("artifactName", artifactName); locationObject.putPOJO("locations", locationsArrayNode); String locationJsonFormat = locationObject.toString(); - logger.info("Value of locaation Json Artifact:" + locationsArrayNode); + logger.info("Value of location Json Artifact:" + locationsArrayNode); return locationJsonFormat; } - public static String formatSdcReq(String payloadData, String artifactName, String artifactLabel, - String artifactType) throws IOException { + /** + * Format the SDC Request + * + * @param payloadData + * The ModelProperties describing the clds model + * @param artifactName + * The name of the artifact + * @param artifactLabel + * The Label of the artifact + * @param artifactType + * The type of the artifact + * @return formatted SDC Request + * @throws IOException + * In case of issues + */ + public String formatSdcReq(String payloadData, String artifactName, String artifactLabel, String artifactType) + throws IOException { logger.info("artifact=" + payloadData); String base64Artifact = base64Encode(payloadData); return "{ \n" + "\"payloadData\" : \"" + base64Artifact + "\",\n" + "\"artifactLabel\" : \"" + artifactLabel @@ -120,7 +143,16 @@ public class SdcReq { + "} \n"; } - public static String getSdcReqUrl(ModelProperties prop, String url) { + /** + * Get the SDC Request URL + * + * @param prop + * The ModelProperties describing the clds model + * @param url + * url + * @return SDC Request URL + */ + public String getSdcReqUrl(ModelProperties prop, String url) { Global globalProps = prop.getGlobal(); String serviceUUID = ""; String resourceInstanceName = ""; @@ -143,13 +175,14 @@ public class SdcReq { * @param prop * @param baseUrl * @param sdcCatalogServices + * @param execution * @return + * @throws GeneralSecurityException */ - public static List getSdcReqUrlsList(ModelProperties prop, String baseUrl, - SdcCatalogServices sdcCatalogServices, DelegateExecution execution) { + public List getSdcReqUrlsList(ModelProperties prop, String baseUrl, SdcCatalogServices sdcCatalogServices, + DelegateExecution execution) throws GeneralSecurityException { // TODO : refact and regroup with very similar code List urlList = new ArrayList<>(); - Global globalProps = prop.getGlobal(); if (globalProps != null) { if (globalProps.getService() != null) { @@ -178,7 +211,6 @@ public class SdcReq { } } } - return urlList; } @@ -190,7 +222,7 @@ public class SdcReq { * @param inText * @return */ - public static String normalizeResourceInstanceName(String inText) { + public String normalizeResourceInstanceName(String inText) { return inText.replace(" ", "").replace("-", "").replace(".", "").toLowerCase(); } @@ -200,7 +232,7 @@ public class SdcReq { * @param data * @return */ - public static String calculateMD5ByString(String data) { + public String calculateMD5ByString(String data) { String calculatedMd5 = DigestUtils.md5Hex(data); // encode base-64 result return base64Encode(calculatedMd5.getBytes()); @@ -212,7 +244,7 @@ public class SdcReq { * @param inText * @return */ - public static String base64Encode(String inText) { + public String base64Encode(String inText) { return base64Encode(stringToByteArray(inText)); } @@ -222,7 +254,7 @@ public class SdcReq { * @param inText * @return */ - public static byte[] stringToByteArray(String inText) { + public byte[] stringToByteArray(String inText) { return inText.getBytes(StandardCharsets.UTF_8); } @@ -232,7 +264,7 @@ public class SdcReq { * @param bytes * @return */ - public static String base64Encode(byte[] bytes) { + public String base64Encode(byte[] bytes) { Base64.Encoder encoder = Base64.getEncoder(); return encoder.encodeToString(bytes); } @@ -241,12 +273,15 @@ public class SdcReq { * Return SDC id and pw as a HTTP Basic Auth string (for example: Basic * dGVzdDoxMjM0NTY=). * - * @return + * @return The String with Basic Auth and password + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password */ - public static String getSdcBasicAuth(RefProp refProp) { + public String getSdcBasicAuth() throws GeneralSecurityException { String sdcId = refProp.getStringValue("sdc.serviceUsername"); String sdcPw = refProp.getStringValue("sdc.servicePassword"); - String idPw = base64Encode(sdcId + ":" + sdcPw); + String password = cryptoUtils.decrypt(sdcPw); + String idPw = base64Encode(sdcId + ":" + password); return "Basic " + idPw; } @@ -257,7 +292,7 @@ public class SdcReq { * @return * @throws IOException */ - public static String getYamlvalue(String docText) throws IOException { + public String getYamlvalue(String docText) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String yamlFileValue = ""; ObjectNode root = objectMapper.readValue(docText, ObjectNode.class); diff --git a/src/main/java/org/onap/clamp/clds/config/CamundaEngineConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CamundaEngineConfiguration.java index a27cc69b..3790e235 100644 --- a/src/main/java/org/onap/clamp/clds/config/CamundaEngineConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CamundaEngineConfiguration.java @@ -23,9 +23,10 @@ package org.onap.clamp.clds.config; +import java.security.GeneralSecurityException; + import javax.sql.DataSource; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,15 +34,17 @@ import org.springframework.context.annotation.Primary; @Configuration public class CamundaEngineConfiguration { - /** - * Camunda Identity databse DataSource configuration + * Camunda Identity database DataSource configuration + * + * @return + * @throws GeneralSecurityException + * In case of issue during the decoding of the password */ @Primary @Bean(name = "camundaBpmDataSource") @ConfigurationProperties(prefix = "spring.datasource.camunda") public DataSource dataSource() { - return DataSourceBuilder.create().build(); + return new EncodedPasswordBasicDataSource(); } - } diff --git a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java index 6b7d337e..0c73ac71 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java @@ -26,6 +26,7 @@ package org.onap.clamp.clds.config; import com.att.ajsc.common.AjscProvider; import com.att.ajsc.common.AjscService; +import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; @@ -44,12 +45,12 @@ import org.onap.clamp.clds.client.SdcCatalogServices; import org.onap.clamp.clds.client.SdcSendReqDelegate; import org.onap.clamp.clds.client.TcaPolicyDelegate; import org.onap.clamp.clds.client.TcaPolicyDeleteDelegate; +import org.onap.clamp.clds.client.req.SdcReq; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.refprop.RefProp; import org.onap.clamp.clds.transform.XslTransformer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; @@ -59,17 +60,18 @@ import org.springframework.context.annotation.Profile; @Configuration @Profile("clamp-default") public class CldsConfiguration { - @Autowired private ApplicationContext context; /** * Clds Identity database DataSource configuration + * + * @return */ @Bean(name = "cldsDataSource") @ConfigurationProperties(prefix = "spring.datasource.cldsdb") public DataSource cldsDataSource() { - return DataSourceBuilder.create().build(); + return new EncodedPasswordBasicDataSource(); } @Bean(name = "jaxrsProviders") @@ -101,6 +103,11 @@ public class CldsConfiguration { return new RefProp(); } + @Bean + public SdcReq getSdcReq() { + return new SdcReq(); + } + @Bean public PolicyClient getPolicyClient() { return new PolicyClient(); @@ -160,5 +167,4 @@ public class CldsConfiguration { public HolmesPolicyDeleteDelegate getHolmesPolicyDeleteDelegate() { return new HolmesPolicyDeleteDelegate(); } - } \ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 19e3caa3..15706345 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -24,12 +24,15 @@ package org.onap.clamp.clds.service; import com.att.ajsc.common.AjscService; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.io.InputStream; +import java.security.GeneralSecurityException; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -39,6 +42,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import javax.annotation.PostConstruct; +import javax.ws.rs.BadRequestException; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; @@ -62,11 +66,13 @@ import org.onap.clamp.clds.client.SdcCatalogServices; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.SdcCommunicationException; +import org.onap.clamp.clds.exception.policy.PolicyClientException; import org.onap.clamp.clds.model.CldsDBServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.model.CldsInfo; import org.onap.clamp.clds.model.CldsModel; +import org.onap.clamp.clds.model.CldsModelProp; import org.onap.clamp.clds.model.CldsSdcResource; import org.onap.clamp.clds.model.CldsSdcServiceDetail; import org.onap.clamp.clds.model.CldsSdcServiceInfo; @@ -74,6 +80,7 @@ import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.DcaeEvent; import org.onap.clamp.clds.model.ValueItem; +import org.onap.clamp.clds.model.prop.AbstractModelElement; import org.onap.clamp.clds.model.prop.ModelProperties; import org.onap.clamp.clds.model.refprop.RefProp; import org.onap.clamp.clds.transform.XslTransformer; @@ -94,37 +101,26 @@ import io.swagger.annotations.ApiOperation; @Api(value = "/clds") @Path("/clds") public class CldsService extends SecureServiceBase { - + protected static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger(); @Autowired - private ApplicationContext appContext; - - private static final String RESOURCE_NAME = "clds-version.properties"; - + private ApplicationContext appContext; + private static final String RESOURCE_NAME = "clds-version.properties"; @Value("${CLDS_PERMISSION_TYPE_CL:permission-type-cl}") - private String cldsPersmissionTypeCl; - + private String cldsPersmissionTypeCl; @Value("${CLDS_PERMISSION_TYPE_CL_MANAGE:permission-type-cl-manage}") - private String cldsPermissionTypeClManage; - + private String cldsPermissionTypeClManage; @Value("${CLDS_PERMISSION_TYPE_CL_EVENT:permission-type-cl-event}") - private String cldsPermissionTypeClEvent; - + private String cldsPermissionTypeClEvent; @Value("${CLDS_PERMISSION_TYPE_FILTER_VF:permission-type-filter-vf}") - private String cldsPermissionTypeFilterVf; - + private String cldsPermissionTypeFilterVf; @Value("${CLDS_PERMISSION_TYPE_TEMPLATE:permission-type-template}") - private String cldsPermissionTypeTemplate; - + private String cldsPermissionTypeTemplate; @Value("${CLDS_PERMISSION_INSTANCE:dev}") - private String cldsPermissionInstance; - - private SecureServicePermission permissionReadCl; - - private SecureServicePermission permissionUpdateCl; - - private SecureServicePermission permissionReadTemplate; - - private SecureServicePermission permissionUpdateTemplate; + private String cldsPermissionInstance; + private SecureServicePermission permissionReadCl; + private SecureServicePermission permissionUpdateCl; + private SecureServicePermission permissionReadTemplate; + private SecureServicePermission permissionUpdateTemplate; @PostConstruct private final void afterConstruction() { @@ -138,25 +134,19 @@ public class CldsService extends SecureServiceBase { @Value("${org.onap.clamp.config.files.globalClds:'classpath:/clds/globalClds.properties'}") private String globalClds; - private Properties globalCldsProperties; - @Autowired private CldsDao cldsDao; @Autowired private RuntimeService runtimeService; @Autowired private XslTransformer cldsBpmnTransformer; - @Autowired private RefProp refProp; - @Autowired private SdcCatalogServices sdcCatalogServices; - @Autowired private DcaeDispatcherServices dcaeDispatcherServices; - @Autowired private DcaeInventoryServices dcaeInventoryServices; @@ -173,23 +163,20 @@ public class CldsService extends SecureServiceBase { * that is currently installed from pom.xml file 3. User permissions * */ - @GET @Path("/cldsInfo") @Produces(MediaType.APPLICATION_JSON) public CldsInfo getCldsInfo() { - CldsInfo cldsInfo = new CldsInfo(); - + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsService: GET cldsInfo", getPrincipalName()); + LoggingUtils.setTimeContext(startTime, new Date()); // Get the user info cldsInfo.setUserName(getUserName()); - // Get CLDS application version String cldsVersion = ""; Properties props = new Properties(); - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - try (InputStream resourceStream = loader.getResourceAsStream(RESOURCE_NAME)) { props.load(resourceStream); cldsVersion = props.getProperty("clds.version"); @@ -197,22 +184,31 @@ public class CldsService extends SecureServiceBase { logger.error("Exception caught during the clds.version reading", ex); } cldsInfo.setCldsVersion(cldsVersion); - // Get the user list of permissions cldsInfo.setPermissionReadCl(isAuthorizedNoException(permissionReadCl)); cldsInfo.setPermissionUpdateCl(isAuthorizedNoException(permissionUpdateCl)); cldsInfo.setPermissionReadTemplate(isAuthorizedNoException(permissionReadTemplate)); cldsInfo.setPermissionUpdateTemplate(isAuthorizedNoException(permissionUpdateTemplate)); + // audit log + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "Get cldsInfo success", this.getClass().getName()); + securityLogger.info("GET cldsInfo completed"); return cldsInfo; } + /** + * REST service that retrieves clds healthcheck information. + * + * @return CldsHealthCheck class containing healthcheck info + */ @GET @Path("/healthcheck") @Produces(MediaType.APPLICATION_JSON) public CldsHealthCheck gethealthcheck() { - CldsHealthCheck cldsHealthCheck = new CldsHealthCheck(); - + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsService: GET healthcheck", getPrincipalName()); + LoggingUtils.setTimeContext(startTime, new Date()); try { cldsDao.doHealthCheck(); cldsHealthCheck.setHealthCheckComponent("CLDS-APP"); @@ -224,8 +220,11 @@ public class CldsService extends SecureServiceBase { cldsHealthCheck.setHealthCheckStatus("DOWN"); cldsHealthCheck.setDescription("NOT-OK"); } + // audit log + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "Get healthcheck success", this.getClass().getName()); + securityLogger.info("GET healthcheck completed"); return cldsHealthCheck; - } /** @@ -253,32 +252,6 @@ public class CldsService extends SecureServiceBase { return model.getBpmnText(); } - /** - * REST service that saves BPMN for a CLDS model by name in the database. - * This is subset of the json putModel. This is only expected to be used for - * testing purposes, not by the UI. - * - * @param modelName - */ - @ApiOperation(value = "Saves BPMN for a CLDS model by name in the database", notes = "This is only expected to be used for testing purposes, not by the UI", response = String.class) - @PUT - @Path("/model/bpmn/{modelName}") - @Consumes(MediaType.TEXT_XML) - public String putBpmnXml(@PathParam("modelName") String modelName, String bpmnText) { - LoggingUtils.setRequestContext("CldsService: PUT model bpmn", getPrincipalName()); - isAuthorized(permissionUpdateCl); - logger.info("PUT bpmnText for modelName={}", modelName); - logger.info("PUT bpmnText={}", bpmnText); - CldsModel cldsModel = CldsModel.retrieve(cldsDao, modelName, true); - cldsModel.setBpmnText(bpmnText); - cldsModel.save(cldsDao, getUserId()); - // audit log - LoggingUtils.setTimeContext(new Date(), new Date()); - LoggingUtils.setResponseContext("0", "Put model bpmn success", this.getClass().getName()); - auditLogger.info("PUT model bpmn completed"); - return "wrote bpmnText for modelName=" + modelName; - } - /** * REST service that retrieves image for a CLDS model name from the * database. This is subset of the json getModel. This is only expected to @@ -304,33 +277,6 @@ public class CldsService extends SecureServiceBase { return model.getImageText(); } - /** - * REST service that saves image for a CLDS model by name in the database. - * This is subset of the json putModel. This is only expected to be used for - * testing purposes, not by the UI. - * - * @param modelName - */ - @ApiOperation(value = "Saves image for a CLDS model by name in the database", notes = "This is only expected to be used for testing purposes, not by the UI", response = String.class) - @PUT - @Path("/model/image/{modelName}") - @Consumes(MediaType.TEXT_XML) - public String putImageXml(@PathParam("modelName") String modelName, String imageText) { - Date startTime = new Date(); - LoggingUtils.setRequestContext("CldsService: PUT model image", getPrincipalName()); - isAuthorized(permissionUpdateCl); - logger.info("PUT iamgeText for modelName={}", modelName); - logger.info("PUT imageText={}", imageText); - CldsModel cldsModel = CldsModel.retrieve(cldsDao, modelName, true); - cldsModel.setImageText(imageText); - cldsModel.save(cldsDao, getUserId()); - // audit log - LoggingUtils.setTimeContext(startTime, new Date()); - LoggingUtils.setResponseContext("0", "Put model image success", this.getClass().getName()); - auditLogger.info("PUT model image completed"); - return "wrote imageText for modelName=" + modelName; - } - /** * REST service that retrieves a CLDS model by name from the database. * @@ -349,7 +295,6 @@ public class CldsService extends SecureServiceBase { CldsModel cldsModel = CldsModel.retrieve(cldsDao, modelName, false); isAuthorizedForVf(cldsModel); cldsModel.setUserAuthorizedToUpdate(isAuthorizedNoException(permissionUpdateCl)); - /** * Checking condition whether our CLDS model can call INventory Method */ @@ -392,7 +337,12 @@ public class CldsService extends SecureServiceBase { logger.info("PUT propText={}", cldsModel.getPropText()); logger.info("PUT imageText={}", cldsModel.getImageText()); cldsModel.setName(modelName); - + try { + duplicateCheckforServiceVf(modelName, cldsModel.getPropText()); + } catch (IOException | BadRequestException e) { + logger.error("Exception occured during duplicate check for service and VF", e); + throw new CldsConfigException(e.getMessage(), e); + } if (cldsModel.getTemplateName() != null) { CldsTemplate template = cldsDao.getTemplate(cldsModel.getTemplateName()); if (template != null) { @@ -441,6 +391,7 @@ public class CldsService extends SecureServiceBase { * @return * @throws TransformerException * @throws ParseException + * @throws GeneralSecurityException */ @ApiOperation(value = "Saves and processes an action for a CLDS model by name", notes = "", response = String.class) @PUT @@ -449,7 +400,7 @@ public class CldsService extends SecureServiceBase { @Produces(MediaType.APPLICATION_JSON) public CldsModel putModelAndProcessAction(@PathParam("action") String action, @PathParam("modelName") String modelName, @QueryParam("test") String test, CldsModel model) - throws TransformerException, ParseException { + throws TransformerException, ParseException, GeneralSecurityException { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Process model action", getPrincipalName()); String actionCd = action.toUpperCase(); @@ -460,7 +411,6 @@ public class CldsService extends SecureServiceBase { String userid = getUserId(); String actionStateCd = CldsEvent.ACTION_STATE_INITIATED; String processDefinitionKey = "clds-process-action-wf"; - logger.info("PUT actionCd={}", actionCd); logger.info("PUT actionStateCd={}", actionStateCd); logger.info("PUT processDefinitionKey={}", processDefinitionKey); @@ -471,7 +421,6 @@ public class CldsService extends SecureServiceBase { logger.info("PUT userid={}", userid); logger.info("PUT getTypeId={}", model.getTypeId()); logger.info("PUT deploymentId={}", model.getDeploymentId()); - if (model.getTemplateName() != null) { CldsTemplate template = cldsDao.getTemplate(model.getTemplateName()); if (template != null) { @@ -483,16 +432,13 @@ public class CldsService extends SecureServiceBase { // save model to db model.setName(modelName); model.save(cldsDao, getUserId()); - // get vars and format if necessary String prop = model.getPropText(); String bpmn = model.getBpmnText(); String docText = model.getDocText(); String controlName = model.getControlName(); - String bpmnJson = cldsBpmnTransformer.doXslTransformToString(bpmn); logger.info("PUT bpmnJson={}", bpmnJson); - // Flag indicates whether it is triggered by Validation Test button from // UI boolean isTest = false; @@ -507,17 +453,14 @@ public class CldsService extends SecureServiceBase { } } logger.info("PUT isTest={}", isTest); - boolean isInsertTestEvent = false; String insertTestEvent = refProp.getStringValue("action.insert.test.event"); if (insertTestEvent != null && insertTestEvent.equalsIgnoreCase("true")) { isInsertTestEvent = true; } logger.info("PUT isInsertTestEvent={}", isInsertTestEvent); - // determine if requested action is permitted model.validateAction(actionCd); - // input variables to camunda process Map variables = new HashMap<>(); variables.put("actionCd", actionCd); @@ -531,17 +474,18 @@ public class CldsService extends SecureServiceBase { variables.put("isInsertTestEvent", isInsertTestEvent); logger.info("modelProp - " + prop); logger.info("docText - " + docText); - - // start camunda process - ProcessInstance pi = runtimeService.startProcessInstanceByKey(processDefinitionKey, variables); - - // log process info - logger.info("Started processDefinitionId={}, processInstanceId={}", pi.getProcessDefinitionId(), - pi.getProcessInstanceId()); - + try { + // start camunda process + ProcessInstance pi = runtimeService.startProcessInstanceByKey(processDefinitionKey, variables); + // log process info + logger.info("Started processDefinitionId={}, processInstanceId={}", pi.getProcessDefinitionId(), + pi.getProcessInstanceId()); + } catch (SdcCommunicationException | PolicyClientException | BadRequestException e) { + logger.error("Exception occured during invoking bpmn process", e); + throw new CldsConfigException(e.getMessage(), e); + } // refresh model info from db (get fresh event info) CldsModel retreivedModel = CldsModel.retrieve(cldsDao, modelName, false); - if (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT) || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT)) { // To verify inventory status and modify model status to distribute @@ -552,7 +496,6 @@ public class CldsService extends SecureServiceBase { LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Process model action success", this.getClass().getName()); auditLogger.info("Process model action completed"); - return retreivedModel; } @@ -579,14 +522,12 @@ public class CldsService extends SecureServiceBase { isAuthorized(permissionEvent); userid = getUserId(); } - // Flag indicates whether it is triggered by Validation Test button from // UI boolean isTest = false; if (test != null && test.equalsIgnoreCase("true")) { isTest = true; } - int instanceCount = 0; if (dcaeEvent.getInstances() != null) { instanceCount = dcaeEvent.getInstances().size(); @@ -595,7 +536,6 @@ public class CldsService extends SecureServiceBase { + " resourceUUID=" + dcaeEvent.getResourceUUID() + " artifactName=" + dcaeEvent.getArtifactName() + " instance count=" + instanceCount + " isTest=" + isTest; logger.info("POST dcae event {}", msgInfo); - if (isTest) { logger.warn("Ignorning test event from DCAE"); } else { @@ -610,24 +550,24 @@ public class CldsService extends SecureServiceBase { LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Post dcae event success", this.getClass().getName()); auditLogger.info("Post dcae event completed"); - return msgInfo; } /** * REST service that retrieves sdc services + * + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password * - * @throws Exception */ @ApiOperation(value = "Retrieves sdc services", notes = "", response = String.class) @GET @Path("/sdc/services") @Produces(MediaType.APPLICATION_JSON) - public String getSdcServices() { + public String getSdcServices() throws GeneralSecurityException { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: GET sdc services", getPrincipalName()); String retStr; - String responseStr = sdcCatalogServices.getSdcServicesInformation(null); try { retStr = createUiServiceFormatJson(responseStr); @@ -635,7 +575,6 @@ public class CldsService extends SecureServiceBase { logger.error("IOException during SDC communication", e); throw new SdcCommunicationException("IOException during SDC communication", e); } - logger.info("value of sdcServices : {}", retStr); // audit log LoggingUtils.setTimeContext(startTime, new Date()); @@ -663,6 +602,9 @@ public class CldsService extends SecureServiceBase { * REST service that retrieves total properties by using invariantUUID based * on refresh and non refresh * + * @throws GeneralSecurityException + * In case of issue when decryting the SDC password + * */ @ApiOperation(value = "Retrieves total properties by using invariantUUID based on refresh and non refresh", notes = "", response = String.class) @GET @@ -670,12 +612,11 @@ public class CldsService extends SecureServiceBase { @Produces(MediaType.APPLICATION_JSON) public String getSdcPropertiesByServiceUUIDForRefresh( @PathParam("serviceInvariantUUID") String serviceInvariantUUID, - @DefaultValue("false") @QueryParam("refresh") String refresh) { + @DefaultValue("false") @QueryParam("refresh") String refresh) throws GeneralSecurityException { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: GET sdc properties by uuid", getPrincipalName()); CldsServiceData cldsServiceData = new CldsServiceData(); cldsServiceData.setServiceInvariantUUID(serviceInvariantUUID); - boolean isCldsSdcDataExpired = true; // To getcldsService information from database cache using invariantUUID // only when refresh = false @@ -698,18 +639,14 @@ public class CldsService extends SecureServiceBase { cldsServiceData.setCldsServiceCache(cldsDao, cldsDBServiceCache); } } - // filter out VFs the user is not authorized for cldsServiceData.filterVfs(this); - // format retrieved data into properties json String sdcProperties = sdcCatalogServices.createPropertiesObjectByUUID(getGlobalCldsString(), cldsServiceData); - // audit log LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get sdc properties by uuid success", this.getClass().getName()); auditLogger.info("GET sdc properties by uuid completed"); - return sdcProperties; } @@ -763,7 +700,6 @@ public class CldsService extends SecureServiceBase { logger.info("value of cldsserviceiNfolist: {}", rawList); if (rawList != null && !rawList.isEmpty()) { List cldsSdcServiceInfoList = sdcCatalogServices.removeDuplicateServices(rawList); - for (CldsSdcServiceInfo currCldsSdcServiceInfo : cldsSdcServiceInfoList) { if (currCldsSdcServiceInfo != null) { invariantIdServiceNode.put(currCldsSdcServiceInfo.getInvariantUUID(), @@ -785,7 +721,6 @@ public class CldsService extends SecureServiceBase { */ ObjectNode serviceObjectNode = createEmptyVfAlarmObject(mapper); ObjectNode vfObjectNode = mapper.createObjectNode(); - /** * to create json with vf and vfresourceId */ @@ -793,7 +728,6 @@ public class CldsService extends SecureServiceBase { serviceObjectNode.putPOJO(cldsSdcServiceDetail.getInvariantUUID(), vfObjectNode); ObjectNode byServiceBasicObjetNode = mapper.createObjectNode(); byServiceBasicObjetNode.putPOJO("byService", serviceObjectNode); - /** * to create json with VFC Node */ @@ -827,7 +761,6 @@ public class CldsService extends SecureServiceBase { List rawCldsSdcResourceList) { ObjectNode vfNode = mapper.createObjectNode(); vfNode.put("", ""); - // To remove repeated resource instance name from // resourceInstanceList List cldsSdcResourceList = sdcCatalogServices @@ -843,7 +776,6 @@ public class CldsService extends SecureServiceBase { } } vfObjectNode2.putPOJO("vf", vfNode); - /** * creating location json object using properties file value */ @@ -857,7 +789,6 @@ public class CldsService extends SecureServiceBase { "Unable to load ui.location.default JSON in clds-references.properties properly", e); } vfObjectNode2.putPOJO("location", locationJsonNode); - /** * creating alarm json object using properties file value */ @@ -872,7 +803,6 @@ public class CldsService extends SecureServiceBase { e); } vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode); - } private ObjectNode createByVFCObjectNode(ObjectMapper mapper, List cldsSdcResourceList) { @@ -901,7 +831,13 @@ public class CldsService extends SecureServiceBase { @QueryParam("test") String test, CldsModel model) throws IOException { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Deploy model", getPrincipalName()); - String deploymentId = "closedLoop_" + UUID.randomUUID() + "_deploymentId"; + String deploymentId = ""; + // If model is already deployed then pass same deployment id + if (model.getDeploymentId() != null && !model.getDeploymentId().isEmpty()) { + deploymentId = model.getDeploymentId(); + } else { + deploymentId = "closedLoop_" + UUID.randomUUID() + "_deploymentId"; + } String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId, model.getTypeId()); String operationStatus = "processing"; @@ -995,4 +931,27 @@ public class CldsService extends SecureServiceBase { throw new CldsConfigException("Unable to load the globalClds due to an exception", e); } } + + private void duplicateCheckforServiceVf(String modelName, String modelPropText) throws IOException { + JsonNode modelJson = new ObjectMapper().readTree(modelPropText); + JsonNode globalNode = modelJson.get("global"); + String service = AbstractModelElement.getValueByName(globalNode, "service"); + List resourceVf = AbstractModelElement.getValuesByName(globalNode, "vf"); + if (resourceVf != null && !resourceVf.isEmpty()) { + List cldsModelPropList = cldsDao.getAllModelProperties(); + for (CldsModelProp cldsModelProp : cldsModelPropList) { + JsonNode currentJson = new ObjectMapper().readTree(cldsModelProp.getPropText()); + JsonNode currentNode = currentJson.get("global"); + String currentService = AbstractModelElement.getValueByName(currentNode, "service"); + List currentVf = AbstractModelElement.getValuesByName(currentNode, "vf"); + if (currentVf != null && !currentVf.isEmpty()) { + if (!modelName.equalsIgnoreCase(cldsModelProp.getName()) && service.equalsIgnoreCase(currentService) + && resourceVf.get(0).equalsIgnoreCase(currentVf.get(0))) { + throw new BadRequestException("Same service/VF already exists in " + cldsModelProp.getName() + + " model, please select different service/VF."); + } + } + } + } + } } diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java index acbd8bbd..70ba32f5 100644 --- a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java +++ b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java @@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import java.security.Principal; +import java.util.Date; import javax.ws.rs.NotAuthorizedException; import javax.ws.rs.core.Context; @@ -40,6 +41,7 @@ import org.onap.clamp.clds.util.LoggingUtils; public abstract class SecureServiceBase { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SecureServiceBase.class); protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + protected static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger(); // By default we'll set it to a default handler private static UserNameHandler userNameHandler = new DefaultUserNameHandler(); @@ -63,7 +65,10 @@ public abstract class SecureServiceBase { */ public String getUserName() { String name = userNameHandler.retrieveUserName(securityContext); - logger.debug("userName={}", name); + Date startTime = new Date(); + LoggingUtils.setTargetContext("CLDS", "getUserName"); + LoggingUtils.setTimeContext(startTime, new Date()); + securityLogger.debug("User logged into the CLDS system={}", name); return name; } @@ -100,30 +105,33 @@ public abstract class SecureServiceBase { */ public boolean isAuthorized(SecureServicePermission inPermission) throws NotAuthorizedException { boolean authorized = false; - logger.debug("checking if {} has permission: {}", getPrincipalName(), inPermission); + + Date startTime = new Date(); + LoggingUtils.setTargetContext("CLDS", "isAuthorized"); + LoggingUtils.setTimeContext(startTime, new Date()); + + securityLogger.debug("checking if {} has permission: {}", getPrincipalName(), inPermission); + // check if the user has the permission key or the permission key with a // combination of all instance and/or all action. if (securityContext.isUserInRole(inPermission.getKey())) { - logger.info("{} authorized for permission: {}", getPrincipalName(), inPermission.getKey()); + securityLogger.info("{} authorized for permission: {}", getPrincipalName(), inPermission.getKey()); authorized = true; // the rest of these don't seem to be required - isUserInRole method // appears to take * as a wildcard } else if (securityContext.isUserInRole(inPermission.getKeyAllInstance())) { - logger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), - inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), inPermission.getKey()); authorized = true; } else if (securityContext.isUserInRole(inPermission.getKeyAllInstanceAction())) { - logger.info("{} authorized because user has permission with * for instance and * for action: {}", - getPrincipalName(), inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey()); authorized = true; } else if (securityContext.isUserInRole(inPermission.getKeyAllAction())) { - logger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), - inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey()); authorized = true; } else { String msg = getPrincipalName() + " does not have permission: " + inPermission; LoggingUtils.setErrorContext("100", "Authorization Error"); - logger.warn(msg); + securityLogger.warn(msg); throw new NotAuthorizedException(msg); } return authorized; @@ -144,29 +152,32 @@ public abstract class SecureServiceBase { */ public boolean isAuthorizedNoException(SecureServicePermission inPermission) { boolean authorized = false; - logger.debug("checking if {} has permission: {}", getPrincipalName(), inPermission); + + securityLogger.debug("checking if {} has permission: {}", getPrincipalName(), inPermission); + Date startTime = new Date(); + LoggingUtils.setTargetContext("CLDS", "isAuthorizedNoException"); + LoggingUtils.setTimeContext(startTime, new Date()); + // check if the user has the permission key or the permission key with a // combination of all instance and/or all action. if (securityContext.isUserInRole(inPermission.getKey())) { - logger.info("{} authorized for permission: {}", getPrincipalName(), inPermission.getKey()); + securityLogger.info("{} authorized for permission: {}", getPrincipalName(), inPermission.getKey()); authorized = true; // the rest of these don't seem to be required - isUserInRole method // appears to take * as a wildcard } else if (securityContext.isUserInRole(inPermission.getKeyAllInstance())) { - logger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), - inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(),inPermission.getKey()); authorized = true; } else if (securityContext.isUserInRole(inPermission.getKeyAllInstanceAction())) { - logger.info("{} authorized because user has permission with * for instance and * for action: {}", - getPrincipalName(), inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey()); authorized = true; } else if (securityContext.isUserInRole(inPermission.getKeyAllAction())) { - logger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), - inPermission.getKey()); + securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey()); authorized = true; } else { String msg = getPrincipalName() + " does not have permission: " + inPermission; LoggingUtils.setErrorContext("100", "Authorization Error"); + securityLogger.warn(msg); logger.warn(msg); } return authorized; diff --git a/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java new file mode 100644 index 00000000..fd4d1b15 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.util; + +import java.security.GeneralSecurityException; + +import javax.annotation.PostConstruct; +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + * CryptoUtils for encrypting/decrypting string based on a Key defined in + * application.properties (Spring config file). + * + */ +@Component("CryptoUtils") +public final class CryptoUtils { + public static final String AES = "AES"; + public static final String KEY_PARAM = "org.onap.clamp.encryption.aes.key"; + @Autowired + private Environment springEnv; + private SecretKeySpec secretKeySpec; + + /** + * Initialize Method + * + */ + @PostConstruct + public void init() { + secretKeySpec = getSecretKeySpec(springEnv.getProperty(KEY_PARAM)); + } + + /** + * Encrypt a value based on the Clamp Encryption Key. + * + * @param value + * @return The encrypted string + * @throws GeneralSecurityException + * In case of issue with the encryption + */ + public String encrypt(String value) throws GeneralSecurityException { + Cipher cipher = Cipher.getInstance(CryptoUtils.AES); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, cipher.getParameters()); + byte[] encrypted = cipher.doFinal(value.getBytes()); + return byteArrayToHexString(encrypted); + } + + /** + * Decrypt a value. + * + * @param message + * The encrypted string that must be decrypted using the Clamp + * Encryption Key + * @return The String decrypted + * @throws GeneralSecurityException + * In case of issue with the encryption + */ + public String decrypt(String message) throws GeneralSecurityException { + Cipher cipher = Cipher.getInstance(CryptoUtils.AES); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); + byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); + return new String(decrypted); + } + + private SecretKeySpec getSecretKeySpec(String keyString) { + byte[] key = hexStringToByteArray(keyString); + return new SecretKeySpec(key, CryptoUtils.AES); + } + + private String byteArrayToHexString(byte[] b) { + StringBuilder sb = new StringBuilder(b.length * 2); + for (int i = 0; i < b.length; i++) { + int v = b[i] & 0xff; + if (v < 16) { + sb.append('0'); + } + sb.append(Integer.toHexString(v)); + } + return sb.toString().toUpperCase(); + } + + private byte[] hexStringToByteArray(String s) { + byte[] b = new byte[s.length() / 2]; + for (int i = 0; i < b.length; i++) { + int index = i * 2; + int v = Integer.parseInt(s.substring(index, index + 2), 16); + b[i] = (byte) v; + } + return b; + } +} diff --git a/src/main/java/org/onap/clamp/clds/workflow/ProcessRequestDelegate.java b/src/main/java/org/onap/clamp/clds/workflow/ProcessRequestDelegate.java index 19bdcaf9..a5d84bb6 100644 --- a/src/main/java/org/onap/clamp/clds/workflow/ProcessRequestDelegate.java +++ b/src/main/java/org/onap/clamp/clds/workflow/ProcessRequestDelegate.java @@ -21,35 +21,21 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -/* Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package org.onap.clamp.clds.workflow; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.springframework.stereotype.Component; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - @Component public class ProcessRequestDelegate implements JavaDelegate { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ProcessRequestDelegate.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ProcessRequestDelegate.class); protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - // @Override @Override public void execute(DelegateExecution execution) throws Exception { logger.info("Processing request by '" + execution.getVariable("customerId") + "'..."); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ae5d31a9..8155cb2b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -96,7 +96,7 @@ kubernetes.namespace=com-att-ajsc spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver spring.datasource.camunda.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 spring.datasource.camunda.username=camunda -spring.datasource.camunda.password=ndMSpw4CAM +spring.datasource.camunda.password=D75B89195FD913848EA11416F755390E spring.datasource.camunda.validationQuery=SELECT 1 spring.datasource.camunda.validationQueryTimeout=20000 spring.datasource.camunda.validationInterval=30000 @@ -117,7 +117,7 @@ camunda.bpm.database.schema-update=false spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 spring.datasource.cldsdb.username=clds -spring.datasource.cldsdb.password=sidnnd83K +spring.datasource.cldsdb.password=035F8819FEBB754F3C99ECCCC1259850 spring.datasource.cldsdb.validationQuery=SELECT 1 spring.datasource.cldsdb.validationQueryTimeout=20000 spring.datasource.cldsdb.validationInterval=30000 @@ -144,6 +144,7 @@ org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.propert org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties +org.onap.clamp.encryption.aes.key=aa3871669d893c7fb8abbcda31b88b4f #Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case ! CLDS_PERMISSION_TYPE_CL=permission-type-cl diff --git a/src/main/resources/clds/clds-reference.properties b/src/main/resources/clds/clds-reference.properties index 94f6dd2c..3bf018d3 100644 --- a/src/main/resources/clds/clds-reference.properties +++ b/src/main/resources/clds/clds-reference.properties @@ -80,7 +80,7 @@ sdc.catalog.url=http://sdc.api.simpledemo.onap.org:8080/sdc/v1/catalog/ sdc.hostUrl=http://sdc.api.simpledemo.onap.org:8080 sdc.serviceUrl=http://sdc.api.simpledemo.onap.org:8080/sdc/v1/catalog/services sdc.serviceUsername=test -sdc.servicePassword=123456 +sdc.servicePassword=A7CADD84A22398C980847A54D23E24E9 sdc.artifactLabel=blueprintclampcockpit sdc.sdcX-InstanceID=CLAMP sdc.artifactType=DCAE_INVENTORY_BLUEPRINT diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 84703132..a1330e3d 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,216 +1,257 @@ - - ${module.ajsc.namespace.name} - - - - - - - - INFO - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n - - - - - - - WARN - - ${logDirectory}/CLAMP/error.log - true - - %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC}|%X{RequestId}|%.20thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDescription}|%msg%n - - - 10 - ${logDirectory}/CLAMP/error.%i.log.zip - - - 10MB - - - - - ${logDirectory}/CLAMP/debug.log - true - - %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC}|%X{RequestId}|%.20thread|%.-5level|%logger{36}|%msg%n - - - 10 - ${logDirectory}/CLAMP/debug.%i.log.zip - - - 10MB - - - - - ${logDirectory}/CLAMP/audit.log - true - - %X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n - - - 10 - ${logDirectory}/CLAMP/audit.%i.log.zip - - - 10MB - - - - 256 - - - - - ${logDirectory}/CLAMP/metric.log - true - - %X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n - - - 10 - ${logDirectory}/CLAMP/metric.%i.log.zip - - - 10MB - - - - 256 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.log - - ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip - - 1 - 9 - - - 5MB - - - "%d [%thread] %-5level %logger{1024} - %msg%n" - - - - - - ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.log - - ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip - - 1 - 9 - - - 5MB - - - "%d [%thread] %-5level %logger{1024} - %msg%n" - - - - - - - - - - - - - - - - - - + + ${module.ajsc.namespace.name} + + + + + + + + INFO + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + + + + + + + WARN + + ${logDirectory}/CLAMP/error.log + true + + %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC}|%X{RequestId}|%.20thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDescription}|%msg%n + + + 10 + ${logDirectory}/CLAMP/error.%i.log.zip + + + + 10MB + + + + + ${logDirectory}/CLAMP/debug.log + true + + %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX",UTC}|%X{RequestId}|%.20thread|%.-5level|%logger{36}|%msg%n + + + 10 + ${logDirectory}/CLAMP/debug.%i.log.zip + + + + 10MB + + + + + ${logDirectory}/CLAMP/audit.log + true + + %X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n + + + + 10 + ${logDirectory}/CLAMP/audit.%i.log.zip + + + + 10MB + + + + 256 + + + + + ${logDirectory}/CLAMP/metric.log + true + + %X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| + %msg%n + + + 10 + ${logDirectory}/CLAMP/metric.%i.log.zip + + + + 10MB + + + + 256 + + + + + + ${logDirectory}/CLAMP/security.log + true + + %X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n + + + + 10 + ${logDirectory}/CLAMP/security.%i.log.zip + + + + 10MB + + + + 256 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.log + + ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 5MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.log + + ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + + 1 + 9 + + + 5MB + + + "%d [%thread] %-5level %logger{1024} - %msg%n" + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/it/CryptoUtilsItCase.java b/src/test/java/org/onap/clamp/clds/it/CryptoUtilsItCase.java new file mode 100644 index 00000000..f03fe83c --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/CryptoUtilsItCase.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.it; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.security.GeneralSecurityException; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.clamp.clds.util.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * Test Crypto Utils with Spring. + */ +@RunWith(SpringRunner.class) +@SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") +public class CryptoUtilsItCase { + @Autowired + private CryptoUtils cryptoUtils; + + /** + * This method tests encryption. + * + * @throws GeneralSecurityException + */ + @Test + public final void testEncryption() throws GeneralSecurityException { + final String testData = "This is a test string"; + final String encodedStringExpected = "A5CB112C9F608A220B35AFED08024D98B9653333AF4C9527C2E934DE473F6145"; + String encodedString = cryptoUtils.encrypt(testData); + assertNotNull(encodedString); + assertEquals(encodedStringExpected, encodedString); + } + + /** + * This method tests decryption. + * + * @throws GeneralSecurityException + */ + @Test + public final void testDecryption() throws GeneralSecurityException { + final String decodedStringExpected = "This is a test string"; + final String encodedString = "A5CB112C9F608A220B35AFED08024D98B9653333AF4C9527C2E934DE473F6145"; + String decryptedString = cryptoUtils.decrypt(encodedString); + assertNotNull(decryptedString); + assertEquals(decodedStringExpected, decryptedString); + } +} \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java index 0deae6d3..b684a506 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java @@ -298,6 +298,11 @@ public class SdcCatalogServicesItCase extends AbstractItCase { SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFCResources.json"), "UTF-8")) .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfcResourcesDetailUrl, false); + String allCvfcResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=CVFC"; + Mockito.doReturn(IOUtils.toString( + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcCVFCResources.json"), "UTF-8")) + .when(spy).getCldsServicesOrResourcesBasedOnURL(allCvfcResourcesDetailUrl, false); + String allVfAlarms = refProp.getStringValue("sdc.catalog.url") + "resources/84855843-5247-4e97-a2bd-5395a510253b/artifacts/d57ac7ec-f3c3-4793-983a-c75ac3a43153"; Mockito.doReturn(IOUtils.toString( diff --git a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java similarity index 73% rename from src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java rename to src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java index 497abe0f..faff2846 100644 --- a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java @@ -21,30 +21,41 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.client.req; +package org.onap.clamp.clds.it; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; import org.onap.clamp.clds.client.SdcCatalogServices; +import org.onap.clamp.clds.client.req.SdcReq; import org.onap.clamp.clds.model.CldsSdcResource; import org.onap.clamp.clds.model.CldsSdcServiceDetail; import org.onap.clamp.clds.model.prop.Global; import org.onap.clamp.clds.model.prop.ModelProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; -public class SdcReqTest { - - String baseUrl = "AYBABTU"; - String serviceInvariantUuid = "serviceInvariantUUID"; +@RunWith(SpringRunner.class) +@SpringBootTest +@TestPropertySource(locations = "classpath:application-no-camunda.properties") +public class SdcReqItCase { + String baseUrl = "AYBABTU"; + String serviceInvariantUuid = "serviceInvariantUUID"; + @Autowired + private SdcReq sdcReq; @Test - public void getSdcReqUrlsListNoGlobalPropTest() { + public void getSdcReqUrlsListNoGlobalPropTest() throws GeneralSecurityException { ModelProperties prop = mock(ModelProperties.class); SdcCatalogServices sdcCatalogServices = mock(SdcCatalogServices.class); DelegateExecution delegateExecution = mock(DelegateExecution.class); @@ -53,32 +64,25 @@ public class SdcReqTest { cldsSdcResources.add(cldsSdcResource); List resourceVf = new ArrayList<>(); resourceVf.add(serviceInvariantUuid); - - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); Global global = mock(Global.class); when(prop.getGlobal()).thenReturn(global); - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); when(global.getService()).thenReturn(serviceInvariantUuid); - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); CldsSdcServiceDetail cldsSdcServiceDetail = mock(CldsSdcServiceDetail.class); when(sdcCatalogServices.getCldsSdcServiceDetailFromJson(null)).thenReturn(cldsSdcServiceDetail); when(global.getResourceVf()).thenReturn(new ArrayList<>()); - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); when(cldsSdcServiceDetail.getResources()).thenReturn(cldsSdcResources); - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); when(cldsSdcResource.getResoucreType()).thenReturn("VF"); - Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); - + Assert.assertTrue(sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty()); when(global.getResourceVf()).thenReturn(resourceVf); when(cldsSdcResource.getResourceInvariantUUID()).thenReturn(serviceInvariantUuid); when(cldsSdcResource.getResourceInstanceName()).thenReturn("Resource instance name"); List expected = new ArrayList<>(); expected.add("AYBABTU/null/resourceInstances/resourceinstancename/artifacts"); - Assert.assertEquals(expected, SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution)); + Assert.assertEquals(expected, sdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution)); } } diff --git a/src/test/resources/application-no-camunda.properties b/src/test/resources/application-no-camunda.properties index 87e84781..f8727946 100644 --- a/src/test/resources/application-no-camunda.properties +++ b/src/test/resources/application-no-camunda.properties @@ -64,7 +64,6 @@ server.contextPath=/ #Modified engine-rest applicationpath spring.jersey.application-path=/engine-rest spring.profiles.active=clamp-default,clamp-spring-authentication -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration #The max number of active threads in this pool server.tomcat.max-threads=200 @@ -95,16 +94,19 @@ kubernetes.namespace=com-att-ajsc #server.port=0 #Camunda Process Engine DataSource connection Details -spring.datasource.camunda.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100 -spring.datasource.camunda.username=camunda -spring.datasource.camunda.password=ndMSpw4CAM spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver +spring.datasource.camunda.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 +spring.datasource.camunda.username=camunda +spring.datasource.camunda.password=D75B89195FD913848EA11416F755390E spring.datasource.camunda.validationQuery=SELECT 1 spring.datasource.camunda.validationQueryTimeout=20000 -spring.datasource.camunda.validationInterval=60000 +spring.datasource.camunda.validationInterval=30000 spring.datasource.camunda.testWhileIdle = true +spring.datasource.camunda.minIdle = 0 +spring.datasource.camunda.initialSize=0 # Automatically test whether a connection provided is good or not spring.datasource.camunda.testOnBorrow=true +spring.datasource.camunda.ignoreExceptionOnPreLoad=true #Camunda application properties #Camunda history level @@ -117,25 +119,25 @@ camunda.bpm.management.health.camunda.enabled=false camunda.bpm.metrics.enabled=false #clds datasource connection details -spring.datasource.cldsdb.driver-class-name=org.mariadb.jdbc.Driver -spring.datasource.cldsdb.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100 +spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver +spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 spring.datasource.cldsdb.username=clds -spring.datasource.cldsdb.password=sidnnd83K -spring.datasource.cldsdb.driverClassName=com.mysql.jdbc.Driver +spring.datasource.cldsdb.password=035F8819FEBB754F3C99ECCCC1259850 spring.datasource.cldsdb.validationQuery=SELECT 1 spring.datasource.cldsdb.validationQueryTimeout=20000 -spring.datasource.cldsdb.validationInterval=60000 +spring.datasource.cldsdb.validationInterval=30000 spring.datasource.cldsdb.testWhileIdle = true +spring.datasource.cldsdb.minIdle = 0 +spring.datasource.cldsdb.initialSize=0 # Automatically test whether a connection provided is good or not spring.datasource.cldsdb.testOnBorrow=true +spring.datasource.cldsdb.ignoreExceptionOnPreLoad=true #Async Executor default Parameters async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -org.onap.clamp.config.dcae.url=http://localhost:9000/closedloop-dcae-services - #GRM Edge endpoint details service.name=ajsc6camundademo service.version=1.0.0.0 @@ -147,6 +149,7 @@ org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.propert org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties +org.onap.clamp.encryption.aes.key=aa3871669d893c7fb8abbcda31b88b4f #Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case ! CLDS_PERMISSION_TYPE_CL=permission-type-cl diff --git a/src/test/resources/example/sdc/sdcCVFCResources.json b/src/test/resources/example/sdc/sdcCVFCResources.json new file mode 100644 index 00000000..790b2d53 --- /dev/null +++ b/src/test/resources/example/sdc/sdcCVFCResources.json @@ -0,0 +1,1166 @@ +[ + { + "uuid": "a0475018-1e7e-4ddd-8bee-33cbf958c2e6", + "invariantUUID": "133dd665-fca8-4e8b-8126-9e74a8d23bf5", + "name": "CLAMP-Dev-nodes.virc_fe_be_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a0475018-1e7e-4ddd-8bee-33cbf958c2e6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "22db11dd-8f1b-4687-93c1-68d9699cc8dd", + "invariantUUID": "5a637382-5168-4493-a08f-6d446cd8a96b", + "name": "Dev2DevNFODVf-nodes.MultiDeploymentFlavor.VF", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/22db11dd-8f1b-4687-93c1-68d9699cc8dd/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "pa0916" + }, + { + "uuid": "a40da782-3ec4-4138-849f-f9dd4013744e", + "invariantUUID": "f3cd3f9c-f3d0-4028-bb34-8e22e265793c", + "name": "VF-example-nodes.vmx_vpfe", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a40da782-3ec4-4138-849f-f9dd4013744e/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "d5711e0f-1e01-4f0f-8bb7-e3805607ddc8", + "invariantUUID": "a3584f36-c6ae-43b9-941f-623f24c34879", + "name": "VNFC_VSP_Test-nodes.rdn", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/d5711e0f-1e01-4f0f-8bb7-e3805607ddc8/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ed852m" + }, + { + "uuid": "c4736acb-5f9b-4918-a188-f166c948f21d", + "invariantUUID": "ab0f8c6f-a323-496b-bbf9-e7c62bba49f1", + "name": "VF-example-nodes.vmx_vre", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c4736acb-5f9b-4918-a188-f166c948f21d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "49c45990-9aca-437a-aeea-cd5d97f4db2d", + "invariantUUID": "13c1808a-1fe0-4282-a97b-b753547844bb", + "name": "VF- DemoR-nodes.vmx_vre", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/49c45990-9aca-437a-aeea-cd5d97f4db2d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "37ee791a-cf0b-4968-8003-9f0b93e4e5e0", + "invariantUUID": "43581fed-d9e2-43c4-90a1-d0ece5731807", + "name": "Dev2devnfod1207.nodes.MultiDeploymentFlavor.VF", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/37ee791a-cf0b-4968-8003-9f0b93e4e5e0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "pa0916" + }, + { + "uuid": "59db0e7d-8800-4b73-8236-42d95e28c865", + "invariantUUID": "60f4b883-f468-4d92-950f-469c9527e7d2", + "name": "sang_vsp-nodes.prx", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/59db0e7d-8800-4b73-8236-42d95e28c865/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "26b7ac12-5cf0-456c-adb4-fb7b5d0d7162", + "invariantUUID": "04d790ef-59cc-4e1f-b3f7-3b19975dfe6a", + "name": "vmme_1710-nodes.vlc", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/26b7ac12-5cf0-456c-adb4-fb7b5d0d7162/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "a056a4ab-4e72-4631-8539-0f4327b5beb0", + "invariantUUID": "c31b5f25-7056-44d0-ba77-c8b21aec5309", + "name": "Dev2devnfod.nodes.MultiDeploymentFlavor.VF", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a056a4ab-4e72-4631-8539-0f4327b5beb0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "pa0916" + }, + { + "uuid": "9d81d5e5-72aa-4ec7-b10e-f55f0369f5b5", + "invariantUUID": "c6078024-e29c-49b3-ab12-008cbdf2cb3f", + "name": "NewSWProductNameField-nodes.ltm", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/9d81d5e5-72aa-4ec7-b10e-f55f0369f5b5/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "ad90ed2d-5266-41f3-af43-db9b9f6765c3", + "invariantUUID": "55852a3d-6337-4074-960e-9456ca9b0f70", + "name": "Alina0815VSP-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/ad90ed2d-5266-41f3-af43-db9b9f6765c3/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "a790f10d-6915-42a4-ae60-f3525d7dfef2", + "invariantUUID": "ba3112d2-3bfb-4756-93ac-df6cbe1f4d3d", + "name": "Rony0620-nodes.prx_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a790f10d-6915-42a4-ae60-f3525d7dfef2/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "8b774c12-26bd-4dff-a9f8-3e4c46d9d5a0", + "invariantUUID": "8d8a5c56-6ef2-4619-bf85-c6432542ee59", + "name": "Rony0620111-nodes.rdn_2", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/8b774c12-26bd-4dff-a9f8-3e4c46d9d5a0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "c2740411-a801-416a-8d71-d10d5a3d3794", + "invariantUUID": "27f53c0b-8e14-4730-839f-747260f78c64", + "name": "Rony0620111-nodes.oam_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c2740411-a801-416a-8d71-d10d5a3d3794/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "7918ba80-97a2-4ead-87f0-dfc61da405c9", + "invariantUUID": "b43016d3-a6fb-49d1-8594-80091136fc2d", + "name": "madhu_mdns-nodes.heat.dns", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/7918ba80-97a2-4ead-87f0-dfc61da405c9/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "bdbe08db-0471-443e-967a-eb7b619be46b", + "invariantUUID": "71bda11f-c327-418e-9654-a64b07963249", + "name": "sang_vsp-nodes.rdn", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/bdbe08db-0471-443e-967a-eb7b619be46b/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "0e997760-1d6d-4afc-b9ab-6c2a94807463", + "invariantUUID": "0b85eb07-f67a-49a5-9e8f-28e7273c42af", + "name": "New_vendor_mdns-nodes.heat.dns", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/0e997760-1d6d-4afc-b9ab-6c2a94807463/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "e47dccd6-a23c-4685-a21b-b57d7c5a7007", + "invariantUUID": "c68fb097-69eb-451b-8ad8-3ff80572dae3", + "name": "vmme_1710-nodes.gpb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e47dccd6-a23c-4685-a21b-b57d7c5a7007/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "2c8f1219-8000-4001-aa13-496a0396d40f", + "invariantUUID": "096ff622-d7ea-4482-b7fe-8c7d99e7d7c6", + "name": "CLAMP-Dev-nodes.virc_fe_be_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/2c8f1219-8000-4001-aa13-496a0396d40f/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "c01cc6f1-4109-4498-b6c1-2cba7140a8b0", + "invariantUUID": "6d31b4ab-182e-4066-9271-b3bb49566a2e", + "name": "VNFC_VSP_Test-nodes.prx", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c01cc6f1-4109-4498-b6c1-2cba7140a8b0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ed852m" + }, + { + "uuid": "0457dd05-f754-48f8-8997-3819c1abbdac", + "invariantUUID": "07bc0b8d-ddf8-4f4a-98ed-8e4192df99a5", + "name": "CVFC1-nodes.pps", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/0457dd05-f754-48f8-8997-3819c1abbdac/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "cba89050-752c-4aac-8cec-6f0463eb8a23", + "invariantUUID": "ac6fab25-abc6-4e0e-ba25-cc2ddd7a51ef", + "name": "LDSA-nodes.ltm", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/cba89050-752c-4aac-8cec-6f0463eb8a23/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "93a60704-ce74-4f1e-b845-ddb3acfe8819", + "invariantUUID": "a02a03a8-079f-4c3c-acab-5f1157a4c3fc", + "name": "vmme_1710-nodes.gpb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/93a60704-ce74-4f1e-b845-ddb3acfe8819/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "5ac81105-ff5a-41fd-a84b-2aff8a694d14", + "invariantUUID": "27bb6ae9-b4c8-466a-ba09-38ac56867852", + "name": "Renana-test-nodes.gpb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/5ac81105-ff5a-41fd-a84b-2aff8a694d14/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "ba85242a-7910-4501-b8d7-fc47fa9ed902", + "invariantUUID": "e27a8b60-5c64-4407-b82b-7dde70c528ea", + "name": "renana-test2-nodes.gpb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/ba85242a-7910-4501-b8d7-fc47fa9ed902/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "dc32e966-81d2-4048-b123-8e91e930b61e", + "invariantUUID": "8f7da555-f4c4-4edd-83ea-913f78a741ac", + "name": "renana-test2-nodes.ncb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/dc32e966-81d2-4048-b123-8e91e930b61e/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "fd7fa970-c758-4daa-8cd8-77cbc1dc2604", + "invariantUUID": "ff55ade4-dafa-42f2-bc2a-785e7e3b15ba", + "name": "Rony0620-nodes.rdn_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/fd7fa970-c758-4daa-8cd8-77cbc1dc2604/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "9b1b82c1-308c-42b8-8ca3-00e744be4cbf", + "invariantUUID": "46614a9e-ba5c-4e46-a6db-bbcccd8d80ad", + "name": "Rony0620111-nodes.oam_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/9b1b82c1-308c-42b8-8ca3-00e744be4cbf/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "c771d2d4-b5e0-43ce-baa6-020389238484", + "invariantUUID": "0a86d24a-8963-4452-b396-e724fa66c1de", + "name": "Rony0620111-nodes.rdn_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c771d2d4-b5e0-43ce-baa6-020389238484/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "50b5240c-fc4f-4f1e-bd9e-a89f48912b50", + "invariantUUID": "f958fc3b-b922-4527-bdb8-e31f33a77535", + "name": "VNFC_VSP_Test-nodes.oam", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/50b5240c-fc4f-4f1e-bd9e-a89f48912b50/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ed852m" + }, + { + "uuid": "cce30e84-4f25-4712-ae16-6223b81ebe30", + "invariantUUID": "566039a2-07c8-47d4-950c-05b4cc9a1c2f", + "name": "MNSDMZ-Demo-nodes.heat.mnsdmzvfw", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/cce30e84-4f25-4712-ae16-6223b81ebe30/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "128b71d0-616c-4ddc-bfc6-831fd07d2b23", + "invariantUUID": "21796132-63ce-43ef-a59a-2bc513f307fe", + "name": "alina_test2-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/128b71d0-616c-4ddc-bfc6-831fd07d2b23/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "2ac67cfc-abc8-4e7a-882f-8594af8a142b", + "invariantUUID": "510f8c68-7581-4fb3-86f5-cfec01b3712e", + "name": "sang_vsp-nodes.oam", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/2ac67cfc-abc8-4e7a-882f-8594af8a142b/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "f3264aab-8f59-4942-a118-2663e445e055", + "invariantUUID": "88404161-33c8-4225-9b11-934b2686b005", + "name": "Dev2DevIpAssign_24_07-nodes.pd_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/f3264aab-8f59-4942-a118-2663e445e055/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "pa0916" + }, + { + "uuid": "0d094452-1b7d-4b5a-86ff-bce315102473", + "invariantUUID": "60a1acdd-f29e-4f61-a3ec-07de8e1827f5", + "name": "infra-nodes.vaaa", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/0d094452-1b7d-4b5a-86ff-bce315102473/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "dec15871-f6f6-4e44-8a8d-1e30f69ac0d3", + "invariantUUID": "2197d73b-5aa5-4788-a5f5-ec1791425595", + "name": "Rony0620-nodes.rdn_4", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/dec15871-f6f6-4e44-8a8d-1e30f69ac0d3/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "9150f327-801e-4963-b25b-b4583ec55c79", + "invariantUUID": "0ed5371b-1a90-473c-a4f4-4d229a2220cf", + "name": "Rony0620-nodes.oam_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/9150f327-801e-4963-b25b-b4583ec55c79/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "6b143e5e-dfcc-4572-b101-7fcb98c0bdde", + "invariantUUID": "f2be01db-aff3-4456-adbe-4fbdecea3511", + "name": "SimonaFirst0814-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/6b143e5e-dfcc-4572-b101-7fcb98c0bdde/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ss1245" + }, + { + "uuid": "fc93fad1-0133-43c8-8355-9e0797665774", + "invariantUUID": "7d7d720c-a328-4ff1-a9df-e8a3dfef3e1b", + "name": "Simona2Test0814-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/fc93fad1-0133-43c8-8355-9e0797665774/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ss1245" + }, + { + "uuid": "24101cfd-f824-4340-916f-a881a203062b", + "invariantUUID": "48f539dd-1edf-40d2-bf36-9f86e1c8a702", + "name": "NFOD_VSP_resource-nodes.MultiDeploymentFlavor.CVFC", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/24101cfd-f824-4340-916f-a881a203062b/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "844453e6-46b2-4673-aee7-f0dba8a90218", + "invariantUUID": "96a8385d-a86c-4d37-84fc-f4e916ac1ae4", + "name": "vmme_1710-nodes.fsb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/844453e6-46b2-4673-aee7-f0dba8a90218/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "6e19c4fc-fe71-4fd1-951a-37cdb76016b5", + "invariantUUID": "5c993249-6442-4ca0-8d2f-6ac1d8628957", + "name": "vmme_1710-nodes.ncb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/6e19c4fc-fe71-4fd1-951a-37cdb76016b5/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "8d5cce48-c3cb-4a7d-b94c-f4a40ea13cf6", + "invariantUUID": "34268c2f-4188-47af-8bde-a78add3d2c80", + "name": "New_vendor_mdns-nodes.heat.dns_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/8d5cce48-c3cb-4a7d-b94c-f4a40ea13cf6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "2cb64483-fa56-4599-8752-da98434bfaa0", + "invariantUUID": "0d1fbc01-2a97-4383-8b2e-81e9f6b86ec5", + "name": "renana-dns-nodes.heat.dns", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/2cb64483-fa56-4599-8752-da98434bfaa0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "ca9d0619-51fc-4c62-a653-c22297a7da0d", + "invariantUUID": "26c5b1e8-aa0b-400a-91a7-792de5fd59ed", + "name": "Rony0620-nodes.prx_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/ca9d0619-51fc-4c62-a653-c22297a7da0d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "183ca9a3-5e5d-4180-9e16-b89cb19050d6", + "invariantUUID": "9f0ba4ff-766b-4a9a-a652-2d153b1713fe", + "name": "Rony0620-nodes.rdn_3", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/183ca9a3-5e5d-4180-9e16-b89cb19050d6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "a4a0faf3-ec92-425c-8720-2cbd43748348", + "invariantUUID": "45a6581e-9bbf-40d9-a6cf-07330e25a9ff", + "name": "vCTS-Alina-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a4a0faf3-ec92-425c-8720-2cbd43748348/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "140b8590-3d21-474c-9cd2-72d71eae93ac", + "invariantUUID": "4ddeea35-c041-472a-853b-40b8974dd9ca", + "name": "MNSOAM DEMO-nodes.heat.mnsoamvfw", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/140b8590-3d21-474c-9cd2-72d71eae93ac/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "2aa34c35-e0b6-4974-89d7-68b0595a67a9", + "invariantUUID": "2aab35d1-61a4-4b08-a69b-a2e472118ea5", + "name": "infra-nodes.vdhcp", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/2aa34c35-e0b6-4974-89d7-68b0595a67a9/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "7fdf044e-7e8b-4a78-b560-1de3709a5748", + "invariantUUID": "9fda9cb6-1d19-4b83-8cb9-2ec6a1fbd72e", + "name": "infra-nodes.vweb", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/7fdf044e-7e8b-4a78-b560-1de3709a5748/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "49632b9c-cb8e-43a3-8aaf-824418e57056", + "invariantUUID": "19a3b039-6c70-4682-b6c6-9d4a0c81f67a", + "name": "vgmux-nodes.vgmux", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/49632b9c-cb8e-43a3-8aaf-824418e57056/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "07d4e7a0-b849-400d-8c9a-3cb77e7dd8b0", + "invariantUUID": "dc87db03-610d-415c-9b4d-2299e34a944f", + "name": "Rony0620111-nodes.rdn_3", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/07d4e7a0-b849-400d-8c9a-3cb77e7dd8b0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "77752274-77c0-430b-a99c-1b4f324fbbe0", + "invariantUUID": "e9367f4e-0346-4fff-996f-309460cd6766", + "name": "Rony0620111-nodes.rdn_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/77752274-77c0-430b-a99c-1b4f324fbbe0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "34236492-9bdf-4014-804d-6067f52bc62d", + "invariantUUID": "e8cea9ef-fe53-453c-a44f-1dd8a1e23fcc", + "name": "CVFC1-nodes.pcm", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/34236492-9bdf-4014-804d-6067f52bc62d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "3cc412d3-a6ee-4d3c-acc8-2a1ff7810377", + "invariantUUID": "db337882-2050-45d2-93df-815e686fd9ce", + "name": "CVFC1-nodes.oam", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/3cc412d3-a6ee-4d3c-acc8-2a1ff7810377/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "1e55adcd-dabf-432e-b872-f8ba02931b15", + "invariantUUID": "31e1074f-8a61-4834-a7e4-fcb72a1f188c", + "name": "ddd-nodes.fe_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/1e55adcd-dabf-432e-b872-f8ba02931b15/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "62e449b8-0539-450c-a929-e78af95decef", + "invariantUUID": "85f251db-1319-4951-bcdf-d7da9d143469", + "name": "ddd-nodes.be", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/62e449b8-0539-450c-a929-e78af95decef/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "72333ee0-007b-4e98-a097-4bc1da668fc6", + "invariantUUID": "f9257741-42cb-419b-a2d4-97b8bbfe11a8", + "name": "Renana-test-nodes.vlc", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/72333ee0-007b-4e98-a097-4bc1da668fc6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "4de24e5d-9608-45fc-8803-980f93841f89", + "invariantUUID": "0b30ace5-c8d7-431c-944a-9221529dd643", + "name": "renana-test2-nodes.fsb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/4de24e5d-9608-45fc-8803-980f93841f89/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "a5e5d12f-7cc8-4b6a-b1b1-f344a7653b76", + "invariantUUID": "27784c91-39ff-4ed1-b30d-dc5a2f2acf54", + "name": "Renana-test-nodes.ncb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a5e5d12f-7cc8-4b6a-b1b1-f344a7653b76/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "be58ec10-fdda-4436-95db-1f059508e63c", + "invariantUUID": "8694b620-d63c-4e0d-93aa-eb78a7b30836", + "name": "vbrgemu-nodes.vbrgemu", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/be58ec10-fdda-4436-95db-1f059508e63c/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "fb0a4dae-87f6-4c72-897c-aa0c7733bb1d", + "invariantUUID": "c58d67d2-b3b9-43cc-9a37-fd1a3e07533f", + "name": "Rony0620-nodes.rdn_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/fb0a4dae-87f6-4c72-897c-aa0c7733bb1d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "eff16637-cc77-4b5e-bb18-e59f4901406b", + "invariantUUID": "f7596e3a-4de9-4e00-9848-193a9f837be7", + "name": "Renana-test-nodes.fsb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/eff16637-cc77-4b5e-bb18-e59f4901406b/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "a4d9c48f-177b-498d-a4f2-f727359d930c", + "invariantUUID": "f7d8ca0d-888b-450c-af0f-cee7d6c60bfb", + "name": "Renana-test-nodes.fsb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a4d9c48f-177b-498d-a4f2-f727359d930c/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "a12837b0-336a-473f-b19c-9f711eac89bb", + "invariantUUID": "95f6e77e-bff4-414a-b4e1-05fd278083b0", + "name": "Renana-test-nodes.ncb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/a12837b0-336a-473f-b19c-9f711eac89bb/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "ba665cad-c3fa-4b7b-b49c-e9151e314fff", + "invariantUUID": "a2b7ddb9-d201-42e3-8417-36df684c0606", + "name": "Rony0620111-nodes.prx_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/ba665cad-c3fa-4b7b-b49c-e9151e314fff/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "f577a370-980c-4d28-93d7-6db297260bf6", + "invariantUUID": "c74bce43-ae25-48ab-8d0b-21aaace97443", + "name": "renana-test2-nodes.ncb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/f577a370-980c-4d28-93d7-6db297260bf6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "67fc9bfe-5f35-406e-892b-bcd6635d8503", + "invariantUUID": "2e882441-f3a2-4a3d-8ce2-c7fb8e2c96ad", + "name": "renana-test2-nodes.gpb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/67fc9bfe-5f35-406e-892b-bcd6635d8503/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "1ca8c4da-0609-4fe4-86d5-a3e95b326f6d", + "invariantUUID": "d7e5da2d-f19c-4bab-b108-04250bd834e9", + "name": "renana-test2-nodes.fsb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/1ca8c4da-0609-4fe4-86d5-a3e95b326f6d/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "f09d1939-490e-456d-a17c-9e3fe75017aa", + "invariantUUID": "c21c3e6b-0196-43b0-965d-c495b036970d", + "name": "ddd-nodes.fe", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/f09d1939-490e-456d-a17c-9e3fe75017aa/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "f502cd24-ee81-446f-87dc-cd4d1924b3d0", + "invariantUUID": "b4955a3a-7d5e-43e8-997a-9f1b6aa88cff", + "name": "infra-nodes.vdns", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/f502cd24-ee81-446f-87dc-cd4d1924b3d0/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "22357844-f903-4252-b9b3-bb21d3190e88", + "invariantUUID": "df1ea6f1-0709-408d-bc46-9ef2dce28d08", + "name": "vbng-nodes.vbng", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/22357844-f903-4252-b9b3-bb21d3190e88/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "5443c9e4-e979-48de-9662-db5e5b0d8473", + "invariantUUID": "f7493b2f-c968-4e2c-bbf4-8fa83e1e0eb0", + "name": "vgw-nodes.vgw", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/5443c9e4-e979-48de-9662-db5e5b0d8473/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ml636r" + }, + { + "uuid": "419fd69c-9d1f-4679-9677-88cff351bc13", + "invariantUUID": "dd24130f-dbed-49b9-8d73-945540766db6", + "name": "Rony0620-nodes.rdn_2", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/419fd69c-9d1f-4679-9677-88cff351bc13/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "02eb6606-ba4d-428a-8043-2a57acfc8180", + "invariantUUID": "6ab293e3-3be0-4318-99bd-1235f813e0fa", + "name": "Rony0620111-nodes.prx_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/02eb6606-ba4d-428a-8043-2a57acfc8180/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "9f5fcf0f-013a-429c-807d-325a0ffe1f4e", + "invariantUUID": "913bb2a7-e8f5-41d8-98d5-bc8be4683557", + "name": "AlinaTest-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/9f5fcf0f-013a-429c-807d-325a0ffe1f4e/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "3b1050e1-ffef-4e39-9e6e-7f13a3b9c28a", + "invariantUUID": "27d9d366-c241-49f7-b24b-341cc9b1effd", + "name": "Alina0831VSP-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/3b1050e1-ffef-4e39-9e6e-7f13a3b9c28a/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "e6f1576a-6ba7-48b9-a72d-c25d6e830b7c", + "invariantUUID": "d293c16b-7576-4422-bf5a-ec205a80381f", + "name": "Renana-test-nodes.gpb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e6f1576a-6ba7-48b9-a72d-c25d6e830b7c/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "c01d30f8-31ee-4e77-90a9-1e6c253e905f", + "invariantUUID": "cabfb49c-e82d-4bbf-b042-debe33041f71", + "name": "renana-test2-nodes.vlc", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c01d30f8-31ee-4e77-90a9-1e6c253e905f/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "9020ebb6-0d56-4355-8308-3b3082d96565", + "invariantUUID": "3ebd6d0e-de0a-4981-9be7-f83855fee828", + "name": "Rony0620-nodes.oam_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/9020ebb6-0d56-4355-8308-3b3082d96565/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "1d746450-e070-4c45-bb49-158537d3246b", + "invariantUUID": "2b4c04b5-13ea-4069-bd80-cd2f1ffabaaf", + "name": "Rony0620111-nodes.rdn_4", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/1d746450-e070-4c45-bb49-158537d3246b/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "el489u" + }, + { + "uuid": "712d2e08-0ca2-4f48-b193-34a887a168c6", + "invariantUUID": "86a03610-7a65-4789-ad34-66af631c2306", + "name": "Shani14.8Software Product-nodes.ltm", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/712d2e08-0ca2-4f48-b193-34a887a168c6/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "c13f95f6-7757-4124-a5be-3a7c6ae2bd20", + "invariantUUID": "4255dd9b-6d39-436f-8b80-1b101c261684", + "name": "CVFC1-nodes.psm", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c13f95f6-7757-4124-a5be-3a7c6ae2bd20/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "12e60ab4-7e48-4f6b-a124-f109b50d9f4a", + "invariantUUID": "d2531c7b-fe26-4371-93c6-9630e3f1c920", + "name": "ddd-nodes.smp", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/12e60ab4-7e48-4f6b-a124-f109b50d9f4a/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "fb57af5b-84f2-4baf-b6a8-61062f924cd2", + "invariantUUID": "73690cef-b776-4a29-b6fe-4fc1f871a27c", + "name": "Alina1002VF-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/fb57af5b-84f2-4baf-b6a8-61062f924cd2/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "7f550ae3-1242-4468-b04a-0666946d84aa", + "invariantUUID": "64be47c5-a176-4dbb-9596-e9106e577be7", + "name": "NFOD_CHECKPOINT-nodes.MultiDeploymentFlavor.CVFC", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/7f550ae3-1242-4468-b04a-0666946d84aa/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "3af9b720-144d-4507-aea8-73b49bc243c4", + "invariantUUID": "587e283e-6b8e-4d40-85cc-07285fb88252", + "name": "alaram-nodes.vCTS_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/3af9b720-144d-4507-aea8-73b49bc243c4/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "24ca039c-26e1-4f79-b2a4-660a7a21f752", + "invariantUUID": "d2a36303-93f0-44a3-b96f-f0e1b1580d91", + "name": "Test_SHAY-nodes.vnf", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/24ca039c-26e1-4f79-b2a4-660a7a21f752/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "c0e6a2a1-3fc7-4663-8df7-b0263288f116", + "invariantUUID": "469da957-40a1-44d2-b23c-f90d50ea20fc", + "name": "CVFC1-nodes.ppd", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/c0e6a2a1-3fc7-4663-8df7-b0263288f116/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "m08740" + }, + { + "uuid": "e74db726-0ad6-4a6e-be6c-4094df81eafd", + "invariantUUID": "e29b57d8-cbfb-4b37-8aea-7c124671ea03", + "name": "renana_alarm-nodes.heat.dns", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e74db726-0ad6-4a6e-be6c-4094df81eafd/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + }, + { + "uuid": "e49a643b-23a0-4b50-a3c0-a5a60003a958", + "invariantUUID": "b3da7781-0f09-48e1-af15-262e5919141a", + "name": "Simona0912-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e49a643b-23a0-4b50-a3c0-a5a60003a958/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "ss1245" + }, + { + "uuid": "e0941d01-8ec6-448b-80f8-007e8c88ed28", + "invariantUUID": "36aaaafb-9341-4bd3-9ea6-1f7cd4c5f18a", + "name": "demo_1234-nodes.MultiDeploymentFlavor.CVFC", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e0941d01-8ec6-448b-80f8-007e8c88ed28/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "98771c36-da29-4a80-85e9-72e9fbef3286", + "invariantUUID": "741f1b1c-bb27-4e4d-8645-834f357ecf03", + "name": "AlinaVSP1011-nodes.TEST_server", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/98771c36-da29-4a80-85e9-72e9fbef3286/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "af3193" + }, + { + "uuid": "7218a91c-7c13-443f-b085-a10f1593624e", + "invariantUUID": "66326c07-be88-4260-a627-4cab5a9c0bbc", + "name": "vmme_1710-nodes.fsb_1", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/7218a91c-7c13-443f-b085-a10f1593624e/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "5a2c7097-c582-4337-918e-48b58d79dd74", + "invariantUUID": "5e5c0b6c-40c8-4909-bb7c-334e16ad833e", + "name": "vmme_1710-nodes.ncb_0", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/5a2c7097-c582-4337-918e-48b58d79dd74/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "sa997j" + }, + { + "uuid": "e70970f3-aa70-4d6b-9fd4-eb07ff42693f", + "invariantUUID": "84358281-e8c1-4a45-ae2d-e3d797f18fc5", + "name": "VF- DemoR-nodes.vmx_vpfe", + "version": "1.0", + "toscaModelURL": "/sdc/v1/catalog/resources/e70970f3-aa70-4d6b-9fd4-eb07ff42693f/toscaModel", + "category": "Generic", + "subCategory": "Abstract", + "resourceType": "CVFC", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "rh176a" + } +] \ No newline at end of file diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties index b0fd639c..567c79fa 100644 --- a/src/test/resources/https/https-test.properties +++ b/src/test/resources/https/https-test.properties @@ -94,9 +94,9 @@ kubernetes.namespace=com-att-ajsc #server.port=0 #Camunda Process Engine DataSource connection Details spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver -spring.datasource.camunda.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true +spring.datasource.camunda.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 spring.datasource.camunda.username=camunda -spring.datasource.camunda.password=ndMSpw4CAM +spring.datasource.camunda.password=D75B89195FD913848EA11416F755390E spring.datasource.camunda.validationQuery=SELECT 1 spring.datasource.camunda.validationQueryTimeout=20000 spring.datasource.camunda.validationInterval=30000 @@ -116,9 +116,9 @@ camunda.bpm.database.schema-update=false #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver -spring.datasource.cldsdb.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true +spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647 spring.datasource.cldsdb.username=clds -spring.datasource.cldsdb.password=sidnnd83K +spring.datasource.cldsdb.password=035F8819FEBB754F3C99ECCCC1259850 spring.datasource.cldsdb.validationQuery=SELECT 1 spring.datasource.cldsdb.validationQueryTimeout=20000 spring.datasource.cldsdb.validationInterval=30000 @@ -145,6 +145,7 @@ org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.propert org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties +org.onap.clamp.encryption.aes.key=aa3871669d893c7fb8abbcda31b88b4f #Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case ! CLDS_PERMISSION_TYPE_CL=permission-type-cl