summaryrefslogtreecommitdiffstats
path: root/main/src
AgeCommit message (Collapse)AuthorFilesLines
2021-06-23Remove expired PDPsJim Hahn19-774/+271
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-06-22Update timestamp of PDP recordJim Hahn1-9/+18
Modified the code to update the record timestamp when a heartbeat is received from a PDP. Also used Map operations instead of List operations to construct policy deploy/undeploy lists so they can be constructed in O(N) instead of O(N^2). Issue-ID: POLICY-2898 Change-Id: Ic7b2b9a249fa0563b625e98855c79f96c6ee81d4 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-18Fix new checkstyle issues in papJim Hahn3-5/+3
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3287 Change-Id: I18a34cbc6197266375981031106acc38385c69b5 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-15Use new filtering methods in PAPJim Hahn2-4/+8
Modified PAP to use the new filter parameters classes instead of the old methods that take lots of parameters. Issue-ID: POLICY-3094 Change-Id: I46ac6d95a8f1e56ced8ed39474eb5a1031142dd7 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-10Sonars in papJim Hahn1-1/+1
Fixed sonars: -use correct class name in logger Issue-ID: POLICY-3287 Change-Id: I62fab4b48151d8f2ca32ad5d2951e7359210e2c0 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-03Update junits for bean validator field nameJim Hahn1-4/+4
Now that the bean validator uses the serialized field name in its error messages, updated the junits to use the serialized names, too. Issue-ID: POLICY-3333 Change-Id: I5d447851b72f460fa71e57936847664e2c789462 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-02Fix build failure and remove unused importswaynedunican3-4/+1
Issue-ID: POLICY-3339 Change-Id: I0c9bd25e63b24ba3ac7e38a77e963fcdbaa4d26a Signed-off-by: waynedunican <wayne.dunican@est.tech>
2021-06-01Merge "support external configuration of pdp groups"Jim Hahn5-33/+109
2021-05-27support external configuration of pdp groupsjhh5-33/+109
- 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-05-27Update PAP to check for deployed policies onlywaynedunican14-83/+85
Have PAP compare the returned list against the delta deployment list instead of comparing against the full list of policies as is the current behaviour. Any references to "get" or "set" policies methods have also been removed Issue-ID: POLICY-3263 Change-Id: I0efe03e835db3c4b2136f7e742bba0e78dc2ac44 Signed-off-by: waynedunican <wayne.dunican@est.tech> Signed-off-by: WayneDunican <wayne.dunican@est.tech>
2021-05-06Fix sonars in policy-papJim Hahn33-130/+118
Fixed: - use "var" instead of actual type - remove unused parameter - remove un-thrown exception from method declaration - call isPresent() before Optional.get() - check empty list before invoking doesNotContain() Issue-ID: POLICY-3285 Change-Id: Ic90dccfd591c102ce29f14084f025b3ca69587dc Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Query deployed policies by regexarkadiusz.adamski4-16/+187
- Query deployed policies by regex on the name, for a given policy type Issue-ID: POLICY-2535 Signed-off-by: arkadiusz.adamski <aadamski@est.tech> Change-Id: Ia2be683d044b22e4104ae14e2ce301882091c8ea
2021-05-03Merge "Remove GroupValidationResult"Jim Hahn11-70/+67
2021-04-28Remove GroupValidationResultJim Hahn11-70/+67
Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: I9597dc84e8a81ac5b8954bb2ce4ad0d7e2a3a4a7 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-27Fixing issue where PdpHeartbeats are incorrectly processed by PAPa.sreekumar1-2/+6
The below 2 issues are fixed in this review: 1) When updating the policiesToBeUndeployed, the policies list in the message itself was getting removed, which resulted in incorrect processing. This was the reason for continuos UPDATE and STATE_CHANGE messages from PAP to PDP. 2) In case if the policy list in heartbeat doesn't include one or more policies that are supposed to be deployed(as per DB), the PAP should send UPDATE messages to PDP asking to deploy them too. But this was not working as the policiesToBeDeployed list was not getting initialized properly before getting processed. Change-Id: I06dbfd1d40bae8a510fc5500fbd38fb87c203c0d Issue-ID: POLICY-3248 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-04-16Refactor PapCommandLineArguments classadheli.tavares3-256/+29
CMD Args class to extend functionality from Common CMD class. Issue-ID: POLICY-3129 Change-Id: Ia00cf7b0277e779811eaac556eebe11da95ed380 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-03-29Validate parameters of REST callsJim Hahn7-2/+125
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 Hahn2-5/+6
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-02-22Support Policy updates between PAP and PDPswaynedunican11-28/+300
Change to send only the policies that need to be updated (deployed/undeployed) rather than full of policies to DMaap via the PDP_UPDATE message Issue-ID: POLICY-2112 Change-Id: I65f8bf46f230afb9d4b6937cb89af1d9f05d2fbd Signed-off-by: waynedunican <wayne.dunican@est.tech>
2021-02-22Merge "Refactor Pap code to use Instant from Date"Jim Hahn3-9/+10
2021-02-19Refactor Pap code to use Instant from Daterameshiyer273-9/+10
Issue-ID: POLICY-3069 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I0e1b8ccc41749cd53a299397c8399f833279df59
2021-02-19Update Pdp policy status during registration or State changea.sreekumar3-7/+51
The Pdp Policy Status is not updated during the pdp heartbeat handling/registration flow, or during State change. When a PDP goes down the pdppolicystatus gets cleared. But when the PDP comes back online, PAP deploys the right policies into it, but the deployment status was not getting updated. Similarly, when the State is changed to PASSIVE, the status should be undeployed, and when the state is changed back to ACTIVE, then the status should be deployed for any active policies in any PDP. These issues are fixed here. Updating postman collection. Also updating the csit test to check for 202 instead of 200 for the deployment api response. Change-Id: I1e05f22df23daaa8da8be1376413e995be2376f3 Issue-ID: POLICY-2526 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-02-17Updating PAP deployment API to reflect actual statusa.sreekumar9-78/+535
Change-Id: I5281937fe5a742916c0c86983f71e280bbe126b2 Issue-ID: POLICY-2526 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-02-12Fix sonars from dependency upgradeJim Hahn7-23/+22
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner and one call to openMocks(). Issue-ID: POLICY-2911 Change-Id: I6f28af9af41a1e5c83dead2eabf580731ffb9526 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-10More sonars in papJim Hahn1-4/+4
Addressed the following issues: - don't use eq() with verify() Issue-ID: POLICY-2911 Change-Id: Idf08195e4e2fb74e5e0d0d30f31b9e630720f48f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-07Make filters on TOSCA entities genericliamfallon2-55/+51
The classes PolicyTypeFilter and PolicyFilter only work on Policy types and policies. However they just filter on name/version/type/typeversion so there is no reason that the filters could not be applied to other entities. This commit adapts the PolicyTypeFilter to EntityFilter and PolicyFilter to TypedEntityFilter, so the filters can be applied to collections of any ToscaEntity class. Issue-ID: POLICY-2995 Change-Id: I7cc0ffa23fb12ab5b6e7617491dccd6f3289fa22 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-15Make PAP statelessJim Hahn40-2774/+623
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>
2021-01-14Add class to manage policy deployment recordsJim Hahn4-0/+855
Issue-ID: POLICY-2648 Change-Id: Icbb9545e3df6942e6f9cf98689607c461f6c8cdd Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-13Add notification tracking classesJim Hahn6-0/+675
When PAP is made stateless, a new mechanism will be needed to track and generate notifications. Added some classes to facilitate that. Issue-ID: POLICY-2648 Change-Id: Ib7b707f68a557e7b306dfdd1c6e6e9abd4671ec1 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-05Changed identifiers to concept identifiersliamfallon37-294/+321
The policy models tosca classes ToscaPolicyIdentifier and ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA concept, not just TOSCA policies so they are renamed to ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion respectively. The class ToscaPolicyTypeIdentifier is redundant and is replaced by ToscaConceptIdentifier. Issue-ID: POLICY-2900 Change-Id: I22bb3fdbaf2e237221a5c89afbf7898410603835 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-17Update persistence.xml with new TOSCA classesliamfallon2-12/+42
Issue-ID: POLICY-2900 Change-Id: I986074f69bef24ca894adc38eaf8b3ca4b4dc5a2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-04Fixing sonar issues in policy-papa.sreekumar4-5/+9
Change-Id: I0f81906098c310aa5c437a2c06b708ae27560af8 Issue-ID: POLICY-2911 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2020-11-06Fix upcoming checkstyle issuesPamela Dragosh1-3/+3
When we upgrade to oparent, these will fail as oparent upgrades to 8.37 of puppycrawl which fixes a few bugs that should have flagged these previously. Issue-ID: POLICY-2887 Change-Id: I7c04f58c683d6eb0322232790e0561b464c1696a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-10-06Remove legacy operational apex policy type from papRam Krishna Verma3-24/+28
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-30Fix new sonars in policy/papJim Hahn3-64/+67
Addressed the following sonar issues: - too many assertions in test method - extract common test method - replace this null literal by an "Optional" object Issue-ID: POLICY-2679 Change-Id: Ie80e5c5fdb94230a2773ea2931758cf54204ae86 Signed-off-by: Jim Hahn <jrh3@att.com>
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-24Add Match Policy Type to default groupPamela Dragosh1-0/+4
Default group will now have match Policy Type. Issue-ID: POLICY-2596 Change-Id: I53c07b417097dc8250191e6ee8d043488b02562d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-17Add new guard filter to defaultGroupPamela Dragosh1-0/+4
New guard filter should be advertised by pap. Issue-ID: POLICY-2590 Change-Id: I7652057d4d759e60c358ee9fad84a8c6a9af6898 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-14Using standard success/failure messages in PAPa.sreekumar2-9/+9
Change-Id: If4613c0fc6f940bc82cf616aba2ba9cc03e1b599 Issue-ID: POLICY-2754 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2020-08-10Merge "Changes to make PAP container crash with non zero exitCode"Pamela Dragosh2-34/+28
2020-08-10Changes to make PAP container crash with non zero exitCodea.sreekumar2-34/+28
Make the application to return exitCode as 1 when the main process terminates due to issues such as: 1) Any basic issue in the startup config file causing error and terminates the main process, for e.g. a wrong name in parameterGroup. 2) Wrong info specified for database connectivity, say wrong username. This doesn't impact a case where database isn't ready yet and PAP container comes up first, such waiting is already handled by initContainer in the oom chart. PAP pod waits for policy-mariadb pod to be ready first, then only the main process is started and comes to this point. 3) An invalid port number is specified and the rest server is not able to start. These are the some of the scenarios which already makes the main process of PAP to terminate, and in these cases, an exception is thrown now which returns the exitCode as 1. Change-Id: Ie48726bcb36d7304eb60807fbaabbee8245e9c70 Issue-ID: POLICY-2754 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2020-08-07Merge "Fail component health check if PDP is down"Jim Hahn4-14/+51
2020-08-07Fail component health check if PDP is downRam Krishna Verma4-14/+51
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-08-06Remove legacy operational policy from papRam Krishna Verma1-4/+0
Issue-ID: POLICY-2763 Change-Id: I9701a80cca10b9fd49d8060ecb6601097ca5824d Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-07-06Replace try/catch blocks with assertj - papwaynedunican1-34/+14
Replaced try/catch blocks in policy/pap test cases with assertj assertions Issue-ID: POLICY-2451 Change-Id: Ic963558e812b59d321e12fa87e7285732d6761e5 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2020-06-30Fix more sonars in papJim Hahn1-3/+4
Somehow missed this sonar on one line of code: - remove useless assignments Apparently, sonar only complains about some useless assignments (perhaps those that do more than copy a constant). Fixed one about which it did not complain, which appeared immediately before the one about which it DID complain. At one point, sonar complained about creating ArrayLists without specifying the initial size (when it was known). It didn't complain about this one, but went ahead and fixed it anyway. Issue-ID: POLICY-2679 Change-Id: I270341195634416db1f8152a95a5822c8d505803 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-30Merge "Fix issues in pap for new sonar rules"Liam Fallon3-11/+15
2020-06-29Fix issues in pap for new sonar rulesJim Hahn3-11/+15
Addressed issues reported due to updates to the sonar rules: - invoke only one method in a junit lambda Issue-ID: POLICY-2679 Change-Id: I422856527b191a45b30a78bb8520f679ca2e7896 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-29Parallel execution of Client Health checkRam Krishna Verma3-44/+85
Issue-ID: POLICY-2390 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: I42f443c64bcf6652adb9795ee8e71e37d8fa8c71