aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/resources
AgeCommit message (Collapse)AuthorFilesLines
2022-02-10Move PAP database provider to spring boot defaulta.sreekumar2-76/+0
This review makes PAP talk to DB directly using the spring repositories instead of going to policy-models-provider. The models-provider methods that were just used by PAP (and not used anymore) will be removed in a different review. Also a bug identified with the usage of GeneratedValue in PfGeneratedIdKey (which is just used by PAP in statistics & audit) will also be fixed in a separate review as part of POLICY-3897. CSIT changes: https://gerrit.onap.org/r/c/policy/docker/+/127033 WIP OOM review: https://gerrit.onap.org/r/c/oom/+/127035 Change-Id: Idb13ba7eb2767cc718672b582a6518fcfc95320f Issue-ID: POLICY-3867 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2022-01-28Create spring repository layer for PAPa.sreekumar3-25/+15
This review adds the spring repository and service layers to PAP. Once this is merged, the next work will be to actually use these spring boot based services to talk to the db directly, and not using policy-models-provider in PAP. Change-Id: Ib086b8b405020cb452e51d6359dd1a69d0000f74 Issue-ID: POLICY-3869 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2022-01-27Remove references to MariaDB from resource fileswaynedunican2-1/+66
Issue-ID: POLICY-2086 Change-Id: I891feb05d2e964ae8d4454d30672ffc77c1da555 Signed-off-by: Wayne Dunican <wayne.dunican@est.tech>
2022-01-07Adding totalPolicyDeployCounts updates to PapStasticsManagerisaac1-0/+25
Issue-ID: POLICY-3836 Signed-off-by: isaac <isaac.adorno@att.com> Change-Id: Ia4ed2595984f68bf75ca9dacb6aa76f04a306224
2021-12-14Migrate pap startup & controllers to spring boota.sreekumar1-0/+81
This commit migrates pap config, startup and controllers to spring boot. Change-Id: Icf91d728160a23db614dfba6b40ddccd2f6163a5 Issue-ID: POLICY-3754 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-11-03Rename username for PAP operations.adheli.tavares5-8/+8
Use an account other than healthcheck in PAP for provisioning of policies. Issue-ID: POLICY-2744 Change-Id: I897f7a4fffbac2d4bbd9cceb059bae1794753aa7 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-08-25Add dmaap connectivity check in papRam Krishna Verma2-0/+14
Add dmaap connectivity check in pap consolidated health check. Make a rest call to fetch all the topics. Verify POLICY-PDP-PAP topic is present. Issue-ID: POLICY-2896 Change-Id: Ide39c70999eaca61205225c95b904e3009d41408 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2021-07-06Use separate subscription for heartbeatsJim Hahn3-0/+21
Separated the heartbeat processing onto its own POLICY-HEARTBEAT topic, still on the "real" (i.e., "effective") POLICY-PDP-PAP topic, like we had originally been doing with the statistics. With this change, statistics processing continues to be part of the heartbeat class/processing, thus a separate class is not required to listen for, and handle, statistics. This new subscription uses a shared consumer group so that only one PAP will process any given heartbeat message, which should reduce the likelihood of DB contention and duplicate keys. This also means that the "saveStatisticsInDb" flag will still be used, which is a more obvious mechanism for controlling the storing of statistics than the presence/absence of a topic in the config file. Issue-ID: POLICY-3460 Change-Id: Ia07132b1c7aef006af86fddbe677fb1243a4e2c3 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-30Add ability to turn on/off pdp statisticsRam Krishna Verma3-0/+3
Adding an ability in pap to turn on/off processing of pdp statistics. By default it will be turned on and can be changed via configuration. Issue-ID: POLICY-3450 Change-Id: I093fe3f1390769f9acf2cfe85dd0d4edf0539de8 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2021-06-25PolicyAudit creation when deploy/undeploy triggered.adheli.tavares1-1/+2
Creates audits for policy when: - deploy - undeploy - undeploy when failure Issue-ID: POLICY-2899 Change-Id: Ib1a7cc4f826b5dceefcd5c7ba5250647f2cc0121 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-06-25Fix broken junitsJim Hahn1-1/+1
Some junits are broken since adding the expiration timer. Changed the length of the heartbeat in an attempt to fix it. Issue-ID: POLICY-3407 Change-Id: I81046476e243a0bf20ae9db9259be4464418e73e Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-23Remove expired PDPsJim Hahn4-46/+4
Added code to remove PDPs for which no message has been received for a while. Added a max-age field to the request-map parameters, changing the parameters class to use a Builder, in the process. Deleted the PdpTracker class, as its functionality was replaced by the expiration checker. Changed port numbers in some tests, due to collisions in junit tests. Issue-ID: POLICY-3407 Change-Id: Ifbfbc03b833a4f11ee5e910e256ee42e21a0afab Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-27support external configuration of pdp groupsjhh1-0/+36
- modify policy-pap.sh to optionally provision a custom group if such a file is present. Issue-ID: POLICY-3331 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Ib53bc14ee6b9471ab48f5a792b4283db3ed53b93 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2021-03-29Validate parameters of REST callsJim Hahn5-0/+43
Added code to validate the parameters of the REST calls. As it turned out, validation only needed to be added to one call. Issue-ID: POLICY-2542 Change-Id: Ia9aabf75e06d6d5f996be9e3ed804218319f70c2 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-19Delete keystores from papJim Hahn1-0/+0
The Keystore is no longer needed in the tarball, as it is supplied externally by the CSITs and Helm charts. Deleted that file. Also modified the junits to use utils-test to generates keystores at runtime, thus deleted the junit keystore file, too. Issue-ID: POLICY-3143 Change-Id: I2b0c4868613e0923aad87844dd16f3ac236d4291 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-16Update policy-keystore with newer certificatesjhh1-0/+0
Issue-ID: POLICY-3139 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I728118f2eb691dddb93b36c832eb4c8a72e0d5af
2021-01-15Make PAP statelessJim Hahn2-51/+16
Removed old code that tracked the status using a cache. Modified the code to use the status found in the DB instead. Issue-ID: POLICY-2648 Change-Id: I4f1f5201eff7b3352631f50d67c40349ac7f2014 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-12-17Update persistence.xml with new TOSCA classesliamfallon1-6/+21
Issue-ID: POLICY-2900 Change-Id: I986074f69bef24ca894adc38eaf8b3ca4b4dc5a2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-10-06Remove legacy operational apex policy type from papRam Krishna Verma1-19/+27
The legacy operational policy type for apex has been removed in Guilin release. Removing it fron pdpGroup config in PAP. Issue-ID: POLICY-2857 Change-Id: Iddf2e6b6301dbab3addcbff4c806142f4cf8e6c6 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-09-24update default keystoresjhh1-0/+0
Issue-ID: POLICY-2827 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I95db673538947cccc39bb5a389ab3f544fa91af8
2020-08-07Fail component health check if PDP is downRam Krishna Verma1-0/+7
Changing the policy component health check to fail if the required PDP instances are down or not registered with PAP. The check is performed by comparing the "currentInstanceCount" & "desiredInstanceCount" fields of PdpSubGroup. Issue-ID: POLICY-2718 Change-Id: Iad1075d0812f4ef166dfed4f110eff4d9e5f995e Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-06-17PAP should discard old PDP messagesJim Hahn1-1/+2
Modified PAP to discard any messages old than 10 minutes so that if PAP is unable to communicate with DMaaP and then suddently gets flooded, it will discard old messages. Updates per review comments - made the "max message age" configurable, with a default of 10 minutes Issue-ID: POLICY-2170 Change-Id: I541c03aabf29482af12a07f51eeb5888bbafbf31 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-17renew policy certs till 03/17/2021jhh1-0/+0
Issue-ID: POLICY-2402 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I6386a6185089bfcc4358db2a0bdfe7a977b23992
2020-02-12Update PAP for policy DB response changesliamfallon1-1/+6
Policy models now throws an exception with a 404 code when policies are not found. This change amends PAP to cope with this change. Note: This change should be merged directly after the following policy-models patch: https://gerrit.onap.org/r/c/policy/models/+/101544 Issue-ID: POLICY-1402 Change-Id: Id38af4b2ad65797592c077e276861b962bc53ea2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-03Policy notifications appear to be reversedJim Hahn2-2/+9
Modified the code as follows: Until all PDPs have responded (or been removed), no notifications for their associated policies will be generated. However, once a response has been received for every PDP, then a notification is generated. For deployed policies, the notifications will continue to be generated as PDPs move back and forth between the success and failed states, as long as the policy is not undeployed. For undeployed policies, on the other hand, no additional notifications will be generated once all PDPs have successfully undeployed the policy. However, until that point, like with deployed policies, notifications will continue to be generated as PDPs move back and forth between the success and failed states. Added notification verifications in deploy and undeploy end-to-end tests. Issue-ID: POLICY-2347 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7d18dad1a7500e1efb7074e89ddaca4b1d368965
2020-01-10Merge "validate and save PdpStatistisc"Jim Hahn1-0/+2
2020-01-10validate and save PdpStatistiscHenry.Sun1-1/+5
Issue-ID: POLICY-2303 Change-Id: Ide10256556a20e2ab3977ab2cfd876dd82e44390 Signed-off-by: Henry.Sun <henry.a.sun@est.tech>
2020-01-09statistics rest api updatening.xi1-0/+1
Issue-ID: POLICY-1629 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: I104fc448d27a282c01e7f54db300f918374b8d07
2020-01-09Changes related to persisiting data type of policy in dba.sreekumar1-1/+2
Change-Id: I09b373a511eaa20603d4d2de71a2a5a6bf652b3b Issue-ID: POLICY-2315 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-12-11consolidate Policy Health Check into PAPHengye4-4/+76
Issue-ID: POLICY-1689 Change-Id: I3b84094e217c8cda115efdbf3444e92f08013a7c Signed-off-by: Hengye <yehui.wang@est.tech>
2019-12-09Only update policies in PAP REST APIJim Hahn8-1/+249
Modified the deploy controller and provider to only update the policies within a group, while leaving the other fields unchanged. Added delta operations so that only additions or deletions need be included instead of providing the complete list of policies. Change-Id: Id2b69dac15f97b8a898f459f8d3f09216fc3618e Issue-ID: POLICY-2274 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-12-05Create PAP API to only create/update PdpGroupsa.sreekumar4-24/+52
Create an API to create/update PdpGroups. Policies are not allowed to be deployed as part of PDPGroup create/update operation. There will be a separate API as part of POLICY-2274 to deploy policies into individual group/subgroups. Change-Id: I4e2cb43fefe08b22d6f70a1db7c026e83f0ebde0 Issue-ID: POLICY-2273 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-11-22Re-register pdp if not found in DBramverma1-2/+7
During heartbeat processing, if the pdp instance is not found in the DB then registering the pdp again. So that it doesn't go out of sync. Added related test cases. Issue-ID: POLICY-2158 Change-Id: I557e2397536fd5b3a2783ec89d75ca0e43dcf9d0 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-11-21Adding pdpGroup to PdpRegistrationHandlerramverma1-0/+112
Adding pdpGroup as the matching condition for registration of Pdps. Removing the check of supported policy types in pdp heartbeat. Adding check of policies in pdp heartbeat. Adding comprehensive unit test coverage (98%) for the heartbeat listener. Issue-ID: POLICY-2231 Change-Id: I0fb961717c74656c5f1b6937b6c3a1410382a76e Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-11-06Support policy types with wild-cardsJim Hahn4-0/+101
Allow supported policy types to end with ".*", which causes the prefix to be matched when new policies are deployed. This entailed updates in three areas: - when a subgroup is added via the group api - when a subgroup is updated via the group api - when a policy is deployed via the simple api Issue-ID: POLICY-1636 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I4ae15971481ce5b2042b5d6fdfd16e11ad099c50 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-11-04Add REST api to query policy status from PAPJim Hahn1-0/+56
As part of this, added code to pre-load the deployed policy tracker by reading the policies and groups from the DB. Change-Id: Ifc6c787d114a3a7add4ea54acc1cc969d6c3ca1c Issue-ID: POLICY-2024 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-10-29Generate notifications when policies changejh73585-0/+65
Updated existing PAP code to make use of new notification classes. Change-Id: I4637ad92ac4f432f215cfc837e672c75074d88b5 Issue-ID: POLICY-1841 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-04Knock on of changing policy types to mapliamfallon1-161/+156
This review adapts policy-pap for the change in the structure of the toasca service template from a list of maps to a plain map. There is only a change to one test file. Issue-ID: POLICY-2047 Change-Id: Ieeeeb43d8f0300d075b3072b67f8d459def27ee7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-08-22update keystorejhh1-0/+0
Issue-ID: POLICY-1988 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I3e7d08621b6ac529f3517de8c2b910d2fa7c5151 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-07-01Remove topic.properties and incorporate into overall config filea.sreekumar7-44/+60
1) The properties in the topic.properties file is moved into overall config json file and the topic.properties file is removed. 2) Common parameters such as RestServer and Topic related parameters from policy-common is used. Change-Id: I390bbe3cda101a69e7ce614404ecdfbf98598dd2 Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-06-21Merge "Allow integer version when using PDP Group Deploy"Jorge Hernandez3-0/+134
2019-06-21Adding PdpGroup healthcheck REST API in PAPramverma1-0/+98
Adding PdpGroup healthcheck REST API in PAP to return the health status of all the Pdps registered with this PAP instance. The healthcheck status will be based on the regular heartbeat coming from the pdps. Change-Id: Ia0f1603b513bf62ce1df3058427dc6ccaf179cb3 Issue-ID: POLICY-1770 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-06-20Allow integer version when using PDP Group Deployjrh33-0/+134
The policies listed in a "PDP Group Deploy" request may not have fully qualified versions. Modified the code to replace the versions in the request with fully qualified versions. Also improved performance by avoiding look-ups of policies that are already in the subgroup. Change-Id: I37899c2b45228b97a80b7ef44f69694ba57e8f4a Issue-ID: POLICY-1784 Signed-off-by: jrh3 <jrh3@att.com>
2019-06-11Add PDP heart beat expiration timerjrh37-1/+48
Added heart beat interval to the PDP-UPDATE message sent in response to a heart beat message received from a PDP. Added timers to detect missing heart beats and remove the PDP from the DB - PdpTracker. Modified current heart beat listener to update PdpTracker when a heart beat is received. Allow 3 missed heart beats instead of 2. Change-Id: I81621fefbe494e0c4d6f0b9767b00b2a9dd398d8 Issue-ID: POLICY-1795 Signed-off-by: jrh3 <jrh3@att.com>
2019-06-05Reject policy deployment with version mismatchJim Hahn1-0/+72
PAP should not allow multiple versions of a policy to be deployed to the same PDP. Modified the code to reject deployment requests where a different version of the policy is already deployed. This impacts both the PDP-Group-Deploy and the Simple-Deploy REST APIs. Change-Id: I586b764951c20228d0d80ec8326869215e970fdf Issue-ID: POLICY-1785 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-04Undeploy policies when subgroup is deletedJim Hahn1-0/+64
When a subgroup is deleted via the PDP Group create/update API, any PDPs in the subgroup should have all of its policies undeployed. In the process, refactored addOrUpdateSubGroups() out of updateGroup(). Change-Id: I0750802bfb133a655e38493a868744b512ca3fb4 Issue-ID: POLICY-1803 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-24Validate supported types3.0.2-ONAPJim Hahn2-1/+5
When a group is created, PAP should verify that the "supported types" exist in the DB. Address potential sonar issue. Address potential sonar issue in similar block of code. Change-Id: Ib830550bc37d4ebe42c8782f3f874e463f3f51c2 Issue-ID: POLICY-1688 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-19Add end-to-end junits for PAP REST APIJim Hahn13-0/+810
Added test that checks sunny day scenarios for the PAP REST API. Uses real PAP components for everything except DMaaP. PDPs are simulated. Change-Id: If2adc3b1523b477c3efd3eb83fb7a7b04f40fa24 Issue-ID: POLICY-1670 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-17Add DMaaP sim configuration filesliamfallon4-1/+72
Add configurtion files that work with the DMaaP simulator. Issue-ID: POLICY-1643 Change-Id: I8e387163ab190b9610669029720ccf7b9989cfdf Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-15Fix sonar issues in PAPJim Hahn7-7/+7
Moved methods into nested class of PdpModifyRequestMap. Note: they will have to be moved back out when the broadcast capability is added. Removed extra "continue" from Publisher. Rather than remove unused parameters and cause significant clutter to the code, chose to use the parameters in a logger call for RequestImpl. Removed unnecessary cast from UpdateReq. Use version constant in PapRestControllerV1. Log exception in PdpGroupQueryControllerV1. Log exception in PdpGroupStateChangeControllerV1. Shortened functional in PdpGroupDeleteProvider. Removed unnecessary type parameters from PdpGroupDeployProvider. Removed unneeded parameter and exception from ProviderBase. Extracted common string from Main. Shorted functionals in PapActivator. Changed uses of getCanonicalName() to getName(); the former only has limited use, while the latter is typically what is wanted and is actually required whenever forClass(name) is used. Fix junit tests broken by rename of ToscaPolicy version from "typeVersion" to "type_version". Change-Id: Ia00e1b3541c9e25b196a951e45681f67aa7f1bfe Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>