aboutsummaryrefslogtreecommitdiffstats
path: root/applications/guard/src/test
AgeCommit message (Collapse)AuthorFilesLines
2020-05-26Change CLC logic for updated OPHist DB entries.pramod.jamkhedkar7-412/+24
Change the CLC policy logic to match the udpate Operations History DB rules. Now if a record has outcome = Started, it is considered to be in progress. Else it is considered to be complete. Issue-ID: POLICY-2583 Change-Id: If3f626bfec2d0656e43a26929107f68ff27af020 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2020-05-19Change CLC granularity to CL level.pramod.jamkhedkar4-7/+3
Change CLC granularity from target level to CL level. Remove the target matching for the db query at PIP level. Issue-ID: POLICY-2573 Change-Id: If9ba1a4d22c3b8bc5dfce0632f7037ad085f6ea6 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2020-05-08Final blacklist fix for multiple entriesPamela Dragosh2-1/+10
The last change wasn't quite right, this has multiple AndOf's under a single AnyOf. Multiple AnyOf's are treated as AND's, but what we really want is a set of OR's. Issue-ID: POLICY-2490 Change-Id: I7336643302ccf7982c91a9c082d17bcf0adb4ac8 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-05-07type_version is now mandatoryPamela Dragosh3-0/+3
Per this review: https://gerrit.onap.org/r/c/policy/models/+/107250 Issue-ID: POLICY-2538 Change-Id: I0b7711c1adc73295092996cd3a1ec7979fd2b4ba Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-04-14Fix blacklist translator and vs orPamela Dragosh1-5/+11
The blacklist entries should be treated as an or (AnyOf) vs an and (AllOf). Issue-ID: POLICY-2490 Change-Id: Id4eb823e18c59d84d4ca28b13f6a09794d36365f Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-23Point to released artifacts and use operationPamela Dragosh2-35/+35
Minor fix to use "operation" vs "recipe" in the guard request. parent, common and models are released. Issue-ID: POLICY-2378 Change-Id: I4c5005c08fef2e184ce2dccefdef0c2c2ea2dc08 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-16Missing support for PolicySetTypePamela Dragosh1-1/+1
Adds support for PolicySetType specifically for Native policies. When/If the other applications change to support they can easily do so. Adding some more code coverage for Native application and translator. Issue-ID: POLICY-2433 Change-Id: I463ca9f04928d759624a2176598b463057d386bd Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-12Better error handling for decisionsPamela Dragosh2-2/+12
Throw exceptions when requests cannot be created and return error information back. Consolidated some code to avoid sonar duplication issues. Companion review to https://gerrit.onap.org/r/c/policy/models/+/103548 Issue-ID: POLICY-2242 Change-Id: Ic873af933dab82e3aeef6335f55939666be20385 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-09Updates to support fixed guard policy typesPamela Dragosh14-280/+707
Because the new TOSCA compliant policy types support required fields, we can simplify the guard translator to utilize Match in the target vs the previous complicated Condition usage. Added test coverage to bump above 90% specifically for the guard and coordination code. Added a sonar exclusion for the test module. Issue-ID: POLICY-2244 Change-Id: Ia90d117bd7b86d28a2268fd5ab8315dce7bf0c12 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-28XACML pdp support for clc.pramod.jamkhedkar5-0/+348
Added policies for SON and PCI to support each blocking the other, with test cases and appropriate requests Issue-ID: POLICY-2163 Change-Id: I8153f9cd973a7cd6824fcd6c9787628a74148d46 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2019-10-23Consolidate common translatable code some sonarPamela Dragosh2-4/+4
There is duplicate code for some common translation of policy decision responses and for scanning obligations. Removed some TODO items (left others because I want to look at them more closely). Stored System.lineSeparator into a static var so that I can remove some unnecessary ifs. There's still one left that I am not worried about. Gson as a static variable. Issue-ID: POLICY-2066 Change-Id: I9c8162d5ad1c5f884be347dd94631fa74ca76f85 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-10-18Modified Decision API to accept query parameters and abbreviate Monitor ↵HOCKLA2-10/+4
decision results Issue-ID: POLICY-2126 Change-Id: I18d50a8746ede792ec9507ab98125383c5914ba1 Signed-off-by: HOCKLA <ah999m@att.com>
2019-10-02Removed TestUtils from common and into a 'xacml-test' projectAli Hockla2-2/+2
Issue-ID: POLICY-2090 Change-Id: Id688e305f878f56e374e6bd9047d9d6c75fbe0c6 Signed-off-by: Ali Hockla <ah999m@att.com>
2019-09-09Integrate using Policy Type to find MatchablePamela Dragosh2-2/+6
Utilize's Jim's helper class to pull from API policy types definitions so that Xacml PDP can determine which properties are "matchable". Override initialize to set translator parameters. Utilize the metadata section of ToscaProperties to store the matchable field. Updated Matchable Request to be dynamic with respect to the incoming resource attributes. Stored the policy types as JSON. Issue-ID: POLICY-1899 Change-Id: Icff3605495b0a34ebfcdfa54346095ce2d8468a4 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-06-19Update totalPoliciesCount statisticJim Hahn1-0/+1
Modified the code to set the policy count statistic at start-up and whenever the policy list is changed. Also fixed a couple of checkstyle issues in guard. Change-Id: I92017fe64cd5d19c36908347193cc21d183f051e Issue-ID: POLICY-1844 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-16Change to fix SQLInvalidAuthorizationSpecExceptionMichael Mokry1-1/+1
Added code to decode password and set property Change-Id: Ied806fcceeaa44d53ca39af636da620fb824e41d Issue-ID: POLICY-1760 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-15Fix incorrect policy with time-in-rangePamela Dragosh4-7/+8
Changed policies to use Z vs -05:00 for timezone since we cannot guarantee the timezone the VM's run in. The test should be generalized. Fixed a sonar issue in the test I was using to debug this. Issue-ID: POLICY-1639 Change-Id: If3e52d199527a8a7e11c5fa994beb8fb886c93a6 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-12Add statistics and sonar cleanup and blacklistPamela Dragosh6-38/+74
* Adding in the statistics for decisions and errors. * Cleaned up sonar issues and added code coverage. * Sped up JUnit tests * Fix JUnit issues with not finding application path * Fix TestDecision not finding persistence.xml * Fix for lingering statistics from previous runs. That needs to be addressed at a later time. * Changed persistence to use properties for configuration of database rather than hard coding the persistence.xml * Fix for Josh's comment to use else-if * Changed to use apache Pair * Added blacklist guard policy Issue-ID: POLICY-1440 Change-Id: I56af8c3dcc82463f7381f1eaea7f1440b76200bd Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-11Add Control Loop Coordination policy.Joshua Reich12-30/+462
Refactor code to support multiple pip engines. Add pip engine for outcome. Modify LegacyGuardTranslator to use coordination translator's convertPolicy function when processing coordination guard. This version of convertPolicy intentionally uses string replacement on template-like xacml coordination guard to enable future support for API-based creation of new coordination guard types. Bug fixes and code cleanup. * Unused imports, sonar problems. * Consolidation of getAttribute method * Only use TypedQuery for Pips Issue-ID: POLICY-1471 Change-Id: I4e9365b7f23bee96cf438dad44feda97c65f6ecc Signed-off-by: Joshua Reich <jreich@research.att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-10XACML PDP DmaaP Deploy/UnDeploy FunctionMichael Mokry2-73/+43
1. Added PDPUpdate listener 2. Added PDPUpdate Publisher 3. Added code to handle PdpUpdate messages and load policies being deployed 4. Modified Activator to register listener 5. Provided placeholder code to get policies from pdpx for return PdpStatus response to the PAP 6. Other minor modifications 7. Fix XacmlPdpApplicationManager to only load policy if supports policy type. 8. Checkstyle fixes 9. Updated applications to support loadPolicy(ToscaPolicy) and all the translators, JUnit tests. 10. Consolidated some duplicate code in the applications. Can probably do more in that area. 11. Fixed bug in Properties not really having a copy constructor. Change-Id: Ic29ad426061cbdb79c1339314667bb8ff8decb88 Issue-ID: POLICY-1451 Signed-off-by: Michael Mokry <michael.mokry@att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-10Test decision from main entryPamela Dragosh1-10/+15
Tests a decision upon startup. This also updates the use of ToscaPolicyTypeIdentifier for all the applications. Very basic packaging for applications and their properties. Added cleaning of unused imports to remove sonar issues. Added production persistence.xml file to guard application. Not sure if we need a copy in the application/common resource directory. Issue-ID: POLICY-1440 Change-Id: If96eef5a9e0a7c6cc5461c0bdb6f0cd708cc41bb Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-01Adding guard PIPPamela Dragosh6-69/+217
Adding the PIP support into the translator to setup the count attribute as an attribute generated by PIP and not sent by calling application. Added JUnit for OperationsHistoryPipEngine. Issue-ID: POLICY-1471 Change-Id: I71773ee8ea0e6c02873506d973a604899383d4b5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-26Fix comments and add debuggingPamela Dragosh3-51/+56
Added some fixes from previous review and some debugging for the JUnits. The merge failed in the JUnits and I could not see why. I think the wrong request was sent, but I'm not sure why the JUnits woulnd't fail locally or in the verify job. We need to do a lot of testing with these policy translations. Also fixed the guard policies to use correct VF Module Create recipe. Issue-ID: POLICY-1273 Change-Id: I813bcca92436d356c43da5613eab7ba7746a4e3d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-25Adding optimization application finish guardPamela Dragosh5-120/+305
Created Optimization application and created a translator for it. The translator makes an assumption that OOF wants to query on policyScope and policyType properties. Rearranged some of the test code for re-usability. Guard policies are now creating for frequency limiter and min max. Probably could use some clean up. Upgraded to xacml 2.0.1 to include a fix for handling null attribute values. Added some code to test missing values. Issue-ID: POLICY-1273 Change-Id: Ia3dbfa992bbe0cbb5aa294c38aa2aff430a3230a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-18Started with test decision JSON objects.Pamela Dragosh1-36/+130
Added new Policy Finder Factory that ONAP will use and got the code working with new policy/models (see other review which will have to be merged first). Added some new conversion methods to convert from a Xacml request to an Onap request. Added some property methods for XACML Properties objects and JUnit tests. Started filling in some Guard application details and combining code. Issue-ID: POLICY-1602 Change-Id: I5235b74f3b036dcf05779b655a03ac290d594354 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-15Monitoring policy creation foundationPamela Dragosh2-0/+133
Upgrde to xacml v2.0.0 release artifact. Some re-arrangement of classes. New class to support a common dictionary among the monitoring applications. I may move it to a common under the main since some of the values are shareable. Created application service provider, so the XACML main knows what policy types are pre-loaded and can report them back to the PAP. struggled with cucumber, which does not create TemporaryFolder although the documentation says its supported. Added a new Policy Finder specific to ONAP which does quicker job to load policies. Issue-ID: POLICY-1273 Change-Id: I4af15a64da3b42d48f29809710421b1649625adc Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>