aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/clamp/clds/client/PolicyClient.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/SdcReq.java79
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/SdcCommunicationException.java61
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsModel.java5
-rw-r--r--src/main/resources/application.properties8
-rw-r--r--src/main/resources/clds/clds-policy-config.properties22
-rw-r--r--src/main/resources/clds/clds-reference.properties36
7 files changed, 141 insertions, 74 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java
index 6095af155..22f215ccf 100644
--- a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java
+++ b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java
@@ -324,8 +324,8 @@ public class PolicyClient {
versions.add(version);
} catch (Exception e) {
// just print warning - if n;o policies, version may be null
- logger.warn("warning: failed to parse policyConfig.getPolicyVersion()="
- + policyConfig.getPolicyVersion());
+ logger.warn("Failed to parse due to an exception policyConfig.getPolicyVersion()="
+ + policyConfig.getPolicyVersion(), e);
}
}
Collections.sort(versions);
diff --git a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java
index 3c16ce60b..9c2ebcda1 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java
@@ -23,6 +23,17 @@
package org.onap.clamp.clds.client.req;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml;
+
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -35,6 +46,7 @@ import java.util.Map.Entry;
import org.apache.commons.codec.digest.DigestUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.clamp.clds.client.SdcCatalogServices;
+import org.onap.clamp.clds.exception.SdcCommunicationException;
import org.onap.clamp.clds.model.CldsSdcResource;
import org.onap.clamp.clds.model.CldsSdcServiceDetail;
import org.onap.clamp.clds.model.prop.Global;
@@ -43,17 +55,6 @@ import org.onap.clamp.clds.model.prop.StringMatch;
import org.onap.clamp.clds.model.prop.Tca;
import org.onap.clamp.clds.model.refprop.RefProp;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml;
-
/**
* Construct a Sdc request given CLDS objects.
*/
@@ -63,14 +64,14 @@ public class SdcReq {
/**
* Format the Blueprint from a Yaml
- *
+ *
* @param refProp
* The RefProp instance containing the Clds config
* @param prop
* The ModelProperties describing the clds model
* @param docText
* The Yaml file that must be converted
- *
+ *
* @return A String containing the BluePrint
* @throws JsonParseException
* In case of issues
@@ -253,37 +254,41 @@ public class SdcReq {
* @throws Exception
*/
public static List<String> getSdcReqUrlsList(ModelProperties prop, String baseUrl,
- SdcCatalogServices sdcCatalogServices, DelegateExecution execution) throws Exception {
+ SdcCatalogServices sdcCatalogServices, DelegateExecution execution) {
// TODO : refact and regroup with very similar code
List<String> urlList = new ArrayList<>();
- Global globalProps = prop.getGlobal();
- if (globalProps != null) {
- if (globalProps.getService() != null) {
- String serviceInvariantUUID = globalProps.getService();
- execution.setVariable("serviceInvariantUUID", serviceInvariantUUID);
- List<String> resourceVfList = globalProps.getResourceVf();
- String serviceUUID = sdcCatalogServices.getServiceUuidFromServiceInvariantId(serviceInvariantUUID);
- String sdcServicesInformation = sdcCatalogServices.getSdcServicesInformation(serviceUUID);
- CldsSdcServiceDetail CldsSdcServiceDetail = sdcCatalogServices
- .getCldsSdcServiceDetailFromJson(sdcServicesInformation);
- if (CldsSdcServiceDetail != null && resourceVfList != null) {
- List<CldsSdcResource> CldsSdcResourcesList = CldsSdcServiceDetail.getResources();
- if (CldsSdcResourcesList != null && CldsSdcResourcesList.size() > 0) {
- for (CldsSdcResource CldsSdcResource : CldsSdcResourcesList) {
- if (CldsSdcResource != null && CldsSdcResource.getResoucreType() != null
- && CldsSdcResource.getResoucreType().equalsIgnoreCase("VF")) {
- if (resourceVfList.contains(CldsSdcResource.getResourceInvariantUUID())) {
- String normalizedResourceInstanceName = normalizeResourceInstanceName(
- CldsSdcResource.getResourceInstanceName());
- String svcUrl = baseUrl + "/" + serviceUUID + "/resourceInstances/"
- + normalizedResourceInstanceName + "/artifacts";
- urlList.add(svcUrl);
+ try {
+ Global globalProps = prop.getGlobal();
+ if (globalProps != null) {
+ if (globalProps.getService() != null) {
+ String serviceInvariantUUID = globalProps.getService();
+ execution.setVariable("serviceInvariantUUID", serviceInvariantUUID);
+ List<String> resourceVfList = globalProps.getResourceVf();
+ String serviceUUID = sdcCatalogServices.getServiceUuidFromServiceInvariantId(serviceInvariantUUID);
+ String sdcServicesInformation = sdcCatalogServices.getSdcServicesInformation(serviceUUID);
+ CldsSdcServiceDetail CldsSdcServiceDetail = sdcCatalogServices
+ .getCldsSdcServiceDetailFromJson(sdcServicesInformation);
+ if (CldsSdcServiceDetail != null && resourceVfList != null) {
+ List<CldsSdcResource> CldsSdcResourcesList = CldsSdcServiceDetail.getResources();
+ if (CldsSdcResourcesList != null && CldsSdcResourcesList.size() > 0) {
+ for (CldsSdcResource CldsSdcResource : CldsSdcResourcesList) {
+ if (CldsSdcResource != null && CldsSdcResource.getResoucreType() != null
+ && CldsSdcResource.getResoucreType().equalsIgnoreCase("VF")) {
+ if (resourceVfList.contains(CldsSdcResource.getResourceInvariantUUID())) {
+ String normalizedResourceInstanceName = normalizeResourceInstanceName(
+ CldsSdcResource.getResourceInstanceName());
+ String svcUrl = baseUrl + "/" + serviceUUID + "/resourceInstances/"
+ + normalizedResourceInstanceName + "/artifacts";
+ urlList.add(svcUrl);
+ }
}
}
}
}
}
}
+ } catch (IOException e) {
+ throw new SdcCommunicationException("Exception occurred during the SDC communication",e);
}
return urlList;
}
@@ -358,7 +363,7 @@ public class SdcReq {
/**
* Method to get yaml/template properties value from json
- *
+ *
* @param docText
* @return
* @throws IOException
diff --git a/src/main/java/org/onap/clamp/clds/exception/SdcCommunicationException.java b/src/main/java/org/onap/clamp/clds/exception/SdcCommunicationException.java
new file mode 100644
index 000000000..429ab8dff
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/exception/SdcCommunicationException.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.exception;
+
+/**
+ * New exception to capture SDC communication errors.
+ *
+ */
+public class SdcCommunicationException extends RuntimeException {
+
+ /**
+ * Generated ID
+ */
+ private static final long serialVersionUID = 8452294782552680243L;
+
+ /**
+ * This constructor can be used to create a new SdcCommunicationException.
+ *
+ * @param message
+ * A string message detailing the problem
+ * @param e
+ * The exception sent by the code
+ */
+ public SdcCommunicationException(String message, Throwable e) {
+ super(message, e);
+ }
+
+ /**
+ * This constructor can be used to create a new SdcCommunicationException.
+ * 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 SdcCommunicationException(String message) {
+ super(message);
+ }
+
+}
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 a830f9380..7eac3d92a 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -300,8 +300,9 @@ public class CldsModel {
*/
public static CldsModel createUsingControlName(String fullControlName) {
if (fullControlName == null || fullControlName.length() < UUID_LENGTH) {
- throw new BadRequestException("closed loop id / control name length, " + fullControlName.length()
- + ", less than the minimum of: " + UUID_LENGTH);
+ throw new BadRequestException(
+ "closed loop id / control name length, " + (fullControlName != null ? fullControlName.length() : 0)
+ + ", less than the minimum of: " + UUID_LENGTH);
}
CldsModel model = new CldsModel();
model.setControlNamePrefix(fullControlName.substring(0, fullControlName.length() - UUID_LENGTH));
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 9ed7c6ede..d10b4f422 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -27,16 +27,16 @@ info.build.description=@project.description@
info.build.version=@project.version@
### Set the port for HTTP or HTTPS protocol (Controlled by Spring framework, only one at a time).
-### (See below for the parameter 'server.http.port' if you want to have both enabled)
+### (See below for the parameter 'server.http.port' if you want to have both enabled)
### To have only HTTP, keep the lines server.ssl.* commented
### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location
server.port=8080
-### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
+### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
#server.ssl.key-store=file:/tmp/mykey.jks
#server.ssl.key-store-password=pass
#server.ssl.key-password=pass
-### In order to be user friendly when HTTPS is enabled,
+### In order to be user friendly when HTTPS is enabled,
### you can add another HTTP port that will be automatically redirected to HTTPS
### by enabling this parameter (server.http.port) and set it to another port (80 or 8080, 8090, etc ...)
#server.http-to-https-redirection.port=8090
@@ -128,7 +128,7 @@ async.core.pool.size=10
async.max.pool.size=20
async.queue.capacity=500
-org.onap.clamp.config.dcae.url=http://localhost:9000/closedloop-dcae-services
+org.onap.clamp.config.dcae.url=http://dcae.api.simpledemo.openecomp.org:9000/closedloop-dcae-services
#GRM Edge endpoint details
service.name=ajsc6camundademo
diff --git a/src/main/resources/clds/clds-policy-config.properties b/src/main/resources/clds/clds-policy-config.properties
index 969410761..fa2634be2 100644
--- a/src/main/resources/clds/clds-policy-config.properties
+++ b/src/main/resources/clds/clds-policy-config.properties
@@ -5,25 +5,25 @@
# Copyright (C) 2017 AT&T Intellectual Property. All rights
# reserved.
# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
+# 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============================================
# ===================================================================
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
###
# Configuration Settings for Policy Engine Components
-PDP_URL1=https://localhost:8081/pdp/ , testpdp, alpha123
-PDP_URL2=https://localhost:8081/pdp/ , testpdp, alpha456
-PAP_URL=https://localhost:8081/pap/ , testpap, alpha123
+PDP_URL1=https://vm1.policy.simpledemo.openecomp.org:8081/pdp/ , testpdp, alpha123
+PDP_URL2=https://vm1.policy.simpledemo.openecomp.org:8081/pdp/ , testpdp, alpha456
+PAP_URL=https://vm1.policy.simpledemo.openecomp.org:8081/pap/ , testpap, alpha123
NOTIFICATION_TYPE=websocket
NOTIFICATION_UEB_SERVERS=localhost
NOTIFICATION_TOPIC=
diff --git a/src/main/resources/clds/clds-reference.properties b/src/main/resources/clds/clds-reference.properties
index e9718e483..df29279c9 100644
--- a/src/main/resources/clds/clds-reference.properties
+++ b/src/main/resources/clds/clds-reference.properties
@@ -5,23 +5,23 @@
# Copyright (C) 2017 AT&T Intellectual Property. All rights
# reserved.
# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
+# 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============================================
# ===================================================================
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
###
-#
+#
# Poperties for CLDS
#
#
@@ -34,7 +34,7 @@ dcae.decode.service_ids={"vUSP":["vUSP - vCTS"],"Trinity":["ASBGv TLS VNF","ASBG
#
sdc.template={}
sdc.decode.service_ids={}
-#
+#
#
# General Policy request properties
#
@@ -49,7 +49,7 @@ policy.op.policyNamePrefix=Config_BRMS_Param_
#
tca.template={"service":"MThresholdCrossingConfiguration","location":"Edge","uuid":"TestUUID","policyName":"???","description":"from clds","configName":"MThresholdCrossingConfiguration","templateVersion":"5.2.0.1","priority":"4","version":"5.2.0.1","policyScope":"resource=F5,service=vSCP,type=configuration,closedLoopControlName=vSCP_F5_Firewall_d925ed73-8231-4d02-9545-db4e101f88f8","content":{"$class": "com.att.ecomp.dcae.clamp.common.MThresholdCrossingConfiguration","domain":"measurementsForVfScaling","policyScope":"pnf=eNodeB;type=configuration","policyName":"policy.dcae.configuration","policyVersion":"1.0.0","subscriberContentType": "application/json","subscriberConsumerId": "c13","subscriberConsumerGroup": "OpenDCAE-c13","subscriberTimeoutMS": "-1","subscriberMessageLimit": "-1","subscriberPollingInterval": "20000","publisherContentType": "application/json","publisherMaxBatchSize": "10","publisherMaxRecoveryQueueSize": "100000","publisherPollingInterval": "20000","publisherAlertWindowingTime": "86400","signatures":[]}}
tca.signature.template={"nfNamingCode":"ENBE","target":"common_id","targetType":"eNodeB","useCaseName":"???","signatureName":"???","signatureUuid":"???","closedLoopControlName":"???","severity":"???","version":"1.0.2","maxInterval":1200,"minMessageViolations":4,"thresholds":[]}
-#
+#
# String Match MicroService Policy request build properties
#
# default
@@ -62,8 +62,8 @@ sm.sc.template={}
sm.rulegroup=true
# by service: vSCP
sm.rulegroup.vSCP=false
-#
-#
+#
+#
# Operational Policy request build properties
#
op.policyDescription=from clds
@@ -86,9 +86,9 @@ op.eNodeB.limit=2
op.eNodeB.period=10s
#
# Sdc service properties
-sdc.catalog.url=http://127.0.0.1:8080/sdc/v1/catalog/
-sdc.hostUrl=http://127.0.0.1:8080
-sdc.serviceUrl=http://127.0.0.1:8080/sdc/v1/catalog/services
+sdc.catalog.url=http://sdc.api.simpledemo.openecomp.org:8080/sdc/v1/catalog/
+sdc.hostUrl=http://sdc.api.simpledemo.openecomp.org:8080
+sdc.serviceUrl=http://sdc.api.simpledemo.openecomp.org:8080/sdc/v1/catalog/services
sdc.serviceUsername=test
sdc.servicePassword=123456
sdc.artifactLabel=blueprintclampcockpit
@@ -110,8 +110,8 @@ action.insert.test.event=false
CLDS_SERVICE_CACHE_MAX_SECONDS=5
#DCAE Inventory Url Properties
-DCAE_INVENTORY_URL = https://127.0.0.1:8080
+DCAE_INVENTORY_URL = https://dcae.api.simpledemo.openecomp.org:8080
#DCAE Dispatcher Url Properties
-DCAE_DISPATCHER_URL = https://127.0.0.1:8443
+DCAE_DISPATCHER_URL = https://dcae.api.simpledemo.openecomp.org:8443