summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/test
AgeCommit message (Collapse)AuthorFilesLines
2020-08-27Use ToscaPolicy instead of legacy PolicyJim Hahn12-284/+232
Removed usage of policy-yaml and old targetType definition. Switched to using TOSCA operational policy classes and new definitions for Target type enum. Issue-ID: POLICY-2428 Change-Id: I25d1c5219764df27bdae7f2cbeb7ada7bcef4e1e Signed-off-by: Jim Hahn <jrh3@att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-25Add Usecases-specific event managerJim Hahn1-2/+1
Created new "usecases" event manager. Also fixed a couple of sonar issues in the new code. Issue-ID: POLICY-2748 Change-Id: I17a2c41bbf4f4e8158adbd8aa5e32ef570daa9d3 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-24Merge "Add "special" Operation classes for new usecases"Pamela Dragosh1-0/+2
2020-08-21remove legacy operational policies supportjhh4-34/+8
Issue-ID: POLICY-2765 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I454365943465863b108ba8668b2bc4b201986959
2020-08-21Add "special" Operation classes for new usecasesJim Hahn1-0/+2
Created place-holder for new "usecases" controller. Note: as of yet, this is still just a normal java project; it will be turned into a full-fledged kie-based controller in a later review. Added some Operation and a few other support classes that will be needed. Note: the detmTarget() method and it's various supporting methods, detmXxx(), found in GetTargetEntityOperation2 were cloned from the pre-existing ControlLoopOperationManager2 class, and modified to fit the strategy of the new controller. Likewise for the junit tests of those methods. Issue-ID: POLICY-2748 Change-Id: Idffa135a11a56bd6afdd2728706fd40168e80912 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-20Add generic eventmanager classesJim Hahn2-0/+675
Added classes that are event-agnostic and support moving control from java into rules. Updates per review comments: - removed policy scope Issue-ID: POLICY-2748-event-mgr Change-Id: Icf811cc25a3975543fc5c725766b7b9df2bb87b0 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-14Remove usecases and legacy actor codeJim Hahn5-1907/+1
Made the following changes to remove usescase and legacy actor code: - deleted the usecases controller and feature - deleted code associated with legacy actors, with the exception of AaiManager, which is needed by RestControlLoopManager - moved the contents of the "guard" project into the m2/guard project, as that is the only thing that still needs it - modified the m2/GuardContext to get the name of its persistence unit from the properties so it could be overridden by junit tests - used eclipselink constants Also fixed a bug in the properties for the VFC actor. Addressed review comment: - removed usecases from Dockerfile Issue-ID: POLICY-2558 Change-Id: I677d68c9efed9247c3d55773abdcc736b577a6b4 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-06fix complete the assertionTaka Cho2-9/+19
add isInstanceOf for assertThatThrownBy. Issue-ID: POLICY-2616 Change-Id: If49255aec6004870d7d2acfeabe258def872c1fa Signed-off-by: Taka Cho <takamune.cho@att.com>
2020-07-02Use new Actor names in drools-appsJim Hahn1-2/+2
Modified drools-apps to use XxxActor instead of XxxActorServiceProvider. This is the second step of the rename. Issue-ID: POLICY-2684 Change-Id: Iea60e92f914b7719ac765b086650479be9192d98 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-29Fix build breakage in drools-apps due to pairJim Hahn1-18/+18
The Pair changes made in drools-pdp also broke drools-apps builds. Replaced usage of drools.utils.Pair with apache Pair. Issue-ID: POLICY-2202 Change-Id: I50aaad47c243637688602ae6cb680a929fe3edd9 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-19Changes for checkstyle 8.32Jim Hahn1-3/+2
Issue-ID: POLICY-2188 Change-Id: Ib90222c537c5440e0de52fa0acbaa99bbcc4772a Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-11Remove deprecated properties for CDS and VFCJim Hahn1-2/+2
Now that the changes to the Actors have been merged, the former properties can be removed, too. Also fixed guard operator/operation name since it changed from "Guard" to "Decision". Issue-ID: POLICY-2629 Change-Id: I1c8d4575be598a8cab12b1aa4ad9b1d3e1f12113 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-09reduce sonar issue - drool-applicationsTaka Cho2-17/+17
In some conditions for assertTrue, sonarcloud recommends using assertEquals Assert.assertTrue(a.equals(b)); Assert.assertTrue(a == b); Assert.assertTrue(a == null); Assert.assertTrue(a != null); Assert.assertFalse(a.equals(b)); Compliant Solution Assert.assertEquals(a, b); Assert.assertSame(a, b); Assert.assertNull(a); Assert.assertNotNull(a); Assert.assertNotEquals(a, b); Change-Id: Ic50bf6e961b74abcc698c2cc0347dd0472fefe71 Issue-ID: POLICY-2616 Signed-off-by: Taka Cho <takamune.cho@att.com>
2020-06-01Use OperationsHistory from modelsJim Hahn1-43/+43
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-12/+42
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-3/+3
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-0/+27
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 Hahn1-0/+4
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-10/+66
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-03-26Expand env variables in frankfurt propertiesJim Hahn1-8/+9
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 Hahn3-20/+24
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 Hahn3-0/+9
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 Hahn3-215/+12
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-09Bug fixes to new rulesJim Hahn2-8/+44
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 Hahn16-4/+3012
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-02-24vDNS tosca compliant policies supportjhh4-89/+59
Issue-ID: POLICY-2383 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5d5d864b2853f6e7e0c7e1096cb17746500f2495 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-02-21Tosca compliant vFirewalljhh3-5/+51
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 testjhh6-95/+142
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-01-16policy/drools-apps jdk11 upgradesHockla, Ali (ah999m)1-1/+1
Issue-ID: POLICY-1587 Change-Id: I02bef6c829f2f24954ae73fb0c540ab7198775ce Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2020-01-09Add ControlLoopParams from models repo.jhh2-2/+119
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-641/+84
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 Hahn3-88/+0
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-6/+6
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-6/+45
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-44/+56
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 Hahn2-63/+259
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-0/+89
* 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-09-04Changes drl filespramod.jamkhedkar1-377/+3574
Changes to the DRL file to change the rules to support custom query. Added new VdnsControlLoop test for custom query, and supporting yaml request Issue-ID: POLICY-1858 Change-Id: Ic1b9e771bd36fe0642e9a3439189076a4906a4b8 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
2019-08-15Modify to work with new drools-pdpJim Hahn2-23/+23
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-07-09Fix drools-applications due to sonar changes in commonJim Hahn2-4/+4
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 Hahn10-796/+587
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 Hahn3-0/+125
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 Hahn2-2/+4
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/+17
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-26New BUILD_VERSION needed as fixed in parent imagejhh1-1/+1
BUILD_VERSION could not be used in ENV variable as it is cooked in the base image itself. Need to create a new one to reflect the drools build to get by. Some minor additional changes as to exit shell when a docker command fails for clarity when executing these operations is added as well. Change-Id: Ic8dfc03bc0563c088d55b1991a0f8c431ab0fab2 Issue-ID: INT-998 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-04-25Match up ControlLoopParams against ToscaPolicyjhh2-0/+67
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 Hernandez3-24/+720
2019-04-11Drools-App changes to support CQpramod.jamkhedkar3-24/+720
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-123/+48
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-01-14Remove eventmanager checkstyle suppressionsJim Hahn2-41/+43
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>