diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-02-27 14:43:57 -0800 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-02-27 15:13:19 -0800 |
commit | 2d28cbf6954c50de004a0d8f1a2ada7ec400fea3 (patch) | |
tree | ef3bb61762221737c3716a0431d0f90f1c7a7a6c /src | |
parent | 95fc10c2f7db4ac8279e9eb595380b265e1614e8 (diff) |
Fix bug in operational policy
Fix bugs in camel routes and operational policy due to changes done for op policy insertion/removal
Issue-ID: CLAMP-647
Change-Id: I68524bd3d5bfbf5dd7a4bcf6d59853df07fd4dd9
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src')
8 files changed, 92 insertions, 92 deletions
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java index 5ec59dbaf..509d4e41c 100755 --- a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java +++ b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java @@ -83,13 +83,12 @@ public class Painter { for (MicroServicePolicy ms : microServices) { ib.arrow().rectangle(ms.getName(), - RectTypes.MICROSERVICE, ms.getPolicyModel().getPolicyAcronym()).arrow(); + RectTypes.MICROSERVICE, ms.getPolicyModel().getPolicyAcronym()); } for (OperationalPolicy policy : policies) { - ib.arrow().rectangle(policy.getName(), RectTypes.POLICY, policy.getPolicyModel().getPolicyAcronym()) - .arrow(); + ib.arrow().rectangle(policy.getName(), RectTypes.POLICY, policy.getPolicyModel().getPolicyAcronym()); } - ib.circle("stop-circle", THICK_LINE); + ib.arrow().circle("stop-circle", THICK_LINE); } private void adjustGraphics2DProperties() { diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java index 2ad47a3c1..7ee088c44 100644 --- a/src/main/java/org/onap/clamp/loop/LoopController.java +++ b/src/main/java/org/onap/clamp/loop/LoopController.java @@ -39,11 +39,10 @@ public class LoopController { private final LoopService loopService; private static final Type OPERATIONAL_POLICY_TYPE = new TypeToken<List<OperationalPolicy>>() { - } - .getType(); + }.getType(); + private static final Type MICROSERVICE_POLICY_TYPE = new TypeToken<List<MicroServicePolicy>>() { - } - .getType(); + }.getType(); @Autowired public LoopController(LoopService loopService) { @@ -103,13 +102,13 @@ public class LoopController { /** * This method add an operational policy to a loop instance. * - * @param loopName The loop name - * @param policyType The policy model type + * @param loopName The loop name + * @param policyType The policy model type * @param policyVersion The policy model version * @return The loop modified */ public Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) { - return loopService.addOperationalPolicy(loopName,policyType,policyVersion); + return loopService.addOperationalPolicy(loopName, policyType, policyVersion); } /** diff --git a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java index 725bfe88b..ff7777f7f 100644 --- a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java @@ -173,7 +173,7 @@ public class LegacyOperationalPolicy { * @param loop The parent loop object */ public static void preloadConfiguration(JsonObject configurationsJson, Loop loop) { - if (configurationsJson.entrySet().isEmpty()) { + if (configurationsJson != null && configurationsJson.entrySet().isEmpty()) { JsonObject controlLoopName = new JsonObject(); controlLoopName.addProperty("controlLoopName", loop != null ? loop.getName() : "Empty (NO loop loaded yet)"); diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index 52b877208..1c7840579 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -32,7 +32,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import com.google.gson.annotations.Expose; - import java.io.IOException; import java.io.Serializable; import java.io.UnsupportedEncodingException; @@ -40,7 +39,6 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -50,7 +48,6 @@ import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; - import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; @@ -94,12 +91,13 @@ public class OperationalPolicy extends Policy implements Serializable { /** * The constructor. - * @param name The name of the operational policy + * + * @param name The name of the operational policy * @param loop The loop that uses this operational policy * @param configurationsJson The operational policy property in the format of - * json + * json * @param policyModel The policy model associated if any, can be null - * @param loopElementModel The loop element from which this instance is supposed to be created + * @param loopElementModel The loop element from which this instance is supposed to be created */ public OperationalPolicy(String name, Loop loop, JsonObject configurationsJson, PolicyModel policyModel, LoopElementModel loopElementModel) { @@ -108,7 +106,9 @@ public class OperationalPolicy extends Policy implements Serializable { this.setPolicyModel(policyModel); this.setConfigurationsJson(configurationsJson); this.setLoopElementModel(loopElementModel); - LegacyOperationalPolicy.preloadConfiguration(configurationsJson, loop); + if (policyModel != null && policyModel.getPolicyModelType().contains("legacy")) { + LegacyOperationalPolicy.preloadConfiguration(configurationsJson, loop); + } try { this.setJsonRepresentation( OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService())); diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 74322f36b..23844cb23 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </li> <li><a href="#_paths">2. Paths</a> <ul class="sectlevel2"> -<li><a href="#_route92">2.1. GET /v1/healthcheck</a> +<li><a href="#_route30">2.1. GET /v1/healthcheck</a> <ul class="sectlevel3"> <li><a href="#_responses">2.1.1. Responses</a></li> <li><a href="#_produces">2.1.2. Produces</a></li> </ul> </li> -<li><a href="#_route93">2.2. GET /v1/user/getUser</a> +<li><a href="#_route31">2.2. GET /v1/user/getUser</a> <ul class="sectlevel3"> <li><a href="#_responses_2">2.2.1. Responses</a></li> <li><a href="#_produces_2">2.2.2. Produces</a></li> </ul> </li> -<li><a href="#_route80">2.3. GET /v2/dictionary</a> +<li><a href="#_route18">2.3. GET /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_responses_3">2.3.1. Responses</a></li> <li><a href="#_produces_3">2.3.2. Produces</a></li> </ul> </li> -<li><a href="#_route82">2.4. PUT /v2/dictionary</a> +<li><a href="#_route20">2.4. PUT /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_parameters">2.4.1. Parameters</a></li> <li><a href="#_responses_4">2.4.2. Responses</a></li> @@ -491,7 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_7">2.7.4. Produces</a></li> </ul> </li> -<li><a href="#_route84">2.8. DELETE /v2/dictionary/{name}</a> +<li><a href="#_route22">2.8. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_4">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> @@ -505,75 +505,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_route14">2.10. PUT /v2/loop/delete/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_6">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> </ul> </li> -<li><a href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_route8">2.11. PUT /v2/loop/deploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_7">2.11.1. Parameters</a></li> <li><a href="#_responses_11">2.11.2. Responses</a></li> <li><a href="#_produces_10">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_route64">2.12. GET /v2/loop/getAllNames</a> +<li><a href="#_route2">2.12. GET /v2/loop/getAllNames</a> <ul class="sectlevel3"> <li><a href="#_responses_12">2.12.1. Responses</a></li> <li><a href="#_produces_11">2.12.2. Produces</a></li> </ul> </li> -<li><a href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_route15">2.13. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_8">2.13.1. Parameters</a></li> <li><a href="#_responses_13">2.13.2. Responses</a></li> <li><a href="#_produces_12">2.13.3. Produces</a></li> </ul> </li> -<li><a href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> +<li><a href="#_route9">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_9">2.14.1. Parameters</a></li> <li><a href="#_responses_14">2.14.2. Responses</a></li> <li><a href="#_produces_13">2.14.3. Produces</a></li> </ul> </li> -<li><a href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_route12">2.15. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_10">2.15.1. Parameters</a></li> <li><a href="#_responses_15">2.15.2. Responses</a></li> <li><a href="#_produces_14">2.15.3. Produces</a></li> </ul> </li> -<li><a href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_route11">2.16. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_11">2.16.1. Parameters</a></li> <li><a href="#_responses_16">2.16.2. Responses</a></li> <li><a href="#_produces_15">2.16.3. Produces</a></li> </ul> </li> -<li><a href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_route13">2.17. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_12">2.17.1. Parameters</a></li> <li><a href="#_responses_17">2.17.2. Responses</a></li> <li><a href="#_produces_16">2.17.3. Produces</a></li> </ul> </li> -<li><a href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> +<li><a href="#_route4">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_13">2.18.1. Parameters</a></li> <li><a href="#_responses_18">2.18.2. Responses</a></li> <li><a href="#_produces_17">2.18.3. Produces</a></li> </ul> </li> -<li><a href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_route10">2.19. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_14">2.19.1. Parameters</a></li> <li><a href="#_responses_19">2.19.2. Responses</a></li> <li><a href="#_produces_18">2.19.3. Produces</a></li> </ul> </li> -<li><a href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_route5">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_15">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> @@ -581,7 +581,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_19">2.20.4. Produces</a></li> </ul> </li> -<li><a href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_route7">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_16">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> @@ -589,7 +589,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_20">2.21.4. Produces</a></li> </ul> </li> -<li><a href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_route6">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_17">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> @@ -597,14 +597,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_21">2.22.4. Produces</a></li> </ul> </li> -<li><a href="#_route65">2.23. GET /v2/loop/{loopName}</a> +<li><a href="#_route3">2.23. GET /v2/loop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_18">2.23.1. Parameters</a></li> <li><a href="#_responses_23">2.23.2. Responses</a></li> <li><a href="#_produces_22">2.23.3. Produces</a></li> </ul> </li> -<li><a href="#_route87">2.24. GET /v2/policyToscaModels</a> +<li><a href="#_route25">2.24. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_24">2.24.1. Responses</a></li> <li><a href="#_produces_23">2.24.2. Produces</a></li> @@ -624,7 +624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_25">2.26.3. Produces</a></li> </ul> </li> -<li><a href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route26">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> <ul class="sectlevel3"> <li><a href="#_parameters_21">2.27.1. Parameters</a></li> <li><a href="#_responses_27">2.27.2. Responses</a></li> @@ -632,7 +632,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_26">2.27.4. Produces</a></li> </ul> </li> -<li><a href="#_route91">2.28. GET /v2/templates</a> +<li><a href="#_route29">2.28. GET /v2/templates</a> <ul class="sectlevel3"> <li><a href="#_responses_28">2.28.1. Responses</a></li> <li><a href="#_produces_27">2.28.2. Produces</a></li> @@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <div class="sect2"> <h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3> <div class="paragraph"> -<p><em>Host</em> : localhost:33631<br> +<p><em>Host</em> : localhost:37295<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_route92"><a class="anchor" href="#_route92"></a><a class="link" href="#_route92">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_route30"><a class="anchor" href="#_route30"></a><a class="link" href="#_route30">2.1. GET /v1/healthcheck</a></h3> <div class="sect3"> <h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route93"><a class="anchor" href="#_route93"></a><a class="link" href="#_route93">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_route31"><a class="anchor" href="#_route31"></a><a class="link" href="#_route31">2.2. GET /v1/user/getUser</a></h3> <div class="sect3"> <h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route80"><a class="anchor" href="#_route80"></a><a class="link" href="#_route80">2.3. GET /v2/dictionary</a></h3> +<h3 id="_route18"><a class="anchor" href="#_route18"></a><a class="link" href="#_route18">2.3. GET /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route82"><a class="anchor" href="#_route82"></a><a class="link" href="#_route82">2.4. PUT /v2/dictionary</a></h3> +<h3 id="_route20"><a class="anchor" href="#_route20"></a><a class="link" href="#_route20">2.4. PUT /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route84"><a class="anchor" href="#_route84"></a><a class="link" href="#_route84">2.8. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_route22"><a class="anchor" href="#_route22"></a><a class="link" href="#_route22">2.8. DELETE /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route76"><a class="anchor" href="#_route76"></a><a class="link" href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_route14"><a class="anchor" href="#_route14"></a><a class="link" href="#_route14">2.10. PUT /v2/loop/delete/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route70"><a class="anchor" href="#_route70"></a><a class="link" href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_route8"><a class="anchor" href="#_route8"></a><a class="link" href="#_route8">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route64"><a class="anchor" href="#_route64"></a><a class="link" href="#_route64">2.12. GET /v2/loop/getAllNames</a></h3> +<h3 id="_route2"><a class="anchor" href="#_route2"></a><a class="link" href="#_route2">2.12. GET /v2/loop/getAllNames</a></h3> <div class="sect3"> <h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route77"><a class="anchor" href="#_route77"></a><a class="link" href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_route15"><a class="anchor" href="#_route15"></a><a class="link" href="#_route15">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route71"><a class="anchor" href="#_route71"></a><a class="link" href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> +<h3 id="_route9"><a class="anchor" href="#_route9"></a><a class="link" href="#_route9">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route74"><a class="anchor" href="#_route74"></a><a class="link" href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_route12"><a class="anchor" href="#_route12"></a><a class="link" href="#_route12">2.15. PUT /v2/loop/restart/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.15.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route73"><a class="anchor" href="#_route73"></a><a class="link" href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_route11"><a class="anchor" href="#_route11"></a><a class="link" href="#_route11">2.16. PUT /v2/loop/stop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route75"><a class="anchor" href="#_route75"></a><a class="link" href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_route13"><a class="anchor" href="#_route13"></a><a class="link" href="#_route13">2.17. PUT /v2/loop/submit/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route66"><a class="anchor" href="#_route66"></a><a class="link" href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<h3 id="_route4"><a class="anchor" href="#_route4"></a><a class="link" href="#_route4">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route72"><a class="anchor" href="#_route72"></a><a class="link" href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_route10"><a class="anchor" href="#_route10"></a><a class="link" href="#_route10">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route67"><a class="anchor" href="#_route67"></a><a class="link" href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_route5"><a class="anchor" href="#_route5"></a><a class="link" href="#_route5">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route69"><a class="anchor" href="#_route69"></a><a class="link" href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_route7"><a class="anchor" href="#_route7"></a><a class="link" href="#_route7">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route68"><a class="anchor" href="#_route68"></a><a class="link" href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_route6"><a class="anchor" href="#_route6"></a><a class="link" href="#_route6">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.22.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route65"><a class="anchor" href="#_route65"></a><a class="link" href="#_route65">2.23. GET /v2/loop/{loopName}</a></h3> +<h3 id="_route3"><a class="anchor" href="#_route3"></a><a class="link" href="#_route3">2.23. GET /v2/loop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route87"><a class="anchor" href="#_route87"></a><a class="link" href="#_route87">2.24. GET /v2/policyToscaModels</a></h3> +<h3 id="_route25"><a class="anchor" href="#_route25"></a><a class="link" href="#_route25">2.24. GET /v2/policyToscaModels</a></h3> <div class="sect3"> <h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route88"><a class="anchor" href="#_route88"></a><a class="link" href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_route26"><a class="anchor" href="#_route26"></a><a class="link" href="#_route26">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> <div class="sect3"> <h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route91"><a class="anchor" href="#_route91"></a><a class="link" href="#_route91">2.28. GET /v2/templates</a></h3> +<h3 id="_route29"><a class="anchor" href="#_route29"></a><a class="link" href="#_route29">2.28. GET /v2/templates</a></h3> <div class="sect3"> <h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -3544,6 +3544,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> <tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>pdpSubGroup</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModel</strong><br> <em>optional</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_policymodel">PolicyModel</a></p></td> @@ -3632,6 +3637,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> <tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>pdpSubGroup</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModel</strong><br> <em>optional</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_policymodel">PolicyModel</a></p></td> @@ -3689,6 +3699,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> <tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyPdpGroup</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td> +</tr> +<tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br> <em>optional</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> 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 3bcfc06bb..fe3f6bdaf 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -569,29 +569,21 @@ </route> </get> - <put uri="/v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> + <put uri="/v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}" outType="org.onap.clamp.loop.Loop" produces="application/json"> <route> - <removeHeaders pattern="*" excludePattern="loopName" /> + <removeHeaders pattern="*" excludePattern="loopName|policyType|policyVersion" /> <doTry> - <log loggingLevel="INFO" - message="ADD OperationalPolicy request for loop: ${header.loopName}" /> <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'ADD OperationalPolicy request')" /> + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add operational Policy')" /> <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','write')" /> + uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> <to uri="direct:load-loop" /> <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request','INFO',${exchangeProperty[loopObject]})" /> - <doTry> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=addOperationalPolicy(${loopName},${policyType},${policyVersion})" /> - - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - </doTry> + uri="bean:org.onap.clamp.loop.LoopController?method=addOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})" /> + <to + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request successfully executed','INFO',${exchangeProperty[loopObject]})" /> + <to + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> <doCatch> <exception>java.lang.Exception</exception> <handled> @@ -602,13 +594,8 @@ <log loggingLevel="ERROR" message="ADD OperationalPolicy request failed for loop: ${header.loopName}" /> <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request failed','ERROR',${exchangeProperty[loopObject]})" /> </doCatch> - <doFinally> - <setBody> - <simple>${exchangeProperty[loopObject]}</simple> - </setBody> - </doFinally> </doTry> </route> </put> diff --git a/src/main/resources/clds/camel/routes/loop-flows.xml b/src/main/resources/clds/camel/routes/loop-flows.xml index 48febfc07..a4b6e2920 100644 --- a/src/main/resources/clds/camel/routes/loop-flows.xml +++ b/src/main/resources/clds/camel/routes/loop-flows.xml @@ -38,7 +38,7 @@ <simple>${body.getName()}</simple> </setProperty> <setProperty propertyName="policyType"> - <simple>${body.getModelType()}</simple> + <simple>${body.getPolicyModel().getPolicyModelType()}</simple> </setProperty> <setProperty propertyName="policyVersion"> <simple>1.0.0</simple> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index ce37fe1d6..afc5f952a 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -213,9 +213,9 @@ </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> + message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/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&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> <to @@ -259,9 +259,9 @@ </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> + message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/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&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> |