From ab9bc444f84f2cbb89747543657de3a54e4554b8 Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 23 Apr 2020 03:01:37 +0200 Subject: Fix entityId bug A user defined entry has been added to the entity id by default, so that json editor falls back to that value when re-editing the policies Issue-ID: CLAMP-829 Signed-off-by: sebdet Change-Id: I593163f87df9f97a19964428bf2016154dc9576d --- .../OperationalPolicyRepresentationBuilder.java | 11 +++++++++++ src/main/resources/META-INF/resources/swagger.html | 19 +++++++++++++++---- .../tosca/new-converter/tosca_apex_with_metadata.json | 4 ++++ .../operational-policy-cds-payload-with-list.json | 4 ++++ .../tosca/operational-policy-json-schema.json | 6 +++++- 5 files changed, 39 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java index 787698ada..b1aa4ad18 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java @@ -128,6 +128,15 @@ public class OperationalPolicyRepresentationBuilder { return vnfSchemaArray; } + private static JsonArray createBlankEntry() { + JsonArray result = new JsonArray(); + JsonObject blankObject = new JsonObject(); + blankObject.addProperty("title", "User defined"); + blankObject.add("properties", new JsonObject()); + result.add(blankObject); + return result; + } + private static JsonArray createVfModuleSchema(Service modelService, boolean generateType) { JsonArray vfModuleOneOfSchemaArray = new JsonArray(); JsonObject modelVfModules = modelService.getResourceByType("VFModule"); @@ -180,6 +189,8 @@ public class OperationalPolicyRepresentationBuilder { */ public static JsonArray createAnyOfArray(Service modelJson, boolean generateType) { JsonArray targetOneOfStructure = new JsonArray(); + // First entry must be user defined + targetOneOfStructure.addAll(createBlankEntry()); targetOneOfStructure.addAll(createVnfSchema(modelJson, generateType)); targetOneOfStructure.addAll(createVfModuleSchema(modelJson, generateType)); return targetOneOfStructure; diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 1f8cc9ebe..6bce83675 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -566,7 +566,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • 2.18.3. Produces
  • -
  • 2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion} +
  • 2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}
    • 2.19.1. Parameters
    • 2.19.2. Responses
    • @@ -737,13 +737,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b

      1.1. Version information

      -

      Version : 5.0.2-SNAPSHOT

      +

      Version : 5.0.5-SNAPSHOT

      1.2. URI scheme

      -

      Host : localhost:34889
      +

      Host : localhost:40065
      BasePath : /restservices/clds/
      Schemes : HTTP

      @@ -1764,7 +1764,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
      -

      2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}

      +

      2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}

      2.19.1. Parameters

      @@ -1789,6 +1789,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b + + + + + @@ -4095,6 +4101,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b + + + + diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json index ad985292c..e03e48fcf 100644 --- a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json +++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json @@ -257,6 +257,10 @@ "type": "object", "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n", "anyOf": [ + { + "title": "User defined", + "properties": {} + }, { "title": "VNF-vLoadBalancerMS 0", "properties": { diff --git a/src/test/resources/tosca/operational-policy-cds-payload-with-list.json b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json index 13b468ea0..81f21d07b 100644 --- a/src/test/resources/tosca/operational-policy-cds-payload-with-list.json +++ b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json @@ -371,6 +371,10 @@ } } }, + { + "title": "User defined", + "properties": {} + }, { "title": "VNF-vLoadBalancerMS 0", "properties": { diff --git a/src/test/resources/tosca/operational-policy-json-schema.json b/src/test/resources/tosca/operational-policy-json-schema.json index 9dee089e0..f6c180aae 100644 --- a/src/test/resources/tosca/operational-policy-json-schema.json +++ b/src/test/resources/tosca/operational-policy-json-schema.json @@ -729,6 +729,10 @@ } } }, + { + "title": "User defined", + "properties": {} + }, { "title": "VNF-vLoadBalancerMS 0", "properties": { @@ -1091,4 +1095,4 @@ } } } -} +} \ No newline at end of file -- cgit 1.2.3-korg

      Path

      policyName
      +required

      string

      Path

      policyType
      required

      string

      JsonObject

      legacy
      +optional

      boolean

      loopElementModel
      optional

      LoopElementModel