aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
AgeCommit message (Collapse)AuthorFilesLines
2020-03-25Point to models 2.2.2Pamela Dragosh1-3/+2
Issue-ID: POLICY-2378 Change-Id: Iecf281253baae6548575890f0c919dedc36a3787 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-19Merge "Re-factor matchable to reduce complexity"Jim Hahn3-56/+89
2020-03-19Re-factor matchable to reduce complexityPamela Dragosh3-56/+89
This solution is much cleaner than what is in StdMatchableTranslator. Over 90% code coverage on it - utilizes a callback to retrieve DataType and PolicyTypes. Support for missing timestamp TOSCA type. Also can do a better job differentiating between a property contained in the policy vs a schema. Changed StdMatchableTranslator to utilize these classes. And removed the old spaghetti. Added some JUnit coverage for ToscaPolicyTranslatorUtils. Removed duplicate code in the XACML Native Exception classes. Issue-ID: POLICY-2242 Change-Id: I18f898d9e65f6da28e3b27517d40f8d389de18a0 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-18renew policy certs till 03/17/2021jhh1-0/+0
Issue-ID: POLICY-2402 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I111f60b9ef60ee9524808653be020f94ae9db170
2020-03-14Add code coverage XacmlPolicyUtilsPamela Dragosh1-1/+1
Fix spelling error and add code cover >95% for the XacmlPolicyUtils. Issue-ID: POLICY-2242 Change-Id: I21f239e6bd42073ff84883d04f2b8bee1466b8e0 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-13Bump XacmlPdpApplicationManager code coveragePamela Dragosh2-3/+213
From under 50% to over 90%. Issue-ID: POLICY-2242 Change-Id: Ie061bddbdd2fcdb37bed608847449e5bc92173b5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-12Better error handling for decisionsPamela Dragosh1-1/+5
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-11Merge "Added support for application/xacml+json in native app"Pamela Dragosh5-25/+115
2020-03-11Added support for application/xacml+json in native appChenfei Gao5-25/+115
Issue-ID: POLICY-2182 Change-Id: I13246e08afdc2f5a380b5737c72851f271211d46 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2020-03-10Misc XACML code coveragePamela Dragosh2-3/+42
Removed duplicate code from operations history classes. added code coverage to other classes. cleared sonar in main for args Issue-ID: POLICY-2242 Change-Id: Ief548c96a180c132a3f17681d9cbc018c62e42ac Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-28Build XACML PDP support for native xacml policy typeChenfei Gao19-12/+964
Added a new native application to the service loader framework Added a new translator for the native application Added custom serialization providers for xacml+json and xacml+xml Added a new endpoint for native xacml decision api Added a new api provider function to handle the native xacml api calls Added corresponding junit tests Issue-ID: POLICY-2182 Change-Id: I30fa4637612c324d543f9952386cf1a27a52d76c Signed-off-by: Chenfei Gao <cgao@research.att.com>
2020-02-13Add missing apps/naming directory for testingPamela Dragosh1-0/+31
Just clears a warning from main JUnit tests. Issue-ID: POLICY-1740 Change-Id: Ie9e5bb0463bf5827085a714a61a5d87021f37860 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-01-14policy/xacml-pdp jdk11 upgradesHOCKLA1-9/+8
Issue-ID: POLICY-1596 Change-Id: I00164ea17eb9d547b45c01e5f46f7aaf0f9a25e2 Signed-off-by: HOCKLA <ah999m@att.com>
2020-01-06Removed supported policy types from Pdp-Status messageHOCKLA2-4/+0
Issue-ID: POLICY-2230 Change-Id: I363dc450b6d7aaf13696c50792cbea5a8d643413 Signed-off-by: HOCKLA <ah999m@att.com>
2019-12-23Add optimization subscriber requestPamela Dragosh1-2/+3
Adding support for a preliminary request to pull subscriber details. The returned decision adds scope attributes for the original request. Fixed some checkstyle issues due to new checkstyle requirements. Issue-ID: POLICY-2066 Change-Id: Ief02d896ce33e4864bb20e9185b0d0f5eb254bfd Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-12-02Clear some simple xacml sonarPamela Dragosh5-12/+27
Missing assertions in JUnit test cases. Use replace vs replaceAll Swapping arguments Issue-ID: POLICY-2079 Change-Id: I5accd462eab3d4f6b3321e375d4ba1084caf4b8c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-11-15Changed Xacml-pdp to report pdp group defined in XacmlPdpParameters config fileHOCKLA17-35/+140
Ignore the pdp group specified in the PdpUpdate message. Updated junits and test resources. Issue-ID: POLICY-2229 Change-Id: I0c7a33c45424cef6440b0837e1dd22a7487c5d44 Signed-off-by: HOCKLA <ah999m@att.com>
2019-11-12Added support to return status and error if pdp-x failed to load policyAli Hockla5-31/+87
Issue-ID: POLICY-2175 Change-Id: I32d2fe78846f58d6e700100dd523732817f1f04d Signed-off-by: Ali Hockla <ah999m@att.com>
2019-11-05Added support for 'Active' and 'Passive' states.Ali Hockla7-5/+81
Removed the rest server start/stop from the Activator because the engine starts in PASSIVE state. Added code to start/stop the rest server when a pdp state change occurs. Issue-ID: POLICY-2154 Change-Id: Iec6fcc990dc3dde702a911eb4f90d29e25c395a2 Signed-off-by: Ali Hockla <ah999m@att.com>
2019-10-28Optimization improvements and test casesPamela Dragosh1-12/+0
* StdBaseTranslator added helpful support methods and can now add obligations to either rule, policy or policy sets. * StdMatchablePolicyRequest improved to support optional policy-type as part of the request to refine the output results. * Added more tests to ensure that the decision is returning the appropriate results. * Added more Javadoc for code. * Added some sonar fix for either log or throw exception. Issue-ID: POLICY-2066 Change-Id: I90d6d90c2cdbb627e96cfce1d2632b2439a1e477 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-10-23Consolidate common translatable code some sonarPamela Dragosh1-2/+2
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-21Use yaml policies in models-examplesPamela Dragosh1-1/+1
Now that yaml is supported, use those policies that are stored in the models-examples that are preloaded into the api. Fixed a minor checkstyle issue. Not sure why it was missed. Issue-ID: POLICY-2066 Change-Id: I2f4384a310bfa818555de5dacb477daf82fac6de Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-10-18Modified Decision API to accept query parameters and abbreviate Monitor ↵HOCKLA4-8/+304
decision results Issue-ID: POLICY-2126 Change-Id: I18d50a8746ede792ec9507ab98125383c5914ba1 Signed-off-by: HOCKLA <ah999m@att.com>
2019-10-09Sonar xacml-pdp issuesPamela Dragosh1-0/+5
Either log or re-throw exception Refactor to not nest more than 3 statements Refactor to throw at most one exception Move variable to comply with Java Code conventions String literal on LHS Issue-ID: POLICY-2079 Change-Id: Iac33623ef4694cf38c4a69c8f0b9040d8439998e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-09-13Upgrade to Tosca derivedFrom fixPamela Dragosh2-8/+2
Upgrade to models fix for derivedFrom() append of 0.0.0 And some sonar fixes for: Exceptions should be either logged or rethrown but not both Preconditions" and logging arguments should not require evaluation Reduced cognitive complexity Issue-ID: POLICY-2079 Change-Id: Ied8630020e8a737c33b1484db953df133c89398f Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-09-12Add yaml support to xacml-pdp rest serverJim Hahn1-2/+3
Also modified code to use StandardYamlCoder. Change-Id: I0596c8b054339ac68ef8c4250cd25b9ff88d47e4 Issue-ID: POLICY-2085 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-09Integrate using Policy Type to find MatchablePamela Dragosh3-9/+13
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-08-30Get policy type from policy-apiJim Hahn10-79/+178
Added a class to retrieve a policy type from the policy-api. Updated property files to include parameters that are needed to configure it. Updates per review comments: - change PolicyApi to PolicyApiCaller - use HttpClientFactory - removed superfluous constructors from exception classes - changed parameters to use RestServerParameters instead of BusTopicParams Change-Id: I8aad6ca5a733c8ad9cc983496e745ebe7400dd17 Issue-ID: POLICY-1911 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-23XACML junit spews dmaap errorsJim Hahn1-1/+1
Modified junit parameters to specify "noop" instead of "dmaap" in the topic properties, eliminating the dmaap error messages from the log. Change-Id: I350d988d10219e6ded2c011a4ed117fd5e71876a Issue-ID: POLICY-1725 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-22update keystorejhh1-0/+0
Issue-ID: POLICY-1988 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I544a0bdf63582cdff74765d7fad1b7f993d0bfa0 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-07-30Use new addTopic() method in xacml-pdpJim Hahn3-18/+5
Replaced ParameterUtils with the use of the new addTopic(TopicParameterGroup) method. Change-Id: I35bf8a78d4670835dda005cdb218665a3bf48a16 Issue-ID: POLICY-1953 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-23Fixed xacml-pdp registrationJim Hahn2-38/+46
Apparently, TimerTasks may not be cancelled and then re-scheduled. Modified the code to use a scheduled thread pool instead. Change-Id: I2e26a5a37636f570f362481823a0274fe558e2e9 Issue-ID: POLICY-1939 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-23Add junit coverage to xacml-pdpJim Hahn8-3/+848
Change-Id: I9b59dcd27705e40c424b6a76420e0395adbe44bb Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-17Modify xacml-pdp to use RestServer from commonJim Hahn2-171/+9
Change-Id: I331483e2e28f2c57160b3eaace40fc84a1c13727 Issue-ID: POLICY-1652 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-08Fix xacml-pdp due to sonar changes in commonJim Hahn3-11/+13
Fixed breakages due to changes made in policy/common to satisfy sonar. Change-Id: I6c655ca9509bc1d52277d55b02103e9875de2c29 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-04Remove topic.properties and incorporate into overall config file for xacmla.sreekumar16-321/+226
Change-Id: I3be6248db65041f5d9b7acfcf0fcd2f49d9d70f8 Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-07-01Use ToStringTester from utils-testramverma1-1/+1
Changing ToStringTester from utils to utils-test. Bumping the policy/common & policy/models version. Change-Id: Idf665bc92345c445f483ebfb190d39c7019280aa Issue-ID: POLICY-1746 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-06-19Update totalPoliciesCount statisticJim Hahn6-5/+35
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-06-17Change getCanonicalName() to getName() in xacml-pdpJim Hahn2-3/+3
Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Change-Id: Id9ad514a7ba10e7cdbf292bba2b07135bdbd2572 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-01Changes to support previous review commentsMichael Mokry2-6/+3
Added new generated request id when sending terminate message changed to send clone of PdpStatus Change-Id: Ia60469c8a62d3c2eff63fd592984cade4760b2bc Issue-ID: POLICY-1645 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-30Added code to send Termination message to PAPMichael Mokry2-2/+29
Fixed checkstyle issues Made changes to include PdpGroup and PdpSubGroup in termination message Change-Id: I772404adbbe9be18001554616eb0c935317bdaba Issue-ID: POLICY-1645 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-26Refactor xacml-pdp to remove various statics3.0.2-ONAPjh735821-816/+763
Refactored xacml-pdp to eliminate a number of static fields. Modified junit tests to allocate new ports for each test. Also modified XacmlPolicyUtilsTest to convert path names to match the file system so that the junit will work in OSs other than linux. Replaced logback.xml with a copy of the one from PAP to resolve some issues. Don't print entire message when discarding, as each PDP receives messages for ALL PDPs. Remove shutdown class from Main - just invoke this.shutdown() directly. Added additional comments to CommonRest. Also modified port test parameters. Change-Id: Id8bf7216cdcb59a1a2cb4cb957fa44f640315cfe Issue-ID: POLICY-1645 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-26Fix nullpointer issue in pdpx heartbeatMichael Mokry1-1/+1
1. Added a null check against XacmlPdpActivator.getCurrent() method to fix the following exception Exception in thread "Timer-0" java.lang.NullPointerException Change-Id: Ia6c7efc2bd317dd52e9e89dd4f9f59d9d66d0857 Issue-ID: POLICY-1703 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-25Fix xacml pdp registration issueMichael Mokry6-72/+70
1. Added appliesTo() check to state change and PDP update listeners. 2. Made changes to record the extracted pdpUpdate values. 3. Removed pdpState instance variable from heartbeat publisher 4. Split XacmlPdpMessage.updateInternalStatus() into two methods to handle PdpStateChange and PdpUpdate messages separately 5. Cleaned up unused imports Change-Id: I76c68d925e46d475c086bd5b86851ea44d821b28 Issue-ID: POLICY-1673 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-12Add statistics and sonar cleanup and blacklistPamela Dragosh22-208/+440
* 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-12Merge "Add Control Loop Coordination policy."Pamela Dragosh3-48/+0
2019-04-11Add Control Loop Coordination policy.Joshua Reich3-48/+0
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-11Changes to handle PDPX deploy/undeployMichael Mokry3-11/+77
Added changes to handle incoming udpate for deploying or undeploying the policies by comparing both sets. STill need to add support for removing the policies and getting the deployed ToscaPolicyIdentifiers for PdpStatus response. * PLD - added functionality to unload policies in the applications and * PLD - added map of loaded policies * Mike - made change to address Jim's and Joshua's comments * Mike - Made change to use mapLoadedPolicies to get deployed policies from the applications * Mike - made change to assembly.xml to add support for apps directory. Change-Id: If7d119197171b68b905b7fd0f2b5be6cf6f609e7 Issue-ID: POLICY-1451 Signed-off-by: Michael Mokry <michael.mokry@att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-10XACML PDP DmaaP Deploy/UnDeploy FunctionMichael Mokry7-21/+247
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 Dragosh7-37/+116
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>