aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html104
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js156
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/propertyController.js17
-rw-r--r--src/main/resources/application-noaaf.properties2
-rw-r--r--src/main/resources/application.properties2
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml235
-rw-r--r--src/main/resources/clds/camel/routes/flexible-flow.xml172
7 files changed, 498 insertions, 190 deletions
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
index cf9382bf8..a53ad73d5 100644
--- a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
+++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
@@ -110,7 +110,9 @@ label {
<select type="text" id="trigger_policy" name="trigger_policy"
class="form-control" ng-model="null_dump"
ng-init="initPolicySelect()"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
<label for="timeout" class="col-sm-3"
@@ -127,6 +129,13 @@ label {
checked="true" class="form-control">
</div>
</div>
+ <div class="form-group clearfix row">
+ <label class="col-sm-4 control-label" for="clname">ControlLoopName</label>
+ <div class="col-sm-8">
+ <input type="text" class="form-control" name="controlLoopName"
+ readonly="readonly" id="clname" ng-model="clname"/>
+ </div>
+ </div>
</div>
</form>
<div class="panel-heading" style="background-color: white;">
@@ -158,7 +167,8 @@ label {
<label class="col-sm-4 control-label" for="recipe">Recipe</label>
<div class="col-sm-8">
<select class="form-control" name="recipe" id="recipe"
- enableFilter="true" ng-click="updateGuardRecipe($event)">
+ enableFilter="true" ng-model="recipe" ng-click="updateGuardRecipe($event)">
+ <option value="">-- choose an option --</option>
<option value="Restart">Restart</option>
<option value="Rebuild">Rebuild</option>
<option value="Migrate">Migrate</option>
@@ -191,7 +201,8 @@ label {
<div class="form-group clearfix">
<label for="actor" class="col-sm-4 control-label"> Actor</label>
<div class="col-sm-8">
- <select class="form-control" id="actor" name="actor">
+ <select class="form-control" id="actor" name="actor" ng-click="updateGuardActor($event)" ng-model="actor">
+ <option value="">-- choose an option --</option>
<option value="APPC">APPC</option>
<option value="SO">SO</option>
<option value="VFC">VFC</option>
@@ -212,7 +223,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="success" name="success"
ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
<div class="form-group clearfix">
@@ -221,7 +234,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="failure" name="failure"
ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
<div class="form-group clearfix">
@@ -230,7 +245,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="failure_timeout"
name="failure_timeout" ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
<div class="form-group clearfix">
@@ -239,7 +256,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="failure_retries"
name="failure_retries" ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
<div class="form-group clearfix">
@@ -248,7 +267,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="failure_exception"
name="failure_exception" ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
<div class="form-group clearfix">
@@ -257,7 +278,9 @@ label {
<div class="col-sm-8">
<select class="form-control" id="failure_guard"
name="failure_guard" ng-model="null_dump"
- ng-options="policy for policy in policy_ids track by policy"></select>
+ ng-options="policy for policy in policy_ids track by policy">
+ <option value="">-- choose an option --</option>
+ </select>
</div>
</div>
</form>
@@ -267,7 +290,8 @@ label {
<label for="type" class="col-sm-4 control-label"> Target
Type</label>
<div class="col-sm-8">
- <select class="form-control" name="type" id="type">
+ <select class="form-control" name="type" id="type"
+ ng-click="initTargetResourceId()" ng-model="type">
<option value="VFC">VFC</option>
<option value="VM">VM</option>
<option value="VNF">VNF</option>
@@ -279,10 +303,55 @@ label {
Target ResourceId</label>
<div class="col-sm-8">
<select class="form-control" name="resourceId" id="resourceId"
- enableFilter="true">
+ enableFilter="true" ng-click="changeTargetResourceId()"
+ ng-model="resourceId">
+ <option value=""></option>
+ <option value="Other:">Other:</option>
</select>
</div>
</div>
+ <div id="metadata">
+ <div class="form-group clearfix">
+ <label for="modelInvariantId" class="col-sm-4 control-label">
+ Model Invariant Id</label>
+ <div class="col-sm-8">
+ <input class="form-control" name="modelInvariantId"
+ id="modelInvariantId" readonly />
+ </div>
+ </div>
+ <div class="form-group clearfix">
+ <label for="modelVersionId" class="col-sm-4 control-label">
+ Model Version Id</label>
+ <div class="col-sm-8">
+ <input class="form-control" name="modelVersionId"
+ id="modelVersionId" readonly />
+ </div>
+ </div>
+ <div class="form-group clearfix">
+ <label for="modelName" class="col-sm-4 control-label">
+ Model Name</label>
+ <div class="col-sm-8">
+ <input class="form-control" name="modelName" id="modelName"
+ readonly />
+ </div>
+ </div>
+ <div class="form-group clearfix">
+ <label for="modelVersion" class="col-sm-4 control-label">
+ Model Version</label>
+ <div class="col-sm-8">
+ <input class="form-control" name="modelVersion"
+ id="modelVersion" readonly />
+ </div>
+ </div>
+ <div class="form-group clearfix">
+ <label for="modelCustomizationId" class="col-sm-4 control-label">
+ Model Customization Id</label>
+ <div class="col-sm-8">
+ <input class="form-control" name="modelCustomizationId"
+ id="modelCustomizationId" readonly />
+ </div>
+ </div>
+ </div>
</form>
<div class="form-group clearfix">
<label for="enableGuardPolicy" class="col-sm-4 control-label">
@@ -306,7 +375,7 @@ label {
title="Guard policy associated" style="border: 2px dotted gray;">
<div class="form-group clearfix">
- <label class="col-sm-4 control-label" for="id">ID</label>
+ <label class="col-sm-4 control-label" for="id">Guard Policy ID</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="id" id="id" />
</div>
@@ -315,7 +384,7 @@ label {
<label class="col-sm-4 control-label" for="recipe">Recipe</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="recipe"
- readonly="readonly" id="recipe" />
+ readonly="readonly" id="recipe"/>
</div>
</div>
<div class="form-group clearfix">
@@ -325,8 +394,13 @@ label {
readonly="readonly" id="clname" ng-model="clname"/>
</div>
</div>
-
-
+ <div class="form-group clearfix">
+ <label for="actor" class="col-sm-4 control-label">Actor</label>
+ <div class="col-sm-8">
+ <input type="text" class="form-control" name="actor"
+ readonly="readonly" id="actor" />
+ </div>
+ </div>
<div class="form-group clearfix">
<label for="guardTargets" class="col-sm-4 control-label">Guard
diff --git a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
index 5a1ac538b..4e8855eb0 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
@@ -37,7 +37,8 @@ app
var allPolicies = {};
$scope.guardType = "GUARD_MIN_MAX";
$scope.number = 0;
- $scope.clname="";
+ $scope.clname = "";
+ $scope.guard_ids = [];
function getAllFormId() {
return Array.from(document.getElementsByClassName("formId"));
@@ -54,17 +55,7 @@ app
}
console.log("No active formId found !");
}
- function initTargetResourceId() {
- if (vf_Services !== null && vf_Services !== undefined) {
- // Set all the Resource Invariant UUID in the target resource ID
- // list (+Empty and other)
- Object.keys(vf_Services["shared"]["byVf"]).forEach(function(key) {
-
- $("#targetResourceId").append($('<option></option>').val(key).html(key));
- });
- }
- }
function add_one_more() {
console.log("add one more");
@@ -102,6 +93,7 @@ app
$(".formId").not($("#formId" + count)).css("display", "none");
addCustListen(count);
$("#formId" + count + " #id").val("new");
+ $("#formId" + count + " #clname").val($scope.clname);
return count;
}
function addCustListen(count) {
@@ -150,10 +142,11 @@ app
}
function savePolicyLocally() {
- var polForm = {}
- polForm = serializeElement($("#operationalPolicyHeaderForm"));
+ var polForm = {};
+ var clPolForm = {};
+ clPolForm = serializeElement($("#operationalPolicyHeaderForm"));
+ allPolicies['guard_policies'] = {};
var policiesArray = []
- allPolicies['guard_policies'] = [];
$.each($(".formId"), function() {
var policyProperties = serializeElement($("#" + this.id + " .policyProperties"));
@@ -161,9 +154,15 @@ app
policiesArray.push(policyProperties);
// Now get the Guard
if ($("#" + this.id + " #enableGuardPolicy").is(':checked')) {
- allPolicies['guard_policies'].push(serializeElement($("#" + this.id + " .guardProperties")));
+ var guardPolicyBody = serializeElement($("#" + this.id + " .guardProperties"));
+ var guardPolicyId = guardPolicyBody['id'];
+ delete guardPolicyBody['id'];
+
+ allPolicies['guard_policies'][guardPolicyId] = guardPolicyBody;
+ $scope.guard_ids.push(guardPolicyId);
}
});
+ polForm['controlLoop'] = clPolForm;
polForm['policies'] = policiesArray;
allPolicies['operational_policy'] = polForm;
}
@@ -183,7 +182,7 @@ app
// Set the header
$.each($('#operationalPolicyHeaderForm').find('.form-control'), function() {
- $(this).val(allPolicies['operational_policy'][this.id]);
+ $(this).val(allPolicies['operational_policy']['controlLoop'][this.id]);
});
// Set the sub-policies
$.each(allPolicies['operational_policy']['policies'], function(opPolicyElemIndex, opPolicyElemValue) {
@@ -198,13 +197,14 @@ app
$("#go_properties_tab" + formNum).text(
allPolicies['operational_policy']['policies'][opPolicyElemIndex]['id']);
// Check if there is a guard set for it
- $.each(allPolicies['guard_policies'], function(guardElemIndex, guardElemValue) {
+ $.each(allPolicies['guard_policies'], function(guardElemId, guardElemValue) {
if (guardElemValue.recipe === $($("#formId" + formNum + " #recipe")[0]).val()) {
// Found one, set all guard prop
$.each($('.guardProperties').find('.form-control'), function(guardPropElemIndex,guardPropElemValue) {
+ guardElemValue['id'] = guardElemId;
$("#formId"+formNum+" .guardProperties").find("#"+guardPropElemValue.id).val(
- allPolicies['guard_policies'][guardElemIndex][guardPropElemValue.id]);
+ guardElemValue[guardPropElemValue.id]);
});
// And finally enable the flag
$("#formId" + formNum + " #enableGuardPolicy").prop("checked", true);
@@ -212,6 +212,107 @@ app
});
});
}
+
+ $scope.initTargetResourceId = function() {
+
+ var recipe = $(event.target).val();
+
+ var type = $(event.target).val();
+
+ $("#modelName").val("");
+ $("#modelInvariantId").val("");
+ $("#modelVersionId").val("");
+ $("#modelVersion").val("");
+ $("#modelCustomizationId").val("");
+ $('#resourceId').empty();
+ $("#resourceId")
+ .append(
+ $('<option></option>').val("")
+ .html(""));
+ $("#resourceId").append(
+ $('<option></option>').val("Other:")
+ .html("Other:"));
+ if (type == "VM" || type == "" || type == "VNF" ) {
+ $("#metadata *").prop('disabled',true);
+ }
+
+ var resourceVnf = getResourceDetailsProperty();
+ if (type == "VNF"
+ && (null !== resourceVnf || undefined !== resourceVnf)) {
+ for ( var prop in resourceVnf) {
+ var name = resourceVnf[prop]["name"];
+ $("#resourceId").append(
+ $('<option></option>')
+ .val(name).html(name));
+ }
+
+ }
+ var resourceVfc = getResourceDetailsVfcProperty();
+ if (type == "VFC"
+ && (null !== resourceVfc || undefined !== resourceVfc)) {
+ if (recipe == 'VF Module Create'
+ || recipe == 'VF Module Delete') {
+ for ( var prop in resourceVfc) {
+ if (resourceVfc[prop]["isBase"] == false) {
+ var name = resourceVfc[prop]["name"];
+ $("#resourceId").append(
+ $('<option></option>')
+ .val(name)
+ .html(name));
+ }
+ }
+ }
+ else
+ {
+ for ( var prop in resourceVfc) {
+ var name = resourceVfc[prop]["name"];
+ $("#resourceId").append(
+ $('<option></option>')
+ .val(name).html(name));
+ }
+ }
+ }
+ }
+
+ $scope.changeTargetResourceId = function() {
+ $("#modelName").val("");
+ $("#modelInvariantId").val("");
+ $("#modelVersionId").val("");
+ $("#modelVersion").val("");
+ $("#modelCustomizationId").val("");
+ var resourceVfc = getResourceDetailsVfcProperty();
+ var type = $("#type").val();
+ var recipe = $("#recipe").val();
+ vfBaseName = $(event.target).val();
+ if (type == "VFC"
+ && (null !== resourceVfc || undefined !== resourceVfc)
+ && (recipe == 'VF Module Create' || recipe == 'VF Module Delete')) {
+ for ( var prop in resourceVfc) {
+ var name = resourceVfc[prop]["name"];
+ if (name == vfBaseName) {
+ var vfModuleModelName = resourceVfc[prop]["name"];
+ $("#modelName").val(
+ vfModuleModelName);
+ var vfModuleModelInvariantUUID = resourceVfc[prop]["invariantUUID"];
+ $("#modelInvariantId").val(
+ vfModuleModelInvariantUUID);
+ var vfModuleModelUUID = resourceVfc[prop]["UUID"];
+ $("#modelVersionId").val(
+ vfModuleModelUUID);
+ var vfModuleModelVersion = resourceVfc[prop]["version"];
+ $("#modelVersion").val(
+ vfModuleModelVersion);
+ var vfModuleModelCustomizationUUID = resourceVfc[prop]["customizationUUID"];
+ $("#modelCustomizationId")
+ .val(
+ vfModuleModelCustomizationUUID);
+ }
+ }
+ }
+ else {
+ $("#metadata *").prop('disabled',true);
+ }
+ }
$scope.changeGuardPolicyType = function() {
@@ -258,13 +359,20 @@ app
add_new_policy();
}
$("#savePropsBtn").click(function(event) {
-
console.log("save properties triggered");
savePolicyLocally();
+ for(var i = 0; i <= $scope.guard_ids.length; i++) {
+ for(var j = i; j <= $scope.guard_ids.length; j++) {
+ if(i != j && $scope.guard_ids[i] == $scope.guard_ids[j]) {
+ // duplacated guard policy id exist
+ alert("The guard policy ID should be unique.");
+ return;
+ }
+ }
+ }
angular.element(document.getElementById('formSpan')).scope().submitForm(allPolicies);
$("#close_button").click();
});
- initTargetResourceId();
});
}
$scope.init();
@@ -274,6 +382,12 @@ app
// Get the second recipe (guard one) and update it
$($("#formId" + formNum + " #recipe")[1]).val($(event.target).val());
}
+ $scope.updateGuardActor = function(event) {
+
+ var formNum = $(event.target).closest('.formId').attr('id').substring(6);
+ // Get the second actor (guard one) and update it
+ $($("#formId" + formNum + " #actor")[1]).val($(event.target).val());
+ }
// When we change the name of a policy
$scope.updateTabLabel = function(event) {
@@ -302,4 +416,4 @@ app
});
};
- } ]); \ No newline at end of file
+ } ]);
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 2b32f4d26..75c64f308 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
@@ -72,7 +72,9 @@ function getMsProperty(type) {
var msProperties = cl_props["microServicePolicies"];
for (p in msProperties) {
if (msProperties[p]["name"] == type) {
- return JSON.parse(JSON.stringify(msProperties[p]["properties"]));
+ if (msProperties[p]["properties"] !== null && msProperties[p]["properties"] !== undefined) {
+ return JSON.parse(JSON.stringify(msProperties[p]["properties"]));
+ }
}
}
return null;
@@ -82,7 +84,7 @@ function getMsUI(type) {
var msProperties = cl_props["microServicePolicies"];
for (p in msProperties) {
if (msProperties[p]["name"] == type) {
- return JSON.parse(JSON.stringify(msProperties[p]["jsonRepresentation"]));
+ return JSON.parse(JSON.stringify(msProperties[p]["jsonRepresentation"]));
}
}
return null;
@@ -111,4 +113,13 @@ function getDeploymentStatusURL() {
function setDeploymentStatusURL(deploymentStatusURL) {
cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL;
}
-module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL }; \ No newline at end of file
+
+function getResourceDetailsProperty() {
+ return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"];
+}
+
+function getResourceDetailsVfcProperty() {
+ return cl_props["modelPropertiesJson"]["resourceDetails"]["VFC"];
+}
+
+module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsProperty,getResourceDetailsVfcProperty }; \ No newline at end of file
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 82b2a283f..84e97ea30 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -135,7 +135,7 @@ clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-
#
#
# Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http://localhost:8085/
+clamp.config.policy.url=http://policy.api.simpledemo.onap.org:8081/policy/api/v1
clamp.config.policy.userName=test
clamp.config.policy.password=test
clamp.config.policy.pdpUrl1=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 02acf184b..b1077d382 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -150,7 +150,7 @@ clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-
#
#
# Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http://policy.api.simpledemo.onap.org:8081/pdp/
+clamp.config.policy.url=http://policy.api.simpledemo.onap.org:8081/policy/api/v1
clamp.config.policy.userName=test
clamp.config.policy.password=test
clamp.config.policy.pdpUrl1=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
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 f339d5d70..c17595e18 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -1,94 +1,147 @@
-<rests xmlns="http://camel.apache.org/schema/spring" >
- <rest >
- <get uri="/v2/loop/getAllNames"
- outType="java.lang.String[]"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
- </route>
- </get>
- <get uri="/v2/loop/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
- </route>
- </get>
- <get uri="/v2/loop/svgRepresentation/{loopName}"
- outType="java.lang.String"
- produces="application/xml">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=getSVGRepresentation(${header.loopName})" />
- </route>
- </get>
+<rests xmlns="http://camel.apache.org/schema/spring">
+ <rest>
+ <get
+ uri="/v2/loop/getAllNames"
+ outType="java.lang.String[]"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
+ </route>
+ </get>
+ <get
+ uri="/v2/loop/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ </route>
+ </get>
+ <get
+ uri="/v2/loop/svgRepresentation/{loopName}"
+ outType="java.lang.String"
+ produces="application/xml">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getSVGRepresentation(${header.loopName})" />
+ </route>
+ </get>
- <post uri="/v2/loop/updateGlobalProperties/{loopName}"
- type="com.google.gson.JsonObject"
- consumes="application/json"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${body})" />
- </route>
- </post>
- <post uri="/v2/loop/updateOperationalPolicies/{loopName}"
- type="com.google.gson.JsonArray"
- consumes="application/json"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${body})" />
- </route>
- </post>
- <post uri="/v2/loop/updateMicroservicePolicy/{loopName}"
- type="org.onap.clamp.policy.microservice.MicroServicePolicy"
- consumes="application/json"
- outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${body})" />
- </route>
- </post>
- <put uri="/v2/loop/deployLoop/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
- </route>
- </put>
- <put uri="/v2/loop/undeployLoop/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
- </route>
- </put>
- <put uri="/v2/loop/submit/{loopName}">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitMsPolicies(${header.loopName})" />
- <!-- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitOpPolicy(${header.loopName})" />-->
- <!--<to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitGuardPolicy(${header.loopName})" /> -->
- </route>
- </put>
- <put uri="/v2/loop/delete/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteMsPolicies(${header.loopName})" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteOpPolicy(${header.loopName})" />
- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteGuardPolicy(${header.loopName})" />
- </route>
- </put>
- </rest>
+ <post
+ uri="/v2/loop/updateGlobalProperties/{loopName}"
+ type="com.google.gson.JsonObject"
+ consumes="application/json"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${body})" />
+ </route>
+ </post>
+ <post
+ uri="/v2/loop/updateOperationalPolicies/{loopName}"
+ type="com.google.gson.JsonArray"
+ consumes="application/json"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${body})" />
+ </route>
+ </post>
+ <post
+ uri="/v2/loop/updateMicroservicePolicy/{loopName}"
+ type="org.onap.clamp.policy.microservice.MicroServicePolicy"
+ consumes="application/json"
+ outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${body})" />
+ </route>
+ </post>
+ <put
+ uri="/v2/loop/deployLoop/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
+ </route>
+ </put>
+ <put
+ uri="/v2/loop/undeployLoop/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
+ </route>
+ </put>
+ <put uri="/v2/loop/submit/{loopName}">
+ <route>
+ <setBody>
+ <simple>${header.loopName}</simple>
+ </setBody>
+ <log
+ loggingLevel="INFO"
+ message="Loop name received: ${body}"></log>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <setHeader headerName="LoopObject">
+ <method
+ ref="org.onap.clamp.loop.LoopService"
+ method="getLoop" />
+ </setHeader>
+ <split streaming="true">
+ <simple>${header.LoopObject.getMicroServicePolicies()}
+ </simple>
+ <setHeader headerName="HttpQueryException">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setHeader>
+ <to uri="direct:delete-micro-service"/>
+
+ <setHeader headerName="HttpQueryException">
+ <simple resultType="java.lang.Boolean">true</simple>
+ </setHeader>
+ <setBody>
+ <simple>${body.createPolicyPayload()}</simple>
+ </setBody>
+ <to uri="direct:create-micro-service"/>
+
+ </split>
+ </route>
+ </put>
+ <put
+ uri="/v2/loop/delete/{loopName}">
+ <route>
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteMsPolicies(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteOpPolicy(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteGuardPolicy(${header.loopName})" />
+ </route>
+ </put>
+ </rest>
</rests>
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 2103b4acf..b8244990b 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -1,61 +1,117 @@
<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="submit">
- <from uri="direct:processSubmit" />
- <choice>
- <when>
- <simple> ${exchangeProperty.actionCd} == 'SUBMIT' || ${exchangeProperty.actionCd} == 'RESUBMIT'</simple>
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
- <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
- <delay>
- <constant>30000</constant>
- </delay>
- <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
- </when>
- <when>
- <simple> ${exchangeProperty.actionCd} == 'DELETE'</simple>
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
- <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate" />
- <delay>
- <constant>30000</constant>
- </delay>
- <to
- uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.ModelDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
- </when>
- <when>
- <simple> ${exchangeProperty.actionCd} == 'UPDATE'</simple>
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
- <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
- <delay>
- <constant>30000</constant>
- </delay>
- <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
- </when>
- <when>
- <simple> ${exchangeProperty.actionCd} == 'STOP'</simple>
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
- <to
- uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
- </when>
- <when>
- <simple> ${exchangeProperty.actionCd} == 'RESTART'</simple>
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
- <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
- <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
- </when>
- </choice>
- </route>
+ <route id="submit">
+ <from uri="direct:processSubmit" />
+ <choice>
+ <when>
+ <simple> ${exchangeProperty.actionCd} == 'SUBMIT' ||
+ ${exchangeProperty.actionCd} == 'RESUBMIT'
+ </simple>
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
+ <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
+ <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
+ <delay>
+ <constant>30000</constant>
+ </delay>
+ <to
+ uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
+ <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
+ </when>
+ <when>
+ <simple> ${exchangeProperty.actionCd} == 'DELETE'</simple>
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
+ <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDeleteDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate" />
+ <delay>
+ <constant>30000</constant>
+ </delay>
+ <to
+ uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
+ <to uri="bean:org.onap.clamp.clds.client.ModelDeleteDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
+ </when>
+ <when>
+ <simple> ${exchangeProperty.actionCd} == 'UPDATE'</simple>
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
+ <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
+ <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
+ <delay>
+ <constant>30000</constant>
+ </delay>
+ <to
+ uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
+ <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
+ </when>
+ <when>
+ <simple> ${exchangeProperty.actionCd} == 'STOP'</simple>
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
+ </when>
+ <when>
+ <simple> ${exchangeProperty.actionCd} == 'RESTART'</simple>
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
+ <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
+ <to
+ uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
+ </when>
+ </choice>
+ </route>
+ <route id="delete-micro-service">
+ <from uri="direct:delete-micro-service" />
+
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="CamelHttpUri">
+ <simple>{{clamp.config.policy.url}}/policyTypes/${body.getModelType()}/versions/1.0.0/policies/${body.getName()}
+ </simple>
+ </setHeader>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <!--<convertBodyTo type="org.onap.clamp.policy.microservice.MicroServicePolicy"/> -->
+ <log
+ loggingLevel="INFO"
+ message="Policy Endpoint for microservice: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
+ <toD
+ uri="http4://policyhost:8085?throwExceptionOnFailure=${header.HttpQueryException}" />
+
+ </route>
+ <route id="create-micro-service">
+ <from uri="direct:create-micro-service" />
+
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="CamelHttpUri">
+ <simple>{{clamp.config.policy.url}}/policyTypes/${body.getModelType()}/versions/1.0.0/policies
+ </simple>
+ </setHeader>
+ <!--<convertBodyTo type="org.onap.clamp.policy.microservice.MicroServicePolicy"/> -->
+ <log
+ loggingLevel="INFO"
+ message="Policy Endpoint for microservice: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
+ <toD
+ uri="http4://policyhost:8085?throwExceptionOnFailure=${header.HttpQueryException}" />
+ </route>
</routes> \ No newline at end of file