aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Closset <cc697w@intl.att.com>2017-08-17 14:46:20 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-17 14:46:20 +0000
commit2b63090e2d2940b2ed4a4dcf143cda41b3dea122 (patch)
treed0653f5a49a1252c9ae36b9fec6b8362fd16fef5
parent4a779ce2a62073a7fac981e7fe27c2336fb4b1d0 (diff)
parentbe0219b3b7f239bc5bba6d659c223a267ec4c0f5 (diff)
Merge "Code improvement"
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/SdcReq.java1
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsModel.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java10
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java6
-rw-r--r--src/main/resources/META-INF/processes.xml8
-rw-r--r--src/main/resources/clds/globalClds.properties2
8 files changed, 41 insertions, 23 deletions
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 343391ebd..e5144bfe2 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
@@ -129,25 +129,26 @@ public class DcaeDispatcherServices {
*/
public String getOperationStatus(String statusUrl) throws Exception {
- String opStatus = null;
+ //Assigning processing status to monitor operation status further
+ String opStatus = "processing";
InputStream in = null;
try {
URL obj = new URL(statusUrl);
HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
conn.setRequestMethod("GET");
int responseCode = conn.getResponseCode();
- logger.debug("response code " + responseCode);
- in = conn.getInputStream();
- String res = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
- JSONParser parser = new JSONParser();
- Object obj0 = parser.parse(res);
- JSONObject jsonObj = (JSONObject) obj0;
- String operationType = (String) jsonObj.get("operationType");
- String status = (String) jsonObj.get("status");
- logger.debug("Operation Type " + operationType);
- logger.debug("Status " + status);
- opStatus = status;
-
+ logger.debug("Deployment operation status response code - " + responseCode);
+ if(responseCode == 200){
+ in = conn.getInputStream();
+ String res = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(res);
+ JSONObject jsonObj = (JSONObject) obj0;
+ String operationType = (String) jsonObj.get("operationType");
+ String status = (String) jsonObj.get("status");
+ logger.debug("Operation Type - " + operationType + ", Status " + status);
+ opStatus = status;
+ }
} catch (Exception e) {
logger.debug(e.getClass().getName() + " " + e.getMessage());
logger.debug(e.getMessage()
diff --git a/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java
index a009f06fd..df86977cd 100644
--- a/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/SdcCatalogServices.java
@@ -108,7 +108,7 @@ public class SdcCatalogServices {
} catch (Exception e) {
LoggingUtils.setResponseContext("900", "Get sdc services failed", this.getClass().getName());
LoggingUtils.setErrorContext("900", "Get sdc services error");
- logger.error("not able to get any service information from sdc for uuid:" + uuid);
+ logger.error("not able to get any service information from sdc for uuid:" + uuid + " , exception is - " + e.getMessage());
}
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setTargetContext("SDC", "Get Services");
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 8a31a3b95..08e196b7c 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
@@ -143,6 +143,7 @@ public class SdcReq {
// "closedLoopControlName":"ClosedLoop-FRWL-SIG-0538e6f2-8c1b-4656-9999-3501b3c59ad7",
configurationObjectNode.put("closedLoopControlName", prop.getControlName());
+ configurationObjectNode.put("messageReaderConsumerGroup", prop.getModelName());
configurationObjectNode.set("serviceConfigurations", serviceConf);
propsObject.put("deployment_JSON", deployJsonNode.toString());
String blueprint = yaml.dump(loadedYaml);
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 e34f47d98..59db9b580 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -243,17 +243,15 @@ public class CldsModel {
permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT);
break;
case CldsEvent.ACTION_UNDEPLOY:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY);
+ permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT);
break;
case CldsEvent.ACTION_DEPLOY:
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE,
- CldsEvent.ACTION_STOP);
+ permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
break;
case CldsEvent.ACTION_RESTART:
case CldsEvent.ACTION_UPDATE:
// for 1702 delete is not currently implemented
- permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
- CldsEvent.ACTION_UNDEPLOY);
+ permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP, CldsEvent.ACTION_UNDEPLOY);
break;
case CldsEvent.ACTION_DELETE:
if (getCurrentActionStateCd().equals(CldsEvent.ACTION_STATE_SENT)) {
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 aaeb03f60..509535c5b 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -32,6 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.ws.rs.Consumes;
@@ -916,7 +917,12 @@ public class CldsService extends SecureServiceBase {
String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId,
model.getTypeId());
String operationStatus = "processing";
+ long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10);
while (operationStatus.equalsIgnoreCase("processing")) {
+ //Break the loop if waiting for more than 10 mins
+ if(waitingTime < System.nanoTime()){
+ break;
+ }
operationStatus = dcaeDispatcherServices.getOperationStatus(createNewDeploymentStatusUrl);
}
if (operationStatus != null && operationStatus.equalsIgnoreCase("succeeded")) {
@@ -956,7 +962,11 @@ public class CldsService extends SecureServiceBase {
String operationStatusUndeployUrl = dcaeDispatcherServices.deleteExistingDeployment(model.getDeploymentId(),
model.getTypeId());
String operationStatus = "processing";
+ long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10);
while (operationStatus.equalsIgnoreCase("processing")) {
+ if(waitingTime < System.nanoTime()){
+ break;
+ }
operationStatus = dcaeDispatcherServices.getOperationStatus(operationStatusUndeployUrl);
}
if (operationStatus != null && operationStatus.equalsIgnoreCase("succeeded")) {
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 c47400689..8ceaa3d87 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -35,21 +35,21 @@ public class LoggingUtils {
/**
* Set request related logging variables in thread local data via MDC
- *
+ *
* @param service
* Service Name of API (ex. "PUT template")
* @param partner
* Partner name (client or user invoking API)
*/
public static void setRequestContext(String service, String partner) {
- MDC.put("RequestId", "clds-" + UUID.randomUUID().toString());
+ MDC.put("RequestId", UUID.randomUUID().toString());
MDC.put("ServiceName", service);
MDC.put("PartnerName", partner);
}
/**
* Set time related logging variables in thread local data via MDC
- *
+ *
* @param beginTimeStamp
* Start time
* @param endTimeStamp
diff --git a/src/main/resources/META-INF/processes.xml b/src/main/resources/META-INF/processes.xml
index fddc60d1b..bd3547dfc 100644
--- a/src/main/resources/META-INF/processes.xml
+++ b/src/main/resources/META-INF/processes.xml
@@ -33,5 +33,13 @@
<property name="isScanForProcessDefinitions">false</property>
</properties>
</process-archive>
+ <process-archive name="clds-process-archive">
+ <process-engine>default</process-engine>
+ <resource>bpmn/clds-process-action.bpmn</resource>
+ <properties>
+ <property name="isDeleteUponUndeploy">true</property>
+ <property name="isScanForProcessDefinitions">false</property>
+ </properties>
+ </process-archive>
</process-application>
diff --git a/src/main/resources/clds/globalClds.properties b/src/main/resources/clds/globalClds.properties
index 3402db324..f6607cb35 100644
--- a/src/main/resources/clds/globalClds.properties
+++ b/src/main/resources/clds/globalClds.properties
@@ -21,4 +21,4 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
###
-globalCldsProps ={"collector":{"topicPublishes":{"DCAE-COLLECTOR-UCSNMP":"DCAE-COLLECTOR-UCSNMP"}},"string_match":{"topicPublishes":{"DCAE-CL-EVENT":"DCAE-CL-EVENT"},"aaiMatchingFields":{"cloud-region.identity-url":"cloud-region.identity-url","complex.city":"complex.city","complex.physical-location-id":"complex.physical-location-id","complex.state":"complex.state","generic-vnf.service-id":"generic-vnf.service-id","generic-vnf.vnf-name":"generic-vnf.vnf-name","generic-vnf.vnf-type":"generic-vnf.vnf-type","tenant.tenant-id":"tenant.tenant-id","vserver.in-maint":"vserver.in-maint","vserver.is-closed-loop-disabled":"vserver.is-closed-loop-disabled","vserver.l-interface.interface-name":"vserver.l-interface.interface-name","vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address":"vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address","vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address":"vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address","vserver.l-interface.network-name":"vserver.l-interface.network-name","vserver.prov-status":"vserver.prov-status","vserver.selflink":"vserver.selflink","vserver.vserver-id":"vserver.vserver-id","vserver.vserver-name":"vserver.vserver-name"},"aaiSendFields":{"cloud-region.identity-url":"cloud-region.identity-url","complex.city":"complex.city","complex.physical-location-id":"complex.physical-location-id","complex.state":"complex.state","generic-vnf.service-id":"generic-vnf.service-id","generic-vnf.vnf-name":"generic-vnf.vnf-name","generic-vnf.vnf-type":"generic-vnf.vnf-type","tenant.tenant-id":"tenant.tenant-id","vserver.in-maint":"vserver.in-maint","vserver.is-closed-loop-disabled":"vserver.is-closed-loop-disabled","vserver.l-interface.interface-name":"vserver.l-interface.interface-name","vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address":"vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address","vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address":"vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address","vserver.l-interface.network-name":"vserver.l-interface.network-name","vserver.prov-status":"vserver.prov-status","vserver.selflink":"vserver.selflink","vserver.vserver-id":"vserver.vserver-id","vserver.vserver-name":"vserver.vserver-name"},"eventSourceType":{"f5BigIP":"f5BigIP","vSBG_Alarms":"vSBG_Alarms","vCTS_Alarms":"vCTS_Alarms"},"eventSeverity":{"NORMAL":"NORMAL","not-NORMAL":"not-NORMAL","OK":"OK","WARNING":"WARNING","MINOR":"MINOR","MAJOR":"MAJOR","CRITICAL":"CRITICAL"},"timeWindow":0,"ageLimit":1600,"outputEventName":{"":"","ONSET":"ONSET","ABATED":"ABATED"},"createClosedLoopEventId":{"Initial":"Initial","Close":"Close"}},"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","tcaSev":{"Normal":"Normal","Critical":"Critical","Major":"Major","Minor":"Minor","Warning":"Warning"},"fieldPath":{"FIELDPATH_test_1":"FIELDPATH_test_1","FIELDPATH_test_2":"FIELDPATH_test_2"},"operator":{">":"GREATER","=":"EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"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":{"":""}}}}} \ No newline at end of file
+globalCldsProps ={"collector":{"topicPublishes":{"DCAE-COLLECTOR-UCSNMP":"DCAE-COLLECTOR-UCSNMP"}},"string_match":{"topicPublishes":{"DCAE-CL-EVENT":"DCAE-CL-EVENT"},"aaiMatchingFields":{"cloud-region.identity-url":"cloud-region.identity-url","complex.city":"complex.city","complex.physical-location-id":"complex.physical-location-id","complex.state":"complex.state","generic-vnf.service-id":"generic-vnf.service-id","generic-vnf.vnf-name":"generic-vnf.vnf-name","generic-vnf.vnf-type":"generic-vnf.vnf-type","tenant.tenant-id":"tenant.tenant-id","vserver.in-maint":"vserver.in-maint","vserver.is-closed-loop-disabled":"vserver.is-closed-loop-disabled","vserver.l-interface.interface-name":"vserver.l-interface.interface-name","vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address":"vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address","vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address":"vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address","vserver.l-interface.network-name":"vserver.l-interface.network-name","vserver.prov-status":"vserver.prov-status","vserver.selflink":"vserver.selflink","vserver.vserver-id":"vserver.vserver-id","vserver.vserver-name":"vserver.vserver-name"},"aaiSendFields":{"cloud-region.identity-url":"cloud-region.identity-url","complex.city":"complex.city","complex.physical-location-id":"complex.physical-location-id","complex.state":"complex.state","generic-vnf.service-id":"generic-vnf.service-id","generic-vnf.vnf-name":"generic-vnf.vnf-name","generic-vnf.vnf-type":"generic-vnf.vnf-type","tenant.tenant-id":"tenant.tenant-id","vserver.in-maint":"vserver.in-maint","vserver.is-closed-loop-disabled":"vserver.is-closed-loop-disabled","vserver.l-interface.interface-name":"vserver.l-interface.interface-name","vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address":"vserver.l-interface.l3-interface-ipv4-address-list.l3-inteface-ipv4-address","vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address":"vserver.l-interface.l3-interface-ipv6-address-list.l3-inteface-ipv6-address","vserver.l-interface.network-name":"vserver.l-interface.network-name","vserver.prov-status":"vserver.prov-status","vserver.selflink":"vserver.selflink","vserver.vserver-id":"vserver.vserver-id","vserver.vserver-name":"vserver.vserver-name"},"eventSourceType":{"f5BigIP":"f5BigIP","vSBG_Alarms":"vSBG_Alarms","vCTS_Alarms":"vCTS_Alarms"},"eventSeverity":{"NORMAL":"NORMAL","not-NORMAL":"not-NORMAL","OK":"OK","WARNING":"WARNING","MINOR":"MINOR","MAJOR":"MAJOR","CRITICAL":"CRITICAL"},"timeWindow":0,"ageLimit":1600,"outputEventName":{"":"","ONSET":"ONSET","ABATED":"ABATED"},"createClosedLoopEventId":{"Initial":"Initial","Close":"Close"}},"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","tcaSev":{"NORMAL":"NORMAL","CRITICAL":"CRITICAL","MAJOR":"MAJOR","MINOR":"MINOR","WARNING":"WARNING"},"fieldPath":{"FIELDPATH_test_1":"FIELDPATH_test_1","FIELDPATH_test_2":"FIELDPATH_test_2"},"operator":{">":"GREATER","=":"EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"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":{"":""}}}}} \ No newline at end of file