From ee233569e74e4620cb35ce4e9c4320b30d108824 Mon Sep 17 00:00:00 2001 From: sebdet Date: Mon, 22 Mar 2021 18:55:46 +0100 Subject: Rework the backend to support PDP updates Add new mem structure so that we do not need to parse the same Json for each policy/type + rework the camel flows so that we use the same code for loop and policies related calls Issue-ID: POLICY-2930 Issue-ID: POLICY-2931 Signed-off-by: sebdet Change-Id: I3c30c4f87cf669b40511472d518fe5ccc89f56f0 --- .../policy/pdp-deployment-testos-1_0_0.json | 30 +++ .../policy/pdp-deployment-testos-2_0_0.json | 204 +++++++++++++++++++++ .../resources/example/policy/policy-merger.json | 76 +++++++- 3 files changed, 302 insertions(+), 8 deletions(-) create mode 100644 src/test/resources/example/policy/pdp-deployment-testos-1_0_0.json create mode 100644 src/test/resources/example/policy/pdp-deployment-testos-2_0_0.json (limited to 'src/test/resources/example') diff --git a/src/test/resources/example/policy/pdp-deployment-testos-1_0_0.json b/src/test/resources/example/policy/pdp-deployment-testos-1_0_0.json new file mode 100644 index 000000000..3b4a0eafc --- /dev/null +++ b/src/test/resources/example/policy/pdp-deployment-testos-1_0_0.json @@ -0,0 +1,30 @@ +{ + "pdpGroupInfo": [ + { + "pdpGroup2": { + "name": "pdpGroup2", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroup2", + "supportedPolicyTypes": [ + { + "name": "org.onap.test", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap.testos", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/example/policy/pdp-deployment-testos-2_0_0.json b/src/test/resources/example/policy/pdp-deployment-testos-2_0_0.json new file mode 100644 index 000000000..0040052f2 --- /dev/null +++ b/src/test/resources/example/policy/pdp-deployment-testos-2_0_0.json @@ -0,0 +1,204 @@ +{ + "pdpGroupInfo": [ + { + "pdpGroup3": { + "name": "pdpGroup3", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroupBad", + "supportedPolicyTypes": [ + { + "name": "org.onap.test", + "version": "2.0.0" + }, + { + "name": "org.onap.test.*", + "version": "1.0.0" + }, + { + "name": "org.onip.testos", + "version": "1.0.0" + }, + { + "name": "org.onap.testos3", + "version": "2.0.0" + }, + { + "name": "org.onap.tes", + "version": "1.0.0" + }, + { + "name": "org.onap", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap", + "version": "1.0.0" + }, + { + "name": "org.onap.testos", + "version": "2.0.0" + }, + { + "name": "org.onap.testos", + "version": "1.0.1" + }, + { + "name": "org.onap.testos.new", + "version": "1.0.0" + }, + { + "name": "org.onap.", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + }, + "pdpGroup1": { + "name": "pdpGroup1", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroupBad", + "supportedPolicyTypes": [ + { + "name": "org.onap.test", + "version": "2.0.0" + }, + { + "name": "org.onap.test.*", + "version": "1.0.0" + }, + { + "name": "org.onip.testos", + "version": "1.0.0" + }, + { + "name": "org.onap.testos3", + "version": "2.0.0" + }, + { + "name": "org.onap.tes", + "version": "1.0.0" + }, + { + "name": "org.onap", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap", + "version": "1.0.0" + }, + { + "name": "org.onap.testos", + "version": "2.0.0" + }, + { + "name": "org.onap.testos", + "version": "1.0.1" + }, + { + "name": "org.onap.testos.new", + "version": "1.0.0" + }, + { + "name": "org.onap.", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + }, + "pdpGroup2": { + "name": "pdpGroup2", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroup3", + "supportedPolicyTypes": [ + { + "name": "org.onap.test*", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap.testos", + "version": "2.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + }, + { + "pdpType": "subGroupBad", + "supportedPolicyTypes": [ + { + "name": "org.onap.test", + "version": "2.0.0" + }, + { + "name": "org.onap.test.*", + "version": "1.0.0" + }, + { + "name": "org.onip.testos", + "version": "1.0.0" + }, + { + "name": "org.onap.testos3", + "version": "2.0.0" + }, + { + "name": "org.onap.tes", + "version": "1.0.0" + }, + { + "name": "org.onap", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap", + "version": "1.0.0" + }, + { + "name": "org.onap.testos", + "version": "2.0.0" + }, + { + "name": "org.onap.testos", + "version": "1.0.1" + }, + { + "name": "org.onap.testos.new", + "version": "1.0.0" + }, + { + "name": "org.onap.", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/example/policy/policy-merger.json b/src/test/resources/example/policy/policy-merger.json index e1424fffb..c3291ef71 100644 --- a/src/test/resources/example/policy/policy-merger.json +++ b/src/test/resources/example/policy/policy-merger.json @@ -34,10 +34,38 @@ "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0", "policy-version": "1.0.0" }, - "pdpGroupInfo": { - "pdpGroup": "pdpGroup2", - "pdpSubGroup": "subGroup2" - }, + "pdpGroupInfo": [ + { + "pdpGroup2": { + "name": "pdpGroup2", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroup2", + "supportedPolicyTypes": [ + { + "name": "onap.policies.monitoring.tcagen2", + "version": "1.0.0" + }, + { + "name": "onap.policies.controlloop.operational.common.Drools", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "MICROSERVICE_vLoadBalancerMS_v1_0_tcagen2_1_0_0_AV0", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + } + } + ], "supportedPdpGroups": [ { "pdpGroup2": [ @@ -97,10 +125,42 @@ "policy-id": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", "policy-version": "1.0.0" }, - "pdpGroupInfo": { - "pdpGroup": "pdpGroup2", - "pdpSubGroup": "subGroup3" - }, + "pdpGroupInfo": [ + { + "pdpGroup2": { + "name": "pdpGroup2", + "pdpGroupState": "ACTIVE", + "pdpSubgroups": [ + { + "pdpType": "subGroup3", + "supportedPolicyTypes": [ + { + "name": "onap.policies.monitoring.tcagen2", + "version": "1.0.0" + }, + { + "name": "onap.policies.controlloop.operational.common.Drools", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "org.onap.testos", + "version": "2.0.0" + }, + { + "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 0, + "pdpInstances": [] + } + ] + } + } + ], "supportedPdpGroups": [ { "pdpGroup2": [ -- cgit 1.2.3-korg