aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
AgeCommit message (Collapse)AuthorFilesLines
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 messageHOCKLA1-3/+0
Issue-ID: POLICY-2230 Change-Id: I363dc450b6d7aaf13696c50792cbea5a8d643413 Signed-off-by: HOCKLA <ah999m@att.com>
2019-12-02Clear some simple xacml sonarPamela Dragosh4-11/+26
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 fileHOCKLA14-29/+128
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 Hockla2-4/+43
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 Hockla5-0/+28
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 ↵HOCKLA2-0/+296
decision results Issue-ID: POLICY-2126 Change-Id: I18d50a8746ede792ec9507ab98125383c5914ba1 Signed-off-by: HOCKLA <ah999m@att.com>
2019-09-09Integrate using Policy Type to find MatchablePamela Dragosh1-2/+4
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 Hahn9-31/+159
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 Hahn1-6/+1
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 Hahn1-23/+27
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 Hahn6-0/+830
Change-Id: I9b59dcd27705e40c424b6a76420e0395adbe44bb Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-08Fix xacml-pdp due to sonar changes in commonJim Hahn1-3/+4
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.sreekumar11-69/+199
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 Hahn2-2/+12
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-04-26Refactor xacml-pdp to remove various statics3.0.2-ONAPjh73587-365/+356
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-12Add statistics and sonar cleanup and blacklistPamela Dragosh11-39/+287
* 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 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-10Test decision from main entryPamela Dragosh2-7/+55
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-05Xacml PDP Register/Unregister ChangesMichael Mokry6-24/+86
1) Modified activator - Extend and use ServiceManagerContainer - add topicSink and topicSource properties to TopicEndpoint manager 2) Added PAP registration class 3) Added PDP message formatting class 4) Added PDP State Change listener to listen for state change and send back PDP Status.. then start heartbeat if not started already 5) Added Heartbeat publisher code to send heartbeat status on periodic interval 6) UPDATE: Made changes to satisfy Jim's review comments 7) Added code to XacmlPdpApplicationManager to get supportedPolicyTypes 8) UPDATE: more changes to satisfy Jim's latest review comments 9) Fixed the failed Junits causing build failure 10) Made change to use NetworkUtil for getting PdpStatus name value per Jorge's comment Still need to in separate review: 1) Write Junits for new code Registration and heartbeat flow as I understand it: 1) PDP starts and sends initial status to PAP with PASSIVE state 2) PDP listens for State Change from the PAP 3) PDP sends updated Active state to the AP 4) PDP begins sending periodic heartbeat status to the PAP Change-Id: Iafa06ae3f1ee195c7da3710a12d9c095c5413ec2 Issue-ID: POLICY-1449 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-04-04Tie XACML REST DecisionPamela Dragosh8-19/+241
Ties the decision API to the applications. Adds a static application manager class to manager the applications. Added applicationPath as a parameter to be supported in the Json parameter group. Issue-ID: POLICY-1440 Change-Id: I43cb44b3e308aadcf258fd987f3b53944c2edb72 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-01Adding guard PIPPamela Dragosh5-3/+37
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-3/+3
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 Dragosh6-12/+34
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-20Use Policy Translator abstract classPamela Dragosh4-0/+34
Instead of applications implementing the converter, use a protected abstract class that implements common code. Newer applications could re-use existing application, and shared code can be put into the base translator class. Fixed sonar issue and changed guard xml. Removed Converter and made translator into an implementation class that is an object in the Application Provider. Issue-ID: POLICY-1273 Change-Id: I9b48cbcdaf80d6d2ef19ef53e4b7cd4830e7e7b2 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-18Started with test decision JSON objects.Pamela Dragosh7-1/+293
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 Dragosh4-1/+32
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>
2019-03-11Added HTTPS and CADI/AAF Support for PDP-XMichael Mokry5-40/+192
- Yay I found the mysterious https issue that caused the junit to fail. Please don't laugh, it was a typo :) - Made changes per review comments 1) Added builder class for RestServer constructor 2) removed some try/catch blocks in junit 3) Other minor changes - More changes per review comments - Added changes per Ram's review comments (not lombrok yet) - Made changes for ONAP API CVS guidelines Change-Id: Ie1a6225459b3ce235cd73828ccddec04c690f5fd Issue-ID: POLICY-1436 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-02-26Stubbed endpoints for Decision API and swaggerMichael Mokry3-3/+6
Includes: 1) Decision API endpoint with Swagger annotations 2) Provider class for Decision added to new provider package 3) Moved other provider classes to provider package 4) Decision model class added to new model package Note: This is just a draft and still needs a lot of work, please do not merge. Thanks in advance for the review comments. Issue-ID: POLICY-1516 Change-Id: Id7414b6cb3eee1b877a0c11521babbef4938a68f Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-02-13Package and Create Docker Image for Xacml PDPMichael Mokry3-52/+72
- Creates docker image of policy xacml-pdp - Creates zip package of policy xacml-pdp - Also committed changes from Healthcheck/Statitics review that were allowed to be deferred Change-Id: Ia5fb72be05a30a341692453fe4ff32c7b112e861 Issue-ID: POLICY-1436 Signed-off-by: Michael Mokry <michael.mokry@att.com>
2019-02-11PDPX Healthcheck/Statistic RESTful API entry pointMichael Mokry17-0/+812
Includes: - Basic code structure modeled after policy distribution - Code implementation to support Healthcheck/Statistics RESTful API entry point - JUnits - Fixed Checkstyles issues and added some missing statistics classes and Junits - Made changes per Jim's comments - Made more changes per Jim's comments > made gson field static > using AssertThatThrownBy() mechanic from AssertJ > added setup and teardown to correctly terminate activator in Junit - Made corrections to the statitics endpoint and junits Change-Id: Iad40272beceff8a0f99966440e96a84fc2043b12 Issue-ID: POLICY-1436 Signed-off-by: Michael Mokry <michael.mokry@att.com>