summaryrefslogtreecommitdiffstats
path: root/models-provider/src
AgeCommit message (Collapse)AuthorFilesLines
2020-04-07Address sonar issues in modelsJim Hahn2-9/+6
Addressed the following sonar issues: - use RE2 instead of java.util Pattern for "+" and "*" - don't use deprecated methods - for Date(long), sonar appeared not to parse the argument's type correctly. Modified the code slightly to make sonar happy - duplicate blocks of code - either log or throw - missing assert in junit - for SDNR & VFC, eliminated threads, as they are unnecessary - duplicate code block in different branches - useless assignments - redeclaring abstract methods - cyclomatic complexity - used lombok in some cases (e.g., EqualsAndHashCode) - assert argument order - actually deleted ControlLoopTargetType, because it is not needed and sonar complains regardless of which order is used - add private constructor to utility classes - use StandardCharsets instead of literals Also: - added logback-test.xml to SO to eliminate the voluminous output from the junit test Issue-ID: POLICY-2305 Change-Id: I586c331781bedbd54a115a71847d04d293689445 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-20Test cascaded multiple revision getsliamfallon2-79/+773
This patch tests cascaded get requests with multiple revisions. Issue-ID: POLICY-2377 Change-Id: Ie7dc849d7b930b861d38c386a9950ae7e84e2a05 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-18Return latest entity on null versionsliamfallon1-5/+4
This review amends the behaviour of "get" operations on entities to always return the latest version of an entity when the version of the search key is the null key (value of 0.0.0). Issue-ID: POLICY-2377 Change-Id: I4f7c12637c90bc1a83ce2ba5ef40e15b461a7d51 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-13Consistent returns on Service Template getsliamfallon2-0/+488
This review enables specification of versions of entities on incoming service templates using a ':' delimiter. So this will load version 1.00, version 2.0.0, and version 3.0.0: org.onap.entitiy:1.0.0: version: 1.0.0 org.onap.entity:2.0.0: version: 2.0.0 org.onap.entity version: 3.0.0 So this will load version 1.00, version 2.0.0, and version 4.0.0: org.onap.entitiy:1.0.0: version: 1.0.0 org.onap.entity:2.0.0: version: 2.0.0 org.onap.entity: version: 3.0.0 org.onap.entity: version: 4.0.0 This will load org.onap.entity:1.0.0 name: org.onap.entity version: 1.0.0 This will throw an exception org.onap.entity:1.0.0 name: org.onap.some.other.entity version: 1.0.0 This will throw an exception org.onap.entity:1.0.0: name: org.onap.entity version: 2.0.0 Issue-ID: POLICY-2377 Change-Id: I34bccf065b4ee4d2fe71b052bf009d4a40e2cba8 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-06TOSCA Compliant Guard PoliciesPamela Dragosh7-357/+0
Fixing the legacy guard policies and renaming them so we are able to differentiate them. Adding newer, cleaner TOSCA Guard Policies that match the operational guard policies. Removing legacy guard policies. Fixing JUnit so that they don't use indexes to test whether versions are changed correctly. Added back in new guard policies. Fixed the guard policy types to use camel case. Issue-ID: POLICY-2243 Change-Id: Ie611f26f73f41e64c0b467f524f470739158f437 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-19Fix cascaded get filtering and speedliamfallon1-1/+49
This change adds proper cascading bahaviour to the returned service template for filtered gets on policies. It also significantly improves the performance on get operations, all get operations on the API now result in only one database query. Issue-ID: POLICY-1402 Change-Id: I7c7d0a8d9f1caf8b610461779e242c34b7f77365 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-18Merge "Add safe entity delete, fix multiple entity get"Ram Krishna Verma4-1/+140
2020-02-18Merge "Allow storing database password in environment variables"Ram Krishna Verma1-1/+8
2020-02-18Add safe entity delete, fix multiple entity getliamfallon4-1/+140
This review implements checks on whether entities are being used or referenced propr to allowing deletes. The review also fixes bugs on multiple entity get returning 4040 not found Issue-ID: POLICY-1402 Change-Id: I9cebb9a873098740e9ff4be6284d6307e19838bd Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-18Add missing classes to persistence.xmlliamfallon1-0/+2
The recent policy-models changes cascade database changes to some new classes. THis change adds these classes to persistence.xml. Issue-ID: POLICY-1402 Change-Id: I4d9953c8423dc6e33f6852744c394c9cfbc21ac6 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-17Add missing entry_schema for operational policy typePamela Dragosh1-6/+7
Also ensure the json for vFirewall matches the yaml. We will need to clean up some of the other legacy operational policies. Or at least rename them. Renamed legacy Operational policies to avoid confusion. Fixed wrong derived_from policy types. Operational Policy Types are now solely for new TOSCA compliant operational policy types. Issue-ID: POLICY-2146 Change-Id: Ia0bcabe6cca8e197f1bec8157a3004a420033969 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-14Fix return codes and policy getliamfallon1-24/+34
Change the return codes for validation to return more helpful and correct codes. Fix the policy "get" request to get policy types and data types for a policy get. Issue-ID: POLICY-1402 Change-Id: I89d67f830e9a75bdeef39c4142523c718879f19c Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-13Allow storing database password in environment variablesDominik Mizyn1-1/+8
This patch allows to store and get database passwor from environment variables. This is needed if we want to send those variables by helm secrets. Issue-ID: OOM-2287 Change-Id: Id9ea8f43dd07c2b0cdeaa6d14a8033336d26923f Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
2020-02-13Update models-tosca for hetter handlingliamfallon1-2/+2
More additions, updates, and fixes for TOSCA service template handling. Better handling of 404 not found on list requests. Issue-ID: POLICY-1402 Change-Id: Id73b9a3cebb5445d4f05ae83e301330ee38a6598 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-12Implement validation and hierarchical getliamfallon8-627/+430
NOTE: This review will require changes to the persistence.xml file in other policy framework components. This change brings in two changes: 1) Validation of the references betwen policies, policy types, and data types This change mans that additions to and changes to policies, policy types, and data types must be structurally correct in the change coming in and with whatever is already in the database 2) Hierarchical return of referenced entitites on policy types, policies and data types. When a policy, policy type, or data type is read from the database, the entities referenced byt the returned policy, policy type, or data type are returned as well. Tests are amended for the stricter validation and structure. Examples are corrected where they are incorrect. Issue-ID: POLICY-1402 Change-Id: Ie6a4cb7ed336562338924079114df405f0ab889f Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-16Clean up TOSCA provider unit testsliamfallon4-31/+79
SOme outstanding comment on TOSCA provider unit tests cleaned up. Issue-ID: POLICY-2315 Change-Id: I235a5fc9996c81f421f17236afb413df7435de19 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-13Read resource dirs in models prvider unit testsliamfallon6-411/+296
Update the unit tests in models-provider so that we can check that the TOSCA artifact that is read from the database is the same as the TOSCA artifact that is stored. This review does some groundwork for that check. Issue-ID: POLICY-2315 Change-Id: Iabc7b247736b862713585a493752bc254cfe1c3d Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-09Merge "update Db provider to support query number"Jim Hahn5-27/+48
2020-01-08Store and return data types for policiesliamfallon1-4/+5
In this change, the data types of policy types are persisted to the database. All policy types currently in the database are returned on all policy type get requests. This will be made more intelligent in the next review. Issue-ID: POLICY-2315 Change-Id: I10065ab9b90e72114a453494fc706d8aabc50c0a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-08update Db provider to support query numberning.xi5-27/+48
Issue-ID: POLICY-1629 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: I42c9542adc44d52b760a70e710ab4cc6fa8a1b3b
2020-01-07Support persistence of data typesliamfallon5-105/+102
Data types must be persisted to the database in order for them to be retrieved in policy type queries and later for policy validation. Issue-ID: POLICY-2315 Change-Id: Iacb88501a597aeee8f6d8bcc3d9604c13dc09090 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-12-20pdp statistics database provider implementationning.xi6-119/+193
Issue-ID: POLICY-1629 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: Ife65d50c862ed90c3c9a3cea91a2b9a8d874fa14
2019-12-11Merge "Fix minor checksyle issues in models"Pamela Dragosh1-1/+3
2019-12-10Fix minor checksyle issues in modelsliamfallon1-1/+3
New checkstyle profile flagged some minor issues in policy models. Issue-ID: POLICY-2165 Change-Id: I17ed070a3d55601ad31e48fdfd29fff01d29fa42 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-12-10Merge "Add JpaPdpStatistics entity"Ram Krishna Verma1-0/+1
2019-12-09Add JpaPdpStatistics entityshaoqiu1-0/+1
Add JpaPdpStatistics entity which will be used in provider. Add Pdp Statistics entities Issue-ID: POLICY-1628 Signed-off-by: shaoqiu <tim.huang@est.tech> Change-Id: Iab12eb02e2e7f0e366aff64fa665b5d6674f2905 Signed-off-by: shaoqiu <tim.huang@est.tech>
2019-12-07Refactor optimization policiesPamela Dragosh1-9/+9
Optimization policies need to be further refactored so that Resource vs Service type policies can be specified. Issue-ID: POLICY-2066 Change-Id: Ia40a947097692ea7dcc6ea8d13eb8669c37fac14 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-12-05Add new Operational Policy TypePamela Dragosh2-0/+17
New operational policy type for Frankfurt. Updating examples. added sample CLAMP metadata. Issue-ID: POLICY-2217 Change-Id: I941c3a4187a4d164bf793ef2d82c34fccc1a2c35 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-11-13Remove duplicate dao objectJim Hahn1-1/+0
Code was creating the DAO object twice - removed the extra line. Note: this properly doesn't fix the race condition, but it should fix a memory leak. Change-Id: I5f5c6002d42f9bb0525d1b5013b1300e80264645 Issue-ID: POLICY-1832 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-05Repair policy types in TOSCA service templateliamfallon2-226/+223
Changed policy types from a list of maps to a map. Changed data types from a list of maps to a map. Made all knock on changes to adapters and tests. Updated Issue ID. Added onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml policy type that is required to be preloaded in policy-api. Issue-ID: POLICY-2047 Change-Id: Ic8e809eab248fd7242f0e565fa2e3da75bcfbdeb Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-06-18Change getCanonicalName to getName in modelsJim Hahn4-5/+8
Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Note: this impacts the output from PfValidationMessage, as it will now list the names of embedded classes with a "$" separator instead of a ".". Change-Id: I2cd64bc0281dd324bf80eac57335a7299a516447 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-18Merge "Fix simple sonar issues in models: errors to sim-pdp"Pamela Dragosh8-366/+357
2019-06-17Fix simple sonar issues in models: errors to sim-pdpJim Hahn8-366/+357
models-errors models-pdp models-provider models-sim-pdp Also had to work around this checkstyle issue: src/test/java/org/onap/policy/models/sim/pdp/comm/ TestPdpStateChangeListener.java:[77,32] (javadoc) JavadocMethod: Unable to get class information for @throws tag 'PdpSimulatorException'. The error appears to be bogus, as PdpSimulatorException is on the "throws" line thus indicating that the class IS accessible to the above java file. Change-Id: Iaca58457a32b00121000fc0bab12a8be4cb19bac Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-17Fix the bug of cannot return multiple versions of particular tosca policy ↵Chenfei Gao2-4/+18
and policy type Issue-ID: POLICY-1807 Change-Id: I831c720993930a911d301a82b59a74cda7cb0c50 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2019-06-14Allow multiple versions of entities to be returnedliamfallon1-13/+14
Fix .gitreviw file to point at "master" rather than "dublin" Allow return of multiple versions of policy types and data types in TOSCA service templates and multiple policies in TOSCA topology templates. Because the return type is a list of singleton maps, utility methods were added to return flat maps of poliicy types, data types, and policies keyed by a compound ToscaEntityKey name/version key. Issue-ID: POLICY-1807 Change-Id: I355038aaca26f41064d0e3cb3b45b1de2294cf5f Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-22Fix name/version regexp in model keysliamfallon3-14/+14
The regular expressions for checking names and versions in policy key names and versions were not expressive enough to restrict all error names and versions. Issue-ID: POLICY-1777 Change-Id: I037eca051f6c7a9f1e7182150d40d8b8d906a75c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-21Add version on legacy get/deleteliamfallon8-59/+116
Issue-ID: POLICY-1777 Change-Id: I5b07ad1acdb4a614a50cb15978130c19bc5786f7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-09Store legacy op policy properties as plain stringsliamfallon2-0/+4
THe properties of legacy operational policies are already encoded and should not be stored in JSON format. Issue-ID: POLICY-1759 Change-Id: I3e2a69f216348c02c2ef9c23282f87da52a7f390 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-09Store policy type version in policy before DB writeliamfallon1-0/+2
The policy type version must be updated on a policy before it is stored to the database, otherwise the database value is incorrect. Issue-ID: POLICY-1738 Change-Id: I0a7f2da3837497dd999141f40466d6507c26159b Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-07Set default and check existance of Policy Typeliamfallon5-5/+119
The TOSCA specification has a "bug" in that it does not have a field to specify the version of a policy type to use. We already had introduced the "type_version" field for this. This review introduces setting of the default version of a policy type to be be used by a policy as the latest version of the policy type in the database. As a side effect of this, we now have to check for existence of the policy type of a policy in the database. This means that creation/update of a policy with a non-existant policy type specified will now fail. Issue-ID: POLICY-1738 Change-Id: I27080cf6cd358948810dab6897c72dfe4d41fe91 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-12Remove version from PdpGroupliamfallon6-229/+101
Issue-ID: POLICY-1095 Change-Id: I91f495947fe77222804e7ab31c4dd7d7aee66b44 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-12UNit test and minor fixes for DB parsliamfallon2-12/+12
Add unit test for the new database provider driver parameter. Address the comments raised in the last review. Issue-ID: POLICY-1095 Change-Id: I9f629d9f4446d12bfb492e00e49e07b97ef5a490 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-11Fix database propertiesliamfallon10-90/+46
Issue-ID: POLICY-1095 Change-Id: I3edd70898836d3bd978643857d1ba29599b1cf6c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-10Finish unit test on policy-modelsliamfallon9-109/+394
Unit test coverage well over 90% in policy-models-base policy-models-dao policy-models-pdp policy-models-tosca policy-models-provider Issue-ID: POLICY-1095 Change-Id: I7703e2ae8a93575ca478c3d809ff8c1fb9f0f334 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-09Add unit tests for policy type and policy filtersliamfallon2-2/+32
THis review adds unit tests for the authorative concepts in the models-tosc module and adds unit tests for the authorative and and database providers. Issue-ID: POLICY-1095 Change-Id: If98deea99658056030dd47725b0c0a4266d84106 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-09Complete unit test for models-pdpliamfallon1-1/+1
This review completes the unit test for the models-pdp module, for persistence of PDP groups and for PDP group filtering. Added unit test of filters for TOSCA policy types and policies. Added fix to allow filters to pass when the value being checked is null. Issue-ID: POLICY-1095 Change-Id: I982400ef39f0282d813d49e484a58207e03b8a63 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-05Complete filters for Database Fetchesliamfallon1-0/+152
This review completes the implementaiton of the filters for fetching policy types, policies, and PDP groups from the database. It also fixes bugs in Policy type creation. Yaml in some of the policy type examples modified so that it is syntatically correct. Proeprties now stored as a blob in DB as they can be big. Issue-ID: POLICY-1095 Change-Id: I6aef88ee2905afa58d778d82832f2b55d794fe9c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-04Add filter obejcts for conceptsliamfallon5-160/+56
This review: - Fixes the bug in getting policies where the key fields were null - Removes complex version checks from DAO interface - Simplifies provider API by introducing filter objects for searches Issue-ID: POLICY-1095 Change-Id: I5ab7471c03e8b61849e7882ed18541acd627dc39 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-03Add impl of more PDP persistenceliamfallon5-5/+70
Add the implementation of more metods in the PDP provider. Issue-ID: POLICY-1095 Change-Id: Ie02189cad7a262a453e1f731190525f838648401 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-02Add persistence for PDP conceptsliamfallon12-69/+92
This review adds the JPA annotations to PDP group/subgroup and PDP for persisting to the database. It also updates the Provider API as requested by other team members. Issue-ID: POLICY-1095 Change-Id: I8188afb763849ede9680f3751b464d9d76c27196 Signed-off-by: liamfallon <liam.fallon@est.tech>