summaryrefslogtreecommitdiffstats
path: root/models-tosca/src
AgeCommit message (Collapse)AuthorFilesLines
2020-05-10Policy DB contents removed on DB deadlockliamfallon7-166/+162
When a DB deadlock occurs, the DB contents can sometimes be deleted becasue the DB removes the Service Template object and recreates a new one in two separate DB transactions. This change makes sure that the object remove and re-create is in a sngle DB transaction, so the operation will either happen or not happen so the DB will not be cleared. Legacy policy handling must also use the SimpleToscaProvider rather than accessing the DB directly, as SimpleToscaProvider keeps the DB structure correct. Issue-ID: POLICY-2548 Change-Id: I263a41cd1d8bec5d7b421045b3b14aad6e6c66d3 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-05-07Fix simultaneous get access to policy providerliamfallon1-71/+86
When a "get" is executed while a "create" or "delete" is underway, the DB sessions overlp and data is lost in the database. "get" requests must also be synchronized. Issue-ID: POLICY-2533 Change-Id: Idbe155568e5d793fe82b7cc3aad5ef121e8209b9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-05-06Make type and type_version mandatory on policiesliamfallon3-17/+86
Up until now, the "type" and "type_version" fields defaulted to "NULL" and "0.0.0" respectively when they were not specified because the "type_version" field was not always specified on policies in previous releases. In cases where the "type_version" field was not specified, it was assumend that a "0.0.0" version of the policy type existed. In parallel, if the version field was not specified on the policy type, the version was stored as 0.0.0. This behaviour is now changed and the "type" and "type_version" fields are now always mandatory. Issue-ID: POLICY-2538 Change-Id: I4279adfa86f531205879dbb87986453604624032 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-05-05Policy delete should only return deleted policyliamfallon1-45/+57
The policy type delete and policy delete now only return what is deleted in the service template. Issue-ID: POLICY-2534 Change-Id: I1b8d10c22d4392b0bbb655aa6876ac900ebc81df Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-05-04Fix simultaneous write access to policy providerliamfallon1-32/+47
This change serializes write access to the policy database via the AUthorative TOSCA provider by making sure that only one request is executed at a time. His change should be repolaced by proper session handling in the next release of the Policy Framework project. Issue-ID: POLICY-2533 Change-Id: I5fe4c0f2846981a66eb2f4e1da936fe3c9490ae5 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-04-16Add version to example yaml filesJim Hahn1-22/+7
Determined that some of the yaml files were not suitable for use in the CSITs, because they were missing the "version" property. Added it where needed. Also added type_version where it was missing, as well. Issue-ID: POLICY-2491 Change-Id: I47bf0ec2b99d29580390a6e90512dfd903b042d6 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-07Address sonar issues in modelsJim Hahn4-21/+11
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-25Cleanup eclipse warningsPamela Dragosh1-1/+0
Issue-ID: POLICY-2165 Change-Id: Iaad54af1b1210fe96fa44dcaa609834c46557877 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-23Add version to compliant operational policiesjhh1-7/+7
Issue-ID: POLICY-2356 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5636ec4e92ff87fdefb9a6372a150ad021aeec16 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-03-19Allow fetch of old policy type verisonsliamfallon3-104/+106
Due to the problems with TOSCA and version handling, the filtering for policy types on old versions did not work. This change fixes that problem. Issue-ID: POLICY-2377 Change-Id: I462bd5710b9dea37475861d1021d28b2c7391a24 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-11SONAR: Squelch bug regarding non-initalized lombok.NonNull valuesChris Ramstad2-0/+2
Issue-ID: POLICY-2389 Signed-off-by: Chris Ramstad <cramstad@ciena.com> Change-Id: Iba9faf9e878d55022be7882e862ebed826dc76c1
2020-03-09Add optional controllerName in Op. Legacy Policiesjhh3-2/+15
Optional controllerName has been added to Legacy Operational policies to be able to route Operational Policies to an specific drools controller. Currently, the policies are deployed to all controllers that support a policy type. In the case, that there are multiple controllers set, and the policy is only to be routed to one of them, this field should be populated. Issue-ID: POLICY-2388 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I7288ce0069a723b8e6ec535331dc9cda56fbf130
2020-03-06Full version in policy metadata versionliamfallon1-1/+1
Major, minor, and patch version of policy now in policy metadata version. Issue-ID: POLICY-2243 Change-Id: I1f3c7054a12e724264b117e399890c9e1c3347f2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-06TOSCA Compliant Guard PoliciesPamela Dragosh16-1033/+82
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-03-04Fix tca monitoring tca_policy typePamela Dragosh1-5/+1
Should not use map or entry_schema Issue-ID: POLICY-2408 Change-Id: Ieebe625676edab6c44323b7c69a50cc22099235f Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-03Return incoming service templates on createliamfallon2-9/+9
We should return the incoming service template on create requests. This change is required for CSIT tests. Issue-ID: POLICY-1402 Change-Id: I1072c9c16d2b267c34fa015e7e7a355ba9f5338a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-24Fix to avoid ConcurrentModificationException in policy-modelsa.sreekumar1-3/+3
Change-Id: If911bdd4116b722e13e00199d05b1794de4e79c2 Issue-ID: POLICY-1402 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2020-02-20Minor fix to avoid ConcurrentModificationException in policy-modelsa.sreekumar1-6/+6
Change-Id: If737f6ae0bcb0f8c694711a67a3c879fee8c11c5 Issue-ID: POLICY-1402 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2020-02-19Fix cascaded get filtering and speedliamfallon2-69/+123
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-18Add safe entity delete, fix multiple entity getliamfallon13-33/+433
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 Dragosh4-16/+21
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-17Fix return building on policy getliamfallon1-4/+11
The service template that is being returned for the "get" has to be built up in the correct order. A policy and the policy types and data types it is referencing must be added together. Before, all the policies were added at once and then the policy types and data types for the policies were added afterwards. This means that if the service template is validated during the service template build, validation may fail, depending on the order of building of the template. Issue-ID: POLICY-1402 Change-Id: Ia4fb9ee3819dccfc8c346c682545b2d27ebc4058 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-14Fix return codes and policy getliamfallon3-12/+11
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-13Update models-tosca for hetter handlingliamfallon11-29/+59
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 getliamfallon19-230/+539
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-02-10Get the tree of parent entities for an entity in a containerliamfallon2-26/+169
Utilityu method to filter out all bit an entity and its parents from a service template entity container. Issue-ID: POLICY-1402 Change-Id: I8c3b4c21b27fd8787cdfde0e1b726646f52c437b Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-07Add data type and policy type reference checkingliamfallon12-125/+311
Full validation including references to policy types and data types added. Unit tests fixed to cope with new stricter validation. Issue-ID: POLICY-1402 Change-Id: I59f37640a99494a53960a54d2fc82cc96861d43b Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-05Add vaidation for entity hierarchiesliamfallon27-149/+498
This change brings in proper hierarchical checks for service templates, making sure that all parents of data types, policy types, and policies must be in place. Issue-ID: POLICY-1402 Change-Id: I61b1b556403f74aeaa092f0d4d6ed19bf6a0b715 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-04Add merge utility for service templatesliamfallon5-31/+413
This utility function allows a TOSCA service template fragment to be merged with an exsiting service template and will be tbe backbone of "create" methods on the API from now on. Issue-ID: POLICY-1402 Change-Id: I3381cb2a1bd30621a639dedc213c546eeb2bf9aa Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-28Merge "Add service template persistence provider"Jorge Hernandez5-8/+309
2020-01-28Add service template persistence providerliamfallon5-8/+309
Persistence needs to be carried out at service template level in order to guarantee consistency of the service template in the database as much as possible. Therefire, service template lelve reading, writing, and delting is required. Issue-ID: POLICY-1402 Change-Id: I5be57c29381bf6ddc87afdbb64ddae66a5ea5e5f Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-20vcpe operational policy tosca compliant jsonjhh1-3/+3
Issue-ID: POLICY-2148 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Id8ac0279184e5d063cbff197e47f14745a9ef353 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2020-01-16Clean up TOSCA provider unit testsliamfallon1-5/+6
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 testsliamfallon2-56/+51
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-10Merge "Added new policy examples to support integration of new version ↵Liam Fallon1-11/+1
validation feature"
2020-01-10Added new policy examples to support integration of new version validation ↵Chenfei Gao1-11/+1
feature Issue-ID: POLICY-2316 Change-Id: Ifcb6739c7dd6c5796067a4b9e2f3eef960e1ace4 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2020-01-10Fix policy-models to support data type propertiesliamfallon4-24/+26
Data type properties are not being stored correctly into the database when MariaDB is used (it worked fine in unit tests in H2). Issue-ID: POLICY-2315 Change-Id: Ia901a070292b338154f3766f5fc7b91d656038df Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-08Update tosca utils to remove code duplicationliamfallon2-63/+80
Refactored the ToscaUtils class to remove code duplication. Issue-ID: POLICY-2315 Change-Id: Ic06a0881d1797dbb3c45ae1903a150fbda421e72 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-08Store and return data types for policiesliamfallon4-25/+231
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-07Support persistence of data typesliamfallon10-213/+471
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-11Merge "Fix minor checksyle issues in models"Pamela Dragosh2-5/+6
2019-12-10Update optimization policiesPamela Dragosh1-16/+16
These policies need to be updated. Issue-ID: POLICY-2066 Change-Id: Idc15aa36f4295477b37aa6398920853436909751 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-12-10Fix minor checksyle issues in modelsliamfallon2-5/+6
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-07Refactor optimization policiesPamela Dragosh2-27/+57
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 Dragosh1-5/+9
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-10-21Update optimization policies to have versionPamela Dragosh3-8/+38
These should be version 1.0.0. Add in a no version test. Issue-ID: POLICY-2066 Change-Id: Ie113c02c37e95b86dbb31247bf7a9fda09f724b1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-09-11Fix derivedFrom fieldliamfallon1-1/+1
TOSCA does not have a version on derivedFrom fields on policies and policy types. THerefore, we use the default value of 0.0.0 for versions on these fields in the database. When reading back out derivedFrom fields, we need to just take the name of the field and not the ID of the field. Issue-ID: POLICY-2075 Change-Id: I55e9c479047d6c1a9376a1713f4ddb2536476b29 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-09-09Add metadata to propertiesPamela Dragosh4-0/+260
Properties should support metadata - adding it in. Added junit tests for the new metadata field. Issue-ID: POLICY-2060 Change-Id: I2e1933ca4260fe5989f36a098108893a366f657a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com> Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-05Repair policy types in TOSCA service templateliamfallon6-56/+115
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>