aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src
AgeCommit message (Collapse)AuthorFilesLines
2020-06-19Changes for checkstyle 8.32Jim Hahn5-5/+1
Issue-ID: POLICY-2188 Change-Id: Ib90222c537c5440e0de52fa0acbaa99bbcc4772a Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-09sonar issue drools-application - 2Taka Cho1-5/+0
fixed some sonar issues: removed empty method, put expected value in the 1st argument Change-Id: I86747938187abda34e9ab41b735d55fbf920ecd8 Issue-ID: POLICY-2616 Signed-off-by: Taka Cho <takamune.cho@att.com>
2020-06-01Use OperationsHistory from modelsJim Hahn3-51/+50
Deleted Dbao and replaced it with the shared class in policy-models. Also had to update the queries and the persistence.xml accordingly. Note: with this change, the "database" project is no longer needed, so it was deleted. Issue-ID: POLICY-2581 Change-Id: Idfde68b28b3a27f2ee794fa477d15e0f12717373 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-23Enable guards in junit testsJim Hahn1-3/+3
Flipped the flag(s) to enable guard checks in the various junit tests for the Usecases and Frankfurt controllers. Note: the guard checks use the guard simulator. Modified new actor code to not include operation history on first "guard denied" report (i.e., make it work like usecases does). Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I2897da4a0c8fb76fa00cb0f6cf8562c0703005d3
2020-01-16policy/drools-apps jdk11 upgradesHockla, Ali (ah999m)4-7/+8
Issue-ID: POLICY-1587 Change-Id: I02bef6c829f2f24954ae73fb0c540ab7198775ce Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2019-11-08Fix more sonar issues in drools-applicationsJim Hahn1-28/+34
Addressed the following sonar issues: - unused imports - unused method parameters - superfluous "throws" declaration - fields within a serializable class must also be serializable; this was/will be fixed with a change to AaiCqResponse in policy-models - use logger instead of System.out; turns out that the code that used System.out is no longer needed. In fact, deleted several classes that are no longer needed: ControlLoopLogger and ControlLoopPublisher - cyclomatic complexity and switch/case statements too big; used eclipse to extract chunks of code into separate methods - duplicate code Note: extracted common code and used lambdas to eliminate duplicate code in PolicyGuardYamlToXacml. However, a better approach would be to use object-oriented programming, using mini/nested objects to do the generation. The lambdas would then become abstract methods. Nevertheless, that would entail significantly more re-write of this class than desired at this time Issue-ID: POLICY-2225 Change-Id: Ie503ffd7accbad3e410af602d32b29c0095c3a33 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-10-22Modify drools-applications to use new Lock APIJim Hahn8-869/+0
Modified code to use new Lock API. Also deleted TargetLock and PolicyGuard, as they are no longer needed. Issue-ID: POLICY-2113 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I5bc9b7732f9cfc6056789b2902d9f6f838b560be
2019-08-15Modify to work with new drools-pdpJim Hahn4-27/+25
Due to sonar fixes, drools-pdp changed in a way that requires changes to drools-applications. In the case of template.demo, lots of test cases had to be modified, so they were refactored to extract common setup and tear down code. Fixed checkstyle issues. Fixed license date. Change-Id: Ie9e0239b95916ae7ef8c1b669987f7bb07d841b9 Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-13Fix sonar issues in drools-applicationsJim Hahn1-85/+47
Addressed sonar issue, "Move constants to a class or enum.", by moving the "manager" object from the ControlLoopMetrics interface into a utility class, ControlLoopMetricsManager. Addressed sonar issue, "duplicated blocks of code must be removed.", by refactoring PolicyGuardYamlToXacml, extracing common functions. Addressed sonar issue, "Remove this unused import", in RestControlLoopManager. Addressed sonar issue, "Refactor this method to throw at most one checked exception", in event manager. Fixed likely new sonar issue with assigning to a parameter. Moved logging line to more appropriate place. Addressed reviewer comment: Use "replace" instead of "replaceAll", thus avoiding escaping Change-Id: I47db957c83c1b3e2bd2330474e261987c6f0aac6 Issue-ID: POLICY-1967 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-09Fix drools-applications due to sonar changes in commonJim Hahn1-3/+3
Fixed breakages due to changes made in policy/common to satisfy sonar. Repointed op.pom to correct parent, which allowed the other version to be dropped and properties used in the rest of the pom. Change-Id: Ib19c228c38b7f27fb9e9f508e5cf2566a8939cdd Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-27Fix some sonar issues in drools-applicationsJim Hahn11-260/+242
Added coverage to: - feature-controlloop-management Fixed sonar issues, but didn't add coverage to: - feature-controlloop-trans - eventmanager - guard Change-Id: I12f09c4a533e838c6fb9762ba56194e51ce864eb Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-26Fix sonar issues in drools-applications databaseJim Hahn1-3/+1
Refactored to eliminate duplicate code blocks. Added coverage tests. Change-Id: I99d2b6f68fee38a1dbbf038ad29d1dfe87fb4ae7 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-18Fix build issues in drools-applications due to changes in policy/models repoRashmi Pujar2-32/+32
Issue-ID: POLICY-1791 Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca> Change-Id: Ife7cbb07c3bb674257bb1979d80f4f8a7ddfc3a5
2019-06-13Fix fieldname for guardPamela Dragosh1-1/+1
Should be clname Issue-ID: POLICY-1855 Change-Id: I17d59f33e761386bad9a30a07ec505ac66c6215a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com> (cherry picked from commit 5eaecb6bb0c0cfca4cf48f23b3b6b32dc8213d0b) Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-05-17PDP-X guard url is retrieved incorrectly.jhh3-2/+3
Change-Id: Ibf3df9288268ca7c8edfc9007e15c31802a4e5e1 Issue-ID: POLICY-1780 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-05-08Add debugging of REST callPamela Dragosh1-1/+7
Debug should really be info not only to assist with debugging but it really should be tracked in the logs. Issue-ID: POLICY-1730 Change-Id: Ib94a60d67820747e594a6ea513e1fdaf1a4f6f48 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-05-03Change guard pdp rest to new apiPamela Dragosh7-516/+93
The guard PDP REST call must be changed to support the new api. Needed to clean out quite a bit of unnecessary code. In addition, there never should be an Indeterminate response coming back anymore. Issue-ID: POLICY-1730 Change-Id: I14b3ad39a803646cfffaba9b77cc2aac79e79bdf Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-11Cleanup PIP/Database-related code.Joshua Reich11-1460/+67
Ensure database schema/naming consistent across repos. Ensure PIP implementation consistent across repos. Cleanup unused imports and made sure licenses are ok. Issue-ID: POLICY-1471 Change-Id: I20a325fe3e66e6ae400e603ec366315aea716993 Signed-off-by: Joshua Reich <jreich@research.att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-10Parse new model ids from operation policyvamshi.nemalikonda1-0/+7
Takes VFModule info from policy yaml,instead AAI. Change-Id: If745b3ba32562cbc37571cea29ec7797ee697e88 Issue-ID: POLICY-1545 Signed-off-by: vamshi.nemalikonda <vn00480215@techmahindra.com>
2019-03-19Change LoggerFactoryWrapper to NetLoggerUtilDaniel Cruz1-7/+5
Removed LoggerFactoryWrapper references to use NetLoggerUtil. Issue-ID: POLICY-1499 Change-Id: I6f7066f4523736672e17d2e1e609c38c44852769 Signed-off-by: Daniel Cruz <dc443y@att.com>
2019-02-02Use helper class to retrieve network loggerKrzysztof Opasiak1-7/+8
Instead of abusing constant from Topic interface use new dedicated helper class to retrive network logger. Issue-ID: POLICY-1486 Depends-On: Ic1f07466e1ab6abcc00098e617f0e82da19e852d Change-Id: I453a14c3dda337f2a4d08914ead32b37adc17353 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-14Remove guard checkstyle suppressionsJim Hahn16-142/+146
Renamed a number of fields and methods, in the Guard classes, to conform to camel-case format. Also updated some toString() methods to return "xxxId=" instead of "xxxID=", if the corresponding field names were also xxxId. Updated license data in one changed file. Change-Id: Idac58f8744b5523d6daed7f369026495dd357bf8 Issue-ID: POLICY-1140 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-26Rename test classes in drools-applicationsParshad Patel3-11/+11
Make test classes name consitence by adding 'Support' or 'Dummy' at start of util or dummy type of test classes Issue-ID: POLICY-1258 Change-Id: Idea946375ee46f14512d4c4bc29e65adaa4d2b37 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
2018-10-02Merge "Fix remaining sonar"Pamela Dragosh2-13/+14
2018-10-01Fix remaining sonarPamela Dragosh2-13/+14
Mostly moving variables to their right spot. Issue-ID: POLICY-1129 Change-Id: Iccc084bbb404ffd51bdd0b26b5f8c373c6142fb1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-28Merge "Yet more sonar issues in drools-applications"Pamela Dragosh1-15/+16
2018-09-27Fix more sonar issuesPamela Dragosh3-11/+11
Most of these are minor issues along with a few others. They have been bugging me so I thought I would get them done. Some also do not show up on sonarlint. Issue-ID: POLICY-1129 Change-Id: I31f2765f6babdfa80b23f0589daacc98da8d2002 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-27Yet more sonar issues in drools-applicationsJoshua Reich1-15/+16
removed unused imports and variable definitions moved variable declarations above methods refactored deeply nested if/while removed code smell due to unecessary use of static keyword moved string literals to left side of comparator fixed logging of exceptions immediately return expression instead of assigning it to the temporary variable Change-Id: Idfd2a2bdf3c2f3bbfcb54a06b713d57bc867b3ab Issue-ID: POLICY-1129 Signed-off-by: Joshua Reich <jreich@research.att.com>
2018-09-24Fix checkstyle declarationsPamela Dragosh9-224/+49
I fixed what I thought would be tolerable for this release. Same issue as policy/common I had to defined the checkstyle in each repo where the suppressions were needed. Issue-ID: POLICY-1135 Change-Id: I8f30bee7e9cddc692ddad3cf88acedb2e6b4781b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-21new sonar issues in drools-applicationsJim Hahn1-18/+18
Don't return null lists from AAI. Transient TargetLock. Extract aai.url, et. al., constants. Don't allocate extra unneeded variable. Re-order fields in xacml attributes. Extract "vserver" constant from simulator. Replace thread sleep with join. Change-Id: Iee1bd182862632af1f131cca5db5b526f5865b9f Issue-ID: POLICY-1129 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-17Add demo for Control Loop Coordination.Joshua Reich4-10/+741
New PipEngine and Junit test added to guard. Also bug in existing Junit test fixed. All other code added to new directory template.demo.clc Change-Id: Ida2267528bcb9404dc59ff391d45797b591814cc Issue-ID: POLICY-1109 Signed-off-by: Joshua Reich <jreich@research.att.com>
2018-09-14Option to disable target locking. Needed by CLC.Joshua Reich1-31/+44
When used, the ControlLoopEventManager will set useTargetLock to false converting TargetLock lock/unlock operations to no-ops. Allows CLC-specified logic to coordinate closed loops instead of hard-coded mutual-exclusion enforced by target locking. Change-Id: Ic067c1e1ce47b12d12742ed4bc04d59aa42751d6 Issue-ID: POLICY-953 Signed-off-by: Joshua Reich <jreich@research.att.com>
2018-08-31pass VF count to guard for scale-outJim Hahn6-45/+145
Also updated license dates. Fixed new checkstyle errors. Change-Id: Ia6153814c4333724185918f76be560aba5a52f96 Issue-ID: POLICY-1084 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-08-29Fix remaining checkstylePamela Dragosh7-138/+238
Lots of formatting, missing javadoc, distance from use, imports must be explicit, ordering of methods. Fixed some abbreviation problems in classes and renamed JUnit tests to fix this. Issue-ID: POLICY-883 Change-Id: I8494f63d88d63c0232aca97f7bcc848816228fb1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-14Fix checkstyle issuesPamela Dragosh4-16/+27
Spacing, missing javadoc Issue-ID: POLICY-883 Change-Id: Ice65c6c1baf0bb7c6273411f078bacfe3496b89b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-07-30Copy policy-endpoints from drools-pdp to commonmmis2-2/+2
Replaced references to classes deleted from drools-pdp with references to the corresponding in policy-common Issue-ID: POLICY-967 Change-Id: Ia9d2ac704e6b7c434e5a9e7aee6d7dcf9198e4f2 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-16Use refresh() instead of lock() in guardJim Hahn2-43/+28
This is the second step of separating the lock "refresh" operation from the original "lock" operation. Modified PolicyGuard to use refresh() to extend a lock. Also removed the host name from the owner String, as it will no be longer needed (once the final step is done). Change-Id: I3a498e6f81d9dba1bbdfd6f7388087355192bcf5 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-11Include hostname as part of lock ownerJim Hahn2-29/+35
Because the lock owner string is constructed, using just the target type and request ID, lock requests made by different ONSETs running on different PDP-Ds may both succeed. Added the hostname to the owner string so that locks for ONSETs for the same request ID will be rejected if the request is made on different PDP-Ds. Change-Id: I1d45194cbb1c5b1a1f6000477fe51879a2fecc19 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-29Add time limit to local guard locking facilityJim Hahn2-68/+58
Modified the local policy guard locking facility to add a time parameter. Modified the control loop event manager to extend the lock when lockCurrentOperation() is re-invoked. Modified the rules to retract the lock if the lock request was denied. Reorder assertions in junit test. Change-Id: Ic9b77acbb4881a5a516f30eb56664bad1a5c4d7e Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-30Merge "Modify PolicyGuard to use new locking API"Jorge Hernandez2-83/+256
2018-04-27Modify PolicyGuard to use new locking APIJim Hahn2-83/+256
Modified PolicyGuard to use the locking API from policy-core instead of its own internal map. Initialized PolicyGuard.factory. Fixed bug in eventmanager junit test uncovered due to changes to PolicyGuard. Change-Id: I853ee5f146f3bde16b3f6e65bc188ca7c0cc4f73 Issue-ID: POLICY-577 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-27Fix failure in PIPEngineGetHistoryTestJim Hahn2-28/+43
Turns out that the getAttributesTest() method depends on testGetCountFromDb() being executed first, but junit does not guarantee this. Modified the code so that it is independent of the order in which the tests are executed. Change-Id: Ie081061e4e83895f4ac89242cf00d843b6e069d4 Issue-ID: POLICY-765 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-16Add missing license headersPamela Dragosh4-0/+76
I removed a couple of empty README and added licenses. Issue-ID: POLICY-741 Change-Id: I10aad3536d02b738a1dc606f7311de6b3a2777cd Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-03-26Fix path to logging classliamfallon1-1/+1
The package path of LoggerUtil changed as below: From: import org.onap.policy.drools.utils.LoggerUtil; To: import org.onap.policy.drools.utils.logging.LoggerUtil; Change-Id: I8187d97de5eeab92268baab155fb4de37f4df3ad Issue-ID: POLICY-448 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-03-22Removed checkstyle warningsmmis26-2646/+2796
Removed checkstyle warnings in: policy/controlloop/common/guard policy/controlloop/common/msb policy/controlloop/simulators including renaming of the following classes: MSBServiceFactory -> MsbServiceFactory MSBServiceManager -> MsbServiceManager MSBServiceException -> MsbServiceException Issue-ID: POLICY-705 Change-Id: I11d62a74fcb77e764121df119cb0bd9b844b485b Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-07Log thrown exception in PIPEngineGetHistoryliamfallon1-1/+1
Sonar Critical error highlighted, with thrown execption not logged. The exception is now logged. Issue-ID: POLICY-455 Change-Id: If2969a4fe118d22dbd1fb11879ba028487848eb8 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-02-06Add JUnit and Remove Technical Debt in Guardliamfallon23-756/+1782
Unit test for guard added and technical debt removed. Issue-ID: POLICY-455 Change-Id: I440766660ddae078013e21b1991ee49c8e488bb3 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2017-12-15Add guard junitsTemoc Rodriguez10-14/+532
Added a few junit files which test most functionality in the guard submodule. Some minor bugs were found by the junits and fixed those newly found bugs. Added persistence.xml for use by junits in guard. Issue-ID: POLICY-490 Change-Id: Ied7e276cfd417e1f396b5a6685a2e9acc9efd109 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-11-03Made network.log output more verbose.Magnusen, Drew (dm741q)1-1/+1
Incoming values were not expanded in network logs for several drools-applications. Current patch makes them more verbose. Issue-ID: POLICY-410 Change-Id: I64bf88a3b39ea58dceaf24de698c8ae6a9a3f8b2 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-10-20Added log output to multiple drools applications.Magnusen, Drew (dm741q)1-0/+4
Added logger statments to network.log for AAI, SO, PDPX Guard, and VFC for all inbound/outbound traffic. Issue-Id: POLICY-356 Change-Id: I802d45d8136f987b4304baa8f17e166b1c8df165 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>