aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
AgeCommit message (Collapse)AuthorFilesLines
2020-06-02Merge "Use OperationsHistory from models"Pamela Dragosh3-9/+9
2020-06-01Use actor constants instead of literalsJim Hahn1-2/+4
Modified drools-apps to use constants from the actor classes instead of hard-coded literals. Only made this change in code that uses the new actor model, as the old code will be deleted during this release. Issue-ID: POLICY-1242 Change-Id: Iac718159fd7cf571a48ac620585bf2b8f94c1e5d Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-01Use OperationsHistory from modelsJim Hahn3-9/+9
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-05-28Generate SDNR notification in drools-appsJim Hahn1-9/+12
Modified drools-apps to generate the SDNR notification using the SDNR-response provided by the actor in the operation outcome, instead of using the controlloop-response provided in the operation outcome, as the latter is deprecated. Issue-ID: POLICY-2593 Change-Id: I70ee4a4b11345a4295d720250a63f407f51cb0bd Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-27Do additional processing when control loop times outJim Hahn1-2/+34
When the overall control loop times out, a notification is sent to POLICY-CL-MGT, but then the event is discarded. Modified the code to update the operation history, if an operation had been started, and to generate an SDNR notification, if appropriate. Applied the same logic for when a lock is lost. Issue-ID: POLICY-2582 Change-Id: I35510ec8a3cfc6b2ca9be5751896f3c0f7d9bd09 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-22Generate SDNR notification even on timeoutJim Hahn1-1/+32
If a request to SDNR times out, the actor class does not generate a notification for the DCAE_CL_RSP topic. Rather than modifying the actor, decided to modify models to handle that case. Seems like that's where it belongs anyway, as notifications are more of an application- level behavior. Issue-ID: POLICY-2580 Change-Id: Id9426c223b719efce337a604316f19335dae8a94 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-22Use "outcome" to indicate pending recordJim Hahn2-0/+10
Mariadb is setting the "endtime" to the current time by default, so rather than indicate a pending record using a null endtime, just modified the code set "outcome" to "Started" to indicate a pending record. Also added code to ensure the "outcome" is never null, as that causes a DB error. Also addressed a comment from a previous review to log a warning message if more than one matching record is found in operations history. Issue-ID: POLICY-2581 Change-Id: I6bf67551cef46808a79cc15afeb0abbfc1b6d945 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-21Insert pending record when operation startsJim Hahn2-27/+73
Modified code to insert a pending record when an operation starts. Also modified it to update the existing record when the operation completes, rather than adding a new record. Note: the "outcome" for a "pending" record is left unset (i.e., it is null). Issue-ID: POLICY-2581 Change-Id: Ia1a02ed5a16b8af1328a49b22478fd57c4b9aca0 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-18Add getter for ControlLoopPolicy instance in ControlLoopProcessordc443y1-0/+1
This is to allow other frameworks, such as M2, to obtain the ControlLoopPolicy instance after the raw ToscaPolicy has been adapted. Issue-ID: POLICY-2574 Change-Id: I003e60991f6e4007bd30f0e9392f6fa8bf21733a Signed-off-by: dc443y <dc443y@att.com>
2020-05-13Handle duplicate events in drools-appsJim Hahn1-0/+18
Modified the frankfurt rules to compare the event objects instead of comparing the request ID when determining if an event is new. The event object's equals() method ignores the request ID when doing the comparison, thus it will treat an event as a duplicate even if the request ID is different, which is the behavior we want. Also removed the @Ignore from the junit that tests for duplicate events in the hope that this change will fix it. If the docker build still breaks, then @Ignore can be added back in. Issue-ID: POLICY-2557 Change-Id: If2b9fd26473d78a356218b951bfe160f93daeb32 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-08Add SDNR notifications to frankfurt rulesJim Hahn2-0/+16
Issue-ID: POLICY-2468 Change-Id: Ibf4d3e5f62fa3106028dcf85050c270b8eab0a89 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-02Synchronize methods for rulesJim Hahn1-9/+9
Added "synchronized" to a few more methods in the event manager class, just to be safe, as they view/modify data that may be viewed/modified by other threads. Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ia8404fd3fd53b0de95f939dfff2088867e0f3b24
2020-03-26Expand env variables in frankfurt propertiesJim Hahn2-25/+5
Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I1109a053e46dc8201ff9676da0c9ff93d8b631d5 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-25Fix db exception in frankfurt junitJim Hahn4-7/+17
Frankfurt junits were generating the following output: Value too long for column "TARGET VARCHAR(50)": "'Target [type=VNF, resourceId=bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38]' The issue turned out to be caused by the fact that the rules for the new actor were storing the "Target" instead of the "TargetEntity" in the DB field. Modified the code to store the target entity, as the the usecases rules do. Issue-ID: POLICY-2441 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I91ee517ef073e3dc3fea4698c814b57a06d87095
2020-03-23Enable guards in junit testsJim Hahn1-2/+21
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-03-13Fix sonar issues in drools-applicationsJim Hahn5-219/+9
Fixed various sonar issues, including moving some code to policy-common. Fixed some eclipse warnings, including deprecated junit APIs. Issue-ID: POLICY-2426 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I10b40c1e5af62308f2e4c315e4d399aafff2998f
2020-03-10Use predefined domain policies from drools corejhh1-9/+9
Issue-ID: POLICY-2388 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5948ed5152297e4addbab444ed65dcd3b8002492
2020-03-09Bug fixes to new rulesJim Hahn2-8/+27
Also added VdnsTest, VfwTest, and VcpeTest. Fixed a number of issues with notifications: - event data (e.g., AAI) was missing - notification was missing for the start of an operation - "message" and "history" fields should contain Target object, target entity - "message" field was missing various details (e.g., start time) Still missing subRequestId - that will require enhancements to the actors. Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7fc33ebcd5939d2f33a9d209ac6119e390e0836d
2020-03-06Add frankfurt rules for Actor redesignJim Hahn11-4/+2407
Note: VcpeTest and VfwTest are not included, as they depend on updates to the APPC and APPC-LCM Actors. Added feature-controlloop-frankfurt. Added HTTP client property files to feature-controlloop-management. Updates per review comments: - pom changes - simplify FrankfurtBase - rename event-svc-http.properties - change "usescases" to "frankfurt" - use blanks for CDS property defaults - trailing spaces in http-client files - add https property to http-client files Added newlines to config files that appear to be missing them (based on feedback from gerrit). Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ib4a4d75461c734ae47309e41dc9d099e8815d55d
2020-03-01Use apache Pair not Sdnr custom PairPamela Dragosh1-7/+7
Companion review to https://gerrit.onap.org/r/c/policy/models/+/102162 in which use of Pair from apache vs creating our own. Removed an unused import. Issue-ID: POLICY-2382 Change-Id: Id3cf9a170480c7a621dddf93540d61f993f3553a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-29Tosca policies missing "final_xxx" fieldsJim Hahn1-12/+27
The code that makes Tosca policies backward compatible was not copying the final_xxx fields (e.g., final_failure_retries). Added code to copy the fields. Issue-ID: POLICY-2376 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I05d746ee9c8ace263c7b33a245221c5eb71b612c
2020-02-21Tosca compliant vFirewalljhh1-11/+27
Issue-ID: POLICY-2376 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I362ebbd941c400a6ffc3e952e66ca2d624afbfdd Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-02-17tosca compliant op policy support + vcpe testjhh4-53/+137
Tosca Compliant and Toscal Legacy Operational policies are both supported for backwards compatibility. vCPE usecase junits to support 2 equivalent policies, one tosca compliant and the other one legacy. Issue-ID: POLICY-2360 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Iafbfc92bbec42e6a3fe4ceb4a9a17c85e636ea14 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-02-07activate refactoring in ControlLoopEventManagerjhh1-62/+69
This is to support backwards compatible implementation of Tosca Compliant Operational Policies. Issue-ID: POLICY-2360 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I0e8b96b19375c58e4b62e0dcd1da5c508091ea2f Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-01-09Add ControlLoopParams from models repo.jhh2-2/+40
This class is only useful under drools applications and eventually will be deprecated to accommodate the new Operational Policy Types. Issue-ID: POLICY-2146 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I68927cb144a33fac6fe330be15fe60aee32b15a1
2019-11-15Removing Named Querypramod.jamkhedkar2-456/+123
Removing all the related files and necessary modifications for removing named query. The code now only supports Custom Query. Issue-ID: POLICY-2125 Change-Id: I2d376eb955d69f45c39ad4d4a1cfacb4d620ca8e Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2019-11-08Fix more sonar issues in drools-applicationsJim Hahn6-230/+65
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-11-06Update drools-application due to ↵Rashmi Pujar1-1/+1
https://gerrit.onap.org/r/#/c/policy/models/+/97989/ Issue-ID: POLICY-1896 Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca> Change-Id: I6125a1c83f58411f08bb143ff21ccd66d4db4977
2019-11-04PNF support changes for drools-applicationRashmi Pujar2-18/+84
Conditional checks for enrichment and validation by target-types PNF specific AAI enrichment Fixed Unit Tests Issue-ID: POLICY-1187 Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca> Change-Id: I78bf73e454828253ca69695f9196047449b4d9d6
2019-10-29Update APPC LCM Model referencesDaniel Cruz2-16/+16
Updates to all references of APPC LCM model code based on changes in policy models for APPC LCM. Issue-ID: POLICY-2043 Change-Id: I0102eb27f449578636cfc0bf22124fa863f05724 Signed-off-by: Daniel Cruz <dc443y@att.com>
2019-10-22Modify drools-applications to use new Lock APIJim Hahn3-76/+161
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-10-16Integrate cds actor service providerBruno Sakoto2-9/+122
* Add request enrichment with aai service instance id and vnf id * Implement cds grpc request * Implement VfwControlLoopCdsTest Issue-ID: POLICY-2088 Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca> Change-Id: Ib44d447d6a3a70ff800a5760032b676fdfa32d9c
2019-08-15Modify to work with new drools-pdpJim Hahn2-29/+33
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 Hahn2-49/+62
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-08-01Add AAI test tooling to telemetry.jhh1-23/+33
Issue-ID: POLICY-1956 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Icceab57db9c19364afbedbf63ecc8e52c1572cba Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-06-27Fix some sonar issues in drools-applicationsJim Hahn2-230/+251
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-20Set timeout to CL timeout if zeroJim Hahn1-1/+4
Modified the rules to set the operational timeout to the overall CL timeout if the operational timeout is zero. Added code to check for zero timeout for the overall CL, too. Change-Id: I28d41632f59e9bc2fce953267883d567abc92a49 Issue-ID: POLICY-1859 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-17Change getCanonicalName() to getName() in drools-appsJim Hahn1-2/+2
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: Ie402ab9239b2d5149c420d495f16bb82417d2d25 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-21Check for null vserver.pramod.jamkhedkar1-0/+4
Handles the case where vserver name is not present in onset mesage. Issue-ID: POLICY-1778 Change-Id: Ie7a1b9d207860a70b49309049b512fc8ce05a984 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2019-04-29Fix sonar bug and upgrade parentPamela Dragosh1-0/+4
* Fix simple sonar bug for logging errors * Private constructors to hide implicit. * Not enough arguments for debug statement * Upgrade to policy/parent released version Issue-ID: POLICY-1700 Change-Id: Id8040c2aa0abdbe4946db60f97cb279974817447 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-25Match up ControlLoopParams against ToscaPolicyjhh1-0/+78
Change-Id: Ia23a5b90b452bcafe2a8aa660598697ebfb07431 Issue-ID: POLICY-1691 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-04-11Merge "Drools-App changes to support CQ"Jorge Hernandez2-56/+125
2019-04-11Drools-App changes to support CQpramod.jamkhedkar2-56/+125
Changes in event manager to support Aai custom query Issue-ID: POLICY-1278 Change-Id: I693dd6b94f1fa6f24b08a389db099914636cf2ba Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2019-04-11Cleanup PIP/Database-related code.Joshua Reich3-151/+9
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-1/+27
Takes VFModule info from policy yaml,instead AAI. Change-Id: If745b3ba32562cbc37571cea29ec7797ee697e88 Issue-ID: POLICY-1545 Signed-off-by: vamshi.nemalikonda <vn00480215@techmahindra.com>
2019-04-08Code changes done for OOF SON use caseSaravanan A1-1/+22
Added a new control loop for SON ANR changes Introducing control loop response flow using DCAE_CL_RSP topic Change-Id: I81d0e92ce2f5c489596ad70d7b523cab0d8436ce Issue-ID: POLICY-1463 Signed-off-by: Saravanan A <saravanan.a75@wipro.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-08update dependency to policy/modelsshaoqiu1-23/+26
Update the dependency of model-impl from drools-applications to policy/models. Issue-ID: POLICY-1264 Change-Id: I07fcb29501499a97689d2d27c845bf8e411e7825 Signed-off-by: shaoqiu <tim.huang@est.tech> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-05Add CCVPN Bandwidth on demand policyVidyashree Rama1-2/+4
CCVPN Bandwidth on demand policy Issue-ID: POLICY-1405 Change-Id: I67bceb35e5a849933b3e46772c9cbbbaab1e9a75 Signed-off-by: Vidyashree Rama <vidyashree.rama@huawei.com>
2019-01-14Remove eventmanager checkstyle suppressionsJim Hahn1-19/+19
Renamed enum class name and various method names in ControlLoopEventManager. Change-Id: I18b4a7d30a24dfcf3b155fd662433590b9d4c769 Issue-ID: POLICY-1138 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-14Remove model-imp/rest checkstyle suppressionsJim Hahn1-6/+6
Renamed "RESTManager" class to "RestManager". This did not require any changes to rules. Updated license data in pom. Change-Id: Ide59b99b8c5d939804b7540c71a686404195173c Issue-ID: POLICY-1141 Signed-off-by: Jim Hahn <jrh3@att.com>