summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main/java/org/onap
AgeCommit message (Collapse)AuthorFilesLines
2018-09-25Fix sonar criticalPamela Dragosh1-8/+8
Sonar complains that the password is an actual password when in fact we are doing exactly the fix they suggest. I seem to not have access to resolve it as a false positive. So it seems the better way to do this is rename this to reflect that it is actually a property value. Had to also address 120> due to new variable name size. Issue-ID: POLICY-1135 Change-Id: I2e2a36ed8d7f5c95e912df4f6ed74983cee8a3dd Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-24Fix checkstyle declarationsPamela Dragosh2-15/+16
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-10/+13
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-14Option to disable target locking. Needed by CLC.Joshua Reich1-3/+26
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-09-12implement Serializable in additional classesJim Hahn3-7/+11
Change-Id: I5d5acb9d71dc49eaa9fb397da5988ba3d8bd5f1d Issue-ID: POLICY-1106 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-12Add implementation for OOF PCI use caseSaravanan A1-1/+58
Receive DMaaP message from PCI-Handler MS with PCI Config change recommendations through DCAE_CL_OUTPUT topic. Trigger SDN-R (if allowed by policy) by sending DMaaP request through SDNR-CL topic. When the response is received from SDNR through SDNR-CL-RSP topic, just parse and print. Code review comments addressed Change-Id: If340a23ae18367b7f98e31fe79c09a09e645b2ad Issue-ID: POLICY-1089 Signed-off-by: Saravanan A<saravanan.a75@wipro.com>
2018-08-31Add code to store abatement events.Joshua Reich2-1/+55
Stores abatement events in history DB. Change-Id: Ifca6acd42cd9eea85e27765bd268a491028e305a Issue-ID: POLICY-975 Signed-off-by: Joshua Reich <jreich@research.att.com>
2018-08-29Fix remaining checkstylePamela Dragosh1-8/+8
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-21move AAI named queryJim Hahn2-2/+94
The AAI vserver named-query was being done as a preliminary step for the SO request. However, it will now be needed during the guard query, which happens much earlier. Thus it has been moved from the SO classes into the event manager class, where it is retrieved in a lazy fashion and cached. Also removed some trailing white space. Update licenses. Make test method private. Change-Id: Id7353a2e0f2d42601d5142cb92961528fa21aa94 Issue-ID: POLICY-1011 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-08-17fix new sonar issues with prov-status checkJim Hahn1-36/+37
Changes made while adding the prov-status check triggered some sonar thresholds in ControlLoopEventManager. Updated the code to resolve them. One of the changes that had been introduced was to check for the existence of both the is-closed-loop-disabled AND the prov-status fields. However, if one is there then the other should be there, thus the second check is redundant and was removed, which should reduce the cyclomatic complexity back under the threshold. Re-ordered the code a little, to make it less ambiguous. Removed trailing white space. Change-Id: If0ce74cedbf947c32cae3df3374cda6ba1305cd2 Issue-ID: POLICY-964 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-08-15add prov-status check to AAI queriesJim Hahn1-34/+81
Also had to add prov-status field to AaiGetVnfResponse class. Removed bogus comment from test. Verify response is not null in test. Verify no requery by vnf name in test. Add prov-status to template.demo tests. Add prov-status to sample json for archetype-cl's. Change-Id: I3f36a2bb6de8265ce5b10103690d6d8813c15b1a Issue-ID: POLICY-964 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-08-15Merge "Fix checkstyle issues"Jorge Hernandez1-2/+2
2018-08-14Fix checkstyle issuesPamela Dragosh1-2/+2
Spacing, missing javadoc Issue-ID: POLICY-883 Change-Id: Ice65c6c1baf0bb7c6273411f078bacfe3496b89b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-14update AAI response classes per APIJim Hahn1-13/+13
Several of the AAI response classes did not match the new AAI interface. Updated AaiGetVnfResponse and AaiGetVserverResponse and the classes they use to reflect the new API; other top-level classes were left untouched. Fix checkstyle errors. Change-Id: Ife5830c45ba8aece8d676a10f0fd8a9c9fe6cb66 Issue-ID: POLICY-964 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-05Clean up objects for deleted rulesJim Hahn1-0/+8
When rules for a closed loop are deleted, associated working memory elements may be left around. Modified the code to retract the various elements. Re-added code to unlock when retracting TargetLock. Add junit tests for new methods. Forgot the junit test for request id. Change-Id: Iec2805adbdb147a643f6163badee05ea353ada88 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-05unlock should always return TargetLockJim Hahn1-6/+8
ControlLoopEventManager.unlock only returns the TargetLock if the PolicyGuard.unlock operation is successful. However, if the lock has already expired, then PolicyGuard.unlock will return false, and ControlLoopEventManager.unlock will then return null. As a result, the rules do not retract the TargetLock. (The rules do, however, retract any left-over TargetLock objects during the clean-up phase. Nevertheless, the earlier rules should not have to depend on the clean-up rules to do that.) Modified the code to address this issue. Change-Id: I2e6099a4e3511053d2e6e1373cae4b480798d1b6 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-29Add time limit to local guard locking facilityJim Hahn1-2/+11
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-25Prevent AAI re-queryJim Hahn1-14/+22
Modified event manager code to not query AAI if there's already a response from a previous query. Modified code to store AAI properties in local variables instead of static to prevent any chance of a race condition in a multi-threaded situation. Updated junit tests to use a new manager for each subsequent query. Update license. Change variable name, in junit test, from onsetEvent to event, because it can be any type of event. Included fix to prevent initial AAI query if AAI data was already available in the initial onset event. Change-Id: Idf3e15ea8c5e297f22f23570c22fd837b72ba200 Issue-ID: POLICY-754 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-27Removed checkstyle warningsmmis3-39/+39
Removed checkstyle warnings from: policy/drools-applications/controlloop/common/model-impl/appc policy/drools-applications/controlloop/common/model-impl/appclcm policy/drools-applications/controlloop/common/model-impl/events including changes to template files due to renamed methods Issue-ID: POLICY-705 Change-Id: Ieb93baf43268aa608f204eef1a610354f2adec32 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-03-26Removed checkstyle warningsmmis2-41/+41
Removed checkstyle warnings from policy/drools-applications/controlloop/common/model-impl/aai including renaming classes: AAI* -> Aai* PNF* -> Pnf* and renaming some methods in those classes Issue-ID: POLICY-705 Change-Id: I2d59a668728aa58a2c9fbe78c44e924e6cfb4531 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-03-22Removed checkstyle warningsmmis12-1716/+1959
Removed checkstyle warnings in: policy/drools-applications/controlloop/common/actors policy/drools-applications/controlloop/common/eventmanager policy/drools-applications/controlloop/common/feature-controlloop-utils Issue-ID: POLICY-705 Change-Id: Iccf99b291bc62bc3ba2082ccdb4c1f9e12107896 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-08JUint/Technical Debt for eventmanagerliamfallon12-677/+742
Unit test expanded for SO POJOs, technical debt removed in eventmanager. Change-Id: I7045f5af88fd2c15019befe29a0b4fcd69801c49 Signed-off-by: liamfallon <liam.fallon@ericsson.com> Issue-ID: POLICY-455 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-01-20Fix Tech Debt/JUnit on VFC POJOsliamfallon1-1/+1
Making fields private, fixing field and methods to follow Java guidelines, and adding getter and setter methods. Unit test added for all classes in org.onap.policy.vfc Issue-ID: POLICY-455 Change-Id: I262337a816706cd5243849cd51e57689275545bf Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-01-19Merge "Fix Technical Debt, add Unit tests for SO"Jorge Hernandez1-3/+3
2018-01-18Fix Technical Debt, add Unit tests for SOvdmeer1-3/+3
Converted to POJOs, fixed sona lint errors, added JUnit tests POJOs now have only private members and getters/setters This implicated actors, simulators, and existing tests Issue-ID: POLICY-455 Change-Id: I4b80f729565e8675822a890892b15676908f73b4 Signed-off-by: vdmeer.sven <sven.van.der.meer@ericsson.com>
2018-01-18Fix Tech Debt/JUnit on control loop event POJOsLiam Fallon2-81/+81
Mainly making fields private, fixing field and methods to follow Java guidelines, and adding getter and setter methods. Unit test added for all classes in org.onap.policy.controlloop Issue-ID: POLICY-455 Change-Id: I445b7cfaf9eb921a230bbb72b06ff4455fe003ce Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
2018-01-16Fix Sonar Technical Debt, Unit Test for APPC POJOsLiam Fallon2-8/+7
Mainly making fields private, fixing field and methods to follow Java guidelines, and adding getter and setter methods. Unit test added for all classes in org.onap.policy.appc Change-Id: If3db740bc146a09f8f7387f02c12b048ad00b201 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com> Issue-ID: POLICY-455 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
2017-12-14Cleanup of A&AI message model module.Liam Fallon2-11/+12
Fields have been made fields private in POJOs, and wrote JUnit unit tests to bring up code coverage. AAIManager also changed to use non-static methods so that it can be stubbed with Mockito. Change-Id: I871427ced5db8a1dfd6495fef4e6d84adf264e65 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com> Issue-ID: POLICY-455 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
2017-11-08Fix SO Request bodyHockla, Ali (ah999m)1-5/+6
- Renamed modelNameVersionId to modelVersionId in SOModelInfo - Removed requestID from SO Request body - As a result of this, an SOResponseWrapper was needed in order to attach the control loop event requestId to use in the SOResponse rule in drl (the requestID that is returned in the SO response is a newly generated requestId with no relation to the Policy control loop event requestId as per Arthur) - Updated drl to reflect the above mentioned change - Updated simulator and junits to reflect changes - Added an additional null httpResponse check/logger statement in SOManager and RestManager Issue-ID: POLICY-438 Change-Id: I5f414ba69b60b5565cca9073b47f4c4835e5abbf Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2017-11-03Fix Generic VNF isClosedLoopDisableddaniel2-2/+17
No A&AI queries will be done for enriched events. The event manager now understands prepended "generic-vnf." in front of is-closed-loop-disabled from DCAE onsets. A test case was revised to include sample data from an enriched onset with vnf data based on the VES documentation. Issue-Id: POLICY-350 Change-Id: Id7f59f8b860b9f147087067a2a9a7766f167f7e4 Signed-off-by: Daniel Cruz <dc443y@att.com>
2017-10-31Passed classloader property to entitymanager.Magnusen, Drew (dm741q)1-0/+2
Passed property EntityManager that sets its class loader. Issue-ID: POLICY-345 Change-Id: Ie2a94feb442243de18cc4de5aab0312a02565729 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-10-30Merge "Fix Final Failure on AAI Queries"Pamela Dragosh1-22/+26
2017-10-30Fix Final Failure on AAI Queriesdaniel1-22/+26
The drools engine will now send final failure notifications if there is an error returned from A&AI queries instead of rejected notifications. Issue-Id: POLICY-364 Change-Id: Ie9c22686d859c633bad47d223726957cc9599f7c Signed-off-by: Daniel Cruz <dc443y@att.com>
2017-10-27Send final failure on null vfc requestCharles Cole1-4/+7
Made sure a final failure is sent and the memroy is cleaned up if we cannot contruct a vfc request. Issue-Id: POLICY-350 Change-Id: Ia9bc827572042ae6ff2d2d2851d33034ee86fc49 Signed-off-by: Charles Cole <cc847m@att.com>
2017-10-25Ensure no AAI lookup on subsequent onsetCharles Cole1-9/+14
Decoupled checking AAI data from checking an event's syntax so that new onsets can check both while all other events can just check the syntax. Issue-Id: POLICY-371 Change-Id: Ic76b1335b389bbec47ff0d29485ccbb249d5f18c Signed-off-by: Charles Cole <cc847m@att.com>
2017-10-25Fix Source/Target Lockdaniel2-35/+65
The locking of the target is now taken care of when the operation manager is initialized. This allows us to keep the template flow the same and to ensure that for vFW we will not lock the source if it is not intended to be the target. NOTE: This will have to be revised in the future if policy chaining will support having different targets specified for each policy in the chain. Additional work was done for hardening the APPC model code to make sure exceptions are caught and we gracefully end processing the event with memory clean up and a final failure notification sent. Issue-Id: POLICY-367 Change-Id: Ic796d95eb5400067744492f810dd8069ba6241b3 Signed-off-by: Daniel Cruz <dc443y@att.com> Signed-off-by: daniel <dc443y@att.com>
2017-10-24Change vnf-id to vnf-namedaniel1-2/+4
These changes now allow a lookup of the source vnf-id based on the onset's vnf-name. Issue-Id: POLICY-366 Change-Id: I6f6bd500b892dddbbb9e12156b4486208309e21d Signed-off-by: Daniel Cruz <dc443y@att.com>
2017-10-24Ensure no AAI lookup on abatementsCharles Cole1-33/+34
Changed check event syntax in the event manager so that it only looks for AAI info if the event is an onset. Issue-Id: POLICY-368 Change-Id: I241e9a110cc5fc4553a5e9cd842d51f76a800368 Signed-off-by: Charles Cole <cc847m@att.com>
2017-10-23Fix handling of aai 'get' errorsCharles Cole1-0/+9
Now reject an event if the AAI get query for the event fails. Added test cases for this behavior. Fixed some issues from my previous pull request. Issue-Id: POLICY-314 Change-Id: I674e95302a271423c307a88d061064e12e491a7a Signed-off-by: Charles Cole <cc847m@att.com>
2017-10-18Merge "Add support for AAI Named Query error handling"Pamela Dragosh2-3/+10
2017-10-18Add support for AAI Named Query error handlingCharles Cole2-3/+10
Errors from AAI after a Named query now throw an AAIEXception. This is caught in the template to allow the resources to be removed from memory and a final failure to be thrown. Issue-ID: POLICY-314 Change-Id: I319d29ef537b2d01ca288622aac1d9dbbe05f5eb Signed-off-by: Charles Cole <cc847m@att.com>
2017-10-18Removed useless imports to clear Sonar IssuesHockla, Ali (ah999m)1-3/+2
Issue-ID: POLICY-292 Change-Id: Ia4d4fae4150ea12e46079aabb4bbf4e3c92c8d00 Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2017-10-17Merge "Fix operation history DB properties for Junits"Jorge Hernandez1-5/+9
2017-10-17Update SO Interface AAI NQ response from v8 to v11Hockla, Ali (ah999m)1-0/+4
- Removed nonBaseIndex since there is only base vf Module in v11 response - Reverted to checkExtractedFields() - Modified the AAI Simulator to return the v11 response - If AAI NQ fails then the SO Request will not be constructed. In this case, we are retracting objects from the transaction and inserting policyResult.FAILURE into current operation to prevent null values in finishOperation Issue-ID: POLICY-339 Change-Id: I1c48fac4f9a51467ad54b0706543f5d1baa70389 Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2017-10-17Fix operation history DB properties for JunitsTemoc Rodriguez1-5/+9
Removed operation_history.properties / operations-history.properties. Changed the properties in persistence.xml so that it uses the correct values. Previously junit would never write to db because the "guard.disabled" property was not set. Set this property. Additionally the operationshistory10 table was trying to be created even though it exists. These values work in junit code. Not tested on rackspace yet. Issue-ID: POLICY-345 Change-Id: Id755b3152ae6ac4991ea9c314154592ea0105070 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-10-06Add fix for guard db on disableTemoc Rodriguez1-0/+7
Added a fix so that the guard database is not attempted to be accessed while guard is set to disabled. The guard db access is done in the operations manager which has no context of guardat the moment. Because of this separation, the boolean must be grabbed from the PolicyEngine properties. We should consider some guard refactoring. Issue-ID: POLICY-296 Change-Id: Ida7a2a7c19e568b076731e0f04bdc8a9fd0fcb26 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-10-05Fix JUnit Race Conditionsdaniel2-3/+66
This fix now implements the observer pattern for the PolicyEngineJUnitImpl so that the test cases can be notified when an event is available to be pulled. This eliminates the need to sleep the thread for some arbitrary time to let the rules process events. Issue-ID: POLICY-291 Change-Id: I884c959c20b95a1b58f357602099d8a01c8d2e3c Signed-off-by: Daniel Cruz <dc443y@att.com>
2017-09-28Merge "Fix Sonar criticals"Jorge Hernandez2-8/+5
2017-09-28Fix Sonar criticalsCharles Cole2-8/+5
Fixed two Sonar criticals. Changed VFC actor service provider to eliminate redundant AAI queries. Issue-ID: POLICY-115 Change-Id: Ic4993b5d498a1cb3d3fc51ce1d2b4e90bb26353d Signed-off-by: Charles Cole <cc847m@att.com>
2017-09-28Fix Retries for Policiesdaniel1-9/+5
This applies changes to make retries work properly for all control loops. The current design was ignoring the upper bound of the retries and retrying until either a success or control loop timeout occured. This is now fixed to only do retries until the limit is reached that is specified from the policy. The operation is now started in the GUARD.PERMITTED rule. I think this is better because it stops Policy from doing extra processing if there is a guard deny. This is also needed so that we can properly do retries for all cases. The notifications sent in GUARD_NOT_YET_QUERIED and GUARD.RESPONSE are now more informative with the message specifying the actor and recipe. The not queried rule has a message stating that we are sending a query to guard and the guard response message in the guard response rule specifices the result from guard. During a retest of vDNS it appeared that the archetype template was no longer working, this was because there were changes in the JUnit template that were not reflected in the archetype template. These were added to archetype and vDNS is verified to work again. Another small fix needed was making sure the action for vCPE is "Restart" instead of "restart". APPC will reject our request if "Restart" is not sent as the action. Issue-ID: POLICY-259 Change-Id: I28dd3c9a629d297b408775a01afadd5c19351e37 Signed-off-by: Daniel Cruz <dc443y@att.com>