summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/clds/ClampServlet.java19
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java48
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java161
-rw-r--r--src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java11
-rw-r--r--src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java112
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java42
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java202
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java473
-rw-r--r--src/main/java/org/onap/clamp/clds/config/ClampProperties.java72
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java20
-rw-r--r--src/main/java/org/onap/clamp/clds/dao/CldsDao.java129
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/BadRequestException.java61
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java61
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsEvent.java1
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsModel.java162
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java25
-rw-r--r--src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java169
-rw-r--r--src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java38
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java51
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/Global.java7
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java132
-rw-r--r--src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java68
-rw-r--r--src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java126
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java198
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java115
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsToscaService.java170
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java78
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java76
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java589
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java3
-rw-r--r--src/main/resources/application-noaaf.properties14
-rw-r--r--src/main/resources/application.properties10
-rw-r--r--src/main/resources/clds/camel/rest/clds-services.xml2
-rw-r--r--src/main/resources/clds/templates/dcae-decode-service_ids.json20
-rw-r--r--src/main/resources/clds/templates/ui-alarm-default.json597
38 files changed, 2057 insertions, 2052 deletions
diff --git a/src/main/java/org/onap/clamp/clds/ClampServlet.java b/src/main/java/org/onap/clamp/clds/ClampServlet.java
index 516325cbe..008a9c743 100644
--- a/src/main/java/org/onap/clamp/clds/ClampServlet.java
+++ b/src/main/java/org/onap/clamp/clds/ClampServlet.java
@@ -36,7 +36,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;
-import org.onap.aaf.cadi.principal.X509Principal;
import org.onap.clamp.clds.service.SecureServicePermission;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
@@ -62,11 +61,24 @@ public class ClampServlet extends CamelHttpTransportServlet {
public static final String PERM_VF = "clamp.config.security.permission.type.filter.vf";
public static final String PERM_MANAGE = "clamp.config.security.permission.type.cl.manage";
public static final String PERM_TOSCA = "clamp.config.security.permission.type.tosca";
+ public static final String AUTHENTICATION_CLASS = "clamp.config.security.authentication.class";
private static List<SecureServicePermission> permissionList;
+ private synchronized Class loadDynamicAuthenticationClass() {
+ try {
+ String authenticationObject = WebApplicationContextUtils.getWebApplicationContext(getServletContext())
+ .getEnvironment().getProperty(AUTHENTICATION_CLASS);
+ return Class.forName(authenticationObject);
+ } catch (ClassNotFoundException e) {
+ logger.error(
+ "Exception caught when attempting to create associated class of config:" + AUTHENTICATION_CLASS, e);
+ return Object.class;
+ }
+ }
+
private synchronized List<SecureServicePermission> getPermissionList() {
if (permissionList == null) {
- permissionList=new ArrayList<>();
+ permissionList = new ArrayList<>();
ApplicationContext applicationContext = WebApplicationContextUtils
.getWebApplicationContext(getServletContext());
String cldsPermissionInstance = applicationContext.getEnvironment().getProperty(PERM_INSTANCE);
@@ -97,9 +109,8 @@ public class ClampServlet extends CamelHttpTransportServlet {
@Override
protected void doService(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
-
Principal p = request.getUserPrincipal();
- if (p instanceof X509Principal) {
+ if (loadDynamicAuthenticationClass().isInstance(p)) {
// When AAF is enabled, there is a need to provision the permissions to Spring
// system
List<GrantedAuthority> grantedAuths = new ArrayList<>();
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
index 16c18ae0e..4151c7aad 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client;
@@ -64,7 +64,6 @@ public class DcaeDispatcherServices {
this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
}
-
public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {
String operationStatus = "";
for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {
@@ -83,9 +82,9 @@ public class DcaeDispatcherServices {
/**
* Get the Operation Status from a specified URL.
- *
+ *
* @param statusUrl
- * The URL provided by a previous DCAE Query
+ * The URL provided by a previous DCAE Query
* @return The status
*/
public String getOperationStatus(String statusUrl) {
@@ -113,35 +112,14 @@ public class DcaeDispatcherServices {
}
/**
- * This method send a getDeployments operation to DCAE.
- */
- public void getDeployments() {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "getDeployments");
- try {
- String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX;
- dcaeHttpConnectionManager.doDcaeHttpQuery(url, "GET", null, null);
- LoggingUtils.setResponseContext("0", "Get deployments success", this.getClass().getName());
- } catch (Exception e) {
- LoggingUtils.setResponseContext("900", "Get deployments failed", this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Get deployments error");
- logger.error("Exception occurred during getDeployments Operation with DCAE", e);
- throw new DcaeDeploymentException("Exception occurred during getDeployments Operation with DCAE", e);
- } finally {
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("getDeployments complete");
- }
- }
-
- /**
* Returns status URL for createNewDeployment operation.
*
* @param deploymentId
- * The deployment ID
+ * The deployment ID
* @param serviceTypeId
- * Service type ID
+ * Service type ID
* @param blueprintInputJson
- * The value for each blueprint parameters in a flat JSON
+ * The value for each blueprint parameters in a flat JSON
* @return The status URL
*/
public String createNewDeployment(String deploymentId, String serviceTypeId, JsonNode blueprintInputJson) {
@@ -157,7 +135,7 @@ public class DcaeDispatcherServices {
logger.info("Dcae api Body String - " + apiBodyString);
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;
String statusUrl = getDcaeResponse(url, "PUT", apiBodyString, "application/json", DCAE_LINK_FIELD,
- DCAE_STATUS_FIELD);
+ DCAE_STATUS_FIELD);
LoggingUtils.setResponseContext("0", "Create new deployment failed", this.getClass().getName());
return statusUrl;
} catch (Exception e) {
@@ -173,11 +151,11 @@ public class DcaeDispatcherServices {
/***
* Returns status URL for deleteExistingDeployment operation.
- *
+ *
* @param deploymentId
- * The deployment ID
+ * The deployment ID
* @param serviceTypeId
- * The service Type ID
+ * The service Type ID
* @return The status URL
*/
public String deleteExistingDeployment(String deploymentId, String serviceTypeId) {
@@ -188,7 +166,7 @@ public class DcaeDispatcherServices {
logger.info("Dcae api Body String - " + apiBodyString);
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;
String statusUrl = getDcaeResponse(url, "DELETE", apiBodyString, "application/json", DCAE_LINK_FIELD,
- DCAE_STATUS_FIELD);
+ DCAE_STATUS_FIELD);
LoggingUtils.setResponseContext("0", "Delete existing deployment success", this.getClass().getName());
return statusUrl;
@@ -197,7 +175,7 @@ public class DcaeDispatcherServices {
LoggingUtils.setErrorContext("900", "Delete existing deployment error");
logger.error("Exception occurred during deleteExistingDeployment Operation with DCAE", e);
throw new DcaeDeploymentException("Exception occurred during deleteExistingDeployment Operation with DCAE",
- e);
+ e);
} finally {
LoggingUtils.setTimeContext(startTime, new Date());
metricsLogger.info("deleteExistingDeployment complete");
@@ -205,7 +183,7 @@ public class DcaeDispatcherServices {
}
private String getDcaeResponse(String url, String requestMethod, String payload, String contentType, String node,
- String nodeAttr) throws IOException, ParseException {
+ String nodeAttr) throws IOException, ParseException {
Date startTime = new Date();
try {
String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, requestMethod, payload, contentType);
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 b63bb646d..327aff1da 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
@@ -19,7 +19,7 @@
* ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client;
@@ -27,14 +27,11 @@ package org.onap.clamp.clds.client;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.util.Date;
import java.util.List;
-import javax.ws.rs.BadRequestException;
-
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -61,32 +58,30 @@ 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();
- private static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
- private static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
- private static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
- public static final String DCAE_TYPE_NAME = "typeName";
- public static final String DCAE_TYPE_ID = "typeId";
+ public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
+ public static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
+ public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
private final ClampProperties refProp;
private final CldsDao cldsDao;
private final DcaeHttpConnectionManager dcaeHttpConnectionManager;
@Autowired
- public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao, DcaeHttpConnectionManager dcaeHttpConnectionManager) {
+ public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao,
+ DcaeHttpConnectionManager dcaeHttpConnectionManager) {
this.refProp = refProp;
this.cldsDao = cldsDao;
this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
}
-
/**
* Set the event inventory.
- *
+ *
* @param cldsModel
- * The CldsModel
+ * The CldsModel
* @param userId
- * The user ID
+ * The user ID
* @throws ParseException
- * In case of DCAE Json parse exception
+ * In case of DCAE Json parse exception
*/
public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException, InterruptedException {
String artifactName = cldsModel.getControlName();
@@ -100,7 +95,7 @@ public class DcaeInventoryServices {
try {
// Below are the properties required for calling the dcae inventory
ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null, false,
- "{}", cldsModel.getPropText());
+ "{}", cldsModel.getPropText());
Global global = prop.getGlobal();
String invariantServiceUuid = global.getService();
List<String> resourceUuidList = global.getResourceVf();
@@ -130,7 +125,7 @@ public class DcaeInventoryServices {
}
private void analyzeAndSaveDcaeResponse(DcaeInventoryResponse dcaeResponse, CldsModel cldsModel,
- DcaeEvent dcaeEvent, String userId) {
+ DcaeEvent dcaeEvent, String userId) {
if (dcaeResponse != null) {
logger.info("Dcae Response for query on inventory: " + dcaeResponse);
String oldTypeId = cldsModel.getTypeId();
@@ -141,9 +136,9 @@ public class DcaeInventoryServices {
cldsModel.setTypeName(dcaeResponse.getTypeName());
}
if (oldTypeId == null || !cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_DISTRIBUTE)
- || cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {
+ || cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {
CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userId, dcaeEvent.getCldsActionCd(),
- CldsEvent.ACTION_STATE_RECEIVED, null);
+ CldsEvent.ACTION_STATE_RECEIVED, null);
}
cldsModel.save(cldsDao, userId);
} else {
@@ -160,37 +155,37 @@ public class DcaeInventoryServices {
}
private DcaeInventoryResponse getItemsFromDcaeInventoryResponse(String responseStr)
- throws ParseException, IOException {
+ throws ParseException, IOException {
JSONParser parser = new JSONParser();
Object obj0 = parser.parse(responseStr);
JSONObject jsonObj = (JSONObject) obj0;
JSONArray itemsArray = (JSONArray) jsonObj.get("items");
JSONObject dcaeServiceType0 = (JSONObject) itemsArray.get(0);
return JacksonUtils.getObjectMapperInstance().readValue(dcaeServiceType0.toString(),
- DcaeInventoryResponse.class);
+ DcaeInventoryResponse.class);
}
/**
* DO a query to DCAE to get some Information.
- *
+ *
* @param artifactName
- * The artifact Name
+ * The artifact Name
* @param serviceUuid
- * The service UUID
+ * The service UUID
* @param resourceUuid
- * The resource UUID
+ * The resource UUID
* @return The DCAE inventory for the artifact in DcaeInventoryResponse
* @throws IOException
- * In case of issues with the stream
+ * In case of issues with the stream
* @throws ParseException
- * In case of issues with the Json parsing
+ * In case of issues with the Json parsing
*/
public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)
- throws IOException, ParseException, InterruptedException {
+ throws IOException, ParseException, InterruptedException {
Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");
String queryString = "?asdcResourceId=" + resourceUuid + "&asdcServiceId=" + serviceUuid + "&typeName="
- + artifactName;
+ + artifactName;
String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types" + queryString;
logger.info("Dcae Inventory Service full url - " + fullUrl);
DcaeInventoryResponse response = queryDcaeInventory(fullUrl);
@@ -200,7 +195,7 @@ public class DcaeInventoryServices {
}
private DcaeInventoryResponse queryDcaeInventory(String fullUrl)
- throws IOException, InterruptedException, ParseException {
+ throws IOException, InterruptedException, ParseException {
int retryInterval = 0;
int retryLimit = 1;
if (refProp.getStringValue(DCAE_INVENTORY_RETRY_LIMIT) != null) {
@@ -219,115 +214,11 @@ public class DcaeInventoryServices {
return getItemsFromDcaeInventoryResponse(response);
}
logger.info(
- "Dcae inventory totalCount returned is 0, so waiting " + retryInterval + "ms before retrying ...");
+ "Dcae inventory totalCount returned is 0, so waiting " + retryInterval + "ms before retrying ...");
// wait for a while and try to connect to DCAE again
Thread.sleep(retryInterval);
}
logger.warn("Dcae inventory totalCount returned is still 0, after " + retryLimit + " attempts, returning NULL");
return null;
}
-
- /**
- * Inserts a new DCAEServiceType or updates an existing instance. If the
- * typeName is same second time(already exists) then the
- * DCAEServiceTypeRequest is updated
- *
- * @param blueprintTemplate
- * blueprint content
- * @param owner
- * owner of the data
- * @param typeName
- * The type/artifact Name
- * @param typeVersion
- * type version
- * @param asdcServiceId
- * The service UUID
- * @param asdcResourceId
- * The vf UUID
- * @return The DCAE inventory type id
- */
- public String createupdateDCAEServiceType(String blueprintTemplate, String owner, String typeName, int typeVersion,
- String asdcServiceId, String asdcResourceId) {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "createDCAEServiceType");
- String typeId = null;
- try {
- ObjectNode dcaeServiceTypeRequest = JacksonUtils.getObjectMapperInstance().createObjectNode();
- dcaeServiceTypeRequest.put("blueprintTemplate", blueprintTemplate);
- dcaeServiceTypeRequest.put("owner", owner);
- dcaeServiceTypeRequest.put("typeName", typeName);
- dcaeServiceTypeRequest.put("typeVersion", typeVersion);
- dcaeServiceTypeRequest.put("asdcServiceId", asdcServiceId);
- dcaeServiceTypeRequest.put("asdcResourceId", asdcResourceId);
- String apiBodyString = dcaeServiceTypeRequest.toString();
- logger.info("Dcae api Body String - " + apiBodyString);
- String url = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types";
- String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, "POST", apiBodyString,
- "application/json");
- // If the DCAEServiceTypeRequest is created successfully it will
- // return a json object responce containing a node for newly created
- // "typeId"
- // The newly generated DCAEServiceTypeRequest can then be accessed
- // via URL: https://<DCAE_INVENTORY_URL>/dcae-service-types/<typeId>
- JSONParser parser = new JSONParser();
- Object obj0 = parser.parse(responseStr);
- JSONObject jsonObj = (JSONObject) obj0;
- typeId = (String) jsonObj.get("typeId"); // need to save this
- // as
- // service_type_id
- // in model table
- } catch (IOException | ParseException e) {
- logger.error("Exception occurred during createupdateDCAEServiceType Operation with DCAE", e);
- throw new BadRequestException("Exception occurred during createupdateDCAEServiceType Operation with DCAE",
- e);
- } finally {
- if (typeId != null) {
- LoggingUtils.setResponseContext("0", "Create update DCAE ServiceType success",
- this.getClass().getName());
- } else {
- LoggingUtils.setResponseContext("900", "Create update DCAE ServiceType failed",
- this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Create update DCAE ServiceType error");
- }
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("createupdateDCAEServiceType complete");
- }
- return typeId;
- }
-
- /**
- * Method to delete blueprint from dcae inventory if it's exists.
- *
- * @param typeName
- * @param serviceUuid
- * @param resourceUuid
- * @throws InterruptedException
- */
- public void deleteDCAEServiceType(String typeName, String serviceUuid, String resourceUuid)
- throws InterruptedException {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "deleteDCAEServiceType");
- boolean result = false;
- try {
- DcaeInventoryResponse inventoryResponse = getDcaeInformation(typeName, serviceUuid, resourceUuid);
- if (inventoryResponse != null && inventoryResponse.getTypeId() != null) {
- String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types/"
- + inventoryResponse.getTypeId();
- dcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "DELETE", null, null);
- }
- result = true;
- } catch (IOException | ParseException e) {
- logger.error("Exception occurred during deleteDCAEServiceType Operation with DCAE", e);
- throw new BadRequestException("Exception occurred during deleteDCAEServiceType Operation with DCAE", e);
- } finally {
- if (result) {
- LoggingUtils.setResponseContext("0", "Delete DCAE ServiceType success", this.getClass().getName());
- } else {
- LoggingUtils.setResponseContext("900", "Delete DCAE ServiceType failed", this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Delete DCAE ServiceType error");
- }
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("deleteDCAEServiceType completed");
- }
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java
index 872999356..adec94f32 100644
--- a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java
+++ b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java
@@ -52,7 +52,7 @@ public class OperationalPolicyDeleteDelegate {
* Perform activity. Delete Operational Policy via policy api.
*
* @param camelExchange
- * The Camel Exchange object containing the properties
+ * The Camel Exchange object containing the properties
*/
@Handler
public void execute(Exchange camelExchange) {
@@ -60,14 +60,11 @@ public class OperationalPolicyDeleteDelegate {
Policy policy = prop.getType(Policy.class);
prop.setCurrentModelElementId(policy.getId());
String eventAction = (String) camelExchange.getProperty("eventAction");
- String responseMessage = "";
- if (!eventAction.equalsIgnoreCase(CldsEvent.ACTION_CREATE) && policy.isFound()) {
+ if (policy.getPolicyChains() != null && !policy.getPolicyChains().isEmpty()
+ && !eventAction.equalsIgnoreCase(CldsEvent.ACTION_CREATE) && policy.isFound()) {
for (PolicyChain policyChain : policy.getPolicyChains()) {
prop.setPolicyUniqueId(policyChain.getPolicyId());
- responseMessage = policyClient.deleteBrms(prop);
- }
- if (responseMessage != null) {
- camelExchange.setProperty("operationalPolicyDeleteResponseMessage", responseMessage.getBytes());
+ logger.info("Policy Delete response: " + policyClient.deleteBrms(prop));
}
}
}
diff --git a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java
deleted file mode 100644
index 3a3d0158c..000000000
--- a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.clamp.clds.client;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Handler;
-import org.apache.commons.codec.DecoderException;
-import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices;
-import org.onap.clamp.clds.client.req.sdc.SdcRequests;
-import org.onap.clamp.clds.config.ClampProperties;
-import org.onap.clamp.clds.model.DcaeEvent;
-import org.onap.clamp.clds.model.properties.Global;
-import org.onap.clamp.clds.model.properties.ModelProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * Send control loop model to dcae proxy.
- */
-@Component
-public class SdcSendReqDelegate {
-
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSendReqDelegate.class);
- protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- @Autowired
- private SdcCatalogServices sdcCatalogServices;
- @Autowired
- private SdcRequests sdcReq;
- @Autowired
- private ClampProperties refProp;
-
- /**
- * Perform activity. Send to sdc proxy.
- *
- * @param camelExchange
- * The camel object that contains all fields
- * @throws DecoderException
- * In case of issues with password decryption
- * @throws GeneralSecurityException
- * In case of issues with password decryption
- * @throws IOException
- * In case of issues with file opening
- */
- @Handler
- public void execute(Exchange camelExchange) throws GeneralSecurityException, DecoderException, IOException {
- String controlName = (String) camelExchange.getProperty("controlName");
- String artifactLabel = sdcReq
- .normalizeResourceInstanceName(refProp.getStringValue("sdc.artifactLabel") + "-" + controlName);
- String locationArtifactLabel = sdcReq
- .normalizeResourceInstanceName(refProp.getStringValue("sdc.locationArtifactLabel") + "-" + controlName);
- String artifactType = refProp.getStringValue("sdc.artifactType");
- String locationArtifactType = refProp.getStringValue("sdc.locationArtifactType");
- String userid = (String) camelExchange.getProperty("userid");
- String docText = (String) camelExchange.getProperty("docText");
- String artifactName = (String) camelExchange.getProperty("controlName") + DcaeEvent.ARTIFACT_NAME_SUFFIX;
- camelExchange.setProperty("artifactName", artifactName);
- ModelProperties prop = ModelProperties.create(camelExchange);
- String bluprintPayload;
- 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);
- if (formattedSdcReq != null) {
- camelExchange.setProperty("formattedArtifactReq", formattedSdcReq.getBytes());
- }
- Global globalProps = prop.getGlobal();
- if (globalProps != null && globalProps.getService() != null) {
- String serviceInvariantUUID = globalProps.getService();
- camelExchange.setProperty("serviceInvariantUUID", serviceInvariantUUID);
- }
- List<String> sdcReqUrlsList = sdcReq.getSdcReqUrlsList(prop);
- String sdcLocationsPayload = sdcReq.formatSdcLocationsReq(prop, artifactName);
- String locationArtifactName = (String) camelExchange.getProperty("controlName") + "-location.json";
- String formattedSdcLocationReq = sdcReq.formatSdcReq(sdcLocationsPayload, locationArtifactName,
- locationArtifactLabel, locationArtifactType);
- if (formattedSdcLocationReq != null) {
- camelExchange.setProperty("formattedLocationReq", formattedSdcLocationReq.getBytes());
- }
- sdcCatalogServices.uploadToSdc(prop, userid, sdcReqUrlsList, formattedSdcReq, formattedSdcLocationReq,
- artifactName, locationArtifactName);
- }
- }
-}
diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java b/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java
index de86faa21..f15d33df2 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java
@@ -35,16 +35,28 @@ import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.PolicyChain;
import org.onap.clamp.clds.model.properties.PolicyItem;
import org.onap.policy.api.AttributeType;
-import org.onap.policy.api.RuleProvider;
public class GuardPolicyAttributesConstructor {
+ public static final String ACTOR = "actor";
+ public static final String RECIPE = "recipe";
+ public static final String TARGETS = "targets";
+ public static final String CLNAME = "clname";
+ public static final String MIN = "min";
+ public static final String MAX = "max";
+ public static final String LIMIT = "limit";
+ public static final String TIME_WINDOW = "timeWindow";
+ public static final String TIME_UNITS = "timeUnits";
+ public static final String GUARD_ACTIVE_START = "guardActiveStart";
+ public static final String GUARD_ACTIVE_END = "guardActiveEnd";
+
private static final EELFLogger logger = EELFManager.getInstance()
.getLogger(GuardPolicyAttributesConstructor.class);
private GuardPolicyAttributesConstructor() {
}
- public static Map<AttributeType, Map<String, String>> formatAttributes(ModelProperties modelProperties, PolicyItem policyItem) {
+ public static Map<AttributeType, Map<String, String>> formatAttributes(ModelProperties modelProperties,
+ PolicyItem policyItem) {
Map<String, String> matchingAttributes = prepareMatchingAttributes(policyItem, modelProperties);
return createAttributesMap(matchingAttributes);
}
@@ -62,20 +74,20 @@ public class GuardPolicyAttributesConstructor {
private static Map<String, String> prepareMatchingAttributes(PolicyItem policyItem, ModelProperties modelProp) {
logger.info("Preparing matching attributes for guard...");
Map<String, String> matchingAttributes = new HashMap<>();
- matchingAttributes.put("actor",policyItem.getActor());
- matchingAttributes.put("recipe",policyItem.getRecipe());
- matchingAttributes.put("targets",policyItem.getGuardTargets());
- matchingAttributes.put("clname",modelProp.getControlNameAndPolicyUniqueId());
- if (RuleProvider.GUARD_MIN_MAX.equals(RuleProvider.valueOf(policyItem.getGuardPolicyType()))) {
- matchingAttributes.put("min",policyItem.getMinGuard());
- matchingAttributes.put("max",policyItem.getMaxGuard());
- } else if (RuleProvider.GUARD_YAML.equals(RuleProvider.valueOf(policyItem.getGuardPolicyType()))) {
- matchingAttributes.put("limit",policyItem.getLimitGuard());
- matchingAttributes.put("timeWindow",policyItem.getTimeWindowGuard());
- matchingAttributes.put("timeUnits",policyItem.getTimeUnitsGuard());
+ matchingAttributes.put(ACTOR, policyItem.getActor());
+ matchingAttributes.put(RECIPE, policyItem.getRecipe());
+ matchingAttributes.put(TARGETS, policyItem.getGuardTargets());
+ matchingAttributes.put(CLNAME, modelProp.getControlNameAndPolicyUniqueId());
+ if ("GUARD_MIN_MAX".equals(policyItem.getGuardPolicyType())) {
+ matchingAttributes.put(MIN, policyItem.getMinGuard());
+ matchingAttributes.put(MAX, policyItem.getMaxGuard());
+ } else if ("GUARD_YAML".equals(policyItem.getGuardPolicyType())) {
+ matchingAttributes.put(LIMIT, policyItem.getLimitGuard());
+ matchingAttributes.put(TIME_WINDOW, policyItem.getTimeWindowGuard());
+ matchingAttributes.put(TIME_UNITS, policyItem.getTimeUnitsGuard());
}
- matchingAttributes.put("guardActiveStart",policyItem.getGuardActiveStart());
- matchingAttributes.put("guardActiveEnd",policyItem.getGuardActiveEnd());
+ matchingAttributes.put(GUARD_ACTIVE_START, policyItem.getGuardActiveStart());
+ matchingAttributes.put(GUARD_ACTIVE_END, policyItem.getGuardActiveEnd());
logger.info("Prepared: " + matchingAttributes);
return matchingAttributes;
diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
index c26b15ce7..c7051157d 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
@@ -26,6 +26,11 @@ package org.onap.clamp.clds.client.req.policy;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
@@ -36,6 +41,7 @@ import javax.ws.rs.BadRequestException;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.config.PolicyConfiguration;
import org.onap.clamp.clds.exception.policy.PolicyClientException;
+import org.onap.clamp.clds.model.CldsToscaModel;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.PolicyItem;
import org.onap.clamp.clds.util.LoggingUtils;
@@ -44,6 +50,8 @@ import org.onap.policy.api.ConfigRequestParameters;
import org.onap.policy.api.DeletePolicyCondition;
import org.onap.policy.api.DeletePolicyParameters;
import org.onap.policy.api.DictionaryType;
+import org.onap.policy.api.ImportParameters;
+import org.onap.policy.api.ImportParameters.IMPORT_TYPE;
import org.onap.policy.api.PolicyChangeResponse;
import org.onap.policy.api.PolicyClass;
import org.onap.policy.api.PolicyConfigException;
@@ -77,6 +85,7 @@ public class PolicyClient {
public static final String POLICY_MS_NAME_PREFIX_PROPERTY_NAME = "policy.ms.policyNamePrefix";
public static final String POLICY_OP_TYPE_PROPERTY_NAME = "policy.op.type";
public static final String POLICY_GUARD_SUFFIX = "_Guard";
+ public static final String TOSCA_FILE_TEMP_PATH = "tosca.filePath";
@Autowired
protected ApplicationContext appContext;
@@ -113,8 +122,8 @@ public class PolicyClient {
// Set a random UUID(Mandatory)
policyParameters.setRequestID(UUID.fromString(policyRequestUuid));
- String rtnMsg = send(policyParameters, prop, null);
- push(DictionaryType.Decision.toString(), prop);
+ String rtnMsg = send(policyParameters, prop, null, null);
+ push(DictionaryType.Decision.toString(), prop, null);
return rtnMsg;
}
@@ -144,9 +153,9 @@ public class PolicyClient {
// Set a random UUID(Mandatory)
policyParameters.setRequestID(UUID.fromString(policyRequestUuid));
String policyNamePrefix = refProp.getStringValue(POLICY_OP_NAME_PREFIX_PROPERTY_NAME);
- String rtnMsg = send(policyParameters, prop, policyNamePrefix);
+ String rtnMsg = send(policyParameters, prop, policyNamePrefix, null);
String policyType = refProp.getStringValue(POLICY_OP_TYPE_PROPERTY_NAME);
- push(policyType, prop);
+ push(policyType, prop, null);
return rtnMsg;
}
@@ -174,9 +183,9 @@ public class PolicyClient {
// Adding this line to clear the policy id from policy name while
// pushing to policy engine
prop.setPolicyUniqueId("");
- String rtnMsg = send(policyParameters, prop, policyNamePrefix);
+ String rtnMsg = send(policyParameters, prop, policyNamePrefix, null);
String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME);
- push(policyType, prop);
+ push(policyType, prop, null);
return rtnMsg;
}
@@ -209,8 +218,9 @@ public class PolicyClient {
// Adding this line to clear the policy id from policy name while
// pushing to policy engine
prop.setPolicyUniqueId("");
- String rtnMsg = send(policyParameters, prop, refProp.getStringValue(POLICY_BASENAME_PREFIX_PROPERTY_NAME));
- push(PolicyConfigType.Base.toString(), prop);
+ String rtnMsg = send(policyParameters, prop, refProp.getStringValue(POLICY_BASENAME_PREFIX_PROPERTY_NAME),
+ null);
+ push(PolicyConfigType.Base.toString(), prop, null);
return rtnMsg;
}
@@ -234,9 +244,9 @@ public class PolicyClient {
// Adding this line to clear the policy id from policy name while
// pushing to policy engine
prop.setPolicyUniqueId("");
- String rtnMsg = send(policyParameters, prop, policyNamePrefix);
+ String rtnMsg = send(policyParameters, prop, policyNamePrefix, null);
String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME);
- push(policyType, prop);
+ push(policyType, prop, null);
return rtnMsg;
}
@@ -249,7 +259,8 @@ public class PolicyClient {
* The ModelProperties
* @return The response message of Policy
*/
- protected String send(PolicyParameters policyParameters, ModelProperties prop, String policyNamePrefix) {
+ protected String send(PolicyParameters policyParameters, ModelProperties prop, String policyPrefix,
+ String policyNameWithPrefix) {
// Verify whether it is triggered by Validation Test button from UI
if (prop.isTestOnly()) {
return "send not executed for test action";
@@ -261,7 +272,7 @@ public class PolicyClient {
try {
if ((PolicyClass.Decision.equals(policyParameters.getPolicyClass()) && !checkDecisionPolicyExists(prop))
|| (PolicyClass.Config.equals(policyParameters.getPolicyClass())
- && !checkPolicyExists(policyNamePrefix, prop))) {
+ && !checkPolicyExists(prop, policyPrefix, policyNameWithPrefix))) {
LoggingUtils.setTargetContext("Policy", "createPolicy");
logger.info("Attempting to create policy for action=" + prop.getActionCd());
response = getPolicyEngine().createPolicy(policyParameters);
@@ -302,22 +313,13 @@ public class PolicyClient {
* The ModelProperties
* @return The response message of policy
*/
- protected String push(String policyType, ModelProperties prop) {
+ protected String push(String policyType, ModelProperties prop, String policyName) {
// Verify whether it is triggered by Validation Test button from UI
if (prop.isTestOnly()) {
return "push not executed for test action";
}
PushPolicyParameters pushPolicyParameters = new PushPolicyParameters();
- // Parameter arguments
- if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) {
- if (DictionaryType.Decision.toString().equals(policyType)) {
- pushPolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueGuardId());
- } else {
- pushPolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueId());
- }
- } else {
- pushPolicyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName());
- }
+ pushPolicyParameters.setPolicyName(selectRightPolicyName(prop, policyType, policyName));
logger.info("Policy Name in Push policy method - " + pushPolicyParameters.getPolicyName());
pushPolicyParameters.setPolicyType(policyType);
pushPolicyParameters.setPdpGroup(refProp.getStringValue("policy.pdp.group"));
@@ -365,7 +367,7 @@ public class PolicyClient {
logger.info("Search in Policy Engine for DecisionpolicyName=" + prop.getPolicyScopeAndNameWithUniqueGuardId());
try {
// No other choice than pushing to see if it exists or not
- String response = push(DictionaryType.Decision.toString(), prop);
+ String response = push(DictionaryType.Decision.toString(), prop, null);
if (response != null) {
policyexists = true;
}
@@ -388,17 +390,11 @@ public class PolicyClient {
* @throws PolicyConfigException
* In case of issues with policy engine
*/
- protected boolean checkPolicyExists(String policyNamePrefix, ModelProperties prop) {
+ protected boolean checkPolicyExists(ModelProperties prop, String policyPrefix, String policyNameWithPrefix) {
boolean policyexists = false;
String policyName = "";
try {
-
- if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) {
- policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix) + "_"
- + prop.getPolicyUniqueId();
- } else {
- policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix);
- }
+ policyName = selectRightPolicyNameWithPrefix(prop, policyPrefix, policyNameWithPrefix);
logger.info("Search in Policy Engine for policyName=" + policyName);
ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
@@ -441,9 +437,9 @@ public class PolicyClient {
String deletePolicyResponse = "";
try {
String policyNamePrefix = refProp.getStringValue(POLICY_MS_NAME_PREFIX_PROPERTY_NAME);
- if (checkPolicyExists(policyNamePrefix, prop)) {
+ if (checkPolicyExists(prop, policyNamePrefix, null)) {
String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME);
- deletePolicyResponse = deletePolicy(prop, policyType);
+ deletePolicyResponse = deletePolicy(prop, policyType, null);
}
} catch (Exception e) {
logger.error("Exception occurred during policy communication", e);
@@ -460,7 +456,7 @@ public class PolicyClient {
* @return A string with the answer from policy
*/
public String deleteBasePolicy(ModelProperties prop) {
- return deletePolicy(prop, PolicyConfigType.Base.toString());
+ return deletePolicy(prop, PolicyConfigType.Base.toString(), null);
}
/**
@@ -475,7 +471,7 @@ public class PolicyClient {
try {
if (checkDecisionPolicyExists(prop)) {
- deletePolicyResponse = deletePolicy(prop, DictionaryType.Decision.toString());
+ deletePolicyResponse = deletePolicy(prop, DictionaryType.Decision.toString(), null);
}
} catch (Exception e) {
logger.error("Exception occurred during policy communication", e);
@@ -495,9 +491,9 @@ public class PolicyClient {
String deletePolicyResponse = "";
try {
String policyNamePrefix = refProp.getStringValue(POLICY_OP_NAME_PREFIX_PROPERTY_NAME);
- if (checkPolicyExists(policyNamePrefix, prop)) {
+ if (checkPolicyExists(prop, policyNamePrefix, null)) {
String policyType = refProp.getStringValue(POLICY_OP_TYPE_PROPERTY_NAME);
- deletePolicyResponse = deletePolicy(prop, policyType);
+ deletePolicyResponse = deletePolicy(prop, policyType, null);
}
} catch (Exception e) {
logger.error("Exception occurred during policy communication", e);
@@ -506,25 +502,60 @@ public class PolicyClient {
return deletePolicyResponse;
}
+ protected String selectRightPolicyName(ModelProperties prop, String policyType, String policyName) {
+ if (policyName == null) {
+ if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) {
+ if (DictionaryType.Decision.toString().equals(policyType)) {
+ return prop.getPolicyScopeAndNameWithUniqueGuardId();
+ } else {
+ return prop.getPolicyScopeAndNameWithUniqueId();
+ }
+ } else {
+ return prop.getCurrentPolicyScopeAndPolicyName();
+ }
+ } else {
+ return policyName;
+ }
+ }
+
/**
- * Format and send delete PAP and PDP requests to Policy.
+ * Method to return correct policy name with prefix
*
* @param prop
* The ModelProperties
- * @return The response message from policy
+ * @param policyPrefix
+ * Policy Prefix
+ * @param policyNameWithPrefix
+ * Policy Name With Prefix
+ * @return
*/
- protected String deletePolicy(ModelProperties prop, String policyType) {
- DeletePolicyParameters deletePolicyParameters = new DeletePolicyParameters();
- if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) {
- if (DictionaryType.Decision.toString().equals(policyType)) {
- deletePolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueGuardId());
+ protected String selectRightPolicyNameWithPrefix(ModelProperties prop, String policyPrefix,
+ String policyNameWithPrefix) {
+ if (policyNameWithPrefix == null) {
+ if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) {
+ return prop.getCurrentPolicyScopeAndFullPolicyName(policyPrefix) + "_" + prop.getPolicyUniqueId();
} else {
- deletePolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueId());
+ return prop.getCurrentPolicyScopeAndFullPolicyName(policyPrefix);
}
} else {
- deletePolicyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName());
+ return policyNameWithPrefix;
}
+ }
+
+ /**
+ * Format and send delete PAP and PDP requests to Policy.
+ *
+ * @param prop
+ * The ModelProperties
+ * @param policyType
+ * The policyType "Decision" or
+ * @return The response message from policy
+ */
+ protected String deletePolicy(ModelProperties prop, String policyType, String policyName) {
+ DeletePolicyParameters deletePolicyParameters = new DeletePolicyParameters();
+ deletePolicyParameters.setPolicyName(selectRightPolicyName(prop, policyType, policyName));
logger.info("Policy Name in delete policy method - " + deletePolicyParameters.getPolicyName());
+ logger.info("Deleting policy from PDP...");
deletePolicyParameters.setPolicyComponent("PDP");
deletePolicyParameters.setDeleteCondition(DeletePolicyCondition.ALL);
deletePolicyParameters.setPdpGroup(refProp.getStringValue("policy.pdp.group"));
@@ -572,4 +603,81 @@ public class PolicyClient {
}
return responseMessage;
}
+
+ /**
+ * Create a temp Tosca model file and perform import model to Policy Engine
+ *
+ * @param cldsToscaModel
+ * Policy model details
+ * @return The response message from policy
+ */
+ public String importToscaModel(CldsToscaModel cldsToscaModel) {
+ String filePath = "";
+ try {
+ String clampToscaPath = refProp.getStringValue(TOSCA_FILE_TEMP_PATH);
+ filePath = buildFilePathForToscaFile(clampToscaPath, cldsToscaModel.getToscaModelName());
+ logger.info("Writing Tosca model : " + filePath);
+ Path path = Paths.get(filePath);
+ Files.createDirectories(path.getParent());
+ // Create or Ovewrite an existing the file
+ try (OutputStream out = Files.newOutputStream(path)) {
+ out.write(cldsToscaModel.getToscaModelYaml().getBytes(), 0,
+ cldsToscaModel.getToscaModelYaml().getBytes().length);
+ }
+ } catch (IOException e) {
+ logger.error("Exception caught when attempting to write Tosca files to disk", e);
+ throw new PolicyClientException("Exception caught when attempting to write Tosca files to disk", e);
+ }
+
+ ImportParameters importParameters = new ImportParameters();
+ importParameters.setImportParameters(cldsToscaModel.getToscaModelName(), cldsToscaModel.getToscaModelName(),
+ null, filePath, IMPORT_TYPE.MICROSERVICE, String.valueOf(cldsToscaModel.getVersion()));
+ return importModel(importParameters);
+ }
+
+ /**
+ * @param importParameters
+ * The ImportParameters
+ * @return The response message from policy
+ */
+ private String importModel(ImportParameters importParameters) {
+ PolicyChangeResponse response = null;
+ String responseMessage = "";
+
+ try {
+ logger.info("Attempting to import tosca policy model for action=" + importParameters.getFilePath());
+ response = getPolicyEngine().policyEngineImport(importParameters);
+ if (response != null) {
+ responseMessage = response.getResponseMessage();
+ }
+ } catch (Exception e) {
+ LoggingUtils.setResponseContext("900", "Policy Model import failed", this.getClass().getName());
+ LoggingUtils.setErrorContext("900", "Policy Model import error");
+ logger.error("Exception occurred during policy communication", e);
+ throw new PolicyClientException("Exception while communicating with Policy", e);
+ }
+ logger.info(LOG_POLICY_PREFIX + responseMessage);
+ if (response != null && (response.getResponseCode() == 200 || response.getResponseCode() == 204)) {
+ LoggingUtils.setResponseContext("0", "Policy Model import success", this.getClass().getName());
+ logger.info("Policy import model successful");
+ metricsLogger.info("Policy import model success");
+ } else {
+ LoggingUtils.setResponseContext("900", "Policy import model failed", this.getClass().getName());
+ logger.warn("Policy import model failed: " + responseMessage);
+ metricsLogger.info("Policy import model failure");
+ throw new BadRequestException("Policy import model failed: " + responseMessage);
+ }
+ return responseMessage;
+ }
+
+ /**
+ * @param clampToscaPath
+ * Temp directory path for writing tosca files
+ * @param toscaModelName
+ * Tosca Model Name
+ * @return File Path on the system
+ */
+ private String buildFilePathForToscaFile(String clampToscaPath, String toscaModelName) {
+ return clampToscaPath + "/" + toscaModelName + ".yml";
+ }
} \ No newline at end of file
diff --git a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java
index 4422c92fe..cd7d4f2cc 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java
@@ -19,7 +19,7 @@
* ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client.req.sdc;
@@ -33,7 +33,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import java.io.BufferedReader;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -50,10 +49,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import javax.ws.rs.BadRequestException;
-
import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.io.IOUtils;
@@ -66,9 +62,6 @@ import org.onap.clamp.clds.model.CldsServiceData;
import org.onap.clamp.clds.model.CldsVfData;
import org.onap.clamp.clds.model.CldsVfKPIData;
import org.onap.clamp.clds.model.CldsVfcData;
-import org.onap.clamp.clds.model.properties.Global;
-import org.onap.clamp.clds.model.properties.ModelProperties;
-import org.onap.clamp.clds.model.sdc.SdcArtifact;
import org.onap.clamp.clds.model.sdc.SdcResource;
import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;
import org.onap.clamp.clds.model.sdc.SdcServiceDetail;
@@ -87,17 +80,17 @@ public class SdcCatalogServices {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcCatalogServices.class);
private 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";
- private static final String SDC_REQUESTID_PROPERTY_NAME = "sdc.header.requestId";
- private static final String SDC_METADATA_URL_PREFIX = "/metadata";
- private static final String SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";
- private static final String SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";
- private static final String SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";
- private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";
- private static final String RESOURCE_URL_PREFIX = "resources";
- private static final LoggingUtils utils = new LoggingUtils (logger);
+ public static final String RESOURCE_VF_TYPE = "VF";
+ public static final String RESOURCE_VFC_TYPE = "VFC";
+ public static final String RESOURCE_CVFC_TYPE = "CVFC";
+ public static final String SDC_REQUESTID_PROPERTY_NAME = "sdc.header.requestId";
+ public static final String SDC_METADATA_URL_PREFIX = "/metadata";
+ public static final String SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";
+ public static final String SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";
+ public static final String SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";
+ public static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";
+ public static final String RESOURCE_URL_PREFIX = "resources";
+ private static final LoggingUtils utils = new LoggingUtils(logger);
@Autowired
private ClampProperties refProp;
@@ -107,11 +100,11 @@ public class SdcCatalogServices {
*
* @return The String with Basic Auth and password
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the HexString message
+ * In case of issues with the decoding of the HexString message
*/
- private String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {
+ public String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {
String sdcId = refProp.getStringValue("sdc.serviceUsername");
String sdcPw = refProp.getStringValue("sdc.servicePassword");
String password = CryptoUtils.decrypt(sdcPw);
@@ -120,16 +113,16 @@ public class SdcCatalogServices {
}
/**
- * This method get the SDC services Information with the corresponding
- * Service UUID.
- *
+ * This method get the SDC services Information with the corresponding Service
+ * UUID.
+ *
* @param uuid
- * The service UUID
+ * The service UUID
* @return A Json String with all the service list
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public String getSdcServicesInformation(String uuid) throws GeneralSecurityException, DecoderException {
Date startTime = new Date();
@@ -142,7 +135,7 @@ public class SdcCatalogServices {
}
URL urlObj = new URL(url);
HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "getSdcServicesInformation");
+ conn = utils.invoke(conn, "SDC", "getSdcServicesInformation");
conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);
conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json;charset=UTF-8");
@@ -166,9 +159,9 @@ public class SdcCatalogServices {
/**
* To remove duplicate serviceUUIDs from sdc services List.
- *
+ *
* @param rawCldsSdcServiceList
- * A list of CldsSdcServiceInfo
+ * A list of CldsSdcServiceInfo
* @return A list of CldsSdcServiceInfo without duplicate service UUID
*/
public List<SdcServiceInfo> removeDuplicateServices(List<SdcServiceInfo> rawCldsSdcServiceList) {
@@ -195,7 +188,7 @@ public class SdcCatalogServices {
/**
* To remove duplicate serviceUUIDs from sdc resources List.
- *
+ *
* @param rawCldsSdcResourceList
* @return List of CldsSdcResource
*/
@@ -223,12 +216,12 @@ public class SdcCatalogServices {
/**
* To remove duplicate basic resources with same resourceUUIDs.
- *
+ *
* @param rawCldsSdcResourceListBasicList
* @return List of CldsSdcResourceBasicInfo
*/
public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(
- List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
+ List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = new ArrayList<>();
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {
// sort list
@@ -245,24 +238,24 @@ public class SdcCatalogServices {
}
// add the last in the list
cldsSdcResourceBasicInfoList
- .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));
+ .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));
}
return cldsSdcResourceBasicInfoList;
}
/**
* To get ServiceUUID by using serviceInvariantUUID.
- *
+ *
* @param invariantId
- * The invariant ID
+ * The invariant ID
* @return The service UUID
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public String getServiceUuidFromServiceInvariantId(String invariantId)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
String serviceUuid = "";
String responseStr = getSdcServicesInformation(null);
List<SdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);
@@ -270,7 +263,7 @@ public class SdcCatalogServices {
if (cldsSdcServicesList != null && !cldsSdcServicesList.isEmpty()) {
for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {
if (currCldsSdcServiceInfo != null && currCldsSdcServiceInfo.getInvariantUUID() != null
- && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {
+ && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {
serviceUuid = currCldsSdcServiceInfo.getUuid();
break;
}
@@ -281,11 +274,11 @@ 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
- * an empty list
+ * The Json string that must be decoded
+ * @return The list of CldsSdcServiceInfo, if there is a failure it return an
+ * empty list
*/
private List<SdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {
if (StringUtils.isBlank(jsonStr)) {
@@ -293,7 +286,7 @@ public class SdcCatalogServices {
}
try {
return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()
- .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));
+ .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));
} catch (IOException e) {
logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);
return new ArrayList<>();
@@ -304,9 +297,8 @@ public class SdcCatalogServices {
* To get List of CldsSdcResourceBasicInfo class by parsing json string.
*
* @param jsonStr
- * The JSOn string that must be decoded
- * @return The list of CldsSdcResourceBasicInfo, an empty list in case of
- * issues
+ * The JSOn string that must be decoded
+ * @return The list of CldsSdcResourceBasicInfo, an empty list in case of issues
*/
private List<SdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {
if (StringUtils.isBlank(jsonStr)) {
@@ -314,7 +306,7 @@ public class SdcCatalogServices {
}
try {
return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()
- .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));
+ .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));
} catch (IOException e) {
logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);
return new ArrayList<>();
@@ -323,7 +315,7 @@ public class SdcCatalogServices {
/**
* To get CldsSdcServiceDetail by parsing json string.
- *
+ *
* @param jsonStr
* @return
*/
@@ -336,75 +328,7 @@ public class SdcCatalogServices {
}
}
- // upload artifact to sdc based on serviceUUID and resource name on url
- private String uploadArtifactToSdc(ModelProperties prop, String userid, String url, String formattedSdcReq) {
- // Verify whether it is triggered by Validation Test button from UI
- if (prop.isTestOnly()) {
- return "sdc artifact upload not executed for test action";
- }
- try {
- logger.info("userid=" + userid);
- byte[] postData = formattedSdcReq.getBytes(StandardCharsets.UTF_8);
- int postDataLength = postData.length;
- HttpURLConnection conn = getSdcHttpUrlConnection(userid, postDataLength, url, formattedSdcReq);
- conn = utils.invoke(conn,"SDC", "uploadArtifact");
- try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
- wr.write(postData);
- }
- boolean requestFailed = true;
- int responseCode = conn.getResponseCode();
- logger.info("responseCode=" + responseCode);
- if (responseCode == 200) {
- requestFailed = false;
- }
- String responseStr = getResponse(conn);
- if (responseStr != null && requestFailed) {
- logger.error("requestFailed - responseStr=" + responseStr);
- utils.invokeReturn();
- throw new BadRequestException(responseStr);
- }
- utils.invokeReturn();
- return responseStr;
- } catch (IOException e) {
- logger.error("Exception when attempting to communicate with SDC", e);
- utils.invokeReturn();
- throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e);
- }
- }
-
- private HttpURLConnection getSdcHttpUrlConnection(String userid, int postDataLength, String url, String content) {
- try {
- logger.info("userid=" + userid);
- String basicAuth = getSdcBasicAuth();
- String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID");
- URL urlObj = new URL(url);
- HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn.setDoOutput(true);
- conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), sdcXonapInstanceId);
- conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
- conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json");
- conn.setRequestProperty(HttpHeaders.CONTENT_MD5,
- Base64.getEncoder().encodeToString(DigestUtils.md5Hex(content).getBytes("UTF-8")));
- conn.setRequestProperty("USER_ID", userid);
- conn.setRequestMethod("POST");
- conn.setRequestProperty("charset", "utf-8");
- conn.setRequestProperty(HttpHeaders.CONTENT_LENGTH, Integer.toString(postDataLength));
- conn.setUseCaches(false);
- conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME), LoggingUtils.getRequestId());
- return conn;
- } catch (IOException e) {
- logger.error("Exception when attempting to open connection with SDC", e);
- throw new SdcCommunicationException("Exception when attempting to open connection with SDC", e);
- } catch (DecoderException e) {
- logger.error("Exception when attempting to decode the Hex string", e);
- throw new SdcCommunicationException("Exception when attempting to decode the Hex string", e);
- } catch (GeneralSecurityException e) {
- logger.error("Exception when attempting to decrypt the encrypted password", e);
- throw new SdcCommunicationException("Exception when attempting to decrypt the encrypted password", e);
- }
- }
-
- private String getResponse(HttpURLConnection conn) {
+ public String getResponse(HttpURLConnection conn) {
try (InputStream is = getInputStream(conn)) {
try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) {
return IOUtils.toString(in);
@@ -430,46 +354,45 @@ public class SdcCatalogServices {
/**
* Check if the SDC Info in cache has expired.
- *
+ *
* @param cldsServiceData
- * The object representing the service data
+ * The object representing the service data
* @return boolean flag
* @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
+ * In case of issues with the decryting the encrypted password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public boolean isCldsSdcCacheDataExpired(CldsServiceData cldsServiceData)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {
String cachedServiceUuid = cldsServiceData.getServiceUUID();
String latestServiceUuid = getServiceUuidFromServiceInvariantId(cldsServiceData.getServiceInvariantUUID());
String configuredMaxAge = refProp.getStringValue("clds.service.cache.invalidate.after.seconds");
if (configuredMaxAge == null) {
logger.warn(
- "clds.service.cache.invalidate.after.seconds NOT set in clds-reference.properties file, taking 60s as default");
+ "clds.service.cache.invalidate.after.seconds NOT set in clds-reference.properties file, taking 60s as default");
configuredMaxAge = "60";
}
return (!cachedServiceUuid.equalsIgnoreCase(latestServiceUuid)) || (cldsServiceData.getAgeOfRecord() != null
- && cldsServiceData.getAgeOfRecord() > Long.parseLong(configuredMaxAge));
+ && cldsServiceData.getAgeOfRecord() > Long.parseLong(configuredMaxAge));
} else {
return true;
}
}
/**
- * Get the Service Data with Alarm Conditions for a given
- * invariantServiceUuid.
- *
+ * Get the Service Data with Alarm Conditions for a given invariantServiceUuid.
+ *
* @param invariantServiceUuid
* @return The CldsServiceData
* @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
+ * In case of issues with the decryting the encrypted password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public CldsServiceData getCldsServiceDataWithAlarmConditions(String invariantServiceUuid)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
String url = refProp.getStringValue(SDC_SERVICE_URL_PROPERTY_NAME);
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);
String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid);
@@ -480,7 +403,7 @@ public class SdcCatalogServices {
SdcServiceDetail cldsSdcServiceDetail;
try {
cldsSdcServiceDetail = JacksonUtils.getObjectMapperInstance().readValue(responseStr,
- SdcServiceDetail.class);
+ SdcServiceDetail.class);
} catch (IOException e) {
logger.error("Exception when decoding the CldsServiceData JSON from SDC", e);
throw new SdcCommunicationException("Exception when decoding the CldsServiceData JSON from SDC", e);
@@ -491,12 +414,12 @@ public class SdcCatalogServices {
cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid());
cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID());
List<SdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(
- cldsSdcServiceDetail.getResources());
+ cldsSdcServiceDetail.getResources());
if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
List<CldsVfData> cldsVfDataList = new ArrayList<>();
for (SdcResource currCldsSdcResource : cldsSdcResourceList) {
if (currCldsSdcResource != null && currCldsSdcResource.getResoucreType() != null
- && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {
+ && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {
CldsVfData currCldsVfData = new CldsVfData();
currCldsVfData.setVfName(currCldsSdcResource.getResourceInstanceName());
currCldsVfData.setVfInvariantResourceUUID(currCldsSdcResource.getResourceInvariantUUID());
@@ -514,20 +437,20 @@ public class SdcCatalogServices {
}
private void getAllVfcForVfList(List<CldsVfData> cldsVfDataList, String catalogUrl)
- throws GeneralSecurityException {
+ throws GeneralSecurityException {
// todo : refact this..
if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {
List<SdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_VF_TYPE);
List<SdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(
- RESOURCE_VFC_TYPE);
+ RESOURCE_VFC_TYPE);
allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE));
for (CldsVfData currCldsVfData : cldsVfDataList) {
if (currCldsVfData != null && currCldsVfData.getVfInvariantResourceUUID() != null) {
String resourceUuid = getResourceUuidFromResourceInvariantUuid(
- currCldsVfData.getVfInvariantResourceUUID(), allVfResources);
+ currCldsVfData.getVfInvariantResourceUUID(), allVfResources);
if (resourceUuid != null) {
String vfResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUuid
- + SDC_METADATA_URL_PREFIX;
+ + SDC_METADATA_URL_PREFIX;
String vfResponse = getCldsServicesOrResourcesBasedOnURL(vfResourceUuidUrl);
if (vfResponse != null) {
// Below 2 line are to get the KPI(field path) data
@@ -542,22 +465,22 @@ public class SdcCatalogServices {
// alarm conditions from artifact
for (CldsVfcData currCldsVfcData : vfcDataListFromVfResponse) {
if (currCldsVfcData != null
- && currCldsVfcData.getVfcInvariantResourceUUID() != null) {
+ && currCldsVfcData.getVfcInvariantResourceUUID() != null) {
String resourceVfcUuid = getResourceUuidFromResourceInvariantUuid(
- currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);
+ currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);
if (resourceVfcUuid != null) {
String vfcResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/"
- + resourceVfcUuid + SDC_METADATA_URL_PREFIX;
+ + resourceVfcUuid + SDC_METADATA_URL_PREFIX;
String vfcResponse = getCldsServicesOrResourcesBasedOnURL(
- vfcResourceUuidUrl);
+ vfcResourceUuidUrl);
if (vfcResponse != null) {
List<CldsAlarmCondition> alarmCondtionsFromVfc = getAlarmCondtionsFromVfc(
- vfcResponse);
+ vfcResponse);
currCldsVfcData.setCldsAlarmConditions(alarmCondtionsFromVfc);
}
} else {
logger.info("No resourceVFC UUID found for given invariantID:"
- + currCldsVfcData.getVfcInvariantResourceUUID());
+ + currCldsVfcData.getVfcInvariantResourceUUID());
}
}
}
@@ -566,7 +489,7 @@ public class SdcCatalogServices {
}
} else {
logger.info("No resourceUUID found for given invariantREsourceUUID:"
- + currCldsVfData.getVfInvariantResourceUUID());
+ + currCldsVfData.getVfInvariantResourceUUID());
}
}
}
@@ -720,7 +643,7 @@ public class SdcCatalogServices {
return null;
}
if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))
- || StringUtils.isBlank(record.get(5))) {
+ || StringUtils.isBlank(record.get(5))) {
logger.debug("Invalid csv field path Record,one of column is having blank value : " + record);
return null;
}
@@ -764,7 +687,7 @@ public class SdcCatalogServices {
return;
}
if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))
- || StringUtils.isBlank(record.get(4))) {
+ || StringUtils.isBlank(record.get(4))) {
logger.debug("invalid csv alarm Record,one of column is having blank value : " + record);
return;
}
@@ -788,11 +711,11 @@ public class SdcCatalogServices {
}
/**
- * Service to services/resources/artifacts from sdc.Pass alarmConditions as
- * true to get alarm conditons from artifact url and else it is false
- *
+ * Service to services/resources/artifacts from sdc.Pass alarmConditions as true
+ * to get alarm conditons from artifact url and else it is false
+ *
* @param url
- * The URL to trigger
+ * The URL to trigger
* @return The String containing the payload
*/
public String getCldsServicesOrResourcesBasedOnURL(String url) {
@@ -802,7 +725,7 @@ public class SdcCatalogServices {
String urlReworked = removeUnwantedBracesFromString(url);
URL urlObj = new URL(urlReworked);
HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "getSdcResources");
+ conn = utils.invoke(conn, "SDC", "getSdcResources");
String basicAuth = getSdcBasicAuth();
conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);
conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
@@ -841,7 +764,7 @@ public class SdcCatalogServices {
* @param cldsServiceData
* @return
* @throws IOException
- * In case of issues during the parsing of the Global Properties
+ * In case of issues during the parsing of the Global Properties
*/
public String createPropertiesObjectByUUID(CldsServiceData cldsServiceData) throws IOException {
String totalPropsStr;
@@ -878,12 +801,12 @@ public class SdcCatalogServices {
byIdObjectNode.putPOJO("byVfc", vfcResourceUuidObjectNode);
// To create byAlarmCondition with alarmConditionKey
List<CldsAlarmCondition> allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,
- "alarmCondition");
+ "alarmCondition");
ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(allAlarmConditions);
byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey);
// To create byAlertDescription with AlertDescription
List<CldsAlarmCondition> allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,
- "alertDescription");
+ "alertDescription");
ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(allAlertDescriptions);
byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);
globalPropsJson.putPOJO("shared", byIdObjectNode);
@@ -895,19 +818,18 @@ public class SdcCatalogServices {
/**
* Method to get alarm conditions/alert description from Service Data.
- *
+ *
* @param cldsServiceData
- * CldsServiceData the Service Data to analyze
+ * CldsServiceData the Service Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
public List<CldsAlarmCondition> getAllAlarmConditionsFromCldsServiceData(CldsServiceData cldsServiceData,
- String eventName) {
+ String eventName) {
List<CldsAlarmCondition> alarmCondList = new ArrayList<>();
if (cldsServiceData != null && cldsServiceData.getCldsVfs() != null
- && !cldsServiceData.getCldsVfs().isEmpty()) {
+ && !cldsServiceData.getCldsVfs().isEmpty()) {
for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {
alarmCondList.addAll(getAllAlarmConditionsFromCldsVfData(currCldsVfData, eventName));
}
@@ -917,12 +839,11 @@ public class SdcCatalogServices {
/**
* Method to get alarm conditions/alert description from VF Data.
- *
+ *
* @param currCldsVfData
- * The Vf Data to analyze
+ * The Vf Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfData(CldsVfData currCldsVfData, String eventName) {
@@ -937,22 +858,21 @@ public class SdcCatalogServices {
/**
* Method to get alarm conditions/alert description from VFC Data.
- *
+ *
* @param currCldsVfcData
- * The VfC Data to analyze
+ * The VfC Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfcData(CldsVfcData currCldsVfcData,
- String eventName) {
+ String eventName) {
List<CldsAlarmCondition> alarmCondList = new ArrayList<>();
if (currCldsVfcData != null && currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {
if (currCldsAlarmCondition != null
- && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {
+ && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {
alarmCondList.add(currCldsAlarmCondition);
}
}
@@ -1002,7 +922,7 @@ public class SdcCatalogServices {
}
private void createKpiObjectNodeByVfUuid(ObjectNode vfResourceUuidObjectNode,
- List<CldsVfKPIData> cldsVfKpiDataList) {
+ List<CldsVfKPIData> cldsVfKpiDataList) {
ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
if (cldsVfKpiDataList != null && !cldsVfKpiDataList.isEmpty()) {
for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) {
@@ -1011,7 +931,7 @@ public class SdcCatalogServices {
ObjectNode fieldPathObjectNode = mapper.createObjectNode();
ObjectNode nfNamingCodeNode = mapper.createObjectNode();
fieldPathObjectNode.put(currCldsVfKpiData.getFieldPathValue(),
- currCldsVfKpiData.getFieldPathValue());
+ currCldsVfKpiData.getFieldPathValue());
nfNamingCodeNode.put(currCldsVfKpiData.getNfNamingValue(), currCldsVfKpiData.getNfNamingValue());
thresholdNameObjectNode.putPOJO("fieldPath", fieldPathObjectNode);
thresholdNameObjectNode.putPOJO("nfNamingCode", nfNamingCodeNode);
@@ -1022,7 +942,7 @@ public class SdcCatalogServices {
}
private void createAlarmCondObjectNodeByVfcUuid(ObjectNode vfcResourceUuidObjectNode,
- List<CldsVfcData> cldsVfcDataList) {
+ List<CldsVfcData> cldsVfcDataList) {
ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
ObjectNode vfcObjectNode = mapper.createObjectNode();
ObjectNode alarmCondNode = mapper.createObjectNode();
@@ -1031,14 +951,14 @@ public class SdcCatalogServices {
for (CldsVfcData currCldsVfcData : cldsVfcDataList) {
if (currCldsVfcData != null) {
if (currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {
if ("alarmCondition".equalsIgnoreCase(currCldsAlarmCondition.getEventName())) {
alarmCondNode.put(currCldsAlarmCondition.getAlarmConditionKey(),
- currCldsAlarmCondition.getAlarmConditionKey());
+ currCldsAlarmCondition.getAlarmConditionKey());
} else {
alertDescNode.put(currCldsAlarmCondition.getAlarmConditionKey(),
- currCldsAlarmCondition.getAlarmConditionKey());
+ currCldsAlarmCondition.getAlarmConditionKey());
}
}
}
@@ -1058,7 +978,7 @@ public class SdcCatalogServices {
/**
* Method to create vfc and kpi nodes inside vf node
- *
+ *
* @param mapper
* @param cldsVfDataList
* @return
@@ -1075,9 +995,9 @@ public class SdcCatalogServices {
if (currCldsVfData.getCldsVfcs() != null && !currCldsVfData.getCldsVfcs().isEmpty()) {
for (CldsVfcData currCldsVfcData : currCldsVfData.getCldsVfcs()) {
if (currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
vfcUuidNode.put(currCldsVfcData.getVfcInvariantResourceUUID(),
- currCldsVfcData.getVfcName());
+ currCldsVfcData.getVfcName());
}
}
} else {
@@ -1086,7 +1006,7 @@ public class SdcCatalogServices {
if (currCldsVfData.getCldsKPIList() != null && !currCldsVfData.getCldsKPIList().isEmpty()) {
for (CldsVfKPIData currCldsVfKPIData : currCldsVfData.getCldsKPIList()) {
kpiObjectNode.put(currCldsVfKPIData.getThresholdValue(),
- currCldsVfKPIData.getThresholdValue());
+ currCldsVfKPIData.getThresholdValue());
}
} else {
kpiObjectNode.put("", "");
@@ -1106,41 +1026,6 @@ public class SdcCatalogServices {
return vfUuidObjectNode;
}
- /**
- * This method searches the equivalent artifact UUID for a specific
- * artifactName in a SdcServiceDetail.
- *
- * @param cldsSdcServiceDetail
- * The SdcServiceDetail that will be analyzed
- * @param artifactName
- * The artifact name that will be searched
- * @return The artifact UUID found
- */
- public String getArtifactIdIfArtifactAlreadyExists(SdcServiceDetail cldsSdcServiceDetail, String artifactName) {
- String artifactUuid = null;
- boolean artifactExists = false;
- if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null
- && !cldsSdcServiceDetail.getResources().isEmpty()) {
- for (SdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {
- if (artifactExists) {
- break;
- }
- if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null
- && !currCldsSdcResource.getArtifacts().isEmpty()) {
- for (SdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {
- if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null
- && currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {
- artifactUuid = currCldsSdcArtifact.getArtifactUUID();
- artifactExists = true;
- break;
- }
- }
- }
- }
- }
- return artifactUuid;
- }
-
// To get all sdc VF/VFC Resources basic info.
private List<SdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);
@@ -1150,12 +1035,12 @@ public class SdcCatalogServices {
}
private String getResourceUuidFromResourceInvariantUuid(String resourceInvariantUuid,
- List<SdcResourceBasicInfo> resourceInfoList) {
+ List<SdcResourceBasicInfo> resourceInfoList) {
String resourceUuid = null;
if (resourceInfoList != null && !resourceInfoList.isEmpty()) {
for (SdcResourceBasicInfo currResource : resourceInfoList) {
if (currResource != null && currResource.getInvariantUUID() != null && currResource.getUuid() != null
- && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {
+ && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {
resourceUuid = currResource.getUuid();
break;
}
@@ -1163,150 +1048,4 @@ public class SdcCatalogServices {
}
return resourceUuid;
}
-
- // Method to get service invariant uuid from model properties.
- private String getServiceInvariantUuidFromProps(ModelProperties props) {
- String invariantUuid = "";
- Global globalProps = props.getGlobal();
- if (globalProps != null && globalProps.getService() != null) {
- invariantUuid = globalProps.getService();
- }
- return invariantUuid;
- }
-
- /**
- * This method upload the BluePrint to SDC.
- *
- * @param prop
- * The Clds model Properties
- * @param userid
- * The user id for SDC
- * @param sdcReqUrlsList
- * The list of SDC URL to try
- * @param formattedSdcReq
- * The blueprint to upload
- * @param formattedSdcLocationReq
- * THe location Blueprint to upload
- * @param artifactName
- * The artifact name from where we can get the Artifact UUID
- * @param locationArtifactName
- * The location artifact name from where we can get the Artifact
- * UUID
- * @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
- * @throws DecoderException
- * In case of issues with the decoding of the Hex String
- */
- public void uploadToSdc(ModelProperties prop, String userid, List<String> sdcReqUrlsList, String formattedSdcReq,
- String formattedSdcLocationReq, String artifactName, String locationArtifactName)
- throws GeneralSecurityException, DecoderException {
- logger.info("userid=" + userid);
- String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop);
- if (sdcReqUrlsList != null && !sdcReqUrlsList.isEmpty()) {
- for (String url : sdcReqUrlsList) {
- if (url != null) {
- String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- logger.info("ServiceUUID used before upload in url:" + originalServiceUuid);
- String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);
- SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
- artifactName);
- // Upload artifacts to sdc
- String updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;
- String responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcReq);
- logger.info("value of sdc Response of uploading to sdc :" + responseStr);
- String updatedServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- if (!originalServiceUuid.equalsIgnoreCase(updatedServiceUuid)) {
- url = url.replace(originalServiceUuid, updatedServiceUuid);
- }
- logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);
- sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);
- cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
- locationArtifactName);
- // To send location information also to sdc
- updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;
- responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcLocationReq);
- logger.info("value of sdc Response of uploading location to sdc :" + responseStr);
- }
- }
- }
- }
-
- /**
- * Method to delete blueprint and location json artifacts from sdc
- *
- * @param prop
- * @param userid
- * @param sdcReqUrlsList
- * @param artifactName
- * @param locationArtifactName
- * @throws GeneralSecurityException
- * @throws DecoderException
- */
- public void deleteArtifactsFromSdc(ModelProperties prop, String userid, List<String> sdcReqUrlsList,
- String artifactName, String locationArtifactName) throws GeneralSecurityException, DecoderException {
- String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop);
- for (String url : sdcReqUrlsList) {
- String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- logger.info("ServiceUUID used before deleting in url:" + originalServiceUuid);
- String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);
- SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail, artifactName);
- String responseStr = deleteArtifact(userid, url, uploadedArtifactUuid);
- logger.info("value of sdc Response of deleting blueprint from sdc :" + responseStr);
- String updatedServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- if (!originalServiceUuid.equalsIgnoreCase(updatedServiceUuid)) {
- url = url.replace(originalServiceUuid, updatedServiceUuid);
- }
- logger.info("ServiceUUID used after delete in ulr:" + updatedServiceUuid);
- sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);
- cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail, locationArtifactName);
- responseStr = deleteArtifact(userid, url, uploadedArtifactUuid);
- logger.info("value of sdc Response of deleting location json from sdc :" + responseStr);
- }
- }
-
- private String deleteArtifact(String userid, String url, String uploadedArtifactUuid) {
- try {
- String responseStr = "";
- if (uploadedArtifactUuid != null && !uploadedArtifactUuid.isEmpty()) {
- logger.info("userid=" + userid);
- String basicAuth = getSdcBasicAuth();
- String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID");
- url = url + "/" + uploadedArtifactUuid;
- URL urlObj = new URL(url);
- HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "deleteArtifact");
- conn.setDoOutput(true);
- conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), sdcXonapInstanceId);
- conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
- conn.setRequestProperty("USER_ID", userid);
- conn.setRequestMethod("DELETE");
- conn.setRequestProperty("charset", "utf-8");
- conn.setUseCaches(false);
- conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME),
- LoggingUtils.getRequestId());
- boolean requestFailed = true;
- int responseCode = conn.getResponseCode();
- logger.info("responseCode=" + responseCode);
- if (responseCode == 200) {
- requestFailed = false;
- }
- responseStr = getResponse(conn);
- if (responseStr != null && requestFailed) {
- logger.error("requestFailed - responseStr=" + responseStr);
- utils.invokeReturn();
- throw new BadRequestException(responseStr);
- }
- }
- utils.invokeReturn();
- return responseStr;
- } catch (IOException | DecoderException | GeneralSecurityException e) {
- logger.error("Exception when attempting to communicate with SDC", e);
- utils.invokeReturn();
- throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e);
- }
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
index bdb4dda5b..9acad94ab 100644
--- a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
+++ b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
@@ -18,16 +18,18 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.config;
import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Splitter;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.util.List;
import org.apache.commons.io.IOUtils;
import org.onap.clamp.clds.util.JacksonUtils;
@@ -52,7 +54,7 @@ public class ClampProperties {
* get property value.
*
* @param key
- * The first key
+ * The first key
* @return The string with the value
*/
public String getStringValue(String key) {
@@ -60,13 +62,13 @@ public class ClampProperties {
}
/**
- * get property value for a combo key (key1 + "." + key2). If not found just
- * use key1.
+ * get property value for a combo key (key1 + "." + key2). If not found just use
+ * key1.
*
* @param key1
- * The first key
+ * The first key
* @param key2
- * The second key after a dot
+ * The second key after a dot
* @return The string with the value
*/
public String getStringValue(String key1, String key2) {
@@ -82,49 +84,47 @@ public class ClampProperties {
* clds-reference file will be used as a filename.
*
* @param key
- * The key that will be used to access the clds-reference file
+ * The key that will be used to access the clds-reference file
* @return A jsonNode
* @throws IOException
- * In case of issues with the JSON parser
+ * In case of issues with the JSON parser
*/
public JsonNode getJsonTemplate(String key) throws IOException {
String fileReference = getStringValue(key);
return (fileReference != null)
- ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference),
- JsonNode.class)
- : null;
+ ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), JsonNode.class)
+ : null;
}
/**
- * Return json as objects that can be updated. First try with combo key
- * (key1 + "." + key2), otherwise default to just key1. The value obtained
- * from the clds-reference file will be used as a filename.
+ * Return json as objects that can be updated. First try with combo key (key1 +
+ * "." + key2), otherwise default to just key1. The value obtained from the
+ * clds-reference file will be used as a filename.
*
* @param key1
- * The first key
+ * The first key
* @param key2
- * The second key after a dot
+ * The second key after a dot
* @return A JsonNode
* @throws IOException
- * In case of issues with the JSON parser
+ * In case of issues with the JSON parser
*/
public JsonNode getJsonTemplate(String key1, String key2) throws IOException {
String fileReference = getStringValue(key1, key2);
return (fileReference != null)
- ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference),
- JsonNode.class)
- : null;
+ ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), JsonNode.class)
+ : null;
}
/**
- * Return the file content. The value obtained from the clds-reference file
- * will be used as a filename.
+ * Return the file content. The value obtained from the clds-reference file will
+ * be used as a filename.
*
* @param key
- * The key that will be used to access the clds-reference file
+ * The key that will be used to access the clds-reference file
* @return File content in String
* @throws IOException
- * In case of issues with the JSON parser
+ * In case of issues with the JSON parser
*/
public String getFileContent(String key) throws IOException {
String fileReference = getStringValue(key);
@@ -133,16 +133,16 @@ public class ClampProperties {
/**
* Return the file content. First try with combo key (key1 + "." + key2),
- * otherwise default to just key1. The value obtained from the
- * clds-reference file will be used as a filename.
+ * otherwise default to just key1. The value obtained from the clds-reference
+ * file will be used as a filename.
*
* @param key1
- * The first key
+ * The first key
* @param key2
- * The second key after a dot
+ * The second key after a dot
* @return File content in String
* @throws IOException
- * In case of issues with the JSON parser
+ * In case of issues with the JSON parser
*/
public String getFileContent(String key1, String key2) throws IOException {
String fileReference = getStringValue(key1, key2);
@@ -153,4 +153,18 @@ public class ClampProperties {
URL url = appContext.getResource(filepath).getURL();
return IOUtils.toString(url, StandardCharsets.UTF_8);
}
+
+ /**
+ *
+ *
+ * @param key
+ * property key
+ * @param separator
+ * property value separator
+ * @return List of Strings split with a separator
+ */
+ public List<String> getStringList(String key, String separator) {
+ return Splitter.on(separator).trimResults().omitEmptyStrings()
+ .splitToList(env.getProperty(CONFIG_PREFIX + key));
+ }
}
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
index 055847085..1fb86c0ce 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
@@ -5,20 +5,20 @@
* Copyright (C) 2017-2018 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.
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.config.spring;
@@ -61,7 +61,7 @@ public class CldsSdcControllerConfiguration {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
sdcControllersConfig.getAllDefinedControllers().forEach((k, v) -> {
logger.info("Creating controller instance:" + k);
- SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, true);
+ SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, null);
sdcControllersList.add(sdcController);
});
}
diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
index 121114b37..b6e27c5e1 100644
--- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
+++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
@@ -29,13 +29,9 @@ import com.att.eelf.configuration.EELFManager;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
import javax.sql.DataSource;
@@ -515,32 +511,34 @@ public class CldsDao {
private List<CldsToscaModel> getToscaModel(String toscaModelName, String policyType) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
List<CldsToscaModel> cldsToscaModels = new ArrayList<>();
- MapSqlParameterSource params = new MapSqlParameterSource();
- String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp, tmr.tosca_model_yaml FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id ";
- if (toscaModelName != null) {
- toscaModelSql += " AND tm.tosca_model_name = :toscaModelName";
- params.addValue("toscaModelName", toscaModelName);
- }
- if (policyType != null) {
- toscaModelSql += " AND tm.policy_type = :policyType";
- params.addValue("policyType", policyType);
- }
- toscaModelSql += " AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)";
+ String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.tosca_model_json, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
+ + ((toscaModelName != null) ? (", tmr.tosca_model_yaml ") : " ")
+ + "FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id "
+ + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
+ + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ")
+ + "AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)";
+
+ List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
- Optional.ofNullable(jdbcTemplateObject.queryForList(toscaModelSql, params)).orElse(Collections.emptyList())
- .forEach(row -> {
+ if (rows != null) {
+ rows.forEach(row -> {
CldsToscaModel cldsToscaModel = new CldsToscaModel();
cldsToscaModel.setId((String) row.get("tosca_model_id"));
cldsToscaModel.setPolicyType((String) row.get("policy_type"));
cldsToscaModel.setToscaModelName((String) row.get("tosca_model_name"));
cldsToscaModel.setUserId((String) row.get("user_id"));
cldsToscaModel.setRevisionId((String) row.get("tosca_model_revision_id"));
+ cldsToscaModel.setToscaModelJson((String) row.get("tosca_model_json"));
cldsToscaModel.setVersion(((Double) row.get("version")));
cldsToscaModel.setCreatedDate(sdf.format(row.get("createdTimestamp")));
- cldsToscaModel.setToscaModelYaml((String) row.get("tosca_model_yaml"));
+ cldsToscaModel.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
+ if (toscaModelName != null) {
+ cldsToscaModel.setToscaModelYaml((String) row.get("tosca_model_yaml"));
+ }
cldsToscaModels.add(cldsToscaModel);
});
+ }
return cldsToscaModels;
}
@@ -604,11 +602,10 @@ public class CldsDao {
* @param userId
*/
public void updateDictionary(String dictionaryId, CldsDictionary cldsDictionary, String userId) {
- String dictionarySql = "UPDATE dictionary SET dictionary_name = :dictionary_name, modified_by = :modified_by WHERE dictionary_id = :dictionary_id";
- SqlParameterSource namedParameters = new MapSqlParameterSource()
- .addValue("dictionary_name", cldsDictionary.getDictionaryName()).addValue("modified_by", userId)
- .addValue("dictionary_id", dictionaryId);
- jdbcTemplateObject.update(dictionarySql, namedParameters);
+
+ String dictionarySql = "UPDATE dictionary " + "SET dictionary_name = '" + cldsDictionary.getDictionaryName()
+ + "', modified_by = '" + userId + "'" + "WHERE dictionary_id = '" + dictionaryId + "'";
+ jdbcTemplateObject.update(dictionarySql);
cldsDictionary.setUpdatedBy(userId);
}
@@ -622,16 +619,17 @@ public class CldsDao {
public List<CldsDictionary> getDictionary(String dictionaryId, String dictionaryName) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
List<CldsDictionary> dictionaries = new ArrayList<>();
- String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary WHERE ";
- MapSqlParameterSource namedParameters = new MapSqlParameterSource();
- Optional.ofNullable(dictionaryName).ifPresent(dn -> namedParameters.addValue("dictionary_name", dn));
- Optional.ofNullable(dictionaryId).ifPresent(dn -> namedParameters.addValue("dictionary_id", dn));
- dictionarySql += Optional.ofNullable(namedParameters.getParameterNames()).filter(a -> a.length > 0)
- .map(Arrays::stream).map(s -> s.map(param -> param + " = :" + param).collect(Collectors.joining(" AND ")))
- .orElse("1");
-
- Optional.ofNullable(jdbcTemplateObject.queryForList(dictionarySql, namedParameters))
- .orElse(Collections.emptyList()).forEach(row -> {
+ String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary"
+ + ((dictionaryId != null || dictionaryName != null)
+ ? (" WHERE " + ((dictionaryName != null) ? ("dictionary_name = '" + dictionaryName + "'") : "")
+ + ((dictionaryId != null && dictionaryName != null) ? (" AND ") : "")
+ + ((dictionaryId != null) ? ("dictionary_id = '" + dictionaryId + "'") : ""))
+ : "");
+
+ List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+ if (rows != null) {
+ rows.forEach(row -> {
CldsDictionary cldsDictionary = new CldsDictionary();
cldsDictionary.setDictionaryId((String) row.get("dictionary_id"));
cldsDictionary.setDictionaryName((String) row.get("dictionary_name"));
@@ -640,6 +638,7 @@ public class CldsDao {
cldsDictionary.setLastUpdatedDate(sdf.format(row.get("timestamp")));
dictionaries.add(cldsDictionary);
});
+ }
return dictionaries;
}
@@ -671,14 +670,13 @@ public class CldsDao {
public void updateDictionaryElements(String dictionaryElementId, CldsDictionaryItem cldsDictionaryItem,
String userId) {
- String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = :dict_element_name, dict_element_short_name = :dict_element_short_name, dict_element_description = :dict_element_description,dict_element_type=:dict_element_type, modified_by = :modified_by WHERE dict_element_id = :dict_element_id";
- SqlParameterSource namedParameters = new MapSqlParameterSource()
- .addValue("dict_element_name", cldsDictionaryItem.getDictElementName())
- .addValue("dict_element_short_name", cldsDictionaryItem.getDictElementShortName())
- .addValue("dict_element_description", cldsDictionaryItem.getDictElementDesc())
- .addValue("dict_element_type", cldsDictionaryItem.getDictElementType()).addValue("modified_by", userId)
- .addValue("dict_element_id", dictionaryElementId);
- jdbcTemplateObject.update(dictionarySql, namedParameters);
+ String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = '"
+ + cldsDictionaryItem.getDictElementName() + "', dict_element_short_name = '"
+ + cldsDictionaryItem.getDictElementShortName() + "', dict_element_description= '"
+ + cldsDictionaryItem.getDictElementDesc() + "', dict_element_type = '"
+ + cldsDictionaryItem.getDictElementType() + "', modified_by = '" + userId + "' "
+ + "WHERE dict_element_id = '" + dictionaryElementId + "'";
+ jdbcTemplateObject.update(dictionarySql);
cldsDictionaryItem.setUpdatedBy(userId);
}
@@ -695,24 +693,17 @@ public class CldsDao {
String dictElementShortName) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
List<CldsDictionaryItem> dictionaryItems = new ArrayList<>();
- MapSqlParameterSource namedParameters = new MapSqlParameterSource();
String dictionarySql = "SELECT de.dict_element_id, de.dictionary_id, de.dict_element_name, de.dict_element_short_name, de.dict_element_description, de.dict_element_type, de.created_by, de.modified_by, de.timestamp "
- + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id ";
- if (dictionaryId != null) {
- dictionarySql += " AND d.dictionary_id = :dictionaryId";
- namedParameters.addValue("dictionaryId", dictionaryId);
- }
- if (dictElementShortName != null) {
- dictionarySql += " AND de.dict_element_short_name = :dictElementShortName";
- namedParameters.addValue("dictElementShortName", dictElementShortName);
- }
- if (dictionaryName != null) {
- dictionarySql += " AND dictionary_name = :dictionaryName";
- namedParameters.addValue("dictionaryName", dictionaryName);
- }
+ + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id "
+ + ((dictionaryId != null) ? (" AND d.dictionary_id = '" + dictionaryId + "'") : "")
+ + ((dictElementShortName != null) ? (" AND de.dict_element_short_name = '" + dictElementShortName + "'")
+ : "")
+ + ((dictionaryName != null) ? (" AND dictionary_name = '" + dictionaryName + "'") : "");
- Optional.ofNullable(jdbcTemplateObject.queryForList(dictionarySql, namedParameters))
- .orElse(Collections.emptyList()).forEach(row -> {
+ List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+ if (rows != null) {
+ rows.forEach(row -> {
CldsDictionaryItem dictionaryItem = new CldsDictionaryItem();
dictionaryItem.setDictElementId((String) row.get("dict_element_id"));
dictionaryItem.setDictionaryId((String) row.get("dictionary_id"));
@@ -725,6 +716,30 @@ public class CldsDao {
dictionaryItem.setLastUpdatedDate(sdf.format(row.get("timestamp")));
dictionaryItems.add(dictionaryItem);
});
+ }
+ return dictionaryItems;
+ }
+
+ /**
+ * Method to get Map of all dictionary elements with key as dictionary short
+ * name and value as the full name
+ *
+ * @param dictionaryElementType
+ * @return Map of dictionary elements as key value pair
+ */
+ public Map<String, String> getDictionaryElementsByType(String dictionaryElementType) {
+ Map<String, String> dictionaryItems = new HashMap<>();
+ String dictionarySql = "SELECT dict_element_name, dict_element_short_name " + "FROM dictionary_elements "
+ + "WHERE dict_element_type = '" + dictionaryElementType + "'";
+
+ List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+ if (rows != null) {
+ rows.forEach(row -> {
+ dictionaryItems.put(((String) row.get("dict_element_short_name")),
+ ((String) row.get("dict_element_name")));
+ });
+ }
return dictionaryItems;
}
}
diff --git a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
new file mode 100644
index 000000000..c6b0d5556
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.exception;
+
+/**
+ * New exception to request errors.
+ *
+ */
+public class BadRequestException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5738167530541646123L;
+
+ /**
+ * This constructor can be used to create a new CldsConfigException.
+ *
+ * @param message
+ * A string message detailing the problem
+ * @param e
+ * The exception sent by the code
+ */
+ public BadRequestException(String message, Throwable e) {
+ super(message, e);
+ }
+
+ /**
+ * This constructor can be used to create a new CldsConfigException. Use this
+ * constructor only if you are creating a new exception stack, not if an
+ * exception was already raised by another code.
+ *
+ * @param message
+ * A string message detailing the problem
+ */
+ public BadRequestException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
new file mode 100644
index 000000000..4ea050392
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.exception;
+
+/**
+ * New exception to request errors.
+ *
+ */
+public class NotAuthorizedException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5738167530541646123L;
+
+ /**
+ * This constructor can be used to create a new CldsConfigException.
+ *
+ * @param message
+ * A string message detailing the problem
+ * @param e
+ * The exception sent by the code
+ */
+ public NotAuthorizedException(String message, Throwable e) {
+ super(message, e);
+ }
+
+ /**
+ * This constructor can be used to create a new CldsConfigException. Use this
+ * constructor only if you are creating a new exception stack, not if an
+ * exception was already raised by another code.
+ *
+ * @param message
+ * A string message detailing the problem
+ */
+ public NotAuthorizedException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
index 90dc996cc..b993c6376 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
@@ -31,6 +31,7 @@ import org.onap.clamp.clds.dao.CldsDao;
public class CldsEvent {
public static final String ACTION_TEST = "TEST";
public static final String ACTION_CREATE = "CREATE";
+ public static final String ACTION_MODIFY = "MODIFY";
public static final String ACTION_SUBMIT = "SUBMIT";
// an update before model is active
public static final String ACTION_RESUBMIT = "RESUBMIT";
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
index 14fe44390..2c178eb8b 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -25,18 +25,18 @@ package org.onap.clamp.clds.model;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import org.onap.clamp.clds.dao.CldsDao;
-import org.onap.clamp.clds.util.JacksonUtils;
+import org.onap.clamp.clds.model.actions.ActionsHandler;
+import org.onap.clamp.clds.model.actions.ActionsHandlerImpl;
+import org.onap.clamp.clds.model.status.StatusHandler;
+import org.onap.clamp.clds.model.status.StatusHandlerImpl;
/**
* Represent a CLDS Model.
@@ -77,6 +77,18 @@ public class CldsModel {
private String deploymentId;
private String deploymentStatusUrl;
+ // Set default handlers but this can be changed if needed.
+ private static StatusHandler statusHandler = new StatusHandlerImpl();
+ private static ActionsHandler actionsHandler = new ActionsHandlerImpl();
+
+ public static synchronized void setStatusHandler(StatusHandler statHandler) {
+ statusHandler = statHandler;
+ }
+
+ public static synchronized void setActionsHandler(ActionsHandler cdHandler) {
+ actionsHandler = cdHandler;
+ }
+
/**
* Construct empty model.
*/
@@ -122,54 +134,7 @@ public class CldsModel {
* set the status in the model
*/
public void determineStatus() {
- status = STATUS_UNKNOWN;
- if (event == null || event.getActionCd() == null) {
- status = STATUS_DESIGN;
- } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) {
- status = STATUS_ERROR;
- } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) {
- status = STATUS_DESIGN;
- } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED)
- || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
- || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED)
- || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) {
- status = STATUS_DISTRIBUTED;
- } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) {
- status = STATUS_DELETING;
- } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
- || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED)
- || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED)
- || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) {
- status = STATUS_ACTIVE;
- } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) {
- status = STATUS_STOPPED;
- }
- }
-
- /**
- * Get the actionCd from current event. If none, default value is
- * CldsEvent.ACTION_CREATE
- */
- private String getCurrentActionCd() {
- // current default actionCd is CREATE
- String actionCd = CldsEvent.ACTION_CREATE;
- if (event != null && event.getActionCd() != null) {
- actionCd = event.getActionCd();
- }
- return actionCd;
- }
-
- /**
- * Get the actionStateCd from current event. If none, default value is
- * CldsEvent.ACTION_STATE_COMPLETED
- */
- private String getCurrentActionStateCd() {
- // current default actionStateCd is CREATE
- String actionStateCd = CldsEvent.ACTION_STATE_COMPLETED;
- if (event != null && event.getActionStateCd() != null) {
- actionStateCd = event.getActionStateCd();
- }
- return actionStateCd;
+ status = statusHandler.determineStatusOnLastEvent(event);
}
/**
@@ -179,94 +144,7 @@ public class CldsModel {
* the first one.
*/
public void determinePermittedActionCd() {
- String actionCd = getCurrentActionCd();
- switch (actionCd) {
- case CldsEvent.ACTION_CREATE:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
- if (isSimplifiedModel()) {
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
- CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
- }
- break;
- case CldsEvent.ACTION_SUBMIT:
- case CldsEvent.ACTION_RESUBMIT:
- case CldsEvent.ACTION_DISTRIBUTE:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
- CldsEvent.ACTION_DELETE);
- if (isSimplifiedModel()) {
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
- CldsEvent.ACTION_DELETE);
- }
- break;
- case CldsEvent.ACTION_SUBMITDCAE:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
- break;
- case CldsEvent.ACTION_SUBMITPOLICY:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
- break;
- case CldsEvent.ACTION_UNDEPLOY:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
- CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
- if (isSimplifiedModel()) {
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
- CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
- }
- break;
- case CldsEvent.ACTION_DEPLOY:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE,
- CldsEvent.ACTION_STOP);
- break;
- case CldsEvent.ACTION_RESTART:
- case CldsEvent.ACTION_UPDATE:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
- CldsEvent.ACTION_UNDEPLOY);
- if (isPolicyOnly()) {
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
- }
- break;
- case CldsEvent.ACTION_STOP:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
- CldsEvent.ACTION_UNDEPLOY);
- if (isPolicyOnly()) {
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
- CldsEvent.ACTION_DELETE);
- }
- break;
- default:
- logger.warn("Invalid current actionCd: " + actionCd);
- }
- }
-
- private boolean isSimplifiedModel() {
- boolean result = false;
- try {
- if (propText != null) {
- JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
- JsonNode simpleModelJson = modelJson.get("simpleModel");
- if (simpleModelJson != null && simpleModelJson.asBoolean()) {
- result = true;
- }
- }
- } catch (IOException e) {
- logger.error("Error while parsing propText json", e);
- }
- return result;
- }
-
- private boolean isPolicyOnly() {
- boolean result = false;
- try {
- if (propText != null) {
- JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
- JsonNode policyOnlyJson = modelJson.get("policyOnly");
- if (policyOnlyJson != null && policyOnlyJson.asBoolean()) {
- result = true;
- }
- }
- } catch (IOException e) {
- logger.error("Error while parsing propText json", e);
- }
- return result;
+ permittedActionCd = actionsHandler.determinePermittedActionsOnLastEvent(event, propText);
}
/**
@@ -278,8 +156,8 @@ public class CldsModel {
determinePermittedActionCd();
if (!permittedActionCd.contains(requestedActionCd)) {
throw new IllegalArgumentException(
- "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: " + getCurrentActionCd()
- + ", the permittedActionCd: " + permittedActionCd);
+ "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: "
+ + actionsHandler.getCurrentActionCd(event) + ", the permittedActionCd: " + permittedActionCd);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java
index 000363d5c..eb05fe406 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java
@@ -29,6 +29,7 @@ package org.onap.clamp.clds.model;
public class CldsMonitoringDetails {
private String closeloopName;
+ private String modelId;
private String modelName;
private String serviceTypeId;
private String deploymentId;
@@ -45,6 +46,14 @@ public class CldsMonitoringDetails {
this.closeloopName = closeloopName;
}
+ public String getModelId() {
+ return modelId;
+ }
+
+ public void setModelId(String modelId) {
+ this.modelId = modelId;
+ }
+
public String getModelName() {
return modelName;
}
@@ -84,7 +93,7 @@ public class CldsMonitoringDetails {
public void setAction(String action) {
this.action = action;
}
-
+
public String getUserid() {
return userid;
}
@@ -92,9 +101,9 @@ public class CldsMonitoringDetails {
public void setUserid(String userid) {
this.userid = userid;
}
-
+
public String getTimestamp() {
- return timestamp;
+ return timestamp;
}
public void setTimestamp(String time) {
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
index 4a2352527..25b8d4016 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
@@ -25,7 +25,11 @@ package org.onap.clamp.clds.model;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor;
public class CldsToscaModel extends CldsToscaModelRevision {
@@ -40,22 +44,31 @@ public class CldsToscaModel extends CldsToscaModelRevision {
* @param cldsDao
* @param userId
*/
- public CldsToscaModel save(CldsDao cldsDao, String userId) {
+ public CldsToscaModel save(CldsDao cldsDao, ClampProperties refProp, PolicyClient policyClient, String userId) {
CldsToscaModel cldsToscaModel = null;
- // TODO tosca parsing logic
- this.setToscaModelJson("{}");
- this.setPolicyType("Aging");// TODO update with subString or node_type from the model name
+ refProp.getStringList("tosca.policyTypes", ",").stream().forEach(policyType -> {
+ if (StringUtils.containsIgnoreCase(this.getToscaModelName(), policyType)) {
+ this.setPolicyType(policyType);
+ }
+ });
+
+ ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(cldsDao);
+ this.setToscaModelJson(convertor.parseToscaYaml(this.getToscaModelYaml()));
List<CldsToscaModel> toscaModels = cldsDao.getToscaModelByName(this.getToscaModelName());
if (toscaModels != null && !toscaModels.isEmpty()) {
CldsToscaModel toscaModel = toscaModels.stream().findFirst().get();
- // CldsToscaModelRevision modelRevision =
- // revisions.stream().max(Comparator.comparingDouble(CldsToscaModelRevision::getVersion)).get();
this.setVersion(incrementVersion(toscaModel.getVersion()));
this.setId(toscaModel.getId());
this.setUserId(userId);
+ if (refProp.getStringValue("import.tosca.model").equalsIgnoreCase("true")) {
+ policyClient.importToscaModel(this);
+ }
cldsToscaModel = cldsDao.updateToscaModelWithNewVersion(this, userId);
} else {
this.setVersion(1);
+ if (refProp.getStringValue("import.tosca.model").equalsIgnoreCase("true")) {
+ policyClient.importToscaModel(this);
+ }
cldsToscaModel = cldsDao.insToscaModel(this, userId);
}
return cldsToscaModel;
diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java
new file mode 100644
index 000000000..1c54dae01
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model.actions;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.onap.clamp.clds.model.CldsEvent;
+import org.onap.clamp.clds.util.JacksonUtils;
+
+/**
+ * Interface for actions that the user can do according to the last event.
+ *
+ *
+ */
+public interface ActionsHandler {
+
+ enum ModelType {
+ SIMPLE_MODEL("simpleModel"), POLICY_MODEL("policyModel");
+ private final String type;
+
+ private ModelType(String type) {
+ this.type = type;
+ }
+
+ public final String getType() {
+ return this.type;
+ }
+ }
+
+ public EELFLogger getLogger();
+
+ /**
+ * This method determines a list of actions that the user can do according to
+ * the last event.
+ *
+ * @param event
+ * The last event
+ * @param propText
+ * The Json properties string
+ * @return A list of actions
+ */
+ default List<String> determinePermittedActionsOnLastEvent(CldsEvent event, String propText) {
+ List<String> permittedActions;
+ String actionCd = getCurrentActionCd(event);
+ switch (actionCd) {
+ case CldsEvent.ACTION_CREATE:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
+ if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+ permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
+ CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
+ }
+ break;
+ case CldsEvent.ACTION_SUBMIT:
+ case CldsEvent.ACTION_RESUBMIT:
+ case CldsEvent.ACTION_DISTRIBUTE:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
+ CldsEvent.ACTION_DELETE);
+ if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+ permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
+ CldsEvent.ACTION_DELETE);
+ }
+ break;
+ case CldsEvent.ACTION_SUBMITDCAE:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+ break;
+ case CldsEvent.ACTION_SUBMITPOLICY:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+ break;
+ case CldsEvent.ACTION_UNDEPLOY:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+ CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
+ if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+ CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+ }
+ break;
+ case CldsEvent.ACTION_DEPLOY:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+ break;
+ case CldsEvent.ACTION_RESTART:
+ case CldsEvent.ACTION_UPDATE:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
+ CldsEvent.ACTION_UNDEPLOY);
+ if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+ }
+ break;
+ case CldsEvent.ACTION_STOP:
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+ CldsEvent.ACTION_UNDEPLOY);
+ if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+ permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+ CldsEvent.ACTION_DELETE);
+ }
+ break;
+ default:
+ getLogger().warn("Invalid current actionCd: " + actionCd);
+ permittedActions = Arrays.asList();
+ }
+ return permittedActions;
+ }
+
+ /**
+ * This method returns the action of the event or a default one if not found.
+ *
+ * @param event
+ * The last event
+ * @return The action
+ */
+ default String getCurrentActionCd(CldsEvent event) {
+ // current default actionCd is CREATE
+ String actionCd = CldsEvent.ACTION_CREATE;
+ if (event != null && event.getActionCd() != null) {
+ actionCd = event.getActionCd();
+ }
+ return actionCd;
+ }
+
+ /**
+ * Check whether the text properties is of specified type ModelType.
+ *
+ * @param propText
+ * The Clamp Json properties
+ * @param key
+ * The model type
+ * @return True if matches the right type specified
+ */
+ default boolean isTypeModel(String propText, ModelType key) {
+ boolean result = false;
+ try {
+ if (propText != null) {
+ JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
+ JsonNode modelJsonOfType = modelJson.get(key.getType());
+ if (modelJsonOfType != null && modelJsonOfType.asBoolean()) {
+ result = true;
+ }
+ }
+ } catch (IOException e) {
+ getLogger().error("Error while parsing propText json", e);
+ }
+ return result;
+ }
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java
new file mode 100644
index 000000000..8d7d24089
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model.actions;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ActionsHandlerImpl implements ActionsHandler {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ActionsHandlerImpl.class);
+
+ @Override
+ public EELFLogger getLogger() {
+ return logger;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
index 6bf4194bd..571e5b1bc 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.properties;
@@ -50,8 +50,8 @@ public abstract class AbstractModelElement {
private static final String LOG_ELEMENT_NOT_FOUND_IN_JSON = "Value '{}' for key 'name' not found in JSON {}";
/**
- * Perform base parsing of properties for a ModelElement (such as,
- * VesCollector, Policy and Tca)
+ * Perform base parsing of properties for a ModelElement (such as, VesCollector,
+ * Policy and Tca)
*/
protected AbstractModelElement(String type, ModelProperties modelProp, ModelBpmn modelBpmn, JsonNode modelJson) {
this.type = type;
@@ -63,23 +63,6 @@ public abstract class AbstractModelElement {
}
/**
- * topicSubscribes is the topicPublishes of the from Model Element (the
- * previous one in the chain).
- *
- * @return the topicSubscribes
- */
- public String getTopicSubscribes() {
- // get fromId for this type
- String fromId = modelBpmn.getFromId(type);
- // find the type of the from model element
- String fromType = modelBpmn.getType(fromId);
- // get the model element for the type
- AbstractModelElement me = modelProp.getModelElementByType(fromType);
- // get the topic publishes for the model element
- return me.topicPublishes;
- }
-
- /**
* @return the topicPublishes
*/
public String getTopicPublishes() {
@@ -87,8 +70,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return the value field of the json node element that has a name field
- * equals to the given name.
+ * Return the value field of the json node element that has a name field equals
+ * to the given name.
*/
public static String getValueByName(JsonNode nodeIn, String name) {
String value = null;
@@ -115,8 +98,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return the Json value field of the json node element that has a name
- * field equals to the given name.
+ * Return the Json value field of the json node element that has a name field
+ * equals to the given name.
*/
public static JsonNode getJsonNodeByName(JsonNode nodeIn, String name) {
JsonNode vnode = null;
@@ -136,8 +119,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return the value field of the json node element that has a name field
- * that equals the given name.
+ * Return the value field of the json node element that has a name field that
+ * equals the given name.
*/
public static String getNodeValueByName(JsonNode nodeIn, String name) {
String value = null;
@@ -153,8 +136,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return the value field of the json node element that has a name field
- * that equals the given name.
+ * Return the value field of the json node element that has a name field that
+ * equals the given name.
*/
public static List<String> getNodeValuesByName(JsonNode nodeIn, String name) {
List<String> values = new ArrayList<>();
@@ -185,8 +168,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return an array of values for the field of the json node element that has
- * a name field equals to the given name.
+ * Return an array of values for the field of the json node element that has a
+ * name field equals to the given name.
*/
public static List<String> getValuesByName(JsonNode nodeIn, String name) {
List<String> values = null;
@@ -221,8 +204,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return the value field of the json node element that has a name field
- * equals to the given name.
+ * Return the value field of the json node element that has a name field equals
+ * to the given name.
*/
public String getValueByName(String name) {
return getValueByName(modelElementJsonNode, name);
@@ -237,8 +220,8 @@ public abstract class AbstractModelElement {
}
/**
- * Return an array of values for the field of the json node element that has
- * a name field equals to the given name.
+ * Return an array of values for the field of the json node element that has a
+ * name field equals to the given name.
*/
public List<String> getValuesByName(String name) {
return getValuesByName(modelElementJsonNode, name);
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Global.java b/src/main/java/org/onap/clamp/clds/model/properties/Global.java
index 6fabc7a51..e86740726 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/Global.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/Global.java
@@ -47,6 +47,7 @@ public class Global {
private List<String> resourceVfc;
private JsonNode deployParameters;
private List<String> location;
+ private String vnfScope;
/**
* Parse global given json node.
@@ -61,6 +62,7 @@ public class Global {
resourceVfc = AbstractModelElement.getValuesByName(globalNode, "vfc");
deployParameters = AbstractModelElement.getJsonNodeByName(globalNode, "deployParameters");
location = AbstractModelElement.getValuesByName(globalNode, "location");
+ vnfScope = AbstractModelElement.getValueByName(globalNode, "vnf");
}
/**
@@ -141,4 +143,9 @@ public class Global {
public void setDeployParameters(JsonNode deployParameters) {
this.deployParameters = deployParameters;
}
+
+ public String getVnfScope() {
+ return vnfScope;
+ }
+
}
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
index f38e8c1c4..3d7bbcc3a 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
@@ -39,7 +39,6 @@ import org.apache.camel.Exchange;
import org.onap.clamp.clds.client.req.policy.PolicyClient;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.exception.ModelBpmnException;
-import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.CldsModel;
import org.onap.clamp.clds.service.CldsService;
import org.onap.clamp.clds.util.JacksonUtils;
@@ -75,22 +74,22 @@ public class ModelProperties {
}
/**
- * Retain data required to parse the ModelElement objects. (Rather than
- * parse them all - parse them on demand if requested.)
+ * Retain data required to parse the ModelElement objects. (Rather than parse
+ * them all - parse them on demand if requested.)
*
* @param modelName
- * The model name coming form the UI
+ * The model name coming form the UI
* @param controlName
- * The closed loop name coming from the UI
+ * The closed loop name coming from the UI
* @param actionCd
- * Type of operation PUT,UPDATE,DELETE
+ * Type of operation PUT,UPDATE,DELETE
* @param isATest
- * The test flag coming from the UI (for validation only, no
- * query are physically executed)
+ * The test flag coming from the UI (for validation only, no query are
+ * physically executed)
* @param modelBpmnText
- * The BPMN flow in JSON from the UI
+ * The BPMN flow in JSON from the UI
* @param modelPropText
- * The BPMN parameters for all boxes defined in modelBpmnTest
+ * The BPMN parameters for all boxes defined in modelBpmnTest
*/
public ModelProperties(String modelName, String controlName, String actionCd, boolean isATest, String modelBpmnText,
String modelPropText) {
@@ -108,10 +107,10 @@ public class ModelProperties {
}
/**
- * This method is meant to ensure that one ModelElement instance exists for
- * each ModelElement class. As new ModelElement classes could have been
- * registered after instantiation of this ModelProperties, we need to build
- * the missing ModelElement instances.
+ * This method is meant to ensure that one ModelElement instance exists for each
+ * ModelElement class. As new ModelElement classes could have been registered
+ * after instantiation of this ModelProperties, we need to build the missing
+ * ModelElement instances.
*/
private final void instantiateMissingModelElements() {
if (modelElementClasses.size() != modelElements.size()) {
@@ -120,19 +119,18 @@ public class ModelProperties {
// Parse the list of base Model Elements and build up the
// ModelElements
modelElementClasses.entrySet().stream().parallel()
- .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
- && missingTypes.contains(entry.getValue())))
- .forEach(entry -> {
- try {
- modelElements.put(entry.getValue(),
- (entry.getKey()
- .getConstructor(ModelProperties.class, ModelBpmn.class, JsonNode.class)
- .newInstance(this, modelBpmn, modelJson)));
- } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
- | InvocationTargetException e) {
- logger.warn("Unable to instantiate a ModelElement, exception follows: ", e);
- }
- });
+ .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
+ && missingTypes.contains(entry.getValue())))
+ .forEach(entry -> {
+ try {
+ modelElements.put(entry.getValue(),
+ (entry.getKey().getConstructor(ModelProperties.class, ModelBpmn.class, JsonNode.class)
+ .newInstance(this, modelBpmn, modelJson)));
+ } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
+ | InvocationTargetException e) {
+ logger.warn("Unable to instantiate a ModelElement, exception follows: ", e);
+ }
+ });
}
}
@@ -162,10 +160,9 @@ public class ModelProperties {
* Create ModelProperties extracted from a CamelExchange.
*
* @param camelExchange
- * The camel Exchange object that contains all info provided to
- * the flow
- * @return A model Properties created from the parameters found in
- * camelExchange object
+ * The camel Exchange object that contains all info provided to the flow
+ * @return A model Properties created from the parameters found in camelExchange
+ * object
*/
public static ModelProperties create(Exchange camelExchange) {
String modelProp = (String) camelExchange.getProperty("modelProp");
@@ -178,20 +175,6 @@ public class ModelProperties {
}
/**
- * return appropriate model element given the type
- *
- * @param type
- * @return
- */
- public AbstractModelElement getModelElementByType(String type) {
- AbstractModelElement modelElement = modelElements.get(type);
- if (modelElement == null) {
- throw new IllegalArgumentException("Invalid or not found ModelElement type: " + type);
- }
- return modelElement;
- }
-
- /**
* @return the modelName
*/
public String getModelName() {
@@ -231,12 +214,11 @@ public class ModelProperties {
}
/**
- * @return The policyName that wil be used in input parameters of DCAE
- * deploy
+ * @return The policyName that wil be used in input parameters of DCAE deploy
*/
public String getPolicyNameForDcaeDeploy(ClampProperties refProp) {
return normalizePolicyScopeName(modelName + createScopeSeparator(modelName)
- + refProp.getStringValue(PolicyClient.POLICY_MS_NAME_PREFIX_PROPERTY_NAME) + getCurrentPolicyName());
+ + refProp.getStringValue(PolicyClient.POLICY_MS_NAME_PREFIX_PROPERTY_NAME) + getCurrentPolicyName());
}
/**
@@ -251,8 +233,8 @@ public class ModelProperties {
* @return the policyScopeAndNameWithUniqueId
*/
public String getPolicyScopeAndNameWithUniqueGuardId() {
- return normalizePolicyScopeName(
- modelName + createScopeSeparator(modelName) + getCurrentPolicyName() + "_" + policyUniqueId+POLICY_GUARD_SUFFIX+guardUniqueId);
+ return normalizePolicyScopeName(modelName + createScopeSeparator(modelName) + getCurrentPolicyName() + "_"
+ + policyUniqueId + POLICY_GUARD_SUFFIX + guardUniqueId);
}
/**
@@ -264,6 +246,24 @@ public class ModelProperties {
}
/**
+ * @return the PolicyNameWithScopeContext
+ */
+ public String getPolicyNameWithScopeContext(String policyScope, String policyType, String vnfScope, String context,
+ String userDefinedName) {
+ return normalizePolicyScopeName(policyScope + createScopeSeparator(policyScope) + policyType + "_" + vnfScope
+ + "_" + context + "_" + modelName + "_" + userDefinedName);
+ }
+
+ /**
+ * @return the PolicyNameWithPrefixScopeContext
+ */
+ public String getPolicyNameWithPrefixScopeContext(String policyScope, String policyType, String vnfScope,
+ String context, String userDefinedName, String policyPrefix) {
+ return normalizePolicyScopeName(policyScope + createScopeSeparator(policyScope) + policyPrefix + policyType
+ + "_" + vnfScope + "_" + context + "_" + modelName + "_" + userDefinedName);
+ }
+
+ /**
* Replace all '-' with '_' within policy scope and name.
*
* @param inName
@@ -281,11 +281,11 @@ public class ModelProperties {
}
/**
- * When generating a policy request for a model element, must set the id of
- * that model element using this method. Used to generate the policy name.
+ * When generating a policy request for a model element, must set the id of that
+ * model element using this method. Used to generate the policy name.
*
* @param currentModelElementId
- * the currentModelElementId to set
+ * the currentModelElementId to set
*/
public void setCurrentModelElementId(String currentModelElementId) {
this.currentModelElementId = currentModelElementId;
@@ -307,11 +307,11 @@ public class ModelProperties {
}
/**
- * When generating a policy request for a model element, must set the unique
- * id of that policy using this method. Used to generate the policy name.
+ * When generating a policy request for a model element, must set the unique id
+ * of that policy using this method. Used to generate the policy name.
*
* @param policyUniqueId
- * the policyUniqueId to set
+ * the policyUniqueId to set
*/
public void setPolicyUniqueId(String policyUniqueId) {
this.policyUniqueId = policyUniqueId;
@@ -332,26 +332,6 @@ public class ModelProperties {
}
/**
- * @return the isCreateRequest
- */
- public boolean isCreateRequest() {
- switch (actionCd) {
- case CldsEvent.ACTION_SUBMIT:
- case CldsEvent.ACTION_RESTART:
- return true;
- }
- return false;
- }
-
- public boolean isStopRequest() {
- switch (actionCd) {
- case CldsEvent.ACTION_STOP:
- return true;
- }
- return false;
- }
-
- /**
* @return the global
*/
public Global getGlobal() {
diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java
new file mode 100644
index 000000000..300c8b133
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model.status;
+
+import org.onap.clamp.clds.model.CldsEvent;
+import org.onap.clamp.clds.model.CldsModel;
+
+/**
+ * This interface describe the handler of the status in CldsModel, it's normally
+ * based on the last event stored in db.
+ *
+ */
+public interface StatusHandler {
+
+ /**
+ * This method determines the status of the closed loop based on the last event.
+ *
+ * @param event
+ * The last event
+ * @return The status
+ */
+ default String determineStatusOnLastEvent(CldsEvent event) {
+ String status = CldsModel.STATUS_UNKNOWN;
+ if (event == null || event.getActionCd() == null) {
+ status = CldsModel.STATUS_DESIGN;
+ } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) {
+ status = CldsModel.STATUS_ERROR;
+ } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) {
+ status = CldsModel.STATUS_DESIGN;
+ } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) {
+ status = CldsModel.STATUS_DISTRIBUTED;
+ } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) {
+ status = CldsModel.STATUS_DELETING;
+ } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED)
+ || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) {
+ status = CldsModel.STATUS_ACTIVE;
+ } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) {
+ status = CldsModel.STATUS_STOPPED;
+ }
+ return status;
+ }
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java
new file mode 100644
index 000000000..b539e9050
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model.status;
+
+public class StatusHandlerImpl implements StatusHandler {
+}
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
index 8796bae1c..5959c0fb5 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
@@ -19,7 +19,7 @@
* ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.sdc.controller;
@@ -81,8 +81,8 @@ public class SdcSingleController {
}
/**
- * This method can be called multiple times at the same moment. The
- * controller must be thread safe !
+ * This method can be called multiple times at the same moment. The controller
+ * must be thread safe !
*/
@Override
public void activateCallback(INotificationData iNotif) {
@@ -91,7 +91,7 @@ public class SdcSingleController {
sdcController.treatNotification(iNotif);
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",
- this.getClass().getName());
+ this.getClass().getName());
}
}
@@ -110,16 +110,16 @@ public class SdcSingleController {
protected final synchronized void changeControllerStatus(SdcSingleControllerStatus newControllerStatus) {
switch (newControllerStatus) {
- case BUSY:
- ++this.nbOfNotificationsOngoing;
- this.controllerStatus = newControllerStatus;
- break;
- case IDLE:
- this.changeControllerStatusIdle();
- break;
- default:
- this.controllerStatus = newControllerStatus;
- break;
+ case BUSY:
+ ++this.nbOfNotificationsOngoing;
+ this.controllerStatus = newControllerStatus;
+ break;
+ case IDLE:
+ this.changeControllerStatusIdle();
+ break;
+ default:
+ this.controllerStatus = newControllerStatus;
+ break;
}
}
@@ -128,8 +128,9 @@ public class SdcSingleController {
}
public SdcSingleController(ClampProperties clampProp, CsarInstaller csarInstaller,
- SdcSingleControllerConfiguration sdcSingleConfig, boolean isClientAutoManaged) {
- this.isSdcClientAutoManaged = isClientAutoManaged;
+ SdcSingleControllerConfiguration sdcSingleConfig, IDistributionClient distributionClient) {
+ this.distributionClient = distributionClient;
+ isSdcClientAutoManaged = (distributionClient == null);
this.sdcConfig = sdcSingleConfig;
this.refProp = clampProp;
this.csarInstaller = csarInstaller;
@@ -139,11 +140,10 @@ public class SdcSingleController {
* This method initializes the SDC Controller and the SDC Client.
*
* @throws SdcControllerException
- * It throws an exception if the SDC Client cannot be
- * instantiated or if an init attempt is done when already
- * initialized
+ * It throws an exception if the SDC Client cannot be instantiated or if
+ * an init attempt is done when already initialized
* @throws SdcParametersException
- * If there is an issue with the parameters provided
+ * If there is an issue with the parameters provided
*/
public void initSdc() throws SdcControllerException {
logger.info("Attempt to initialize the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -157,8 +157,8 @@ public class SdcSingleController {
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
- throw new SdcControllerException("Initialization of the SDC Controller failed with reason: "
- + result.getDistributionMessageResult());
+ throw new SdcControllerException(
+ "Initialization of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
}
logger.info("SDC Controller successfully initialized: " + sdcConfig.getSdcControllerName());
logger.info("Attempt to start the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -167,7 +167,7 @@ public class SdcSingleController {
logger.error("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
throw new SdcControllerException(
- "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
+ "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
}
logger.info("SDC Controller successfully started: " + sdcConfig.getSdcControllerName());
this.changeControllerStatus(SdcSingleControllerStatus.IDLE);
@@ -177,8 +177,8 @@ public class SdcSingleController {
* This method closes the SDC Controller and the SDC Client.
*
* @throws SdcControllerException
- * It throws an exception if the SDC Client cannot be closed
- * because it's currently BUSY in processing notifications.
+ * It throws an exception if the SDC Client cannot be closed because
+ * it's currently BUSY in processing notifications.
*/
public void closeSdc() throws SdcControllerException {
if (this.getControllerStatus() == SdcSingleControllerStatus.BUSY) {
@@ -198,33 +198,33 @@ public class SdcSingleController {
}
private void sendAllNotificationForCsarHandler(INotificationData iNotif, CsarHandler csar,
- NotificationType notificationType, DistributionStatusEnum distributionStatus, String errorMessage) {
+ NotificationType notificationType, DistributionStatusEnum distributionStatus, String errorMessage) {
if (csar != null) {
// Notify for the CSAR
this.sendSdcNotification(notificationType, csar.getArtifactElement().getArtifactURL(),
- sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
- System.currentTimeMillis());
+ sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
+ System.currentTimeMillis());
// Notify for all VF resources found
for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {
// Normally always 1 artifact in resource for Clamp as we
// specified
// only VF_METADATA type
this.sendSdcNotification(notificationType,
- blueprint.getValue().getResourceAttached().getArtifacts().get(0).getArtifactURL(),
- sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
- System.currentTimeMillis());
+ blueprint.getValue().getResourceAttached().getArtifacts().get(0).getArtifactURL(),
+ sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
+ System.currentTimeMillis());
}
} else {
this.sendSdcNotification(notificationType, null, sdcConfig.getConsumerID(), iNotif.getDistributionID(),
- distributionStatus, errorMessage, System.currentTimeMillis());
+ distributionStatus, errorMessage, System.currentTimeMillis());
}
}
/**
* This method processes the notification received from Sdc.
- *
+ *
* @param iNotif
- * The INotificationData
+ * The INotificationData
*/
public void treatNotification(INotificationData iNotif) {
CsarHandler csar = null;
@@ -235,37 +235,37 @@ public class SdcSingleController {
logger.info("Notification received for service UUID:" + iNotif.getServiceUUID());
this.changeControllerStatus(SdcSingleControllerStatus.BUSY);
csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(),
- refProp.getStringValue(CONFIG_SDC_FOLDER));
+ refProp.getStringValue(CONFIG_SDC_FOLDER));
csar.save(downloadTheArtifact(csar.getArtifactElement()));
if (csarInstaller.isCsarAlreadyDeployed(csar)) {
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.ALREADY_DOWNLOADED, null);
+ DistributionStatusEnum.ALREADY_DOWNLOADED, null);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.ALREADY_DEPLOYED, null);
+ DistributionStatusEnum.ALREADY_DEPLOYED, null);
} else {
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.DOWNLOAD_OK, null);
+ DistributionStatusEnum.DOWNLOAD_OK, null);
csarInstaller.installTheCsar(csar);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_OK, null);
+ DistributionStatusEnum.DEPLOY_OK, null);
}
} catch (SdcArtifactInstallerException | SdcToscaParserException e) {
logger.error("SdcArtifactInstallerException exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} catch (SdcDownloadException | CsarHandlerException e) {
logger.error("SdcDownloadException exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage());
+ DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage());
} catch (InterruptedException e) {
logger.error("Interrupt exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
Thread.currentThread().interrupt();
} catch (RuntimeException e) {
logger.error("Unexpected exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} finally {
this.changeControllerStatus(SdcSingleControllerStatus.IDLE);
}
@@ -276,8 +276,8 @@ public class SdcSingleController {
}
private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException {
- logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
- + artifact.getArtifactUUID());
+ logger.info(
+ "Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: " + artifact.getArtifactUUID());
IDistributionClientDownloadResult downloadResult;
try {
downloadResult = distributionClient.download(artifact);
@@ -290,20 +290,20 @@ public class SdcSingleController {
}
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
logger.info("Successfully downloaded the artifact " + artifact.getArtifactURL() + " UUID "
- + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
+ + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
} else {
- throw new SdcDownloadException("Artifact " + artifact.getArtifactName()
- + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID "
- + artifact.getArtifactUUID() + ")" + System.lineSeparator() + "Error message is "
- + downloadResult.getDistributionMessageResult() + System.lineSeparator());
+ throw new SdcDownloadException(
+ "Artifact " + artifact.getArtifactName() + " could not be downloaded from SDC URL "
+ + artifact.getArtifactURL() + " UUID " + artifact.getArtifactUUID() + ")" + System.lineSeparator()
+ + "Error message is " + downloadResult.getDistributionMessageResult() + System.lineSeparator());
}
return downloadResult;
}
private void sendSdcNotification(NotificationType notificationType, String artifactURL, String consumerID,
- String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
+ String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
String event = "Sending " + notificationType.name() + "(" + status.name() + ")"
- + " notification to SDC for artifact:" + artifactURL;
+ + " notification to SDC for artifact:" + artifactURL;
if (errorReason != null) {
event = event + "(" + errorReason + ")";
}
@@ -311,18 +311,18 @@ public class SdcSingleController {
String action = "";
try {
IDistributionStatusMessage message = new DistributionStatusMessage(artifactURL, consumerID, distributionID,
- status, timestamp);
+ status, timestamp);
switch (notificationType) {
- case DOWNLOAD:
- this.sendDownloadStatus(message, errorReason);
- action = "sendDownloadStatus";
- break;
- case DEPLOY:
- this.sendDeploymentStatus(message, errorReason);
- action = "sendDeploymentdStatus";
- break;
- default:
- break;
+ case DOWNLOAD:
+ this.sendDownloadStatus(message, errorReason);
+ action = "sendDownloadStatus";
+ break;
+ case DEPLOY:
+ this.sendDeploymentStatus(message, errorReason);
+ action = "sendDeploymentdStatus";
+ break;
+ default:
+ break;
}
} catch (RuntimeException e) {
logger.warn("Unable to send the SDC Notification (" + action + ") due to an exception", e);
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
index 5d5e218a2..0fb1e0f3a 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
@@ -44,106 +44,116 @@ import org.springframework.stereotype.Component;
@Component
public class CldsDictionaryService extends SecureServiceBase {
- @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
- private String cldsPermissionTypeTosca;
- @Value("${clamp.config.security.permission.instance:dev}")
- private String cldsPermissionInstance;
- private SecureServicePermission permissionReadTosca;
- private SecureServicePermission permissionUpdateTosca;
+ @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
+ private String cldsPermissionTypeTosca;
+ @Value("${clamp.config.security.permission.instance:dev}")
+ private String cldsPermissionInstance;
+ private SecureServicePermission permissionReadTosca;
+ private SecureServicePermission permissionUpdateTosca;
- @Autowired
- private CldsDao cldsDao;
+ @Autowired
+ private CldsDao cldsDao;
+
+ private LoggingUtils util = new LoggingUtils(logger);
+
- @PostConstruct
- private final void initConstruct() {
- permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
- permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update");
- }
+ @PostConstruct
+ private final void initConstruct() {
+ permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
+ permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance,
+ "update");
+ }
- /**
- * REST Service that creates or Updates a Dictionary
- *
- * @param dictionaryName
- * @param cldsDictionary
- * @return CldsDictionary that was created in DB.
- */
- public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
- CldsDictionary cldsDictionary) {
- Date startTime = new Date();
- LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionary", getPrincipalName());
- // TODO revisit based on new permissions
- isAuthorized(permissionUpdateTosca);
- if (cldsDictionary == null) {
- cldsDictionary = new CldsDictionary();
- cldsDictionary.setDictionaryName(dictionaryName);
- }
- cldsDictionary.save(dictionaryName, cldsDao, getUserId());
- LoggingUtils.setTimeContext(startTime, new Date());
- LoggingUtils.setResponseContext("0", "createOrUpdateDictionary success", this.getClass().getName());
- auditLogger.info("createOrUpdateDictionary completed");
- return new ResponseEntity<>(cldsDictionary, HttpStatus.OK);
- }
+ /**
+ * REST Service that creates or Updates a Dictionary
+ *
+ * @param dictionaryName
+ * @param cldsDictionary
+ * @return CldsDictionary that was created in DB.
+ */
+ public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
+ CldsDictionary cldsDictionary) {
+ Date startTime = new Date();
+ LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionary", getPrincipalName());
+ // TODO revisit based on new permissions
+ isAuthorized(permissionUpdateTosca);
+ if (cldsDictionary == null) {
+ cldsDictionary = new CldsDictionary();
+ cldsDictionary.setDictionaryName(dictionaryName);
+ }
+ cldsDictionary.save(dictionaryName, cldsDao, getUserId());
+ LoggingUtils.setTimeContext(startTime, new Date());
+ LoggingUtils.setResponseContext("0", "createOrUpdateDictionary success", this.getClass().getName());
+ auditLogger.info("createOrUpdateDictionary completed");
+ return new ResponseEntity<>(cldsDictionary, HttpStatus.OK);
+ }
- /**
- * REST Service that creates or Updates a Dictionary Elements for dictionary in DB
- *
- * @param dictionaryName
- * @param dictionaryItem
- * @return CldsDictionaryItem
- * A dictionary items that was created or updated in DB
- */
- public ResponseEntity<CldsDictionaryItem> createOrUpdateDictionaryElements(String dictionaryName,
- CldsDictionaryItem dictionaryItem) {
- Date startTime = new Date();
- LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionaryElements", getPrincipalName());
- // TODO revisit based on new permissions
- isAuthorized(permissionUpdateTosca);
- dictionaryItem.save(dictionaryName, cldsDao, getUserId());
- LoggingUtils.setTimeContext(startTime, new Date());
- LoggingUtils.setResponseContext("0", "createOrUpdateDictionaryElements success", this.getClass().getName());
- auditLogger.info("createOrUpdateDictionaryElements completed");
- return new ResponseEntity<>(dictionaryItem, HttpStatus.OK);
- }
+ /**
+ * REST Service that creates or Updates a Dictionary Elements for dictionary
+ * in DB
+ *
+ * @param dictionaryName
+ * @param dictionaryItem
+ * @return CldsDictionaryItem A dictionary items that was created or updated
+ * in DB
+ */
+ public ResponseEntity<CldsDictionaryItem> createOrUpdateDictionaryElements(String dictionaryName,
+ CldsDictionaryItem dictionaryItem) {
+ Date startTime = new Date();
+ LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionaryElements", getPrincipalName());
+ // TODO revisit based on new permissions
+ isAuthorized(permissionUpdateTosca);
+ dictionaryItem.save(dictionaryName, cldsDao, getUserId());
+ LoggingUtils.setTimeContext(startTime, new Date());
+ LoggingUtils.setResponseContext("0", "createOrUpdateDictionaryElements success", this.getClass().getName());
+ auditLogger.info("createOrUpdateDictionaryElements completed");
+ return new ResponseEntity<>(dictionaryItem, HttpStatus.OK);
+ }
- /**
- * Rest Service that retrieves all CLDS dictionary in DB
- *
- * @return CldsDictionary List
- * List of CldsDictionary available in DB
- */
- public ResponseEntity<List<CldsDictionary>> getAllDictionaryNames() {
- Date startTime = new Date();
- LoggingUtils.setRequestContext("CldsDictionaryService: getAllDictionaryNames", getPrincipalName());
- // TODO revisit based on new permissions
- isAuthorized(permissionReadTosca);
- List<CldsDictionary> dictionaries = cldsDao.getDictionary(null, null);
- LoggingUtils.setTimeContext(startTime, new Date());
- LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
- auditLogger.info("getAllDictionaryNames completed");
- return new ResponseEntity<>(dictionaries, HttpStatus.OK);
- }
+ /**
+ * Rest Service that retrieves all CLDS dictionary in DB
+ *
+ * @return CldsDictionary List List of CldsDictionary available in DB
+ */
+ public ResponseEntity<List<CldsDictionary>> getAllDictionaryNames() {
+ Date startTime = new Date();
+ LoggingUtils.setRequestContext("CldsDictionaryService: getAllDictionaryNames", getPrincipalName());
+ // TODO revisit based on new permissions
+ isAuthorized(permissionReadTosca);
+ List<CldsDictionary> dictionaries = cldsDao.getDictionary(null, null);
+ LoggingUtils.setTimeContext(startTime, new Date());
+ LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
+ auditLogger.info("getAllDictionaryNames completed");
+ return new ResponseEntity<>(dictionaries, HttpStatus.OK);
+ }
- /**
- * Rest Service that retrieves all CLDS dictionary items in DB for a give dictionary name
- *
- * @param dictionaryName
- * @return CldsDictionaryItem list
- * List of CLDS Dictionary items for a given dictionary name
- */
- public ResponseEntity<List<CldsDictionaryItem>> getDictionaryElementsByName(String dictionaryName) {
- Date startTime = new Date();
- LoggingUtils.setRequestContext("CldsDictionaryService: getDictionaryElementsByName", getPrincipalName());
- // TODO revisit based on new permissions
- isAuthorized(permissionReadTosca);
- List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, null, null);
- LoggingUtils.setTimeContext(startTime, new Date());
- LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
- auditLogger.info("getAllDictionaryNames completed");
- return new ResponseEntity<>(dictionaryItems, HttpStatus.OK);
- }
+ /**
+ * Rest Service that retrieves all CLDS dictionary items in DB for a give
+ * dictionary name
+ *
+ * @param dictionaryName
+ * @return CldsDictionaryItem list List of CLDS Dictionary items for a given
+ * dictionary name
+ */
+ public ResponseEntity<List<CldsDictionaryItem>> getDictionaryElementsByName(String dictionaryName) {
+ Date startTime = new Date();
+ LoggingUtils.setRequestContext("CldsDictionaryService: getDictionaryElementsByName", getPrincipalName());
+ // TODO revisit based on new permissions
+ isAuthorized(permissionReadTosca);
+ List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, null, null);
+ LoggingUtils.setTimeContext(startTime, new Date());
+ LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
+ auditLogger.info("getAllDictionaryNames completed");
+ return new ResponseEntity<>(dictionaryItems, HttpStatus.OK);
+ }
- public ResponseEntity<?> deleteDictionary() {
- return null;
- }
+ public ResponseEntity<?> deleteDictionary() {
+ return null;
+ }
+
+ // Created for the integration test
+ public void setLoggingUtil(LoggingUtils utilP) {
+ util = utilP;
+ }
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java
index a017d54b0..c25e6e7ac 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java
@@ -29,6 +29,8 @@ import java.util.Date;
import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsHealthCheck;
import org.onap.clamp.clds.util.LoggingUtils;
+import org.onap.clamp.clds.util.ONAPLogConstants;
+import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -54,6 +56,7 @@ public class CldsHealthcheckService {
public ResponseEntity<CldsHealthCheck> gethealthcheck() {
CldsHealthCheck cldsHealthCheck = new CldsHealthCheck();
Date startTime = new Date();
+ LoggingUtils util = new LoggingUtils(logger);
LoggingUtils.setRequestContext("CldsService: GET healthcheck", "Clamp-Health-Check");
LoggingUtils.setTimeContext(startTime, new Date());
boolean healthcheckFailed = false;
@@ -74,8 +77,10 @@ public class CldsHealthcheckService {
// audit log
LoggingUtils.setTimeContext(startTime, new Date());
if(healthcheckFailed) {
+ util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR);
return new ResponseEntity<>(cldsHealthCheck, HttpStatus.INTERNAL_SERVER_ERROR);
} else {
+ util.exiting("200", "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
return new ResponseEntity<>(cldsHealthCheck, HttpStatus.OK);
}
}
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 be19e31c0..206a4246b 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -52,7 +52,6 @@ import org.onap.clamp.clds.client.DcaeInventoryServices;
import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.dao.CldsDao;
-import org.onap.clamp.clds.exception.CldsConfigException;
import org.onap.clamp.clds.exception.policy.PolicyClientException;
import org.onap.clamp.clds.exception.sdc.SdcCommunicationException;
import org.onap.clamp.clds.model.CldsDbServiceCache;
@@ -67,8 +66,6 @@ import org.onap.clamp.clds.model.DcaeEvent;
import org.onap.clamp.clds.model.ValueItem;
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.model.properties.ModelProperties;
-import org.onap.clamp.clds.model.sdc.SdcResource;
-import org.onap.clamp.clds.model.sdc.SdcServiceDetail;
import org.onap.clamp.clds.model.sdc.SdcServiceInfo;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
import org.onap.clamp.clds.transform.XslTransformer;
@@ -163,7 +160,7 @@ public class CldsService extends SecureServiceBase {
* used to generate the ClosedLoop model. ACTION_CD | Current state of the
* ClosedLoop in CLDS application.
*/
- public List<CldsMonitoringDetails> getCLDSDetails() {
+ public List<CldsMonitoringDetails> getCldsDetails() {
util.entering(request, "CldsService: GET model details");
Date startTime = new Date();
List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails();
@@ -503,7 +500,7 @@ public class CldsService extends SecureServiceBase {
* In case of issues
*/
public String getSdcProperties() throws IOException {
- return createPropertiesObjectByUUID("{}");
+ return ((ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY)).toString();
}
/**
@@ -603,114 +600,6 @@ public class CldsService extends SecureServiceBase {
return serviceNode.toString();
}
- private String createPropertiesObjectByUUID(String cldsResponseStr) throws IOException {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- SdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, SdcServiceDetail.class);
- ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY);
- if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getUuid() != null) {
- /**
- * to create json with vf, alarm and locations
- */
- ObjectNode serviceObjectNode = createEmptyVfAlarmObject();
- ObjectNode vfObjectNode = mapper.createObjectNode();
- /**
- * to create json with vf and vfresourceId
- */
- createVfObjectNode(vfObjectNode, cldsSdcServiceDetail.getResources());
- serviceObjectNode.putPOJO(cldsSdcServiceDetail.getInvariantUUID(), vfObjectNode);
- ObjectNode byServiceBasicObjetNode = mapper.createObjectNode();
- byServiceBasicObjetNode.putPOJO("byService", serviceObjectNode);
- /**
- * to create json with VFC Node
- */
- ObjectNode emptyvfcobjectNode = createByVFCObjectNode(cldsSdcServiceDetail.getResources());
- byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode);
- globalPropsJson.putPOJO("shared", byServiceBasicObjetNode);
- logger.info("valuie of objNode: {}", globalPropsJson);
- }
- return globalPropsJson.toString();
- }
-
- private ObjectNode createEmptyVfAlarmObject() {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode emptyObjectNode = mapper.createObjectNode();
- emptyObjectNode.put("", "");
- ObjectNode vfObjectNode = mapper.createObjectNode();
- vfObjectNode.putPOJO("vf", emptyObjectNode);
- vfObjectNode.putPOJO("location", emptyObjectNode);
- vfObjectNode.putPOJO("alarmCondition", emptyObjectNode);
- ObjectNode emptyServiceObjectNode = mapper.createObjectNode();
- emptyServiceObjectNode.putPOJO("", vfObjectNode);
- return emptyServiceObjectNode;
- }
-
- private void createVfObjectNode(ObjectNode vfObjectNode2, List<SdcResource> rawCldsSdcResourceList) {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode vfNode = mapper.createObjectNode();
- vfNode.put("", "");
- // To remove repeated resource instance name from
- // resourceInstanceList
- List<SdcResource> cldsSdcResourceList = sdcCatalogServices
- .removeDuplicateSdcResourceInstances(rawCldsSdcResourceList);
- /**
- * Creating vf resource node using cldsSdcResource Object
- */
- if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
- for (SdcResource cldsSdcResource : cldsSdcResourceList) {
- if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) {
- vfNode.put(cldsSdcResource.getResourceUUID(), cldsSdcResource.getResourceName());
- }
- }
- }
- vfObjectNode2.putPOJO("vf", vfNode);
- /**
- * creating location json object using properties file value
- */
- ObjectNode locationJsonNode;
- try {
- locationJsonNode = (ObjectNode) mapper.readValue(refProp.getStringValue("ui.location.default"),
- JsonNode.class);
- } catch (IOException e) {
- logger.error("Unable to load ui.location.default JSON in clds-references.properties properly", e);
- throw new CldsConfigException(
- "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
- */
- String alarmStringValue = refProp.getStringValue("ui.alarm.default");
- logger.info("value of alarm: {}", alarmStringValue);
- ObjectNode alarmStringJsonNode;
- try {
- alarmStringJsonNode = (ObjectNode) mapper.readValue(alarmStringValue, JsonNode.class);
- } catch (IOException e) {
- logger.error("Unable to ui.alarm.default JSON in clds-references.properties properly", e);
- throw new CldsConfigException("Unable to load ui.alarm.default JSON in clds-references.properties properly",
- e);
- }
- vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode);
- }
-
- private ObjectNode createByVFCObjectNode(List<SdcResource> cldsSdcResourceList) {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode emptyObjectNode = mapper.createObjectNode();
- ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
- ObjectNode vfCObjectNode = mapper.createObjectNode();
- vfCObjectNode.putPOJO("vfC", emptyObjectNode);
- ObjectNode subVfCObjectNode = mapper.createObjectNode();
- subVfCObjectNode.putPOJO("vfc", emptyObjectNode);
- if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
- for (SdcResource cldsSdcResource : cldsSdcResourceList) {
- if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) {
- vfCObjectNode.putPOJO(cldsSdcResource.getResourceUUID(), subVfCObjectNode);
- }
- }
- }
- emptyvfcobjectNode.putPOJO("", vfCObjectNode);
- return emptyvfcobjectNode;
- }
-
public ResponseEntity<CldsModel> deployModel(String modelName, CldsModel model) {
util.entering(request, "CldsService: Deploy model");
Date startTime = new Date();
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
index f33039f01..04205b704 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
@@ -29,6 +29,8 @@ import java.util.Optional;
import javax.annotation.PostConstruct;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsToscaModel;
import org.onap.clamp.clds.util.LoggingUtils;
@@ -44,106 +46,124 @@ import org.springframework.stereotype.Component;
@Component
public class CldsToscaService extends SecureServiceBase {
- @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
- private String cldsPermissionTypeTosca;
- @Value("${clamp.config.security.permission.instance:dev}")
- private String cldsPermissionInstance;
- private SecureServicePermission permissionReadTosca;
- private SecureServicePermission permissionUpdateTosca;
-
- @Autowired
- private CldsDao cldsDao;
-
- @PostConstruct
- private final void initConstruct() {
- permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
- permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update");
- }
-
- /**
- * REST service to upload a new Tosca Model or update an existing Tosca model with new version.
- * This API will parse the Tosca model yaml and generates a JSON schema out of it.
- *
- * @param toscaModelName
- * Tosca model name to be used as a key
- * @param cldsToscaModel
- * Object containing the tosca model yaml
- *
- * @return clds tosca models - list of CLDS tosca models for a given policy type
- */
- public ResponseEntity<?> parseToscaModelAndSave(String toscaModelName, CldsToscaModel cldsToscaModel ) {
+ @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
+ private String cldsPermissionTypeTosca;
+ @Value("${clamp.config.security.permission.instance:dev}")
+ private String cldsPermissionInstance;
+ private SecureServicePermission permissionReadTosca;
+ private SecureServicePermission permissionUpdateTosca;
+
+ @Autowired
+ private CldsDao cldsDao;
+
+ @Autowired
+ private ClampProperties refProp;
+
+ @Autowired
+ private PolicyClient policyClient;
+ private LoggingUtils util = new LoggingUtils(logger);
+
+ @PostConstruct
+ private final void initConstruct() {
+ permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
+ permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance,
+ "update");
+ }
+
+ /**
+ * REST service to upload a new Tosca Model or update an existing Tosca
+ * model with new version. This API will parse the Tosca model yaml and
+ * generates a JSON schema out of it.
+ *
+ * @param toscaModelName
+ * Tosca model name to be used as a key
+ * @param cldsToscaModel
+ * Object containing the tosca model yaml
+ *
+ * @return clds tosca models - list of CLDS tosca models for a given policy
+ * type
+ */
+ public ResponseEntity<?> parseToscaModelAndSave(String toscaModelName, CldsToscaModel cldsToscaModel) {
Date startTime = new Date();
LoggingUtils.setRequestContext("CldsToscaService: Parse Tosca model and save", getPrincipalName());
- //TODO revisit based on new permissions
+ // TODO revisit based on new permissions
isAuthorized(permissionUpdateTosca);
cldsToscaModel.setToscaModelName(toscaModelName);
- cldsToscaModel = cldsToscaModel.save(cldsDao, getUserId());
+ cldsToscaModel = cldsToscaModel.save(cldsDao, refProp, policyClient, getUserId());
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Parse Tosca model and save success", this.getClass().getName());
auditLogger.info("Parse Tosca model and save completed");
return new ResponseEntity<>(cldsToscaModel, HttpStatus.CREATED);
- }
-
- /**
- * REST service to retrieve all Tosca models from the CLDS database.
- *
- * @return clds tosca models - list of CLDS tosca models
- */
- public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() {
-
- Date startTime = new Date();
+ }
+
+ /**
+ * REST service to retrieve all Tosca models from the CLDS database.
+ *
+ * @return clds tosca models - list of CLDS tosca models
+ */
+ public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() {
+
+ Date startTime = new Date();
LoggingUtils.setRequestContext("CldsToscaService: Get All tosca models", getPrincipalName());
- //TODO revisit based on new permissions
+ // TODO revisit based on new permissions
isAuthorized(permissionReadTosca);
List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getAllToscaModels()).get();
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Get All tosca models success", this.getClass().getName());
auditLogger.info("Get All tosca models");
return new ResponseEntity<>(cldsToscaModels, HttpStatus.OK);
- }
-
- /**
- * REST service that retrieves a CLDS Tosca model by model name from the database.
- *
- * @param toscaModelName
- * Path param with tosca model name
- *
- * @return clds tosca model - CLDS tosca model for a given tosca model name
- */
- public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) {
- Date startTime = new Date();
+ }
+
+ /**
+ * REST service that retrieves a CLDS Tosca model by model name from the
+ * database.
+ *
+ * @param toscaModelName
+ * Path param with tosca model name
+ *
+ * @return clds tosca model - CLDS tosca model for a given tosca model name
+ */
+ public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) {
+ Date startTime = new Date();
LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by model name", getPrincipalName());
- //TODO revisit based on new permissions
+ // TODO revisit based on new permissions
isAuthorized(permissionReadTosca);
List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByName(toscaModelName)).get();
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Get tosca models by model name success", this.getClass().getName());
auditLogger.info("GET tosca models by model name completed");
- return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK);
- }
-
-
- /**
- * REST service that retrieves a CLDS Tosca model lists for a policy type from the database.
- *
- * @param policyType
- * @return clds tosca model - CLDS tosca model for a given policy type
- */
- public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) {
- Date startTime = new Date();
+ return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(),
+ HttpStatus.OK);
+ }
+
+ /**
+ * REST service that retrieves a CLDS Tosca model lists for a policy type
+ * from the database.
+ *
+ * @param policyType
+ * @return clds tosca model - CLDS tosca model for a given policy type
+ */
+ public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) {
+ Date startTime = new Date();
LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by policyType", getPrincipalName());
- //TODO revisit based on new permissions
+ // TODO revisit based on new permissions
isAuthorized(permissionReadTosca);
List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByPolicyType(policyType)).get();
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Get tosca models by policyType success", this.getClass().getName());
auditLogger.info("GET tosca models by policyType completed");
- return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK);
- }
-
- public ResponseEntity<?> deleteToscaModelById(String toscaModeId) {
- //TODO
- return null;
- }
-
+ return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(),
+ HttpStatus.OK);
+ }
+
+ public ResponseEntity<?> deleteToscaModelById(String toscaModeId) {
+ // TODO
+ return null;
+ }
+
+ // Created for the integration test
+ public void setLoggingUtil(LoggingUtils utilP) {
+ util = utilP;
+ }
+
}
diff --git a/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java
new file mode 100644
index 000000000..58a2f6f05
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.tosca;
+
+public class JsonEditorSchemaConstants {
+
+ //Data types in JSON Schema
+ public static final String TYPE_OBJECT = "object";
+ public static final String TYPE_ARRAY = "array";
+ public static final String TYPE_STRING = "string";
+ public static final String TYPE_INTEGER = "integer";
+
+ //Key elements in JSON Schema
+ public static final String TYPE = "type";
+ public static final String TITLE = "title";
+ public static final String REQUIRED = "required";
+ public static final String DEFAULT = "default";
+ public static final String ENUM = "enum";
+ public static final String ENUM_TITLES = "enum_titles";
+ public static final String OPTIONS = "options";
+ public static final String FORMAT = "format";
+ public static final String ITEMS = "items";
+ public static final String PROPERTIES = "properties";
+ public static final String PROPERTY_ORDER = "propertyOrder";
+
+ public static final String MINIMUM = "minimum";
+ public static final String MAXIMUM = "maximum";
+ public static final String MIN_LENGTH = "minLength";
+ public static final String MAX_LENGTH = "maxLength";
+ public static final String EXCLUSIVE_MINIMUM = "exclusiveMinimum";
+ public static final String EXCLUSIVE_MAXIMUM = "exclusiveMaximum";
+
+ public static final String CUSTOM_KEY_FORMAT = "format";
+ public static final String CUSTOM_KEY_FORMAT_TABS_TOP = "tabs-top";
+ public static final String FORMAT_SELECT = "select";
+ public static final String UNIQUE_ITEMS = "uniqueItems";
+ public static final String TRUE = "true";
+ public static final String QSSCHEMA = "qschema";
+ public static final String TYPE_QBLDR = "qbldr";
+
+ public static final String ID = "id";
+ public static final String LABEL = "label";
+ public static final String OPERATORS = "operators";
+ public static final String FILTERS = "filters";
+
+ public static final String SCHEMA = "schema";
+ public static final String CURRENT_VALUES = "currentValues";
+
+
+
+
+
+
+
+
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java
new file mode 100644
index 000000000..f5b5a8d2b
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.tosca;
+
+public class ToscaSchemaConstants {
+
+ //Data types in TOSCA Schema
+ public static final String TYPE_LIST = "list";
+ public static final String TYPE_MAP = "map";
+ public static final String TYPE_STRING = "string";
+ public static final String TYPE_INTEGER = "integer";
+ public static final String TYPE_FLOAT = "float";
+ public static final String TYPE_BOOLEAN = "boolean";
+
+ //Key elements in Tosca
+ public static final String NODE_TYPES = "node_types";
+ public static final String DATA_TYPES = "data_types";
+ public static final String TYPE = "type";
+ public static final String DESCRIPTION = "description";
+ public static final String DEFAULT = "default";
+ public static final String PROPERTIES = "properties";
+ public static final String REQUIRED = "required";
+ public static final String ENTRY_SCHEMA = "entry_schema";
+
+ //Constraints
+ public static final String CONSTRAINTS = "constraints";
+ public static final String VALID_VALUES = "valid_values";
+ public static final String EQUAL = "equal";
+ public static final String GREATER_THAN = "greater_than";
+ public static final String GREATER_OR_EQUAL = "greater_or_equal";
+ public static final String LESS_THAN = "less_than";
+ public static final String LESS_OR_EQUAL = "less_or_equal";
+ public static final String IN_RANGE = "in_range";
+ public static final String LENGTH = "length";
+ public static final String MIN_LENGTH = "min_length";
+ public static final String MAX_LENGTH = "max_length";
+ public static final String PATTERN = "pattern";
+
+ //Prefix for policy nodes
+ public static final String POLICY_NODE = "policy.nodes.";
+
+ //Prefix for data nodes
+ public static final String POLICY_DATA = "policy.data.";
+
+ //Prefix for dictionary elements
+ public static final String DICTIONARY = "Dictionary:";
+
+ //Custom Elements that must exist in the Tosca models
+ public static final String NAME = "name";
+ public static final String CONTEXT = "context";
+
+
+
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
new file mode 100644
index 000000000..784d95e94
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
@@ -0,0 +1,589 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.tosca;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.model.CldsDictionaryItem;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ * Tosca Model Yaml parser and convertor to JSON Schema consumable for JSON
+ * Editor
+ *
+ */
+public class ToscaYamlToJsonConvertor {
+
+ private CldsDao cldsDao;
+ private int simpleTypeOrder = 1000;
+ private int complexTypeOrder = 10000;
+ private int complexSimpleTypeOrder = 1;
+
+ public ToscaYamlToJsonConvertor(CldsDao cldsDao) {
+ this.cldsDao = cldsDao;
+ }
+
+ private int incrementSimpleTypeOrder() {
+ return simpleTypeOrder++;
+ }
+
+ private int incrementComplexTypeOrder() {
+ return complexTypeOrder = complexTypeOrder + 10000;
+ }
+
+ private int incrementComplexSimpleTypeOrder() {
+ complexSimpleTypeOrder++;
+ return complexTypeOrder + complexSimpleTypeOrder;
+ }
+
+ /**
+ * @return the cldsDao
+ */
+ public CldsDao getCldsDao() {
+ return cldsDao;
+ }
+
+ /**
+ * @param cldsDao
+ * the cldsDao to set
+ */
+ public void setCldsDao(CldsDao cldsDao) {
+ this.cldsDao = cldsDao;
+ }
+
+ @SuppressWarnings("unchecked")
+ public String parseToscaYaml(String yamlString) {
+
+ Yaml yaml = new Yaml();
+ LinkedHashMap<String, Object> loadedYaml = (LinkedHashMap<String, Object>) yaml.load(yamlString);
+ LinkedHashMap<String, Object> nodeTypes = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> dataNodes = new LinkedHashMap<String, Object>();
+ JSONObject jsonEditorObject = new JSONObject();
+ JSONObject jsonParentObject = new JSONObject();
+ JSONObject jsonTempObject = new JSONObject();
+ parseNodeAndDataType(loadedYaml, nodeTypes, dataNodes);
+ populateJsonEditorObject(loadedYaml, nodeTypes, dataNodes, jsonParentObject, jsonTempObject);
+ if (jsonTempObject.length() > 0) {
+ jsonParentObject = jsonTempObject;
+ }
+ jsonEditorObject.put(JsonEditorSchemaConstants.SCHEMA, jsonParentObject);
+ return jsonEditorObject.toString();
+ }
+
+ // Parse node_type and data_type
+ @SuppressWarnings("unchecked")
+ private void parseNodeAndDataType(LinkedHashMap<String, Object> map, LinkedHashMap<String, Object> nodeTypes,
+ LinkedHashMap<String, Object> dataNodes) {
+ map.entrySet().stream().forEach(n -> {
+ if (n.getKey().contains(ToscaSchemaConstants.NODE_TYPES) && n.getValue() instanceof Map) {
+
+ parseNodeAndDataType((LinkedHashMap<String, Object>) n.getValue(), nodeTypes, dataNodes);
+
+ } else if (n.getKey().contains(ToscaSchemaConstants.DATA_TYPES) && n.getValue() instanceof Map) {
+
+ parseNodeAndDataType((LinkedHashMap<String, Object>) n.getValue(), nodeTypes, dataNodes);
+
+ } else if (n.getKey().contains(ToscaSchemaConstants.POLICY_NODE)) {
+
+ nodeTypes.put(n.getKey(), n.getValue());
+
+ } else if (n.getKey().contains(ToscaSchemaConstants.POLICY_DATA)) {
+
+ dataNodes.put(n.getKey(), n.getValue());
+ }
+
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ private void populateJsonEditorObject(LinkedHashMap<String, Object> map, LinkedHashMap<String, Object> nodeTypes,
+ LinkedHashMap<String, Object> dataNodes, JSONObject jsonParentObject, JSONObject jsonTempObject) {
+
+ Map<String, JSONObject> jsonEntrySchema = new HashMap();
+ jsonParentObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_OBJECT);
+ nodeTypes.entrySet().stream().forEach(nt -> {
+ if (nt.getValue() instanceof Map) {
+ ((LinkedHashMap<String, Object>) nt.getValue()).entrySet().forEach(ntElement -> {
+ if (ntElement.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
+ JSONArray rootNodeArray = new JSONArray();
+ if (ntElement.getValue() instanceof Map) {
+ ((LinkedHashMap<String, Object>) ntElement.getValue()).entrySet()
+ .forEach((ntPropertiesElement) -> {
+ boolean isListNode = false;
+ parseDescription((LinkedHashMap<String, Object>) ntPropertiesElement.getValue(),
+ jsonParentObject);
+ LinkedHashMap<String, Object> parentPropertiesMap = (LinkedHashMap<String, Object>) ntPropertiesElement
+ .getValue();
+ if (parentPropertiesMap.containsKey(ToscaSchemaConstants.TYPE)
+ && ((String) parentPropertiesMap.get(ToscaSchemaConstants.TYPE))
+ .contains(ToscaSchemaConstants.TYPE_LIST)
+ && parentPropertiesMap.containsKey(ToscaSchemaConstants.ENTRY_SCHEMA)) {
+ parentPropertiesMap = (LinkedHashMap<String, Object>) parentPropertiesMap
+ .get(ToscaSchemaConstants.ENTRY_SCHEMA);
+ isListNode = true;
+ }
+ if (parentPropertiesMap.containsKey(ToscaSchemaConstants.TYPE)
+ && ((String) parentPropertiesMap.get(ToscaSchemaConstants.TYPE))
+ .contains(ToscaSchemaConstants.POLICY_DATA)) {
+ ((LinkedHashMap<String, Object>) dataNodes
+ .get(parentPropertiesMap.get(ToscaSchemaConstants.TYPE))).entrySet()
+ .stream().forEach(pmap -> {
+ if (pmap.getKey()
+ .equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
+ parseToscaProperties(ToscaSchemaConstants.POLICY_NODE,
+ (LinkedHashMap<String, Object>) pmap.getValue(),
+ jsonParentObject, rootNodeArray, jsonEntrySchema, dataNodes,
+ incrementSimpleTypeOrder());
+ }
+
+ });
+
+ }
+ if (isListNode) {
+ jsonTempObject.put(JsonEditorSchemaConstants.TYPE,
+ JsonEditorSchemaConstants.TYPE_ARRAY);
+ parseDescription((LinkedHashMap<String, Object>) ntPropertiesElement.getValue(),
+ jsonTempObject);
+ jsonTempObject.put(JsonEditorSchemaConstants.ITEMS, jsonParentObject);
+ jsonTempObject.put(JsonEditorSchemaConstants.FORMAT,
+ JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS_TOP);
+ jsonTempObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS,
+ JsonEditorSchemaConstants.TRUE);
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ private void parseToscaProperties(String parentKey, LinkedHashMap<String, Object> propertiesMap,
+ JSONObject jsonDataNode, JSONArray array, Map<String, JSONObject> jsonEntrySchema,
+ LinkedHashMap<String, Object> dataNodes, final int order) {
+ JSONObject jsonPropertyNode = new JSONObject();
+ propertiesMap.entrySet().stream().forEach(p -> {
+ // Populate JSON Array for "required" key
+
+ if (p.getValue() instanceof Map) {
+ LinkedHashMap<String, Object> nodeMap = (LinkedHashMap<String, Object>) p.getValue();
+ if (nodeMap.containsKey(ToscaSchemaConstants.REQUIRED)
+ && ((boolean) nodeMap.get(ToscaSchemaConstants.REQUIRED))) {
+ array.put(p.getKey());
+ }
+ // if(nodeMap.containsKey(ToscaSchemaConstants.CONSTRAINTS))
+ parseToscaChildNodeMap(p.getKey(), nodeMap, jsonPropertyNode, jsonEntrySchema, dataNodes, array,
+ incrementSimpleTypeOrder());
+ }
+ });
+ jsonDataNode.put(JsonEditorSchemaConstants.REQUIRED, array);
+ jsonDataNode.put(JsonEditorSchemaConstants.PROPERTIES, jsonPropertyNode);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void parseToscaPropertiesForType(String parentKey, LinkedHashMap<String, Object> propertiesMap,
+ JSONObject jsonDataNode, JSONArray array, Map<String, JSONObject> jsonEntrySchema,
+ LinkedHashMap<String, Object> dataNodes, boolean isType, int order) {
+ JSONObject jsonPropertyNode = new JSONObject();
+
+ propertiesMap.entrySet().stream().forEach(p -> {
+ // array.put(p.getKey());
+ boolean overWriteArray = false;
+ if (p.getValue() instanceof Map) {
+ LinkedHashMap<String, Object> nodeMap = (LinkedHashMap<String, Object>) p.getValue();
+ if (!(parentKey.contains(ToscaSchemaConstants.ENTRY_SCHEMA)
+ || parentKey.contains(ToscaSchemaConstants.POLICY_NODE))
+ && nodeMap.containsKey(ToscaSchemaConstants.TYPE)
+ && (((String) nodeMap.get(ToscaSchemaConstants.TYPE)).contains(ToscaSchemaConstants.POLICY_DATA))) {
+ overWriteArray = true;
+ }
+ if (nodeMap.containsKey(ToscaSchemaConstants.REQUIRED)
+ && ((boolean) nodeMap.get(ToscaSchemaConstants.REQUIRED))) {
+ array.put(p.getKey());
+ }
+ parseToscaChildNodeMap(p.getKey(), nodeMap, jsonPropertyNode, jsonEntrySchema, dataNodes, array, order);
+ }
+ });
+ jsonDataNode.put(JsonEditorSchemaConstants.REQUIRED, array);
+ jsonDataNode.put(JsonEditorSchemaConstants.PROPERTIES, jsonPropertyNode);
+ }
+
+ private void parseToscaChildNodeMap(String childObjectKey, LinkedHashMap<String, Object> childNodeMap,
+ JSONObject jsonPropertyNode, Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes,
+ JSONArray array, int order) {
+ JSONObject childObject = new JSONObject();
+ // JSONArray childArray = new JSONArray();
+ parseDescription(childNodeMap, childObject);
+ parseTypes(childObjectKey, childNodeMap, childObject, jsonEntrySchema, dataNodes, array, order);
+ parseConstraints(childNodeMap, childObject);
+ parseEntrySchema(childNodeMap, childObject, jsonPropertyNode, jsonEntrySchema, dataNodes);
+
+ jsonPropertyNode.put(childObjectKey, childObject);
+ order++;
+
+ }
+
+ private void parseEntrySchema(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject,
+ JSONObject jsonPropertyNode, Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes) {
+ if (childNodeMap.get(ToscaSchemaConstants.ENTRY_SCHEMA) != null) {
+ if (childNodeMap.get(ToscaSchemaConstants.ENTRY_SCHEMA) instanceof Map) {
+ LinkedHashMap<String, Object> entrySchemaMap = (LinkedHashMap<String, Object>) childNodeMap
+ .get(ToscaSchemaConstants.ENTRY_SCHEMA);
+ entrySchemaMap.entrySet().stream().forEach(entry -> {
+ if (entry.getKey().equalsIgnoreCase(ToscaSchemaConstants.TYPE) && entry.getValue() != null) {
+ String entrySchemaType = (String) entry.getValue();
+ if (entrySchemaType.contains(ToscaSchemaConstants.POLICY_DATA)) {
+ JSONArray array = new JSONArray();
+ if (jsonEntrySchema.get(entrySchemaType) != null) {
+ // Already traversed
+ JSONObject entrySchemaObject = jsonEntrySchema.get(entrySchemaType);
+ attachEntrySchemaJsonObject(childObject, entrySchemaObject,
+ JsonEditorSchemaConstants.TYPE_OBJECT);
+ } else if (dataNodes.containsKey(entrySchemaType)) {
+
+ JSONObject entrySchemaObject = new JSONObject();
+ // Need to traverse
+ ((LinkedHashMap<String, Object>) dataNodes.get(entrySchemaType)).entrySet().stream()
+ .forEach(pmap -> {
+ if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
+ parseToscaProperties(ToscaSchemaConstants.ENTRY_SCHEMA,
+ (LinkedHashMap<String, Object>) pmap.getValue(), entrySchemaObject,
+ array, jsonEntrySchema, dataNodes, incrementComplexTypeOrder());
+ jsonEntrySchema.put(entrySchemaType, entrySchemaObject);
+ dataNodes.remove(entrySchemaType);
+ attachEntrySchemaJsonObject(childObject, entrySchemaObject,
+ JsonEditorSchemaConstants.TYPE_OBJECT);
+ }
+
+ });
+ }
+ } else if (entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)
+ || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)
+ || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) {
+ JSONObject entrySchemaObject = new JSONObject();
+ parseConstraints(entrySchemaMap, entrySchemaObject);
+ String jsontype = JsonEditorSchemaConstants.TYPE_STRING;
+ if (entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)
+ || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) {
+ jsontype = JsonEditorSchemaConstants.TYPE_INTEGER;
+ }
+ if (childNodeMap.get(ToscaSchemaConstants.TYPE) != null) {
+ // Only known value of type is String for now
+ if (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) {
+ String typeValue = (String) childNodeMap.get(ToscaSchemaConstants.TYPE);
+ if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) {
+ // Custom key for JSON Editor and UI rendering
+ childObject.put(JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT,
+ JsonEditorSchemaConstants.FORMAT_SELECT);
+ // childObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS,
+ // JsonEditorSchemaConstants.TRUE);
+ }
+ }
+ }
+ attachEntrySchemaJsonObject(childObject, entrySchemaObject, jsontype);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private void attachEntrySchemaJsonObject(JSONObject childObject, JSONObject entrySchemaObject, String dataType) {
+
+ entrySchemaObject.put(JsonEditorSchemaConstants.TYPE, dataType);
+ childObject.put(JsonEditorSchemaConstants.ITEMS, entrySchemaObject);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void attachTypeJsonObject(JSONObject childObject, JSONObject typeObject) {
+ Iterator<String> keys = typeObject.keys();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ childObject.put(key, typeObject.get(key));
+ }
+ }
+
+ /*
+ * private String parseKey(String toscaKey, String lookupString) { return
+ * toscaKey.substring(toscaKey.indexOf(lookupString) + lookupString.length(),
+ * toscaKey.length()); }
+ */
+
+ private void parseDescription(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject) {
+ if (childNodeMap.get(ToscaSchemaConstants.DESCRIPTION) != null) {
+ childObject.put(JsonEditorSchemaConstants.TITLE, childNodeMap.get(ToscaSchemaConstants.DESCRIPTION));
+ }
+ }
+
+ private void parseTypes(String childObjectKey, LinkedHashMap<String, Object> childNodeMap, JSONObject childObject,
+ Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes, JSONArray array, int order) {
+ if (childNodeMap.get(ToscaSchemaConstants.TYPE) != null) {
+ // Only known value of type is String for now
+ if (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) {
+ childObject.put(JsonEditorSchemaConstants.PROPERTY_ORDER, order);
+ String typeValue = (String) childNodeMap.get(ToscaSchemaConstants.TYPE);
+ if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) {
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_INTEGER);
+
+ } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) {
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_INTEGER);
+ } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) {
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_ARRAY);
+ // Custom key for JSON Editor and UI rendering
+ childObject.put(JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT,
+ JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS_TOP);
+ childObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS, JsonEditorSchemaConstants.TRUE);
+ } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_MAP)) {
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_OBJECT);
+ } else if (typeValue.contains(ToscaSchemaConstants.POLICY_DATA)) {
+ JSONArray childArray = new JSONArray();
+
+ if (jsonEntrySchema.get(typeValue) != null) {
+ // Already traversed
+ JSONObject entrySchemaObject = jsonEntrySchema.get(typeValue);
+ attachTypeJsonObject(childObject, entrySchemaObject);
+ } else if (dataNodes.containsKey(typeValue)) {
+ JSONObject entrySchemaObject = new JSONObject();
+ // Need to traverse
+ JSONArray jsonArray = new JSONArray();
+ ((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> {
+ if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
+
+ ((LinkedHashMap<String, Object>) pmap.getValue()).entrySet().stream().forEach(p -> {
+ if (p.getValue() instanceof Map) {
+ LinkedHashMap<String, Object> childNodeMap2 = (LinkedHashMap<String, Object>) p
+ .getValue();
+ if (childNodeMap2.containsKey(ToscaSchemaConstants.TYPE)
+ && (((String) childNodeMap2.get(ToscaSchemaConstants.TYPE))
+ .contains(ToscaSchemaConstants.POLICY_DATA))) {
+ }
+ }
+ });
+ }
+ });
+ ((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> {
+ if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
+ parseToscaPropertiesForType(childObjectKey,
+ (LinkedHashMap<String, Object>) pmap.getValue(), entrySchemaObject, childArray,
+ jsonEntrySchema, dataNodes, true, incrementComplexSimpleTypeOrder());
+ jsonEntrySchema.put(typeValue, entrySchemaObject);
+ dataNodes.remove(typeValue);
+ attachTypeJsonObject(childObject, entrySchemaObject);
+ }
+ });
+ }
+ } else {
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_STRING);
+ }
+ }
+ if (childNodeMap.get(ToscaSchemaConstants.DEFAULT) != null) {
+ childObject.put(JsonEditorSchemaConstants.DEFAULT, childNodeMap.get(ToscaSchemaConstants.DEFAULT));
+ }
+ }
+ }
+
+ private void parseConstraints(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject) {
+ if (childNodeMap.containsKey(ToscaSchemaConstants.CONSTRAINTS)
+ && childNodeMap.get(ToscaSchemaConstants.CONSTRAINTS) != null) {
+ List<LinkedHashMap<String, Object>> constraintsList = (List<LinkedHashMap<String, Object>>) childNodeMap
+ .get(ToscaSchemaConstants.CONSTRAINTS);
+ constraintsList.stream().forEach(c -> {
+ if (c instanceof Map) {
+ c.entrySet().stream().forEach(constraint -> {
+ if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.MIN_LENGTH)
+ || constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.GREATER_OR_EQUAL)) {
+ // For String min_lenghth is minimum length whereas for number, it will be
+ // minimum or greater than to the defined value
+ if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE)
+ && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String)
+ && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE))
+ .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
+ childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, constraint.getValue());
+ } else {
+ childObject.put(JsonEditorSchemaConstants.MINIMUM, constraint.getValue());
+ }
+ } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.MAX_LENGTH)
+ || constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.LESS_OR_EQUAL)) {
+ // For String max_lenghth is maximum length whereas for number, it will be
+ // maximum or less than the defined value
+ if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE)
+ && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String)
+ && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE))
+ .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
+ childObject.put(JsonEditorSchemaConstants.MAX_LENGTH, constraint.getValue());
+ } else {
+ childObject.put(JsonEditorSchemaConstants.MAXIMUM, constraint.getValue());
+ }
+ } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.LESS_THAN)) {
+ childObject.put(JsonEditorSchemaConstants.EXCLUSIVE_MAXIMUM, constraint.getValue());
+ } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.GREATER_THAN)) {
+ childObject.put(JsonEditorSchemaConstants.EXCLUSIVE_MINIMUM, constraint.getValue());
+ } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.IN_RANGE)) {
+ if (constraint.getValue() instanceof ArrayList<?>) {
+ if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE)
+ && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String)
+ && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE))
+ .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
+ childObject.put(JsonEditorSchemaConstants.MIN_LENGTH,
+ ((ArrayList) constraint.getValue()).get(0));
+ childObject.put(JsonEditorSchemaConstants.MAX_LENGTH,
+ ((ArrayList) constraint.getValue()).get(1));
+ } else {
+ childObject.put(JsonEditorSchemaConstants.MINIMUM,
+ ((ArrayList) constraint.getValue()).get(0));
+ childObject.put(JsonEditorSchemaConstants.MAXIMUM,
+ ((ArrayList) constraint.getValue()).get(1));
+ }
+
+ }
+ } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.VALID_VALUES)) {
+ JSONArray validValuesArray = new JSONArray();
+
+ if (constraint.getValue() instanceof ArrayList<?>) {
+ boolean processDictionary = ((ArrayList<?>) constraint.getValue()).stream()
+ .anyMatch(value -> (value instanceof String
+ && ((String) value).contains(ToscaSchemaConstants.DICTIONARY)));
+ if (!processDictionary) {
+ ((ArrayList<?>) constraint.getValue()).stream().forEach(value -> {
+ validValuesArray.put(value);
+ });
+ childObject.put(JsonEditorSchemaConstants.ENUM, validValuesArray);
+ } else {
+ ((ArrayList<?>) constraint.getValue()).stream().forEach(value -> {
+ if ((value instanceof String
+ && ((String) value).contains(ToscaSchemaConstants.DICTIONARY))) {
+ processDictionaryElements(childObject, (String) value);
+ }
+
+ });
+
+ }
+ }
+
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private void processDictionaryElements(JSONObject childObject, String dictionaryReference) {
+
+ if (dictionaryReference.contains("#")) {
+ String[] dictionaryKeyArray = dictionaryReference
+ .substring(dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11,
+ dictionaryReference.length())
+ .split("#");
+ // We support only one # as of now.
+ List<CldsDictionaryItem> cldsDictionaryElements = null;
+ List<CldsDictionaryItem> subDictionaryElements = null;
+ if (dictionaryKeyArray != null && dictionaryKeyArray.length == 2) {
+ cldsDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKeyArray[0], null, null);
+ subDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKeyArray[1], null, null);
+
+ if (cldsDictionaryElements != null) {
+ List<String> subCldsDictionaryNames = subDictionaryElements.stream()
+ .map(CldsDictionaryItem::getDictElementShortName).collect(Collectors.toList());
+ JSONArray jsonArray = new JSONArray();
+
+ Optional.ofNullable(cldsDictionaryElements).get().stream().forEach(c -> {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put(JsonEditorSchemaConstants.TYPE, getJsonType(c.getDictElementType()));
+ if (c.getDictElementType() != null
+ && c.getDictElementType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
+ jsonObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1);
+ }
+ jsonObject.put(JsonEditorSchemaConstants.ID, c.getDictElementName());
+ jsonObject.put(JsonEditorSchemaConstants.LABEL, c.getDictElementShortName());
+ jsonObject.put(JsonEditorSchemaConstants.OPERATORS, subCldsDictionaryNames);
+ jsonArray.put(jsonObject);
+ });
+ ;
+ JSONObject filterObject = new JSONObject();
+ filterObject.put(JsonEditorSchemaConstants.FILTERS, jsonArray);
+
+ childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_QBLDR);
+ // TO invoke validation on such parameters
+ childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1);
+ childObject.put(JsonEditorSchemaConstants.QSSCHEMA, filterObject);
+
+ }
+ }
+ } else {
+ String dictionaryKey = dictionaryReference.substring(
+ dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11, dictionaryReference.length());
+ if (dictionaryKey != null) {
+ List<CldsDictionaryItem> cldsDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKey,
+ null, null);
+ if (cldsDictionaryElements != null) {
+ List<String> cldsDictionaryNames = new ArrayList<>();
+ List<String> cldsDictionaryFullNames = new ArrayList<>();
+ cldsDictionaryElements.stream().forEach(c -> {
+ // Json type will be translated before Policy creation
+ if (c.getDictElementType() != null && !c.getDictElementType().equalsIgnoreCase("json")) {
+ cldsDictionaryFullNames.add(c.getDictElementName());
+ }
+ cldsDictionaryNames.add(c.getDictElementShortName());
+ });
+
+ if (cldsDictionaryFullNames.size() > 0) {
+ childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryFullNames);
+ // Add Enum titles for generated translated values during JSON instance
+ // generation
+ JSONObject enumTitles = new JSONObject();
+ enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, cldsDictionaryNames);
+ childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles);
+ } else {
+ childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryNames);
+ }
+
+ }
+ }
+ }
+ }
+
+ private String getJsonType(String toscaType) {
+ String jsonType = null;
+ if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) {
+ jsonType = JsonEditorSchemaConstants.TYPE_INTEGER;
+ } else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) {
+ jsonType = JsonEditorSchemaConstants.TYPE_ARRAY;
+ } else {
+ jsonType = JsonEditorSchemaConstants.TYPE_STRING;
+ }
+ return jsonType;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
index 759edb1d9..300d60663 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -176,6 +176,7 @@ public class LoggingUtils {
* @return this.
*/
public void entering(HttpServletRequest request, String serviceName) {
+ MDC.clear();
checkNotNull(request);
// Extract MDC values from standard HTTP headers.
final String requestID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
@@ -205,6 +206,8 @@ public class LoggingUtils {
if (serviceName == null ||
serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
+ } else {
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
}
this.mLogger.info(ONAPLogConstants.Markers.ENTRY);
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 0ce8a7b65..2d34fba7b 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -82,7 +82,7 @@ camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml
#clds datasource connection details
spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
-spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
+spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
spring.datasource.cldsdb.username=clds
spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
spring.datasource.cldsdb.validationQuery=SELECT 1
@@ -101,10 +101,10 @@ async.max.pool.size=20
async.queue.capacity=500
#For EELF logback file
-#com.att.eelf.logging.path=
+#clamp.config.logback.path=
clamp.config.logback.filename=logback-default.xml
#The log folder that will be used in logback.xml file
-clamp.config.log.path=/var/log/ONAP/clamp
+clamp.config.log.path=/var/log/onap/clamp
clamp.config.files.systemProperties=classpath:/system.properties
clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
@@ -114,7 +114,6 @@ clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
# DCAE request build properties
#
clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.decode.service_ids=classpath:/clds/templates/dcae-decode-service_ids.json
clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
#
# SDC request blueprint properties
@@ -148,6 +147,9 @@ clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
clamp.config.policy.base.policyNamePrefix=Config_
clamp.config.policy.op.type=BRMS_Param
+clamp.config.import.tosca.model=true
+clamp.config.tosca.policyTypes=tca
+clamp.config.tosca.filePath=/tmp/tosca-models
# TCA MicroService Policy request build properties
#
@@ -160,7 +162,7 @@ clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-te
#
# Operational Policy request build properties
#
-clamp.config.op.policyDescription=from clds
+clamp.config.op.policyDescription=from CLAMP
# default
clamp.config.op.templateName=ClosedLoopControlName
clamp.config.op.operationTopic=APPC-CL
@@ -186,7 +188,6 @@ clamp.config.sdc.csarFolder = /tmp/sdc-controllers
clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
#
clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-clamp.config.ui.alarm.default=classpath:/clds/templates/ui-alarm-default.json
#
# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
clamp.config.action.test.override=false
@@ -214,3 +215,4 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template
clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca
#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
clamp.config.security.permission.instance=dev
+clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal \ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 263c09d35..c492f74de 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -99,7 +99,7 @@ camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml
#clds datasource connection details
spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
-spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
+spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
spring.datasource.cldsdb.username=clds
spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
spring.datasource.cldsdb.validationQuery=SELECT 1
@@ -121,7 +121,7 @@ async.queue.capacity=500
#clamp.config.logback.path=
clamp.config.logback.filename=logback-default.xml
#The log folder that will be used in logback.xml file
-clamp.config.log.path=/var/log/ONAP/clamp
+clamp.config.log.path=/var/log/onap/clamp
clamp.config.files.systemProperties=classpath:/system.properties
clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
@@ -131,7 +131,6 @@ clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
# DCAE request build properties
#
clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.decode.service_ids=classpath:/clds/templates/dcae-decode-service_ids.json
clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
#
# SDC request blueprint properties
@@ -165,6 +164,9 @@ clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
clamp.config.policy.base.policyNamePrefix=Config_
clamp.config.policy.op.type=BRMS_Param
+clamp.config.import.tosca.model=true
+clamp.config.tosca.policyTypes=tca
+clamp.config.tosca.filePath=/tmp/tosca-models
# TCA MicroService Policy request build properties
#
@@ -203,7 +205,6 @@ clamp.config.sdc.csarFolder = /tmp/sdc-controllers
clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
#
clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-clamp.config.ui.alarm.default=classpath:/clds/templates/ui-alarm-default.json
#
# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
clamp.config.action.test.override=false
@@ -231,6 +232,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template
clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca
#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
clamp.config.security.permission.instance=dev
+clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
#AAF related parameters
clamp.config.cadi.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
diff --git a/src/main/resources/clds/camel/rest/clds-services.xml b/src/main/resources/clds/camel/rest/clds-services.xml
index e67fb162d..476816977 100644
--- a/src/main/resources/clds/camel/rest/clds-services.xml
+++ b/src/main/resources/clds/camel/rest/clds-services.xml
@@ -4,7 +4,7 @@
outType="org.onap.clamp.clds.model.CldsMonitoringDetails"
produces="application/json">
<to
- uri="bean:org.onap.clamp.clds.service.CldsService?method=getCLDSDetails()" />
+ uri="bean:org.onap.clamp.clds.service.CldsService?method=getCldsDetails()" />
</get>
<get uri="/clds/cldsInfo"
outType="org.onap.clamp.clds.model.CldsInfo"
diff --git a/src/main/resources/clds/templates/dcae-decode-service_ids.json b/src/main/resources/clds/templates/dcae-decode-service_ids.json
deleted file mode 100644
index 619cac67a..000000000
--- a/src/main/resources/clds/templates/dcae-decode-service_ids.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "vUSP": [
- "vUSP - vCTS"
- ],
- "Trinity": [
- "ASBGv TLS VNF",
- "ASBGv No TLS",
- "ASBGv (NO TLS) VNF",
- "ASBGv TLS",
- "NSBGv VNF",
- "NSBGv"
- ],
- "vSCP": [
- "AKRON_vSCP_F5_FW-SVC/vSCP_F5_FW 1",
- "ALLEN_vSCP_F5_FW-SVC/vSCP_F5_FW 1"
- ],
- "vProbes": [
- "vProbes - FW"
- ]
-}
diff --git a/src/main/resources/clds/templates/ui-alarm-default.json b/src/main/resources/clds/templates/ui-alarm-default.json
deleted file mode 100644
index c851e6cdd..000000000
--- a/src/main/resources/clds/templates/ui-alarm-default.json
+++ /dev/null
@@ -1,597 +0,0 @@
-{
- "Reports a transient alarm condition when an incoming CDR cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR cannot be decoded successfully",
- "Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully",
- "Reports a transient alarm condition when a CDR validation fails": "vCCF: Reports a transient alarm condition when a CDR validation fails",
- "Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully",
- "Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully",
- "Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully",
- "Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session": "vCCF: Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session",
- "Reports a transient alarm condition when an outgoing Ro message send fails": "vCCF: Reports a transient alarm condition when an outgoing Ro message send fails",
- "Reports a transient alarm condition when an outgoing GTP' message send fails": "vCCF: Reports a transient alarm condition when an outgoing GTP' message send fails",
- "Reports a transient alarm condition when an outgoing Sh/Dh message send fails": "vCCF: Reports a transient alarm condition when an outgoing Sh/Dh message send fails",
- "Reports an alarm when build or send Rf message fail": "vCCF: Reports an alarm when build or send Rf message fail",
- "Reports a transient alarm condition when an abnormal incoming CCA message": "vCCF: Reports a transient alarm condition when an abnormal incoming CCA message",
- "Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message": "vCCF: Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message",
- "For Rf interface, if IeCCF receives a message with incorrect value for session id.": "vCCF: For Rf interface, if IeCCF receives a message with incorrect value for session id.",
- "Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold",
- "Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold": "vCCF: Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold",
- "Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold": "vCCF: Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold",
- "Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold",
- "Reports an alarm when external DB usage exceeds the major threshold": "vCCF: Reports an alarm when external DB usage exceeds the major threshold",
- "Reports a transient alarm condition when the workflow definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the workflow definition table is provisioned wrongly",
- "Reports a transient alarm condition when the Action Definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Action Definition table is provisioned wrongly",
- "Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly",
- "Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly",
- "Reports a transient alarm condition when a specific dictionary or rule does not exist": "vCCF: Reports a transient alarm condition when a specific dictionary or rule does not exist",
- "Reports a transient alarm condition when failure occurs when mapping Rf message to XDR": "vCCF: Reports a transient alarm condition when failure occurs when mapping Rf message to XDR",
- "Reports a transient alarm condition when failure occurs in aggregating process": "vCCF: Reports a transient alarm condition when failure occurs in aggregating process",
- "Reports a transient alarm condition when failure happens in correlating process": "vCCF: Reports a transient alarm condition when failure happens in correlating process",
- "Reports a transient alarm condition when failure occurs in generating CDR": "vCCF: Reports a transient alarm condition when failure occurs in generating CDR",
- "Reports a transient alarm condition when failure occurs in constructing CCR message from XDR": "vCCF: Reports a transient alarm condition when failure occurs in constructing CCR message from XDR",
- "Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file": "vCCF: Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file",
- "Reports an alarm condition when aggregation or correlation central database connection is lost": "vCCF: Reports an alarm condition when aggregation or correlation central database connection is lost",
- "Reports an alarm condition when a specific failure happens in database operations": "vCCF: Reports an alarm condition when a specific failure happens in database operations",
- "Reports an alarm condition when DB capacity has been consumed to critical threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to critical threshold",
- "Reports an alarm condition when DB capacity has been consumed to major threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to major threshold",
- "Reports an alarm condition when DB capacity has been consumed to minor threshold.": "vCCF: Reports an alarm condition when DB capacity has been consumed to minor threshold.",
- "Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem": "vCCF: Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem",
- "Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further",
- "Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further",
- "Reports an alarm condition when the ACR file loses some ACR records": "vCCF: Reports an alarm condition when the ACR file loses some ACR records",
- "Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further",
- "Reports an alarm condition when error occurs in processing CDR/ACR files": "vCCF: Reports an alarm condition when error occurs in processing CDR/ACR files",
- "Reports an alarm condition when CDR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to critical threshold",
- "Reports an alarm condition when CDR partition has been consumed to major threshold.": "vCCF: Reports an alarm condition when CDR partition has been consumed to major threshold.",
- "Reports an alarm condition when CDR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to minor threshold",
- "Reports an alarm condition when ACR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to critical threshold",
- "Reports an alarm condition when ACR partition has been consumed to major threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to major threshold",
- "Reports an alarm condition when ACR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to minor threshold",
- "Reports an alarm condition when CPU consumption reaches critical threshold": "vCCF: Reports an alarm condition when CPU consumption reaches critical threshold",
- "Reports an alarm condition when CPU consumption reaches major threshold": "vCCF: Reports an alarm condition when CPU consumption reaches major threshold",
- "Reports an alarm condition when CPU consumption reaches minor threshold": "vCCF: Reports an alarm condition when CPU consumption reaches minor threshold",
- "Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.": "vCCF: Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.",
- "CDR size exceed the platform capacity.": "vCCF: CDR size exceed the platform capacity.",
- "Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.",
- "Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.",
- "External Node of this Cluster is overload": "vCCF: External Node of this Cluster is overload",
- "bdb_high_latency": "vCCF-vDB: bdb_high_latency",
- "bdb_high_throughput": "vCCF-vDB: bdb_high_throughput",
- "bdb_size": "vCCF-vDB: bdb_size",
- "cluster_inconsistent_rl_sw": "vCCF-vDB: cluster_inconsistent_rl_sw",
- "cluster_node_remove_abort_failed": "vCCF-vDB: cluster_node_remove_abort_failed",
- "cluster_node_remove_failed": "vCCF-vDB: cluster_node_remove_failed",
- "cluster_ram_overcommit": "vCCF-vDB: cluster_ram_overcommit",
- "cluster_rebalance_failed": "vCCF-vDB: cluster_rebalance_failed",
- "cluster_too_few_nodes_for_replication": "vCCF-vDB: cluster_too_few_nodes_for_replication",
- "node_cpu_utilization": "vCCF-vDB: node_cpu_utilization",
- "node_ephemeral_storage": "vCCF-vDB: node_ephemeral_storage",
- "node_failed": "vCCF-vDB: node_failed",
- "node_memory": "vCCF-vDB: node_memory",
- "node_net_throughput": "vCCF-vDB: node_net_throughput",
- "node_offline_failed": "vCCF-vDB: node_offline_failed",
- "node_offline_abort_failed": "vCCF-vDB: node_offline_abort_failed",
- "node_online_failed": "vCCF-vDB: node_online_failed",
- "OAM NODE-<OAME-hostname> IS NOT ACTIVE ": "vCCF-vDB: OAM NODE-<OAME-hostname> IS NOT ACTIVE ",
- "LSS_asdaCommunicationFailure": "vCTS: LSS_asdaCommunicationFailure",
- "LSS_ccdbCommunicationFailure": "vCTS: LSS_ccdbCommunicationFailure",
- "LSS_cpiCTS3xxFailRate": "vCTS: LSS_cpiCTS3xxFailRate",
- "LSS_cpiCTS4xxFailRate": "vCTS: LSS_cpiCTS4xxFailRate",
- "LSS_cpiCTS5xxFailRate": "vCTS: LSS_cpiCTS5xxFailRate",
- "LSS_cpiCTS6xxFailRate": "vCTS: LSS_cpiCTS6xxFailRate",
- "LSS_cpiCTSSIPRetransmitInvite": "vCTS: LSS_cpiCTSSIPRetransmitInvite",
- "LSS_cpiCTSSIPRetransmitNonInvite": "vCTS: LSS_cpiCTSSIPRetransmitNonInvite",
- "LSS_glsInvalidCellId": "vCTS: LSS_glsInvalidCellId",
- "LSS_glsServerUnavailable": "vCTS: LSS_glsServerUnavailable",
- "LSS_hlrSyncConnection": "vCTS: LSS_hlrSyncConnection",
- "LSS_hlrSyncQueue": "vCTS: LSS_hlrSyncQueue",
- "LSS_lispBufferFullExternalLIG": "vCTS: LSS_lispBufferFullExternalLIG",
- "LSS_prdbConnectWithAlternateFailure": "vCTS: LSS_prdbConnectWithAlternateFailure",
- "LSS_prdbSyncDataToAlternateFailure": "vCTS: LSS_prdbSyncDataToAlternateFailure",
- "LSS_preAllocatedResourceOverload": "vCTS: LSS_preAllocatedResourceOverload",
- "LSS_prifSocketError": "vCTS: LSS_prifSocketError",
- "LSS_prsCallInstanceExceeded": "vCTS: LSS_prsCallInstanceExceeded",
- "LSS_prsCpuOverload": "vCTS: LSS_prsCpuOverload",
- "LSS_prsDatabaseMigrationFailure": "vCTS: LSS_prsDatabaseMigrationFailure",
- "LSS_prsFailureToConnectWithPRDB": "vCTS: LSS_prsFailureToConnectWithPRDB",
- "LSS_prsQueueExceeded": "vCTS: LSS_prsQueueExceeded",
- "LSS_smdiSocketError": "vCTS: LSS_smdiSocketError",
- "LSS_socketError": "vCTS: LSS_socketError",
- "LSS_softwareComponentDown": "vCTS: LSS_softwareComponentDown",
- "LSS_tlsInitError": "vCTS: LSS_tlsInitError",
- "LSS_usageOfSyncTable": "vCTS: LSS_usageOfSyncTable",
- "LSS_utHttpProxyConnectionDown ": "vCTS: LSS_utHttpProxyConnectionDown ",
- "LSS_wpifSocketError": "vCTS: LSS_wpifSocketError",
- "LSS_acrTemporaryBufferOverload": "vCTS: LSS_acrTemporaryBufferOverload",
- "LSS_adnsExtendedTTLcaching": "vCTS: LSS_adnsExtendedTTLcaching",
- "LSS_adnsQueryFailureCaching": "vCTS: LSS_adnsQueryFailureCaching",
- "LSS_adnsQueueCongestion": "vCTS: LSS_adnsQueueCongestion",
- "LSS_asdaRequestQueue": "vCTS: LSS_asdaRequestQueue",
- "LSS_capacityLicenseKeyExpiration": "vCTS: LSS_capacityLicenseKeyExpiration",
- "LSS_capacityLicenseKeyNearExpiration": "vCTS: LSS_capacityLicenseKeyNearExpiration",
- "LSS_capacityLicenseKeyValidationError": "vCTS: LSS_capacityLicenseKeyValidationError",
- "LSS_cardConnectionLost": "vCTS: LSS_cardConnectionLost",
- "LSS_cpiAlrmCritical": "vCTS: LSS_cpiAlrmCritical",
- "LSS_cpiAlrmMajor": "vCTS: LSS_cpiAlrmMajor",
- "LSS_cpiAlrmMinor": "vCTS: LSS_cpiAlrmMinor",
- "LSS_cpiAlrmWarning": "vCTS: LSS_cpiAlrmWarning",
- "LSS_cpiAsrtEsc": "vCTS: LSS_cpiAsrtEsc",
- "LSS_cpiAsrtNonEsc": "vCTS: LSS_cpiAsrtNonEsc",
- "LSS_cpiAsrtNonEscCritical": "vCTS: LSS_cpiAsrtNonEscCritical",
- "LSS_cpiAsrtNonEscMajor": "vCTS: LSS_cpiAsrtNonEscMajor",
- "LSS_cpiAsrtNonEscMinor": "vCTS: LSS_cpiAsrtNonEscMinor",
- "LSS_cpiAudErrCount": "vCTS: LSS_cpiAudErrCount",
- "LSS_cpiAudManAct": "vCTS: LSS_cpiAudManAct",
- "LSS_cpiAudNewEvent": "vCTS: LSS_cpiAudNewEvent",
- "LSS_cpiCompleteRateAlarm": "vCTS: LSS_cpiCompleteRateAlarm",
- "LSS_cpiDropMGAllocConnReq": "vCTS: LSS_cpiDropMGAllocConnReq",
- "LSS_cpiDropRateAlarm": "vCTS: LSS_cpiDropRateAlarm",
- "LSS_cpiExceptionService": "vCTS: LSS_cpiExceptionService",
- "LSS_cpiFailRateAlarm": "vCTS: LSS_cpiFailRateAlarm",
- "LSS_cpiFailSCTPFastRetransIncr": "vCTS: LSS_cpiFailSCTPFastRetransIncr",
- "LSS_cpiFailSCTPFastRetransRate": "vCTS: LSS_cpiFailSCTPFastRetransRate",
- "LSS_cpiFailSCTPSRTT1Incr": "vCTS: LSS_cpiFailSCTPSRTT1Incr",
- "LSS_cpiFailSCTPSRTT2Incr": "vCTS: LSS_cpiFailSCTPSRTT2Incr",
- "LSS_cpiFailSCTPT3RetransIncr": "vCTS: LSS_cpiFailSCTPT3RetransIncr",
- "LSS_cpiFailSCTPT3RetransRate": "vCTS: LSS_cpiFailSCTPT3RetransRate",
- "LSS_cpiFileSysUsage": "vCTS: LSS_cpiFileSysUsage",
- "LSS_cpiMemAllocFail": "vCTS: LSS_cpiMemAllocFail",
- "LSS_cpiNumOfLICDRDel": "vCTS: LSS_cpiNumOfLICDRDel",
- "LSS_cpiReinitServiceSelf": "vCTS: LSS_cpiReinitServiceSelf",
- "LSS_cpiSIPRetransmitInvite": "vCTS: LSS_cpiSIPRetransmitInvite",
- "LSS_cpiSIPRetransmitNonInvite": "vCTS: LSS_cpiSIPRetransmitNonInvite",
- "LSS_cpiSS7DropSCTPPktsRcvd": "vCTS: LSS_cpiSS7DropSCTPPktsRcvd",
- "LSS_cpiSS7FailSCTPFastRetransRate": "vCTS: LSS_cpiSS7FailSCTPFastRetransRate",
- "LSS_cpiStabilityAlarm": "vCTS: LSS_cpiStabilityAlarm",
- "LSS_cpuOverload": "vCTS: LSS_cpuOverload",
- "LSS_databaseConnectionLost": "vCTS: LSS_databaseConnectionLost",
- "LSS_databaseReplicationLinkDown": "vCTS: LSS_databaseReplicationLinkDown",
- "LSS_databaseSizeExhausted": "vCTS: LSS_databaseSizeExhausted",
- "LSS_dbHighCpuUtilization": "vCTS: LSS_dbHighCpuUtilization",
- "LSS_dbOffline": "vCTS: LSS_dbOffline",
- "LSS_dbStatusUnexpected": "vCTS: LSS_dbStatusUnexpected",
- "LSS_degradedResource": "vCTS: LSS_degradedResource",
- "LSS_degrow": "vCTS: LSS_degrow",
- "LSS_deviceServerCxnLost": "vCTS: LSS_deviceServerCxnLost",
- "LSS_diamLinkDown": "vCTS: LSS_diamLinkDown",
- "LSS_diamMaxClientsExceeded": "vCTS: LSS_diamMaxClientsExceeded",
- "LSS_dnsThreshold": "vCTS: LSS_dnsThreshold",
- "LSS_ethernetError": "vCTS: LSS_ethernetError",
- "LSS_ethernetLinkDown": "vCTS: LSS_ethernetLinkDown",
- "LSS_externalConnectivity": "vCTS: LSS_externalConnectivity",
- "LSS_featureLicenseExpiration": "vCTS: LSS_featureLicenseExpiration",
- "LSS_featureLicenseKeyNearExpiration": "vCTS: LSS_featureLicenseKeyNearExpiration",
- "LSS_featureLockValidationError": "vCTS: LSS_featureLockValidationError",
- "LSS_fqdnError": "vCTS: LSS_fqdnError",
- "LSS_fru": "vCTS: LSS_fru",
- "LSS_gatewayCongestion": "vCTS: LSS_gatewayCongestion",
- "LSS_gatewayForcedOOS": "vCTS: LSS_gatewayForcedOOS",
- "LSS_gatewayProvisioningError": "vCTS: LSS_gatewayProvisioningError",
- "LSS_gatewayUnreachable": "vCTS: LSS_gatewayUnreachable",
- "LSS_gatewayUnregistered": "vCTS: LSS_gatewayUnregistered",
- "LSS_globalParameterNotFound": "vCTS: LSS_globalParameterNotFound",
- "LSS_grow": "vCTS: LSS_grow",
- "LSS_h248MessageBufferDepletion": "vCTS: LSS_h248MessageBufferDepletion",
- "LSS_hostDown": "vCTS: LSS_hostDown",
- "LSS_hostReset": "vCTS: LSS_hostReset",
- "LSS_invalidGateway": "vCTS: LSS_invalidGateway",
- "LSS_iriLinkDown": "vCTS: LSS_iriLinkDown",
- "LSS_ldapServerConnectionLost": "vCTS: LSS_ldapServerConnectionLost",
- "LSS_llcDown": "vCTS: LSS_llcDown",
- "LSS_logicalLinkDown": "vCTS: LSS_logicalLinkDown",
- "LSS_logicalLinkNotFound": "vCTS: LSS_logicalLinkNotFound",
- "LSS_logRotateThreshold": "vCTS: LSS_logRotateThreshold",
- "LSS_memoryOverload": "vCTS: LSS_memoryOverload",
- "LSS_nodeConfigFailure": "vCTS: LSS_nodeConfigFailure",
- "LSS_nodeGroupOOS": "vCTS: LSS_nodeGroupOOS",
- "LSS_nodeOOS": "vCTS: LSS_nodeOOS",
- "LSS_nonCompliantFaultGroupMemberState": "vCTS: LSS_nonCompliantFaultGroupMemberState",
- "LSS_nonCsAddrChannelDepletion": "vCTS: LSS_nonCsAddrChannelDepletion",
- "LSS_numberOfTuplesInUse": "vCTS: LSS_numberOfTuplesInUse",
- "LSS_osSecInfoModificationDetected": "vCTS: LSS_osSecInfoModificationDetected",
- "LSS_osSecInformationMissing": "vCTS: LSS_osSecInformationMissing",
- "LSS_osSecUnexpectedInformation": "vCTS: LSS_osSecUnexpectedInformation",
- "LSS_pdnsMySqlReplication": "vCTS: LSS_pdnsMySqlReplication",
- "LSS_pktCorruptionDetectedViaRCCLANCheck": "vCTS: LSS_pktCorruptionDetectedViaRCCLANCheck",
- "LSS_platformCommandFailure": "vCTS: LSS_platformCommandFailure",
- "LSS_pmDataNotCollected": "vCTS: LSS_pmDataNotCollected",
- "LSS_processDown": "vCTS: LSS_processDown",
- "LSS_processNotStarted": "vCTS: LSS_processNotStarted",
- "LSS_provisioningInhibitedMode": "vCTS: LSS_provisioningInhibitedMode",
- "LSS_rccInhibitedMode": "vCTS: LSS_rccInhibitedMode",
- "LSS_remotedbLinkDown": "vCTS: LSS_remotedbLinkDown",
- "LSS_remoteQueryServerFailure": "vCTS: LSS_remoteQueryServerFailure",
- "LSS_restore": "vCTS: LSS_restore",
- "LSS_serviceCFGDataTimestampError": "vCTS: LSS_serviceCFGDataTimestampError",
- "LSS_serviceCommCxnLost": "vCTS: LSS_serviceCommCxnLost",
- "LSS_serviceOnewayCommunication": "vCTS: LSS_serviceOnewayCommunication",
- "LSS_sheddingOverload": "vCTS: LSS_sheddingOverload",
- "LSS_simxml": "vCTS: LSS_simxml",
- "LSS_sipLinkSetMaxQuarantineList": "vCTS: LSS_sipLinkSetMaxQuarantineList",
- "LSS_sipLinkSetUnavailable": "vCTS: LSS_sipLinkSetUnavailable",
- "LSS_sipLinkUnavailable": "vCTS: LSS_sipLinkUnavailable",
- "LSS_softwareAllocatedResourceOverload": "vCTS: LSS_softwareAllocatedResourceOverload",
- "LSS_softwareComponentStandbyNotReady": "vCTS: LSS_softwareComponentStandbyNotReady",
- "LSS_softwareLicense": "vCTS: LSS_softwareLicense",
- "LSS_svcdegrow": "vCTS: LSS_svcdegrow",
- "LSS_svcgrow": "vCTS: LSS_svcgrow",
- "LSS_swVersionMismatch": "vCTS: LSS_swVersionMismatch",
- "LSS_tftpDownloadCorrupt": "vCTS: LSS_tftpDownloadCorrupt",
- "LSS_timeStampValueOutOfSystemRange": "vCTS: LSS_timeStampValueOutOfSystemRange",
- "LSS_transactionHandlerBlockDepletion": "vCTS: LSS_transactionHandlerBlockDepletion",
- "LSS_upgrade": "vCTS: LSS_upgrade",
- "SYS_BackupFailure": "vCTS: SYS_BackupFailure",
- "SYS_Configuration": "vCTS: SYS_Configuration",
- "SYS_COTRecordTransferFailure": "vCTS: SYS_COTRecordTransferFailure",
- "SYS_CPM_USERDATA_INCONSITENCY": "vCTS: SYS_CPM_USERDATA_INCONSITENCY",
- "SYS_CPM_USERDATA_RESTORED": "vCTS: SYS_CPM_USERDATA_RESTORED",
- "SYS_EventQueueCapacity": "vCTS: SYS_EventQueueCapacity",
- "SYS_ICMPFailure": "vCTS: SYS_ICMPFailure",
- "SYS_IPsecConfig": "vCTS: SYS_IPsecConfig",
- "SYS_LinkDown": "vCTS: SYS_LinkDown",
- "SYS_NotifyDisabled": "vCTS: SYS_NotifyDisabled",
- "SYS_NotifyLocked": "vCTS: SYS_NotifyLocked",
- "SYS_NumTL1MeasThresh": "vCTS: SYS_NumTL1MeasThresh",
- "SYS_RADIUS_TO_LDAP_FAILURE": "vCTS: SYS_RADIUS_TO_LDAP_FAILURE",
- "SYS_ROOT_ACCESS_DENIED": "vCTS: SYS_ROOT_ACCESS_DENIED",
- "SYS_ROOT_FTP_VIOLATION": "vCTS: SYS_ROOT_FTP_VIOLATION",
- "SYS_ROOT_LOGIN_VIOLATION": "vCTS: SYS_ROOT_LOGIN_VIOLATION",
- "SYS_ROOT_SSH_LOGIN_VIOLATION": "vCTS: SYS_ROOT_SSH_LOGIN_VIOLATION",
- "SYS_SetupAAAFailure": "vCTS: SYS_SetupAAAFailure",
- "SYS_SNETrapOverload": "vCTS: SYS_SNETrapOverload",
- "SYS_SNMPAuthenticationFailure": "vCTS: SYS_SNMPAuthenticationFailure",
- "SYS_SNMPFailure": "vCTS: SYS_SNMPFailure",
- "SYS_SU_TO_ROOT_FAILURE": "vCTS: SYS_SU_TO_ROOT_FAILURE",
- "SYS_SYSTEMTrapOverload": "vCTS: SYS_SYSTEMTrapOverload",
- "SYS_ThresholdCrossed": "vCTS: SYS_ThresholdCrossed",
- "SYS_UndiscoveredObject": "vCTS: SYS_UndiscoveredObject",
- "SYS_WriteAAAFailure": "vCTS: SYS_WriteAAAFailure",
- "jnxSpaceDiskUsageRising": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRising",
- "jnxSpaceDiskUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRisingCleared",
- "jnxSpaceSwapUsageRising": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRising",
- "jnxSpaceSwapUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRisingCleared",
- "jnxSpaceCPULARising": "vDBE-EMS-Juniper: jnxSpaceCPULARising",
- "jnxSpaceCPULARisingCleared": "vDBE-EMS-Juniper: jnxSpaceCPULARisingCleared",
- "jnxSpaceWebpProxyProcessDown": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessDown",
- "jnxSpaceWebpProxyProcessUp": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessUp",
- "jnxSpaceNMAProcessDown": "vDBE-EMS-Juniper: jnxSpaceNMAProcessDown",
- "jnxSpaceNMAProcessUp": "vDBE-EMS-Juniper: jnxSpaceNMAProcessUp",
- "jnxSpaceJbossProcessDown": "vDBE-EMS-Juniper: jnxSpaceJbossProcessDown",
- "jnxSpaceJbossProcessUp": "vDBE-EMS-Juniper: jnxSpaceJbossProcessUp",
- "jnxSpaceMysqlProcessDown": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessDown",
- "jnxSpaceMysqlProcessUp": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessUp",
- "jnxSpacePostgresqlProcessDown": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessDown",
- "jnxSpacePostgresqlProcessUp": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessUp",
- "jnxSpaceWatchdogStopped": "vDBE-EMS-Juniper: jnxSpaceWatchdogStopped",
- "jnxSpaceWatchdogStarted": "vDBE-EMS-Juniper: jnxSpaceWatchdogStarted",
- "jnxSpaceSNAProcessDown": "vDBE-EMS-Juniper: jnxSpaceSNAProcessDown",
- "jnxSpaceSNAProcessUp": "vDBE-EMS-Juniper: jnxSpaceSNAProcessUp",
- "jnxSpaceNodeDown": "vDBE-EMS-Juniper: jnxSpaceNodeDown",
- "jnxSpaceNodeUp": "vDBE-EMS-Juniper: jnxSpaceNodeUp",
- "jnxSpaceNodeRemoval": "vDBE-EMS-Juniper: jnxSpaceNodeRemoval",
- "jnxCmCfgChange": "vDBE-Juniper: jnxCmCfgChange",
- "jnxCmRescueChange": "vDBE-Juniper: jnxCmRescueChange",
- "jnxEventTrap": "vDBE-Juniper: jnxEventTrap",
- "jnxJsFwAuthFailure": "vDBE-Juniper: jnxJsFwAuthFailure",
- "jnxJsFwAuthServiceUp": "vDBE-Juniper: jnxJsFwAuthServiceUp",
- "jnxJsFwAuthServiceDown": "vDBE-Juniper: jnxJsFwAuthServiceDown",
- "jnxJsFwAuthCapacityExceeded": "vDBE-Juniper: jnxJsFwAuthCapacityExceeded",
- "jnxJsIdpSignatureUpdate": "vDBE-Juniper: jnxJsIdpSignatureUpdate",
- "jnxJsIdpAttackLog": "vDBE-Juniper: jnxJsIdpAttackLog",
- "jnxJsSrcNatPoolThresholdStatus": "vDBE-Juniper: jnxJsSrcNatPoolThresholdStatus",
- "jnxJsNatRuleThresholdStatus": "vDBE-Juniper: jnxJsNatRuleThresholdStatus",
- "jnxJsScreenAttack": "vDBE-Juniper: jnxJsScreenAttack",
- "jnxJsScreenCfgChange": "vDBE-Juniper: jnxJsScreenCfgChange",
- "jnxJsAvPatternUpdateTrap": "vDBE-Juniper: jnxJsAvPatternUpdateTrap",
- "jnxJsChassisClusterSwitchover": "vDBE-Juniper: jnxJsChassisClusterSwitchover",
- "jnxJsChClusterIntfTrap": "vDBE-Juniper: jnxJsChClusterIntfTrap",
- "jnxJsChClusterSpuMismatchTrap": "vDBE-Juniper: jnxJsChClusterSpuMismatchTrap",
- "jnxJsChClusterWeightTrap": "vDBE-Juniper: jnxJsChClusterWeightTrap",
- "jnxLicenseGraceExpired": "vDBE-Juniper: jnxLicenseGraceExpired",
- "jnxLicenseGraceAboutToExpire": "vDBE-Juniper: jnxLicenseGraceAboutToExpire",
- "jnxLicenseAboutToExpire": "vDBE-Juniper: jnxLicenseAboutToExpire",
- "jnxLicenseInfringeCumulative": "vDBE-Juniper: jnxLicenseInfringeCumulative",
- "jnxLicenseInfringeSingle": "vDBE-Juniper: jnxLicenseInfringeSingle",
- "jnxNatAddrPoolThresholdStatus": "vDBE-Juniper: jnxNatAddrPoolThresholdStatus",
- "jnxSyslogTrap": "vDBE-Juniper: jnxSyslogTrap",
- "jnxAccessAuthServiceUp": "vDBE-Juniper: jnxAccessAuthServiceUp",
- "jnxAccessAuthServiceDown": "vDBE-Juniper: jnxAccessAuthServiceDown",
- "jnxAccessAuthServerDisabled": "vDBE-Juniper: jnxAccessAuthServerDisabled",
- "jnxAccessAuthServerEnabled": "vDBE-Juniper: jnxAccessAuthServerEnabled",
- "jnxAccessAuthAddressPoolHighThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolHighThreshold",
- "jnxAccessAuthAddressPoolAbateThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolAbateThreshold",
- "jnxAccessAuthAddressPoolOutOfAddresses": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfAddresses",
- "jnxAccessAuthAddressPoolOutOfMemory": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfMemory",
- "LEVEL_WARNING_CPU": "vMRF: LEVEL_WARNING_CPU",
- "LEVEL_MAJOR_CPU": "vMRF: LEVEL_MAJOR_CPU",
- "LEVEL_CRITICAL_CPU": "vMRF: LEVEL_CRITICAL_CPU",
- "LEVEL_WARNING_MEM": "vMRF: LEVEL_WARNING_MEM",
- "LEVEL_MAJOR_MEM": "vMRF: LEVEL_MAJOR_MEM",
- "LEVEL_CRITICAL_MEM": "vMRF: LEVEL_CRITICAL_MEM",
- "LEVEL_WARNING_DISK": "vMRF: LEVEL_WARNING_DISK",
- "LEVEL_MAJOR_DISK": "vMRF: LEVEL_MAJOR_DISK",
- "LEVEL_CRITICAL_DISK": "vMRF: LEVEL_CRITICAL_DISK",
- "LEVEL_WARNING_RTPBANDWIDTH": "vMRF: LEVEL_WARNING_RTPBANDWIDTH",
- "LEVEL_MAJOR_RTPBANDWIDTH": "vMRF: LEVEL_MAJOR_RTPBANDWIDTH",
- "LEVEL_CRITICAL_RTPBANDWIDTH": "vMRF: LEVEL_CRITICAL_RTPBANDWIDTH",
- "LEVEL_WARNING_RTPINPACKETLOSS": "vMRF: LEVEL_WARNING_RTPINPACKETLOSS",
- "LEVEL_MAJOR_RTPINPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPINPACKETLOSS",
- "LEVEL_CRITICAL_RTPINPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPINPACKETLOSS",
- "LEVEL_WARNING_RTPOUTPACKETLOSS": "vMRF: LEVEL_WARNING_RTPOUTPACKETLOSS",
- "LEVEL_MAJOR_RTPOUTPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPOUTPACKETLOSS",
- "LEVEL_CRITICAL_RTPOUTPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPOUTPACKETLOSS",
- "LEVEL_WARNING_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_WARNING_TCPLOSTRETRANSMITRATE",
- "LEVEL_MAJOR_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_MAJOR_TCPLOSTRETRANSMITRATE",
- "LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE",
- "LEVEL_WARNING_TCPLOSSFAILURERATE": "vMRF: LEVEL_WARNING_TCPLOSSFAILURERATE",
- "LEVEL_MAJOR_TCPLOSSFAILURERATE": "vMRF: LEVEL_MAJOR_TCPLOSSFAILURERATE",
- "LEVEL_CRITICAL_TCPLOSSFAILURERATE": "vMRF: LEVEL_CRITICAL_TCPLOSSFAILURERATE",
- "LEVEL_CRITICAL_RTPLINKDOWN": "vMRF: LEVEL_CRITICAL_RTPLINKDOWN",
- "TARGET_REACHABLE": "vMRF: TARGET_REACHABLE",
- "PUBLICATION_ERROR": "vMRF: PUBLICATION_ERROR",
- "REMOTE_SERVER_SYNCHRONIZATION_ERROR": "vMRF: REMOTE_SERVER_SYNCHRONIZATION_ERROR",
- "TRANSCODER_TOOL_EXEC_ERROR": "vMRF: TRANSCODER_TOOL_EXEC_ERROR",
- "CLIENT_SYNCHRONIZATION_ERROR": "vMRF: CLIENT_SYNCHRONIZATION_ERROR",
- "CLUSTER_UNREACHABLE": "vMRF: CLUSTER_UNREACHABLE",
- "REMOTE_NODE_OFFLINE": "vMRF: REMOTE_NODE_OFFLINE",
- "IPADDR_STOPPED": "vMRF: IPADDR_STOPPED",
- "MRFC_STOPPED": "vMRF: MRFC_STOPPED",
- "MNGT_STOPPED": "vMRF: MNGT_STOPPED",
- "IPADDR_STARTED": "vMRF: IPADDR_STARTED",
- "MRFC_STARTED": "vMRF: MRFC_STARTED",
- "MNGT_STARTED": "vMRF: MNGT_STARTED",
- "VOLATTACH_FAILED": "vMRF: VOLATTACH_FAILED",
- "VOLDETACH_FAILED": "vMRF: VOLDETACH_FAILED",
- "VOLDEL": "vMRF: VOLDEL",
- "VOLCORRUPT": "vMRF: VOLCORRUPT",
- "VOLFOREIGN": "vMRF: VOLFOREIGN",
- "ACTIVE_ALARM_TABLE_PURGE": "vMRF: ACTIVE_ALARM_TABLE_PURGE",
- "GENERIC_FORMER_STATELESS": "vMRF: GENERIC_FORMER_STATELESS",
- "GENERIC_FORMER_STATEFUL": "vMRF: GENERIC_FORMER_STATEFUL",
- "NO_MORE_ALARM_DESCRIPTION": "vMRF: NO_MORE_ALARM_DESCRIPTION",
- "SERVICE_PROCESS_ENDS": "vMRF: SERVICE_PROCESS_ENDS",
- "DEFENSE_STOPPED": "vMRF: DEFENSE_STOPPED",
- "USER_ACCOUNT_LOCKED": "vMRF: USER_ACCOUNT_LOCKED",
- "CONNECTION_SQL_NOT_ESTABLISHED": "vMRF: CONNECTION_SQL_NOT_ESTABLISHED",
- "FALSE_ALARM": "vMRF: FALSE_ALARM",
- "RADIUS SERVER HS": "vMRF: RADIUS SERVER HS",
- "DRM_PACKAGER_IS_NOT_AVAILABLE": "vMRF: DRM_PACKAGER_IS_NOT_AVAILABLE",
- "DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE": "vMRF: DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE",
- "ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE": "vMRF: ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE",
- "ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION": "vMRF: ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION",
- "PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND": "vMRF: PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND",
- "COULD_NOT_CONNECT_TO_PVNS_SERVER": "vMRF: COULD_NOT_CONNECT_TO_PVNS_SERVER",
- "HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED": "vMRF: HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED",
- "I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE": "vMRF: I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE",
- "ERROR_WHILE_REQUESTING_SDP_FILE": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE",
- "ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION",
- "NO_STREAMING_RESOURCES": "vMRF: NO_STREAMING_RESOURCES",
- "NO_STREAMING_MODULES_REGISTERED": "vMRF: NO_STREAMING_MODULES_REGISTERED",
- "SM_FAILURE": "vMRF: SM_FAILURE",
- "MISSING_FILE_OR_ENCODER": "vMRF: MISSING_FILE_OR_ENCODER",
- "INVALID_RANGE": "vMRF: INVALID_RANGE",
- "THRESHOLD_VALUE_EXCEEDED": "vMRF: THRESHOLD_VALUE_EXCEEDED",
- "TICKET_QUEUE_FULL": "vMRF: TICKET_QUEUE_FULL",
- "PARSING_INITIALIZATION_EXCEPTION": "vMRF: PARSING_INITIALIZATION_EXCEPTION",
- "CUSTOMERCARE_INTERNAL_EXCEPTION": "vMRF: CUSTOMERCARE_INTERNAL_EXCEPTION",
- "PARSING_EXCEPTION": "vMRF: PARSING_EXCEPTION",
- "I/O_PROBLEM": "vMRF: I/O_PROBLEM",
- "INEXISTENT_FILE_OR_FOLDER": "vMRF: INEXISTENT_FILE_OR_FOLDER",
- "FILE_NOT_IN_XML_FORMAT": "vMRF: FILE_NOT_IN_XML_FORMAT",
- "SERVICE_STATE_CHANGE": "vMRF: SERVICE_STATE_CHANGE",
- "MONITORED_FILE_UPDATE_ERROR": "vMRF: MONITORED_FILE_UPDATE_ERROR",
- "MONITORED_RPM_DELETED_ERROR": "vMRF: MONITORED_RPM_DELETED_ERROR",
- "MONITORED_RPM_ADDED_ERROR": "vMRF: MONITORED_RPM_ADDED_ERROR",
- "MONITORED_CHMOD_ERROR": "vMRF: MONITORED_CHMOD_ERROR",
- "MONITORED_CHOWN_ERROR": "vMRF: MONITORED_CHOWN_ERROR",
- "PASSWD_ROOT_ERROR": "vMRF: PASSWD_ROOT_ERROR",
- "PASSWD_ERROR": "vMRF: PASSWD_ERROR",
- "ROOTKIT_ERROR": "vMRF: ROOTKIT_ERROR",
- "STARTUP_ERR_UNDEFINED_PORT": "vMRF: STARTUP_ERR_UNDEFINED_PORT",
- "STARTUP_ERR_FAIL_FIND_HOSTNAME": "vMRF: STARTUP_ERR_FAIL_FIND_HOSTNAME",
- "STARTUP_ERR_CF_MISSING": "vMRF: STARTUP_ERR_CF_MISSING",
- "STARTUP_ERR_FAILED_TO_OPEN_CF": "vMRF: STARTUP_ERR_FAILED_TO_OPEN_CF",
- "STARTUP_ERR_FAILED_TO_BIND_PORT": "vMRF: STARTUP_ERR_FAILED_TO_BIND_PORT",
- "STARTUP_ERR_CFG_UNIT_MISSING": "vMRF: STARTUP_ERR_CFG_UNIT_MISSING",
- "MCTR_INVALID_CODEC_NAME": "vMRF: MCTR_INVALID_CODEC_NAME",
- "RTSP_SERVER_FAILURE": "vMRF: RTSP_SERVER_FAILURE",
- "RTSP_SERVER_QUARANTINE": "vMRF: RTSP_SERVER_QUARANTINE",
- "TRANSCODING_FAILURE": "vMRF: TRANSCODING_FAILURE",
- "FILE_CACHE_FAILURE": "vMRF: FILE_CACHE_FAILURE",
- "STARTUP_ERROR_INITIALIZATION_FAILED": "vMRF: STARTUP_ERROR_INITIALIZATION_FAILED",
- "CONFERENCE_FAILURE": "vMRF: CONFERENCE_FAILURE",
- "PLC_DEGRADATION_LOW": "vMRF: PLC_DEGRADATION_LOW",
- "PLC_DEGRADATION_MEDIUM": "vMRF: PLC_DEGRADATION_MEDIUM",
- "PLC_DEGRADATION_HIGH": "vMRF: PLC_DEGRADATION_HIGH",
- "AUDIO_RESYNCH_LOW": "vMRF: AUDIO_RESYNCH_LOW",
- "AUDIO_RESYNCH_MEDIUM": "vMRF: AUDIO_RESYNCH_MEDIUM",
- "AUDIO_RESYNCH_HIGH": "vMRF: AUDIO_RESYNCH_HIGH",
- "VIDEO_RESYNCH_LOW": "vMRF: VIDEO_RESYNCH_LOW",
- "VIDEO_RESYNCH_MEDIUM": "vMRF: VIDEO_RESYNCH_MEDIUM",
- "VIDEO_RESYNCH_HIGH": "vMRF: VIDEO_RESYNCH_HIGH",
- "PLAY_FAILURES_LOW": "vMRF: PLAY_FAILURES_LOW",
- "PLAY_FAILURES_MEDIUM": "vMRF: PLAY_FAILURES_MEDIUM",
- "PLAY_FAILURES_HIGH": "vMRF: PLAY_FAILURES_HIGH",
- "NOT_ENOUGH_FREE_CONFEREE": "vMRF: NOT_ENOUGH_FREE_CONFEREE",
- "NO_LONGER_FREE_CONFERENCE_ROOM": "vMRF: NO_LONGER_FREE_CONFERENCE_ROOM",
- "STARTUP_ERROR_FAIL_TO_READ_CF": "vMRF: STARTUP_ERROR_FAIL_TO_READ_CF",
- "STARTUP_ERROR_SIP_ADAPTER_INIT": "vMRF: STARTUP_ERROR_SIP_ADAPTER_INIT",
- "STARTUP_ERROR_MONITORING_INIT": "vMRF: STARTUP_ERROR_MONITORING_INIT",
- "REGISTER_ERROR_FAILURE": "vMRF: REGISTER_ERROR_FAILURE",
- "DRI_ERROR_FAILURE": "vMRF: DRI_ERROR_FAILURE",
- "STARTUP_ERROR_STACK_CONFIGURATION": "vMRF: STARTUP_ERROR_STACK_CONFIGURATION",
- "STARTUP_ERROR_CONF": "vMRF: STARTUP_ERROR_CONF",
- "STARTUP_ERROR_UNDEFINED_PORT": "vMRF: STARTUP_ERROR_UNDEFINED_PORT",
- "HOST_REMOVED": "vMRF: HOST_REMOVED",
- "INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED": "vMRF: INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED",
- "STARTUP_ERROR_STACK_CONF": "vMRF: STARTUP_ERROR_STACK_CONF",
- "STARTUP_ERROR_CONFIGURATION": "vMRF: STARTUP_ERROR_CONFIGURATION",
- "STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME": "vMRF: STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME",
- "LEVEL_WARNING_CALL": "vMRF: LEVEL_WARNING_CALL",
- "LEVEL_ALARM_MINOR_CALL": "vMRF: LEVEL_ALARM_MINOR_CALL",
- "LEVEL_ALARM_MAJOR_CALL": "vMRF: LEVEL_ALARM_MAJOR_CALL",
- "LEVEL_ALARM_MRFPoutOfService": "vMRF: LEVEL_ALARM_MRFPoutOfService",
- "MRFP_CALL_REJECTED_Threshold #1": "vMRF: MRFP_CALL_REJECTED_Threshold #1",
- "MRFP_CALL_REJECTED_Threshold #2": "vMRF: MRFP_CALL_REJECTED_Threshold #2",
- "MRFP_CALL_REJECTED_Threshold #3": "vMRF: MRFP_CALL_REJECTED_Threshold #3",
- "MRFP_CALL_RETRIED_Threshold #1": "vMRF: MRFP_CALL_RETRIED_Threshold #1",
- "MRFP_CALL_RETRIED_Threshold #2": "vMRF: MRFP_CALL_RETRIED_Threshold #2",
- "MRFP_CALL_RETRIED_Threshold #3": "vMRF: MRFP_CALL_RETRIED_Threshold #3",
- "STARTUP_PUB_FILE_NOT_PRESENT": "vMRF: STARTUP_PUB_FILE_NOT_PRESENT",
- "STARTUP_INF_FILE_NOT_PRESENT": "vMRF: STARTUP_INF_FILE_NOT_PRESENT",
- "STARTUP_LIC_FILE_NOT_PRESENT": "vMRF: STARTUP_LIC_FILE_NOT_PRESENT",
- "GENERIC_HARDWARE_PROBLEM": "vMRF: GENERIC_HARDWARE_PROBLEM",
- "HARD_DRIVE_PROBLEM": "vMRF: HARD_DRIVE_PROBLEM",
- "NETWORK_LINK_PROBLEM": "vMRF: NETWORK_LINK_PROBLEM",
- "POWER_SUPPLY_PROBLEM": "vMRF: POWER_SUPPLY_PROBLEM",
- "SMART_HARD_DRIVE_PROBLEM": "vMRF: SMART_HARD_DRIVE_PROBLEM",
- "STARTUP_ERROR": "vMRF: STARTUP_ERROR",
- "RESOURCE_NOT_ACCESSIBLE": "vMRF: RESOURCE_NOT_ACCESSIBLE",
- "RESOURCE_ACCESSIBLE": "vMRF: RESOURCE_ACCESSIBLE",
- "RESOURCE_FULL": "vMRF: RESOURCE_FULL",
- "DRI_ALARM": "vMRF: DRI_ALARM",
- "REGISTER_ERROR_CCF": "vMRF: REGISTER_ERROR_CCF",
- "REGISTER_ERROR_EXTERNAL": "vMRF: REGISTER_ERROR_EXTERNAL",
- "TIMEOUT_ERROR": "vMRF: TIMEOUT_ERROR",
- "VXML_ERROR": "vMRF: VXML_ERROR",
- "A Network Element is no longer available due to a connection failure": "vMVM: A Network Element is no longer available due to a connection failure",
- "A MetaSphere server is reporting a fault with the configuration of its connection to MetaView": "vMVM: A MetaSphere server is reporting a fault with the configuration of its connection to MetaView",
- "Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []": "vMVM: Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []",
- "Service Assurance Server <IP address> cannot be contacted": "vMVM: Service Assurance Server <IP address> cannot be contacted",
- "The primary MetaView Director has lost contact with the backup MetaView Director": "vMVM: The primary MetaView Director has lost contact with the backup MetaView Director",
- "The active server has lost connection to the standby": "vMVM: The active server has lost connection to the standby",
- "CrashCounter": "vprobes-vBE-Processing: CrashCounter",
- "IsAlive": "vprobes-vBE-Processing: IsAlive",
- "SwRestart": "vprobes-vLB: SwRestart",
- "Repeated exceptions have occurred.": "vSBC-Metaswitch: Repeated exceptions have occurred.",
- "A licensing limit is close to capacity.": "vSBC-Metaswitch: A licensing limit is close to capacity.",
- "One or more feature packs have been breached.": "vSBC-Metaswitch: One or more feature packs have been breached.",
- "The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.",
- "The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.",
- "The license on this Perimeta system will expire in less than 4 weeks.": "vSBC-Metaswitch: The license on this Perimeta system will expire in less than 4 weeks.",
- "A Perimeta blade has become unlicensed.": "vSBC-Metaswitch: A Perimeta blade has become unlicensed.",
- "Perimeta is licensed with a bypass certificate, which is valid until the time displayed.": "vSBC-Metaswitch: Perimeta is licensed with a bypass certificate, which is valid until the time displayed.",
- "The number of licensed instances exceeded a threshold of the licensed limit.": "vSBC-Metaswitch: The number of licensed instances exceeded a threshold of the licensed limit.",
- "The software token on the primary Distributed Capacity Manager will expire on the displayed date.": "vSBC-Metaswitch: The software token on the primary Distributed Capacity Manager will expire on the displayed date.",
- "A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.": "vSBC-Metaswitch: A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.",
- "An adjacency has voice quality alerts.": "vSBC-Metaswitch: An adjacency has voice quality alerts.",
- "The number of calls being audited is congested.": "vSBC-Metaswitch: The number of calls being audited is congested.",
- "Session Controller is rejecting calls because there is no valid active call policy set configured.": "vSBC-Metaswitch: Session Controller is rejecting calls because there is no valid active call policy set configured.",
- "A call policy set is inactive because it has been misconfigured.": "vSBC-Metaswitch: A call policy set is inactive because it has been misconfigured.",
- "Session Controller is inactive and rejecting calls.": "vSBC-Metaswitch: Session Controller is inactive and rejecting calls.",
- "Sources have breached minor or major blacklist thresholds.": "vSBC-Metaswitch: Sources have breached minor or major blacklist thresholds.",
- "Sources are blacklisted.": "vSBC-Metaswitch: Sources are blacklisted.",
- "The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.": "vSBC-Metaswitch: The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.",
- "A large number of downgrades and bans have been created as a result of blacklisting.": "vSBC-Metaswitch: A large number of downgrades and bans have been created as a result of blacklisting.",
- "Session Controller is unable to track further sources for blacklisting.": "vSBC-Metaswitch: Session Controller is unable to track further sources for blacklisting.",
- "A software protection switch was triggered.": "vSBC-Metaswitch: A software protection switch was triggered.",
- "A disk area on a processor blade is nearly full.": "vSBC-Metaswitch: A disk area on a processor blade is nearly full.",
- "Memory use is very high.": "vSBC-Metaswitch: Memory use is very high.",
- "The primary processor-blade has lost contact with the backup.": "vSBC-Metaswitch: The primary processor-blade has lost contact with the backup.",
- "An efix or patch has been applied to this system containing diagnostic versions of some software libraries.": "vSBC-Metaswitch: An efix or patch has been applied to this system containing diagnostic versions of some software libraries.",
- "A software protection switch (SPS) was triggered. Call and registration state was lost.": "vSBC-Metaswitch: A software protection switch (SPS) was triggered. Call and registration state was lost.",
- "The Ethernet Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Ethernet Heartbeat between primary and backup processors has failed.",
- "The Backplane Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Backplane Heartbeat between primary and backup processors has failed.",
- "A disk area on a processor blade reported an error.": "vSBC-Metaswitch: A disk area on a processor blade reported an error.",
- "The system is upgrading.": "vSBC-Metaswitch: The system is upgrading.",
- "An error with NTP functionality has been detected.": "vSBC-Metaswitch: An error with NTP functionality has been detected.",
- "One or more users are locked out of the system.": "vSBC-Metaswitch: One or more users are locked out of the system.",
- "The Craft Terminal user FTP directory on a processor blade is nearly full.": "vSBC-Metaswitch: The Craft Terminal user FTP directory on a processor blade is nearly full.",
- "A scheduled configuration snapshot has failed.": "vSBC-Metaswitch: A scheduled configuration snapshot has failed.",
- "The Session Controller is stopping as a result of administrator action.": "vSBC-Metaswitch: The Session Controller is stopping as a result of administrator action.",
- "A Session Controller processor blade is stopping as a result of administrator action.": "vSBC-Metaswitch: A Session Controller processor blade is stopping as a result of administrator action.",
- "An object could not be activated because its service address does not exist or is not fully specified.": "vSBC-Metaswitch: An object could not be activated because its service address does not exist or is not fully specified.",
- "The hardware on a processor does not meet minimum requirements.": "vSBC-Metaswitch: The hardware on a processor does not meet minimum requirements.",
- "The hardware expectations of the two processors are not the same.": "vSBC-Metaswitch: The hardware expectations of the two processors are not the same.",
- "The read speed of the main hard disk on a processor blade is too slow.": "vSBC-Metaswitch: The read speed of the main hard disk on a processor blade is too slow.",
- "An error has occurred reading from the hard disk on a processor blade.": "vSBC-Metaswitch: An error has occurred reading from the hard disk on a processor blade.",
- "Backup and primary processor-blades have an inconsistent system role.": "vSBC-Metaswitch: Backup and primary processor-blades have an inconsistent system role.",
- "Event: The system encountered a critical error and had to restart.": "vSBC-Metaswitch: Event: The system encountered a critical error and had to restart.",
- "Event: A RADIUS server failed to respond to an authentication request.": "vSBC-Metaswitch: Event: A RADIUS server failed to respond to an authentication request.",
- "Event: All configured RADIUS servers failed to respond to authentication requests.": "vSBC-Metaswitch: Event: All configured RADIUS servers failed to respond to authentication requests.",
- "Event: The number of CPUs has changed.": "vSBC-Metaswitch: Event: The number of CPUs has changed.",
- "Event: A user has been automatically deleted": "vSBC-Metaswitch: Event: A user has been automatically deleted",
- "The primary processor blade has lost management connectivity": "vSBC-Metaswitch: The primary processor blade has lost management connectivity",
- "Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.": "vSBC-Metaswitch: Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.",
- "Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.": "vSBC-Metaswitch: Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.",
- "Perimeta is attempting to resend cached billing records.": "vSBC-Metaswitch: Perimeta is attempting to resend cached billing records.",
- "The Rf billing cache is full.": "vSBC-Metaswitch: The Rf billing cache is full.",
- "The inbound call queue is congested.": "vSBC-Metaswitch: The inbound call queue is congested.",
- "A configured realm group contains realms that are not available to the SBC.": "vSBC-Metaswitch: A configured realm group contains realms that are not available to the SBC.",
- "An allowed MSC configuration is not connected to any physical MSCs.": "vSBC-Metaswitch: An allowed MSC configuration is not connected to any physical MSCs.",
- "An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.",
- "No suitable DNS records were found for a peer group's DNS hostname.": "vSBC-Metaswitch: No suitable DNS records were found for a peer group's DNS hostname.",
- "One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings": "vSBC-Metaswitch: One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings",
- "An adjacency has failed as its service network does not match the service network on its associated peer group.": "vSBC-Metaswitch: An adjacency has failed as its service network does not match the service network on its associated peer group.",
- "An adjacency has failed as its configured TLS certificate could not be found.": "vSBC-Metaswitch: An adjacency has failed as its configured TLS certificate could not be found.",
- "The caching function has not been initialized properly.": "vSBC-Metaswitch: The caching function has not been initialized properly.",
- "An adjacency has failed as the listen socket could not be created.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created.",
- "An adjacency is congested and may be rejecting calls.": "vSBC-Metaswitch: An adjacency is congested and may be rejecting calls.",
- "There is an issue with a Diameter peer.": "vSBC-Metaswitch: There is an issue with a Diameter peer.",
- "A realm is no longer reachable via any configured peers.": "vSBC-Metaswitch: A realm is no longer reachable via any configured peers.",
- "An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.": "vSBC-Metaswitch: An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.",
- "One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted": "vSBC-Metaswitch: One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted",
- "An interface ARP or NDP probe has failed.": "vSBC-Metaswitch: An interface ARP or NDP probe has failed.",
- "One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.",
- "One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.",
- "An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.": "vSBC-Metaswitch: An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.",
- "An interface device is running above the expected speed.": "vSBC-Metaswitch: An interface device is running above the expected speed.",
- "An IP address conflict has been detected on a management interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a management interface.",
- "An interface ICMP probe has failed.": "vSBC-Metaswitch: An interface ICMP probe has failed.",
- "A High-Availability link has detected a connectivity issue.": "vSBC-Metaswitch: A High-Availability link has detected a connectivity issue.",
- "An HA-link device is being reported as underspeed.": "vSBC-Metaswitch: An HA-link device is being reported as underspeed.",
- "An IP address conflict has been detected on a replication interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a replication interface.",
- "The Session Controller has started.": "vSBC-Metaswitch: The Session Controller has started.",
- "A statistic exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic exceeded its configured thresholds.",
- "One or more statistic has not been retrieved at least 3 times in a row.": "vSBC-Metaswitch: One or more statistic has not been retrieved at least 3 times in a row.",
- "A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.": "vSBC-Metaswitch: A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.",
- "A statistic has exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic has exceeded its configured thresholds.",
- "A Fallback Operation will soon be started": "vSBG: A Fallback Operation will soon be started",
- "BRM, Auto Export Backup Failed": "vSBG: BRM, Auto Export Backup Failed",
- "BRM, Scheduled Backup Failed": "vSBG: BRM, Scheduled Backup Failed",
- "COM SA, AMF Component Cleanup Failed": "vSBG: COM SA, AMF Component Cleanup Failed",
- "COM SA, AMF Component Instantiation Failed": "vSBG: COM SA, AMF Component Instantiation Failed",
- "COM SA, AMF SI Unassigned": "vSBG: COM SA, AMF SI Unassigned",
- "COM SA, CLM Cluster Node Unavailable": "vSBG: COM SA, CLM Cluster Node Unavailable",
- "COM SA, MDF Detected Model Error": "vSBG: COM SA, MDF Detected Model Error",
- "COM SA, Proxy Status of a Component Changed to Unproxied": "vSBG: COM SA, Proxy Status of a Component Changed to Unproxied",
- "File Management, Number of Files in FileGroup Exceeded": "vSBG: File Management, Number of Files in FileGroup Exceeded",
- "File Management, Max Size in FileGroup Exceeded": "vSBG: File Management, Max Size in FileGroup Exceeded",
- "LOTC Disk Replication Communication": "vSBG: LOTC Disk Replication Communication",
- "LOTC Disk Replication Consistency": "vSBG: LOTC Disk Replication Consistency",
- "LOTC Disk Usage": "vSBG: LOTC Disk Usage",
- "LOTC memory Usage": "vSBG: LOTC memory Usage",
- "LOTC Time Synchronization": "vSBG: LOTC Time Synchronization",
- "SBG, BGF Control Link Down": "vSBG: SBG, BGF Control Link Down",
- "SBG, BGF Control Link Disabled": "vSBG: SBG, BGF Control Link Disabled",
- "SBG, BGF Control Link Enabled": "vSBG: SBG, BGF Control Link Enabled",
- "SBG, BGF Control Link Remote Locked": "vSBG: SBG, BGF Control Link Remote Locked",
- "SBG, Charging Data Storage Maximum Records Reached": "vSBG: SBG, Charging Data Storage Maximum Records Reached",
- "SBG, Charging Server Rejects Charging Data": "vSBG: SBG, Charging Server Rejects Charging Data",
- "SBG, Excessive Packet Rate Detected ": "vSBG: SBG, Excessive Packet Rate Detected ",
- "SBG, High Amount of Malformed Packets Received": "vSBG: SBG, High Amount of Malformed Packets Received",
- "SBG, High Amount of STUN Packets Detected": "vSBG: SBG, High Amount of STUN Packets Detected",
- "SBG, High Amount of TCP SYN Packets Received": "vSBG: SBG, High Amount of TCP SYN Packets Received",
- "SBG, High Amount of UDP Packets Received ": "vSBG: SBG, High Amount of UDP Packets Received ",
- "SBG, IP Address Blocked Due to Excessive Packet Rate": "vSBG: SBG, IP Address Blocked Due to Excessive Packet Rate",
- "SBG, Lost Connectivity to Diameter Server": "vSBG: SBG, Lost Connectivity to Diameter Server",
- "SBG, Mated Pair out of Service": "vSBG: SBG, Mated Pair out of Service",
- "SBG, Network Unavailable for Media Handling": "vSBG: SBG, Network Unavailable for Media Handling",
- "SBG, Non-emergency Call Released to Free Resources for Emergency Call": "vSBG: SBG, Non-emergency Call Released to Free Resources for Emergency Call",
- "SBG, Not Enough Disk Space for Storing Charging Data": "vSBG: SBG, Not Enough Disk Space for Storing Charging Data",
- "SBG, Payload Mated Pair Failure": "vSBG: SBG, Payload Mated Pair Failure",
- "SBG, Payload Processor Failure": "vSBG: SBG, Payload Processor Failure",
- "SBG, Processor Overloaded": "vSBG: SBG, Processor Overloaded",
- "SBG, Registered User Set in Quarantine": "vSBG: SBG, Registered User Set in Quarantine",
- "SBG, Registration Contacts Exceed Configured Threshold": "vSBG: SBG, Registration Contacts Exceed Configured Threshold",
- "SBG, Sequential Restart Initiated": "vSBG: SBG, Sequential Restart Initiated",
- "SBG, SIP Abuse Detected": "vSBG: SBG, SIP Abuse Detected",
- "SBG, SIP Network Locked": "vSBG: SBG, SIP Network Locked",
- "SBG, SIP Next Hop Reachable": "vSBG: SBG, SIP Next Hop Reachable",
- "SBG, SIP Next Hop Unreachable": "vSBG: SBG, SIP Next Hop Unreachable",
- "SBG, SIP Request Rejected by Network Throttling": "vSBG: SBG, SIP Request Rejected by Network Throttling",
- "SBG, TLS Certificate Imported": "vSBG: SBG, TLS Certificate Imported",
- "SBG, Trace Recording Session Number Limit Reached": "vSBG: SBG, Trace Recording Session Number Limit Reached",
- "SBG, Trace Session Deactivated": "vSBG: SBG, Trace Session Deactivated",
- "SBG, Trace Session Times Out": "vSBG: SBG, Trace Session Times Out",
- "SBG, Unknown Media Type or Payload Type": "vSBG: SBG, Unknown Media Type or Payload Type"
-}