aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
AgeCommit message (Collapse)AuthorFilesLines
2019-06-04Undeploy policies when subgroup is deletedJim Hahn3-19/+205
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-05-17Add son handler to xacml pdp groupPamela Dragosh1-0/+4
Need this for the 5G OOF PCI Use Case. Issue-ID: POLICY-1776 Change-Id: I86758174840d376d6003f5200f0deeb72c3e01d9 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-05-10Return 200 when policy successfully undeployedJim Hahn4-5/+27
The PAP Undeploy CSIT was failing, because it was returning 400. The code was counting PDP UPDATE requests to determine whether or not the policy had been found. However, if a subgroup currently has no PDPs assigned (as is the case with the CSIT), then there will be no PDP UPDATEs, thus it will think that the policy was not found and return 400. Modified the code to count updates to the DB instead. Change-Id: I80cdcc738e07c418e0a7184284e7a228e3a6014d Issue-ID: POLICY-1758 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-09Use group from cache even with new policy typeJim Hahn3-18/+57
When multiple policies are deployed to the same group in a single request, and the policies have different policy types, only the changes associated with the last policy are kept. Updated the policy type lookup to use cached groups, when available. This still needs a junit to verify the fix, but that can come later. Also added more logging. Change-Id: Ieaf866da504b167c884bf53f88aa8cb9e9b5e32a Issue-ID: POLICY-1761 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-09Return error when deleting non-existent policyJim Hahn6-16/+41
When undeploying a policy, if a policy's type is found in a group, but the policy is not, then PAP returns 200. It should return an error instead. Change-Id: I88273fdbd5d49095e8248ab9267cccc529af0ae0 Issue-ID: POLICY-1758 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-02Changing the PAP initial db dataramverma1-60/+28
Changing PAP initial db data to bring all the xacml supportedPolicyTypes in one PdpGroup. Change-Id: I9a0788c788bab470109b0f09fb631e7fbb90042e Issue-ID: POLICY-1723 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-30Cancel PDP timers in PAPJim Hahn2-0/+13
When a response is received by PAP from a PDP, the associated timer (and listener) are not being cancelled. As a result, when the timer later expired, PAP was re-sending the request. Modified the code to fix this. Change-Id: Id63f76622c01d286c169b618f8369b849ff31085 Issue-ID: POLICY-1715 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-30Adding algorithm for Pdp registrationramverma2-24/+129
1) Adding algorithm for improving Pdp registration. The flow is: When a new Pdp comes for registration, PAP will shortlist a list of PdpGroups based on the supportedPolicyTypes reported by PdpStatus message and the supportedPolicyTypes in the PdpSubGroup. Then PAP will find the PdpGroup which needs the Pdp most in two ways: 1) If there is a subgroup with no Pdp's then that takes the priority. 2) Otherwise the Pdp is allocated to the PdpGroup with highest difference value of desiredInstanceCount - currentInstanceCount. 2) Changing the preconfigured TosaPolicyType for apex to avoid interference with legacy operational policies of drools. Change-Id: I77584c3c030bc27903c11689acaca33148e27e3c Issue-ID: POLICY-1630 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-29Sonar fixes for PAP "duplicate code"Jim Hahn3-40/+42
Extracted common code from "delete" controller. Extracted common code from "deploy" controller. Not sure if this will actually fix the sonar issue or not. If it's really complaining about the code, then this should fix it. On the other hand, if it's complaining about the annotations, then I don't think there's a way around it. Change-Id: I7c68393f3fc1b9719987d850582bd8ed335b9663 Issue-ID: POLICY-1711 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-24Validate supported types3.0.2-ONAPJim Hahn9-22/+157
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-23Return appropriate HTTP status codeJim Hahn15-375/+351
Return 404 instead of 500 when items are not found. Bubble up other HTTP error codes instead of changing them all to 500. Change-Id: Ib614bb83f28cfb1ce2384679398f0a45058fc455 Issue-ID: POLICY-1686 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-20Merge "Handle null policy lists"Jorge Hernandez3-5/+60
2019-04-19Add end-to-end junits for PAP REST APIJim Hahn27-171/+2306
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-19Handle null policy listsJim Hahn3-5/+60
UpdateReq throws NPE if the policy list in the request or the response is null. Change-Id: I0d71d6ad4cc9b96315c3b3ba89af8e4d8f3f94e6 Issue-ID: POLICY-1669 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-16Add missing fields to initial subgroupsJim Hahn2-5/+14
Some required fields were missing from the subgroups in the inital DB. Also added code to validate what is initially loaded into the DB. Change-Id: Iffa56a5a0dee833691d1bb7859b075c3b4d86595 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-16Merge "Set DAO factory in request map parameters"Jorge Hernandez1-0/+1
2019-04-16Merge "Clear servlets at the start of tests"Jorge Hernandez3-0/+7
2019-04-16Set DAO factory in request map parametersJim Hahn1-0/+1
While testing, saw NPE when PdpModifyRequestMap attempted to create a DAO provider. Forgot to add the DAO factory to the list of parameters passed to the request map constructor. Change-Id: I72bc63543bc58b11c3ef70f50342e72a24a8b653 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-16Merge "Fix more sonar issues"Pamela Dragosh3-20/+27
2019-04-16Clear servlets at the start of testsJim Hahn3-0/+7
Modified the junit tests to destroy the servlet factory before each test to prevent previous configurations from interfering with new configurations. Change-Id: I558269e89af271bee13cb9db94eadbcbf08f14d4 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-16Fix sonar issue in PdpStatusMessageHandlerJim Hahn1-8/+15
Change-Id: I389f61f9311bba35115a174c8526f897c98a3364 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-16Fix more sonar issuesJim Hahn3-20/+27
Added another unused parameter from RequestImpl to a logging message. Removed "throws PfModelException" from ProviderBase. Shorten lambda function in SessionData. Change-Id: I5c0ba99bd92ac94bdeacd2398fbc65f081ef85ad Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-15Fix sonar issues in PAPJim Hahn22-107/+110
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>
2019-04-15Support integer policy-versionJim Hahn9-140/+116
The deploy/undeploy APIs used by CLAMP only pass the major number when specifying a policy-version. Modified the code to handle policy-versions of the form, major or major.minor. Change-Id: I3251df162984f287bd1430b8e46da675b4c265ee Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-13Support group-oriented REST APIJim Hahn22-170/+1418
Added code to support PDP group create/update & delete REST API calls. The create/update request can also be used to deploy/undeploy policies. It is assumed that the create/update request specifies a valid list of supported policy types for each subgroup (i.e., PDP type). Updated due to elimination of "version" from group in policy/models. Added/updated junits. Change-Id: I1916d9b17dfd5f12129c6f6a2fcf54e706662c10 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12Update PDP with null group/subgroup when disabledJim Hahn9-38/+85
Modified the code so that, when a PDP is unable to fulfill a request, an UPDATE is sent to the PDP with group=null and subgroup=null. Also made updates to eliminate group version due to changes in policy/models. Change-Id: I9400ef5f8c365f492113a5b592b9ee6b7218756e Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-11Adding code for db config & initial group creationramverma10-48/+165
1) Adding code for initial PdpGroup/Subgroup creation. 2) Adding db configuration 3) Updated code as per change in policy/models Change-Id: If37870925001b333e0537e364eecb266c351cf5a Issue-ID: POLICY-1635 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-11Don't change group version numberJim Hahn10-390/+71
Modified code to update a PdpGroup, adding or removing policies, without changing the version number. Change-Id: I10031dff5f6d9c7e568605a8d73af6fe3c740901 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-11Fix junits broken with policy-id changeJim Hahn4-13/+13
Several junit tests were broken when the json-encoded names were changed for the fields within ToscaPolicyIdentifierOptVersion. This review fixes those junit tests. Change-Id: I963190b7792a2ebc3165ef04c74f4671c41c37da Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-10Remove PDP from all active groupsJim Hahn4-85/+36
The code to disable a PDP used the group name, extracted from a prior PdpUpdate request, to identify the group from which the PDP should be removed. This is not sufficient, as the requests tracker may have never seen an update request. Therefore, the code was modified to simply remove the PDP from all active groups. Also made removeFromGroups(pdpName) public so that it can be used by other PAP code. Change-Id: Iedec88cb23e586944563dcc5ac82ff3b9f122f8c Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-10Merge "Add junit tests for PdpGroupDeleteProvider"Jorge Hernandez6-19/+339
2019-04-10Merge "Refactor request map"Jorge Hernandez23-1834/+2894
2019-04-10Merge "Adding final dmaap & db configurations"Jorge Hernandez1-0/+46
2019-04-10Add junit tests for PdpGroupDeleteProviderJim Hahn6-19/+339
Change-Id: Id744a7d49b9fb608ba3379dd43bcbd6a0297891f Issue-ID: POLICY-1541 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-10Merge "Current draft of undeploy"Liam Fallon5-103/+144
2019-04-10Current draft of undeployJim Hahn5-103/+144
Change-Id: If3f01a6e92bef9eb889066115537f599e6b09229 Issue-ID: POLICY-1541 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-10Fix eclipse warning in SessionDataJim Hahn1-1/+0
Change-Id: I0c11b9704960f1b0b4d4c099a1b582ee259524e0 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-10Adding final dmaap & db configurationsramverma1-0/+46
Change-Id: I547f8a520d84d3593f90256fa91fc964c1d1e83c Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-09Refactor request mapJim Hahn23-1834/+2894
Refactored to facilitate the addition of broadcast requests in the future. Added disable-PDP capability. Updated some comments. Add junit tests. Only treat null group as broadcast - empty strings are not broadcasts. Added more logging. Change-Id: I6f62b8755d20769c333f06752e9d63ac9ed83b57 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-09Fix review comments & add updateLockramverma3-39/+74
1) Fixing review comments from previous review. 2) Adding updateLock to registration handler & state change provider. Change-Id: I9f6e0de1f58190e490b28965c84a3a0c7aa90486 Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-09Adding PdpGroup query & statechange providersramverma8-72/+301
1) Adding implementation of PdpGroup Query & State change providers for PAP REST API. 2) Adding support for unregistering Pdp after recieving TERMINATED state in PdpStatus message. 3) Updating PdpStatusMessageHandler with new filter changes in models. 4) Removing updatePdpStatistics method as we will implement db provider and REST provider in next release. 5) Fixing few bugs found during Pdp registration testing. 6) Updating the existing test cases to work. 7) Will be adding more exhaustive test cases in another review. Change-Id: I7aa20bf422671fdc1e06dab5e90aef4ee19a6a02 Issue-ID: POLICY-1541 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-08Merge "Add latest-version check to status msg handler"Liam Fallon1-2/+2
2019-04-05Add latest-version check to status msg handlerJim Hahn1-2/+2
PdpGroupFilter now supports filtering by latest version. Removed a TODO from PdpStatusMessageHandler and added the filter parameter. Change-Id: I67983397b616d8e289c4dc79d912bb4cf26e97ae Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-05Delay DB updates until all policies processedJim Hahn9-172/+515
If an exception is thrown in the middle of processing policies, it's possible for the DB to reflect a partial deployment. This change queues the DB changes so that they're all made at once, after all policies have been processed. Extracted sort() into a common place. Corrected some comments. Simplified the list retrieval in the junits since all DB creates and updates are now batched together into one operation each. Change-Id: I835175fc16d4042c741d36ec69caa8f603d46d5a Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-05Flesh out policy deployment REST APIJim Hahn34-222/+2295
Also moved the controller, the provider, and supporting classes to their own dep_undep package. Change-Id: Ifea1c4dd2ecbf93a8f4d45e130830cf9271103d3 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-05Fixes per latest models updatesJim Hahn5-26/+24
Changes made per the scrum call on 4/4 moved things around. In addition, filter classes were added to the tosca provider. Both of these necessitated changes to policy/pap so that things compile. Change-Id: Iba4c52b650dab0f8d242b06be3fede42dd5b7264 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-04Adding more code to pdp registration handlerramverma4-30/+67
1) Adding more code to pdp registration handler. 2) Fixing few broken files. Change-Id: Ic8b68f95f7022ce0572345ea358ff380ec8a3e61 Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-03Fix classes in pap to align with change in modelsramverma13-759/+71
Change-Id: I0ecef8f004967e2fffa33eff2ee7e6f035d3d94c Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-03Changes in pdp registration handlerramverma1-21/+20
1) Fix left over comments from previous review. 2) Change from PdpGroups to List<PdpGroup> Change-Id: I833d4cf2837babf0947c9999220a651f9a69bf7e Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>