summaryrefslogtreecommitdiffstats
path: root/src/main/resources
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-05-23 17:34:07 +0200
committersebdet <sebastien.determe@intl.att.com>2019-06-05 11:05:35 +0200
commit09bc8450b2b0c4f60eb4a241efc548d13c5c9912 (patch)
treeaddd899e38e02946a6dfa3997b7a43264bd0276a /src/main/resources
parentc7b7368b08fa4e75919d6f7282dee526ccedf398 (diff)
Rework the loop state
Rework the state loop so there is no bug in the loop state anymore, now the components are scanned + upgrade to 4.0.4 Issue-ID: CLAMP-384 Change-Id: If7649238ee52864c84bfb9b6b8471d1738752e29 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/META-INF/resources/designer/modeler/dist/index.html8
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js75
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/app.js28
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/propertyController.js30
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml64
-rw-r--r--src/main/resources/clds/camel/routes/dcae-flows.xml187
-rw-r--r--src/main/resources/clds/camel/routes/flexible-flow.xml638
-rw-r--r--src/main/resources/clds/camel/routes/loop-flows.xml250
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml476
-rw-r--r--src/main/resources/clds/camel/routes/utils-flows.xml17
10 files changed, 992 insertions, 781 deletions
diff --git a/src/main/resources/META-INF/resources/designer/modeler/dist/index.html b/src/main/resources/META-INF/resources/designer/modeler/dist/index.html
index ab337de8f..cd7d6668b 100644
--- a/src/main/resources/META-INF/resources/designer/modeler/dist/index.html
+++ b/src/main/resources/META-INF/resources/designer/modeler/dist/index.html
@@ -59,15 +59,17 @@
<thead>
<tr>
<th><span align="left" class="text">Date</span></th>
- <th><span align="center" class="text">Type</span></th>
+ <th><span align="left" class="text">Type</span></th>
+ <th><span align="left" class="text">Component</span></th>
<th><span align="right" class="text">Log</span></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in loop_logs" ng-class="{reverse: reverse}">
- <td width="20%">{{log.logInstant}}</td>
+ <td width="10%">{{log.logInstant}}</td>
<td width="10%" ng-class="log.logType">{{log.logType}}</td>
- <td width="70">{{log.message}}</td>
+ <td width="10%">{{log.logComponent}}</td>
+ <td width="70%">{{log.message}}</td>
</tr>
</tbody>
</table>
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
index 0cc5c38f3..2b27a7fd5 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -41,32 +41,8 @@ app
ToscaModelWindow();
}
}
- this.toggleDeploy = function(uiAction, modelName) {
- var svcAction = uiAction.toLowerCase();
- var deployUrl = "/restservices/clds/v2/loop/" + svcAction + "Loop/" + modelName;
- var def = $q.defer();
- var sets = [];
- $http.put(deployUrl).success(
- function(data) {
- def.resolve(data);
- alertService.alertMessage("Action Successful: " + svcAction, 1)
- // update deploymentID, lastUpdatedStatus
- setLastComputedState(data.lastComputedState);
- setDeploymentStatusURL(data.dcaeDeploymentStatusUrl);
- setDeploymentID(data.dcaeDeploymentId);
- setStatus(data.lastComputedState);
- enableDisableMenuOptions();
- }).error(
- function(data) {
- def.resolve(data);
- alertService.alertMessage("Action Failure: " + svcAction, 2);
- def.reject(svcAction + " not successful");
- });
- return def.promise;
- }
this.getModel = function(modelName) {
var def = $q.defer();
- var sets = [];
var svcUrl = "/restservices/clds/v2/loop/" + modelName;
$http.get(svcUrl).success(function(data) {
cl_props = data;
@@ -79,7 +55,6 @@ app
};
this.getSavedModel = function() {
var def = $q.defer();
- var sets = [];
var svcUrl = "/restservices/clds/v2/loop/getAllNames";
$http.get(svcUrl).success(function(data) {
@@ -92,7 +67,6 @@ app
};
this.processAction = function(uiAction, modelName) {
var def = $q.defer();
- var sets = [];
var svcAction = uiAction.toLowerCase();
var svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + modelName;
@@ -100,10 +74,6 @@ app
function(data) {
def.resolve(data);
alertService.alertMessage("Action Successful: " + svcAction, 1)
- // update deploymentID, lastUpdatedStatus
- setLastComputedState(data.lastComputedState);
- setDeploymentStatusURL(data.dcaeDeploymentStatusUrl);
- setDeploymentID(data.dcaeDeploymentId);
}).error(
function(data) {
def.resolve(data);
@@ -116,7 +86,6 @@ app
this.manageAction = function(modelName, typeId, typeName) {
var def = $q.defer();
- var sets = [];
var config = {
url : "/restservices/clds/v1/clds/getDispatcherInfo",
method : "GET",
@@ -143,37 +112,34 @@ app
};
this.refreshStatus = function(modelName) {
var def = $q.defer();
- var sets = [];
var svcUrl = "/restservices/clds/v2/loop/getstatus/" + modelName;
$http.get(svcUrl).success(function(data) {
+ cl_props = data;
setStatus(data.lastComputedState);
def.resolve(data);
}).error(function(data) {
def.reject("Refresh Status not successful");
});
return def.promise;
- enableDisableMenuOptions();
}
function setStatus(status) {
// apply color to status
var statusColor = 'white';
if (status.trim() === "DESIGN") {
statusColor = 'gray'
- } else if (status.trim() === "DISTRIBUTED") {
- statusColor = 'blue'
} else if (status.trim() === "SUBMITTED") {
+ statusColor = 'blue'
+ } else if (status.trim() === "DEPLOYED") {
+ statusColor = 'blue'
+ } else if (status.trim() === "RUNNING") {
statusColor = 'green'
} else if (status.trim() === "STOPPED") {
- statusColor = 'red'
- } else if (status.trim() === "DELETING") {
- statusColor = 'pink'
- } else if (status.trim() === "ERROR") {
statusColor = 'orange'
- } else if (status.trim() === "UNKNOWN") {
- statusColor = 'blue'
- } else {
- statusColor = null;
- }
+ } else if (status.trim() === "IN_ERROR") {
+ statusColor = 'red'
+ } else if (status.trim() === "WAITING") {
+ statusColor = 'greenyellow'
+ }
var statusMsg = '<span style="background-color:'
+ statusColor
+ ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;">&nbsp;&nbsp;&nbsp;'
@@ -185,6 +151,22 @@ app
.append(
'<span id="status_clds" style="position: absolute; left: 61%;top: 151px; font-size:20px;">Status: '
+ statusMsg + '</span>');
+
+ var statusTable = '<table id="status_components_table" style="width:100%"><tr><th><span align="left" class="text">Component</span></th><th><span align="center" class="text">State</span></th><th><span align="right" class="text">Description</span></th></tr>';
+
+ $.each(cl_props['components'], function(componentIndex, componentValue) {
+ statusTable+='<tr><td>'+componentIndex+'</td>';
+ statusTable+='<td>'+componentValue['componentState']['stateName']+'</td>';
+ statusTable+='<td>'+componentValue['componentState']['description']+'</td></tr>';
+ });
+ statusTable+= '</table>';
+ if ($("#status_components").length >= 1)
+ $("#status_components").remove();
+ $("#activity_modeler")
+ .append(
+ '<span id="status_components" style="position: absolute; left: 61%;top: 191px; font-size:10px;">'
+ + statusTable + '</span>');
+
}
function manageCLImage(modelName) {
getModelImage(modelName).then(function(pars) {
@@ -203,13 +185,12 @@ app
}, function(data) {
});
}
- enableDisableMenuOptions = function() {
+ function enableDisableMenuOptions () {
enableDefaultMenu();
enableAllActionMenu();
}
- getModelImage = function(modelName) {
+ function getModelImage(modelName) {
var def = $q.defer();
- var sets = [];
var svcUrl = "/restservices/clds/v2/loop/svgRepresentation/" + modelName;
$http.get(svcUrl).success(function(data) {
def.resolve(data);
diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js
index 5597bd992..7dda84799 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/app.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/app.js
@@ -388,7 +388,7 @@ function($scope, $rootScope, $timeout, dialogs) {
};
$scope.propertyExplorerErrorMessage = function(msg) {
- var dlg = dialogs.notify('Error', msg);
+ dialogs.notify('Error', msg);
}
$scope.activityModelling = function() {
@@ -505,7 +505,8 @@ function($scope, $rootScope, $timeout, dialogs) {
cldsModelService.processAction(uiAction, modelName).then(function(pars) {
console.log("cldsPerformAction: pars=" + pars);
- cldsModelService.getModel(modelName).then(function(pars) {
+ cldsModelService.refreshStatus(modelName).then(function(pars) {
+ console.log("refreshStatus: pars=" + pars);
$rootScope.refreshLoopLog();
}, function(data) {
});
@@ -514,9 +515,10 @@ function($scope, $rootScope, $timeout, dialogs) {
};
$scope.refreshStatus = function() {
var modelName = selected_model;
- console.log("refreStatus modelName=" + modelName);
+ console.log("refreshStatus modelName=" + modelName);
cldsModelService.refreshStatus(modelName).then(function(pars) {
- console.log("refreStatus: pars=" + pars);
+ console.log("refreshStatus: pars=" + pars);
+ $rootScope.refreshLoopLog();
}, function(data) {
});
@@ -547,7 +549,7 @@ function($scope, $rootScope, $timeout, dialogs) {
'Are you sure you want to deploy the closed loop?');
confirm.result.then(function() {
- cldsToggleDeploy("deploy");
+ $scope.cldsPerformAction("deploy");
});
});
};
@@ -557,24 +559,12 @@ function($scope, $rootScope, $timeout, dialogs) {
+ uiAction.toLowerCase() + ' the closed loop?');
dlg.result.then(function(btn) {
- cldsToggleDeploy(uiAction.toLowerCase());
+ $scope.cldsPerformAction(uiAction.toLowerCase());
}, function(btn) {
});
};
- function cldsToggleDeploy(uiAction) {
- console.log("cldsPerformAction: " + uiAction + " modelName="
- + selected_model);
- cldsModelService.toggleDeploy(uiAction, selected_model).then(
- function(pars) {
- cldsModelService.getModel(selected_model).then(function(pars) {
- $rootScope.refreshLoopLog();
- }, function(data) {
- });
- }, function(data) {
- });
-
- }
+
$scope.ToscaModelWindow = function (tosca_model) {
var dlg = dialogs.create('partials/portfolios/tosca_model_properties.html','ToscaModelCtrl',{closable:true,draggable:true},{size:'lg',keyboard: true,backdrop: 'static',windowClass: 'my-class'});
diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
index a8aa83c06..0323529ee 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
@@ -91,30 +91,6 @@ function getMsUI(type) {
return null;
}
-function getLastUpdatedStatus() {
- return cl_props["lastComputedState"];
-}
-
-function setLastComputedState(status) {
- cl_props["lastComputedState"] = status;
-}
-
-function getDeploymentID() {
- return cl_props["dcaeDeploymentId"];
-}
-
-function setDeploymentID(deploymentId) {
- cl_props["dcaeDeploymentId"] = deploymentId;
-}
-
-function getDeploymentStatusURL() {
- return cl_props["dcaeDeploymentStatusUrl"];
-}
-
-function setDeploymentStatusURL(deploymentStatusURL) {
- cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL;
-}
-
function getResourceDetailsVfProperty() {
return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"];
}
@@ -127,4 +103,8 @@ function getLoopLogsArray() {
return cl_props.loopLogs;
}
-module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsVfProperty,getResourceDetailsVfModuleProperty };
+function getComponentStates() {
+ return cl_props.components;
+}
+
+module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getResourceDetailsVfProperty,getResourceDetailsVfModuleProperty };
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index da856e947..101449492 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -193,7 +193,7 @@
</route>
</post>
<put
- uri="/v2/loop/deployLoop/{loopName}"
+ uri="/v2/loop/deploy/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
@@ -212,27 +212,8 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE DEPLOY request','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:get-status-from-policy" />
- <to uri="direct:get-status-from-dcae" />
- <log
- loggingLevel="INFO"
- message="Policy deployment status: ${exchangeProperty[policyStatus]}"></log>
- <choice>
- <when>
- <simple> ${exchangeProperty[policyStatus]} == 'SUBMITTED' and
- ${exchangeProperty[dcaeStatus]} == 'NOT_DEPLOYED'
- </simple>
- <to uri="direct:deploy-loop" />
- </when>
- <otherwise>
- <log
- loggingLevel="INFO"
- message="POLICY status ${exchangeProperty[policyStatus]}/DCAE status ${exchangeProperty[dcaeStatus]}, DCAE deployment will be started anyway" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('POLICY status ${exchangeProperty[policyStatus]}/DCAE status ${exchangeProperty[dcaeStatus]}, DCAE deployment will be started anyway','ERROR',${exchangeProperty[loopObject]})" />
- <to uri="direct:deploy-loop" />
- </otherwise>
- </choice>
+ <to uri="direct:deploy-loop" />
+
<log
loggingLevel="INFO"
message="DEPLOY request successfully executed for loop: ${header.loopName}" />
@@ -257,7 +238,7 @@
</route>
</put>
<put
- uri="/v2/loop/undeployLoop/{loopName}"
+ uri="/v2/loop/undeploy/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
@@ -275,21 +256,8 @@
<to uri="direct:load-loop" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE UNDEPLOY request','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:get-status-from-dcae" />
- <choice>
- <when>
- <simple> ${exchangeProperty[dcaeStatus]} == 'DEPLOYED' or ${exchangeProperty[dcaeStatus]} == 'IN_ERROR' or ${exchangeProperty[dcaeStatus]} == 'PROCESSING'
- </simple>
<to uri="direct:undeploy-loop" />
- </when>
- <otherwise>
- <log
- loggingLevel="INFO"
- message="Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be undeployed when in state DEPLOYED/IN_ERROR/PROCESSING" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be deployed when in state DEPLOYED','ERROR',${exchangeProperty[loopObject]})" />
- </otherwise>
- </choice>
+
<log
loggingLevel="INFO"
message="UNDEPLOY request successfully executed for loop: ${header.loopName}" />
@@ -524,6 +492,7 @@
<to uri="direct:load-loop" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})" />
+ <to uri="direct:undeploy-loop" />
<to uri="direct:remove-all-policy-from-active-pdp-group" />
<split>
<simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
@@ -609,20 +578,16 @@
<to uri="direct:load-loop" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-status-from-policy" />
- <to uri="direct:get-status-from-dcae" />
- <to
- uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopStatus(${exchangeProperty[loopObject]},${exchangeProperty[policyStatus]}, ${exchangeProperty[dcaeStatus]})" />
- <log
- loggingLevel="INFO"
- message="Get Status request successfully executed. The new state is: ${body}" />
+ <doTry>
+ <to uri="direct:update-policy-status-for-loop" />
+ <to uri="direct:update-dcae-status-for-loop" />
+ <to uri="direct:update-loop-state" />
+
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request successfully executed','INFO',${exchangeProperty[loopObject]})" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ </doTry>
<doCatch>
<exception>java.lang.Exception</exception>
<handled>
@@ -637,8 +602,9 @@
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
<doFinally>
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <setBody>
+ <simple>${exchangeProperty[loopObject]}</simple>
+ </setBody>
</doFinally>
</doTry>
</route>
diff --git a/src/main/resources/clds/camel/routes/dcae-flows.xml b/src/main/resources/clds/camel/routes/dcae-flows.xml
new file mode 100644
index 000000000..b69c4fb8d
--- /dev/null
+++ b/src/main/resources/clds/camel/routes/dcae-flows.xml
@@ -0,0 +1,187 @@
+<routes xmlns="http://camel.apache.org/schema/spring">
+ <route id="deploy-loop">
+ <from uri="direct:deploy-loop" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
+ <setBody>
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="getDeployPayload(${exchangeProperty[loopObject]})" />
+ </setBody>
+ <setProperty propertyName="dcaeDeploymentId">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="generateDeploymentId()" />
+ </setProperty>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>PUT</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
+ <toD
+ uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionsPerRoute=3" />
+ <convertBodyTo type="java.lang.String" />
+ <setProperty propertyName="dcaeResponse">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="convertDcaeResponse(${body})" />
+ </setProperty>
+ <setProperty propertyName="dcaeStatusUrl">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
+ </setProperty>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>DEPLOY loop status
+ (Dep-id:${exchangeProperty[dcaeDeploymentId]},
+ StatusUrl:${exchangeProperty[dcaeStatusUrl]})
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="undeploy-loop">
+ <from uri="direct:undeploy-loop" />
+ <log
+ loggingLevel="INFO"
+ message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
+ <choice>
+ <when>
+ <simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
+ != null
+ </simple>
+ <doTry>
+ <setBody>
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="getUndeployPayload(${exchangeProperty[loopObject]})" />
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
+ <toD
+ uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionsPerRoute=3" />
+ <convertBodyTo type="java.lang.String" />
+ <setProperty propertyName="dcaeResponse">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="convertDcaeResponse(${body})" />
+ </setProperty>
+ <setProperty propertyName="dcaeStatusUrl">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
+ </setProperty>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>UNDEPLOY loop status</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </when>
+ <otherwise>
+ <log
+ loggingLevel="WARNING"
+ message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING',${exchangeProperty[loopObject]})" />
+
+ </otherwise>
+ </choice>
+ </route>
+ <route id="get-dcae-deployment-status">
+ <from uri="direct:get-dcae-deployment-status" />
+ <log
+ loggingLevel="INFO"
+ message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
+ <doTry>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
+ <toD
+ uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>DCAE deployment status</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+
+ </route>
+</routes> \ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 1bad5fbbe..bc79fc211 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -75,642 +75,4 @@
</when>
</choice>
</route>
-
- <route id="load-loop">
- <from uri="direct:load-loop" />
- <setBody>
- <simple>${header.loopName}</simple>
- </setBody>
- <setProperty propertyName="loopObject">
- <method
- ref="org.onap.clamp.loop.LoopService"
- method="getLoop" />
- </setProperty>
-
- <when>
- <simple>${exchangeProperty[loopObject]} == null</simple>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>404</constant>
- </setHeader>
- <log
- loggingLevel="WARNING"
- message="Loop not found in database: ${body}" />
- <stop />
- </when>
- </route>
-
- <route id="create-micro-service-policy">
- <from uri="direct:create-micro-service-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
- <setBody>
- <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-micro-service-policy">
- <from uri="direct:delete-micro-service-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="create-operational-policy">
- <from uri="direct:create-operational-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
- <setBody>
- <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-operational-policy">
- <from uri="direct:delete-operational-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="create-guard-policy">
- <from uri="direct:create-guard-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
- <setBody>
- <simple>${exchangeProperty[guardPolicy].getValue()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} creation status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-guard-policy">
- <from uri="direct:delete-guard-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} removal status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="add-all-to-active-pdp-group">
- <from uri="direct:add-all-to-active-pdp-group" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
- <setBody>
- <simple>${exchangeProperty[loopObject].createPoliciesPayloadPdpGroup()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>PDP Group push ALL status</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="remove-all-policy-from-active-pdp-group">
- <from uri="direct:remove-all-policy-from-active-pdp-group" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
- <split>
- <simple>${exchangeProperty[loopObject].listPolicyNamesPdpGroup()}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body}</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} PDP Group removal status
- </simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>PDP Group removal, Error reported: ${exception}</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
- <route id="deploy-loop">
- <from uri="direct:deploy-loop" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
- <setBody>
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="getDeployPayload(${exchangeProperty[loopObject]})" />
- </setBody>
- <setProperty propertyName="deploymentId">
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="getDeploymentId(${exchangeProperty[loopObject]})" />
- </setProperty>
- <setHeader headerName="CamelHttpMethod">
- <constant>PUT</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},${exchangeProperty[deploymentId]})" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>DEPLOY loop status (id:${exchangeProperty[deploymentId]})</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="undeploy-loop">
- <from uri="direct:undeploy-loop" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
-
- <setBody>
- <simple>{\"serviceTypeId\": \"${exchangeProperty[loopObject].getDcaeBlueprintId()}\"}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},null)" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>UNDEPLOY loop status</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="get-status-from-policy">
- <from uri="direct:get-status-from-policy" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Query Closed Loop status from policy PDP: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Query operational policies to PDP group')" />
- <setProperty propertyName="operationalPolicyName">
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="getOperationalPolicyName(${exchangeProperty[loopObject]})" />
- </setProperty>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to query from Policy PDP: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicyName]}/versions/deployed"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicyName]}/versions/deployed?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>Policy deployment status</simple>
- </setProperty>
- <setProperty propertyName="policyStatus">
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="analysePolicyResponse(${header.CamelHttpResponseCode})" />
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="get-status-from-dcae">
- <from uri="direct:get-status-from-dcae" />
- <log
- loggingLevel="INFO"
- message="Query Closed Loop status from DCAE ${exchangeProperty[loopObject].getName()}" />
- <choice>
- <when>
- <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} == null
- </simple>
- <setProperty propertyName="dcaeStatus">
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="analyseDcaeResponse(*,null)" />
- </setProperty>
- <log
- loggingLevel="INFO"
- message="dcae status: ${exchangeProperty[dcaeStatus]}"></log>
- </when>
- <otherwise>
- <doTry>
- <log
- loggingLevel="INFO"
- message="Query Closed Loop status from Dcae" />
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
- <toD
- uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=20000&amp;httpClient.socketTimeout=20000&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>DCAE deployment status</simple>
- </setProperty>
- <setProperty propertyName="dcaeStatus">
- <method ref="org.onap.clamp.loop.LoopOperation"
- method="analyseDcaeResponse(*,${header.CamelHttpResponseCode})" />
- </setProperty>
- <log
- loggingLevel="INFO"
- message="dcae status: ${exchangeProperty[dcaeStatus]}"></log>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </otherwise>
- </choice>
- </route>
- <route id="reset-raise-http-exception-flag">
- <from uri="direct:reset-raise-http-exception-flag" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">true</simple>
- </setProperty>
- </route>
-
- <route id="dump-loop-log-http-response">
- <from uri="direct:dump-loop-log-http-response" />
- <log loggingLevel="INFO" message="${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" />
- </route>
</routes> \ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/loop-flows.xml b/src/main/resources/clds/camel/routes/loop-flows.xml
new file mode 100644
index 000000000..ede899e71
--- /dev/null
+++ b/src/main/resources/clds/camel/routes/loop-flows.xml
@@ -0,0 +1,250 @@
+<routes xmlns="http://camel.apache.org/schema/spring">
+ <route id="load-loop">
+ <from uri="direct:load-loop" />
+ <setBody>
+ <simple>${header.loopName}</simple>
+ </setBody>
+ <setProperty propertyName="loopObject">
+ <method
+ ref="org.onap.clamp.loop.LoopService"
+ method="getLoop" />
+ </setProperty>
+
+ <when>
+ <simple>${exchangeProperty[loopObject]} == null</simple>
+ <setHeader headerName="CamelHttpResponseCode">
+ <constant>404</constant>
+ </setHeader>
+ <log
+ loggingLevel="WARNING"
+ message="Loop not found in database: ${body}" />
+ <stop />
+ </when>
+ </route>
+ <route id="update-policy-status-for-loop">
+ <from uri="direct:update-policy-status-for-loop" />
+ <setProperty propertyName="atLeastOnePolicyNotFound">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <setProperty propertyName="atLeastOnePolicyNotDeployed">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <setProperty propertyName="policyComponent">
+ <simple>${exchangeProperty[loopObject].getComponent('POLICY')}
+ </simple>
+ </setProperty>
+ <log
+ loggingLevel="INFO"
+ message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
+ <split>
+ <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body.getName()}</simple>
+ </setProperty>
+ <setProperty propertyName="policyType">
+ <simple>${body.getModelType()}</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <log
+ loggingLevel="INFO"
+ message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotFound">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+ <to uri="direct:get-deployment-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotDeployed">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+ </split>
+ <log
+ loggingLevel="INFO"
+ message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
+ <split>
+ <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body.getName()}</simple>
+ </setProperty>
+ <setProperty propertyName="policyType">
+ <simple>onap.policies.controlloop.Operational</simple>
+ </setProperty>
+ <setProperty propertyName="operationalPolicy">
+ <simple>${body}</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <log
+ loggingLevel="INFO"
+ message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotFound">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+ <to uri="direct:get-deployment-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotDeployed">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+
+ <log
+ loggingLevel="INFO"
+ message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
+ <split>
+ <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body.getKey()}</simple>
+ </setProperty>
+ <setProperty propertyName="policyType">
+ <simple>onap.policies.controlloop.Guard</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <log
+ loggingLevel="INFO"
+ message="Processing Guard Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotFound">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+ <to uri="direct:get-deployment-policy" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="atLeastOnePolicyNotDeployed">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </when>
+ </split>
+ </split>
+ <setProperty propertyName="policyState">
+ <simple> ${exchangeProperty[policyComponent].computeState(*)}
+ </simple>
+ </setProperty>
+ <log
+ loggingLevel="INFO"
+ message="Policy state set to: ${exchangeProperty[policyState].getStateName()}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Policy state set to: ${exchangeProperty[policyState].getStateName()}','INFO','POLICY',${exchangeProperty[loopObject]})" />
+ </route>
+ <route id="update-dcae-status-for-loop">
+ <from uri="direct:update-dcae-status-for-loop" />
+ <log
+ loggingLevel="INFO"
+ message="Updating DCAE status for loop: ${exchangeProperty[loopObject].getName()}" />
+ <setProperty propertyName="dcaeComponent">
+ <simple>${exchangeProperty[loopObject].getComponent('DCAE')}</simple>
+ </setProperty>
+ <when>
+ <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}
+ != null
+ </simple>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-dcae-deployment-status" />
+ <when>
+ <simple> ${header.CamelHttpResponseCode} == 200 </simple>
+ <convertBodyTo type="java.lang.String" />
+ <setProperty propertyName="dcaeResponse">
+ <method
+ ref="org.onap.clamp.loop.components.external.DcaeComponent"
+ method="convertDcaeResponse(${body})" />
+ </setProperty>
+ </when>
+ </when>
+
+ <setProperty propertyName="dcaeState">
+ <simple> ${exchangeProperty[dcaeComponent].computeState(*)}
+ </simple>
+ </setProperty>
+ <log
+ loggingLevel="INFO"
+ message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[loopObject]})" />
+
+ </route>
+ <route id="direct:update-loop-state">
+ <from uri="direct:update-loop-state" />
+ <log
+ loggingLevel="INFO"
+ message="Updating status for loop: ${exchangeProperty[loopObject].getName()}" />
+ <choice>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'BLUEPRINT_DEPLOYED' and ${exchangeProperty['policyState'].getStateName()} == 'NOT_SENT'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DESIGN')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' or ${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_INSTALLATION_FAILED'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_UNINSTALLATION_FAILED' or ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'RUNNING')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and ${exchangeProperty['policyState'].getStateName()} == 'SENT'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'STOPPED')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'BLUEPRINT_DEPLOYED' or ${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' and ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'SUBMITTED')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'PROCESSING_MICROSERVICE_INSTALLATION' or ${exchangeProperty['dcaeState'].getStateName()} == 'PROCESSING_MICROSERVICE_UNINSTALLATION' and ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'WAITING')" />
+ </when>
+ <when>
+ <simple>${exchangeProperty['dcaeState'].getStateName()} == 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT'</simple>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DEPLOYED')" />
+ </when>
+ </choice>
+ <log
+ loggingLevel="INFO"
+ message="New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}','INFO',${exchangeProperty[loopObject]})" />
+
+ </route>
+</routes> \ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
new file mode 100644
index 000000000..8cc594d2e
--- /dev/null
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -0,0 +1,476 @@
+
+<routes xmlns="http://camel.apache.org/schema/spring">
+ <route id="get-policy">
+ <from uri="direct:get-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Getting Policy: ${exchangeProperty[policyName]}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')" />
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET
+ Policy status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="get-deployment-policy">
+ <from uri="direct:get-deployment-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')" />
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to get policy deployment status: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/deployed"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/deployed?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET Policy deployment
+ status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="create-micro-service-policy">
+ <from uri="direct:create-micro-service-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
+ <setBody>
+ <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="delete-micro-service-policy">
+ <from uri="direct:delete-micro-service-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')" />
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="create-operational-policy">
+ <from uri="direct:create-operational-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
+ <setBody>
+ <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="delete-operational-policy">
+ <from uri="direct:delete-operational-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')" />
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="create-guard-policy">
+ <from uri="direct:create-guard-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
+ <setBody>
+ <simple>${exchangeProperty[guardPolicy].getValue()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} creation status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="delete-guard-policy">
+ <from uri="direct:delete-guard-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionsPerRoute=3" />
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} removal status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="add-all-to-active-pdp-group">
+ <from uri="direct:add-all-to-active-pdp-group" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
+ <setBody>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionsPerRoute=3" />
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group push ALL status</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="remove-all-policy-from-active-pdp-group">
+ <from uri="direct:remove-all-policy-from-active-pdp-group" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
+ <split>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body}</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionsPerRoute=3" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} PDP Group removal status
+ </simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </split>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group removal, Error reported: ${exception}</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doCatch>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doFinally>
+ </doTry>
+ </route>
+</routes> \ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/utils-flows.xml b/src/main/resources/clds/camel/routes/utils-flows.xml
new file mode 100644
index 000000000..adf843ffe
--- /dev/null
+++ b/src/main/resources/clds/camel/routes/utils-flows.xml
@@ -0,0 +1,17 @@
+<routes xmlns="http://camel.apache.org/schema/spring">
+ <route id="reset-raise-http-exception-flag">
+ <from uri="direct:reset-raise-http-exception-flag" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setProperty>
+ </route>
+
+ <route id="dump-loop-log-http-response">
+ <from uri="direct:dump-loop-log-http-response" />
+ <log
+ loggingLevel="INFO"
+ message="${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" />
+ </route>
+</routes> \ No newline at end of file