import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;\r
import org.onap.clamp.clds.model.sdc.SdcServiceDetail;\r
import org.onap.clamp.clds.model.sdc.SdcServiceInfo;\r
+import org.onap.clamp.clds.service.CldsService;\r
import org.onap.clamp.clds.util.CryptoUtils;\r
import org.onap.clamp.clds.util.LoggingUtils;\r
import org.springframework.beans.factory.annotation.Autowired;\r
* @param globalProps\r
* @param cldsServiceData\r
* @return\r
+ * @throws IOException\r
+ * In case of issues during the parsing of the Global Properties\r
*/\r
- public String createPropertiesObjectByUUID(String globalProps, CldsServiceData cldsServiceData) {\r
+ public String createPropertiesObjectByUUID(CldsServiceData cldsServiceData) throws IOException {\r
String totalPropsStr;\r
ObjectMapper mapper = new ObjectMapper();\r
- ObjectNode globalPropsJson;\r
+ ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(CldsService.GLOBAL_PROPERTIES_KEY);\r
if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {\r
// Objectnode to save all byservice, byvf , byvfc and byalarm nodes\r
ObjectNode byIdObjectNode = mapper.createObjectNode();\r
"alertDescription");\r
ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(mapper, allAlertDescriptions);\r
byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);\r
- globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
globalPropsJson.putPOJO("shared", byIdObjectNode);\r
logger.info("Global properties JSON created with SDC info:" + globalPropsJson);\r
- } else {\r
- /**\r
- * to create json with total properties when no serviceUUID passed\r
- */\r
- globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
}\r
totalPropsStr = globalPropsJson.toString();\r
return totalPropsStr;\r
}\r
\r
- private ObjectNode decodeGlobalProp(String globalProps, ObjectMapper mapper) {\r
- try {\r
- return (ObjectNode) mapper.readValue(globalProps, JsonNode.class);\r
- } catch (IOException e) {\r
- logger.error("Exception occurred during decoding of the global props, returning an empty objectNode", e);\r
- return mapper.createObjectNode();\r
- }\r
- }\r
-\r
/**\r
* Method to get alarm conditions/alert description from Service Data.\r
* \r
import org.onap.clamp.clds.util.LoggingUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
@Produce(uri = "direct:processSubmit")
private CamelProxy camelProxy;
protected static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger();
- @Autowired
- private ApplicationContext appContext;
private static final String RESOURCE_NAME = "clds-version.properties";
+ public static final String GLOBAL_PROPERTIES_KEY = "files.globalProperties";
@Value("${clamp.config.security.permission.type.cl:permission-type-cl}")
private String cldsPersmissionTypeCl;
@Value("${clamp.config.security.permission.type.cl.manage:permission-type-cl-manage}")
"update");
}
- @Value("${org.onap.clamp.config.files.globalClds:'classpath:/clds/globalClds.properties'}")
- private String globalClds;
- private Properties globalCldsProperties;
@Autowired
private CldsDao cldsDao;
@Autowired
@Path("/properties")
@Produces(MediaType.APPLICATION_JSON)
public String getSdcProperties() throws IOException {
- return createPropertiesObjectByUUID(getGlobalCldsString(), "{}");
+ return createPropertiesObjectByUUID("{}");
}
/**
// filter out VFs the user is not authorized for
cldsServiceData.filterVfs(this);
// format retrieved data into properties json
- String sdcProperties = sdcCatalogServices.createPropertiesObjectByUUID(getGlobalCldsString(), cldsServiceData);
+ String sdcProperties = sdcCatalogServices.createPropertiesObjectByUUID(cldsServiceData);
// audit log
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Get sdc properties by uuid success", this.getClass().getName());
return serviceNode.toString();
}
- private String createPropertiesObjectByUUID(String globalProps, String cldsResponseStr) throws IOException {
+ private String createPropertiesObjectByUUID(String cldsResponseStr) throws IOException {
ObjectMapper mapper = new ObjectMapper();
SdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, SdcServiceDetail.class);
- ObjectNode globalPropsJson = null;
+ ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY);
if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getUuid() != null) {
/**
* to create json with vf, alarm and locations
*/
ObjectNode emptyvfcobjectNode = createByVFCObjectNode(mapper, cldsSdcServiceDetail.getResources());
byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode);
- globalPropsJson = (ObjectNode) mapper.readValue(globalProps, JsonNode.class);
globalPropsJson.putPOJO("shared", byServiceBasicObjetNode);
logger.info("valuie of objNode: {}", globalPropsJson);
- } else {
- /**
- * to create json with total properties when no serviceUUID passed
- */
- globalPropsJson = (ObjectNode) mapper.readValue(globalProps, JsonNode.class);
}
return globalPropsJson.toString();
}
return model;
}
- private String getGlobalCldsString() {
- try {
- if (null == globalCldsProperties) {
- globalCldsProperties = new Properties();
- globalCldsProperties.load(appContext.getResource(globalClds).getInputStream());
- }
- return (String) globalCldsProperties.get("globalCldsProps");
- } catch (IOException e) {
- logger.error("Unable to load the globalClds due to an exception", e);
- throw new CldsConfigException("Unable to load the globalClds due to an exception", e);
- }
- }
-
private void checkForDuplicateServiceVf(String modelName, String modelPropText) throws IOException {
JsonNode modelJson = new ObjectMapper().readTree(modelPropText);
JsonNode globalNode = modelJson.get("global");
\r
org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties\r
org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json\r
-org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties\r
+clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json\r
org.onap.clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json\r
\r
# Properties for Clamp\r
+++ /dev/null
-###\r
-# ============LICENSE_START=======================================================\r
-# ONAP CLAMP\r
-# ================================================================================\r
-# Copyright (C) 2017 AT&T Intellectual Property. All rights\r
-# reserved.\r
-# ================================================================================\r
-# Licensed under the Apache License, Version 2.0 (the "License"); \r
-# you may not use this file except in compliance with the License. \r
-# You may obtain a copy of the License at\r
-# \r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-# \r
-# Unless required by applicable law or agreed to in writing, software \r
-# distributed under the License is distributed on an "AS IS" BASIS, \r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r
-# See the License for the specific language governing permissions and \r
-# limitations under the License.\r
-# ============LICENSE_END============================================\r
-# ===================================================================\r
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
-###\r
-\r
-globalCldsProps ={"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","eventName":{"vCPEvGMUXPacketLoss":"vCPEvGMUXPacketLoss","vLoadBalancer":"vLoadBalancer","vFirewallBroadcastPackets":"vFirewallBroadcastPackets"},"fieldPathM":{"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated":"receivedBroadcastPacketsAccumulated","$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta":"receivedDiscardedPacketsDelta"},"operator":{">":"GREATER",">=":"GREATER_OR_EQUAL","=":"EQUAL","<=":"LESS_OR_EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"},"controlLoopSchemaType":{"":"","VM":"VM","VNF":"VNF"},"closedLoopEventStatus":{"":"","ONSET":"ONSET","ABATED":"ABATED"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"DC1":"Data Center 1","DC2":"Data Center 2","DC3":"Data Center 3"}},"policy":{"pname":"0","timeout":345,"vnfRecipe":{"":"","restart":"Restart","rebuild":"Rebuild","migrate":"Migrate","healthCheck":"Health Check"},"enbRecipe":{"":"","reset":"Reset"},"maxRetries":"3","retryTimeLimit":180,"resource":{"vCTS":"vCTS","v3CDB":"v3CDB","vUDR":"vUDR","vCOM":"vCOM","vRAR":"vRAR","vLCS":"vLCS","vUDR-BE":"vUDR-BE","vDBE":"vDBE"},"parentPolicyConditions":{"Failure_Retries":"Failure: Max Retries Exceeded","Failure_Timeout":"Failure: Time Limit Exceeded","Failure_Guard":"Failure: Guard","Failure_Exception":"Failure: Exception","Failure":"Failure: Other","Success":"Success"}},"shared":{"byService":{"":{"vf":{"":""},"location":{"":""},"alarmCondition":{"":""}}},"byVf":{"":{"vfc":{"":""}}}}}
--- /dev/null
+{
+ "tca": {
+ "tname": "New_Set",
+ "tcaInt": "1",
+ "tcaVio": "1",
+ "eventName": {
+ "vCPEvGMUXPacketLoss": "vCPEvGMUXPacketLoss",
+ "vLoadBalancer": "vLoadBalancer",
+ "vFirewallBroadcastPackets": "vFirewallBroadcastPackets"
+ },
+ "fieldPathM": {
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated": "receivedBroadcastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta": "receivedDiscardedPacketsDelta"
+ },
+ "operator": {
+ ">": "GREATER",
+ ">=": "GREATER_OR_EQUAL",
+ "=": "EQUAL",
+ "<=": "LESS_OR_EQUAL",
+ "<": "LESS"
+ },
+ "opsPolicy": {
+ "POLICY_test_X": "POLICY_test_X",
+ "POLICY_test_Y": "POLICY_test_Y"
+ },
+ "controlLoopSchemaType": {
+ "": "",
+ "VM": "VM",
+ "VNF": "VNF"
+ },
+ "closedLoopEventStatus": {
+ "": "",
+ "ONSET": "ONSET",
+ "ABATED": "ABATED"
+ }
+ },
+ "global": {
+ "actionSet": {
+ "vnfRecipe": "VNF",
+ "enbRecipe": "eNodeB"
+ },
+ "location": {
+ "DC1": "Data Center 1",
+ "DC2": "Data Center 2",
+ "DC3": "Data Center 3"
+ }
+ },
+ "policy": {
+ "pname": "0",
+ "timeout": 345,
+ "vnfRecipe": {
+ "": "",
+ "restart": "Restart",
+ "rebuild": "Rebuild",
+ "migrate": "Migrate",
+ "healthCheck": "Health Check"
+ },
+ "enbRecipe": {
+ "": "",
+ "reset": "Reset"
+ },
+ "maxRetries": "3",
+ "retryTimeLimit": 180,
+ "resource": {
+ "vCTS": "vCTS",
+ "v3CDB": "v3CDB",
+ "vUDR": "vUDR",
+ "vCOM": "vCOM",
+ "vRAR": "vRAR",
+ "vLCS": "vLCS",
+ "vUDR-BE": "vUDR-BE",
+ "vDBE": "vDBE"
+ },
+ "parentPolicyConditions": {
+ "Failure_Retries": "Failure: Max Retries Exceeded",
+ "Failure_Timeout": "Failure: Time Limit Exceeded",
+ "Failure_Guard": "Failure: Guard",
+ "Failure_Exception": "Failure: Exception",
+ "Failure": "Failure: Other",
+ "Success": "Success"
+ }
+ },
+ "shared": {
+ "byService": {
+ "": {
+ "vf": {
+ "": ""
+ },
+ "location": {
+ "": ""
+ },
+ "alarmCondition": {
+ "": ""
+ }
+ }
+ },
+ "byVf": {
+ "": {
+ "vfc": {
+ "": ""
+ }
+ }
+ }
+ }
+}
\r
org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties\r
org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json\r
-org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties\r
+clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json\r
org.onap.clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json\r
\r
# Properties for Clamp\r
--- /dev/null
+{
+ "tca": {
+ "tname": "New_Set",
+ "tcaInt": "1",
+ "tcaVio": "1",
+ "eventName": {
+ "vCPEvGMUXPacketLoss": "vCPEvGMUXPacketLoss",
+ "vLoadBalancer": "vLoadBalancer",
+ "vFirewallBroadcastPackets": "vFirewallBroadcastPackets"
+ },
+ "fieldPathM": {
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated": "receivedBroadcastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta": "receivedDiscardedPacketsDelta"
+ },
+ "operator": {
+ ">": "GREATER",
+ ">=": "GREATER_OR_EQUAL",
+ "=": "EQUAL",
+ "<=": "LESS_OR_EQUAL",
+ "<": "LESS"
+ },
+ "opsPolicy": {
+ "POLICY_test_X": "POLICY_test_X",
+ "POLICY_test_Y": "POLICY_test_Y"
+ },
+ "controlLoopSchemaType": {
+ "": "",
+ "VM": "VM",
+ "VNF": "VNF"
+ },
+ "closedLoopEventStatus": {
+ "": "",
+ "ONSET": "ONSET",
+ "ABATED": "ABATED"
+ }
+ },
+ "global": {
+ "actionSet": {
+ "vnfRecipe": "VNF",
+ "enbRecipe": "eNodeB"
+ },
+ "location": {
+ "DC1": "Data Center 1",
+ "DC2": "Data Center 2",
+ "DC3": "Data Center 3"
+ }
+ },
+ "policy": {
+ "pname": "0",
+ "timeout": 345,
+ "vnfRecipe": {
+ "": "",
+ "restart": "Restart",
+ "rebuild": "Rebuild",
+ "migrate": "Migrate",
+ "healthCheck": "Health Check"
+ },
+ "enbRecipe": {
+ "": "",
+ "reset": "Reset"
+ },
+ "maxRetries": "3",
+ "retryTimeLimit": 180,
+ "resource": {
+ "vCTS": "vCTS",
+ "v3CDB": "v3CDB",
+ "vUDR": "vUDR",
+ "vCOM": "vCOM",
+ "vRAR": "vRAR",
+ "vLCS": "vLCS",
+ "vUDR-BE": "vUDR-BE",
+ "vDBE": "vDBE"
+ },
+ "parentPolicyConditions": {
+ "Failure_Retries": "Failure: Max Retries Exceeded",
+ "Failure_Timeout": "Failure: Time Limit Exceeded",
+ "Failure_Guard": "Failure: Guard",
+ "Failure_Exception": "Failure: Exception",
+ "Failure": "Failure: Other",
+ "Success": "Success"
+ }
+ },
+ "shared": {
+ "byService": {
+ "": {
+ "vf": {
+ "": ""
+ },
+ "location": {
+ "": ""
+ },
+ "alarmCondition": {
+ "": ""
+ }
+ }
+ },
+ "byVf": {
+ "": {
+ "vfc": {
+ "": ""
+ }
+ }
+ }
+ }
+}