summaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main
AgeCommit message (Collapse)AuthorFilesLines
2021-01-28Add copy constructors to conceptsliamfallon2-2/+59
Copy constructors for ToscaServiceTemplate and ToscaTopologyTemplate. Issue-ID: POLICY-2971 Change-Id: Idb4abf8bce40593e0bf18614b8c647688dd5748d Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-19Merge "Add PfKey translation to ToscaConceptIdentifier"Pamela Dragosh1-0/+16
2021-01-18Create ToscaConceptIdentifier from ToscaEntityKeyliamfallon1-1/+5
THis change adds a method to create a ToscaConceptIdentifer from a ToscaEntityKey class. This method reduces the code vloume when translating between these identifiers. Issue-ID: POLICY-2971 Change-Id: Idd62339935d2ba78e6c60b40ee95fedac0642bef Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-16Add PfKey translation to ToscaConceptIdentifierliamfallon1-0/+16
Concenience constructor to create a TosaConceptIdentifier from a PfKey and a method to create a PfConceptKey from a ToscaConceptIdentifier. Issue-ID: POLICY-2971 Change-Id: I402b2e12cc11976cd7e98436eb46486c35fdaa31 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-15Merge "Add copy constructor to ToscaNodeTemplate"Jim Hahn1-1/+19
2021-01-14Add copy constructor to ToscaNodeTemplateliamfallon1-1/+19
In order to support serialization and deserialization of ToscaNodeTemplate objects onto DMaaP, we need a copy constructor on the ToscaNodeTemplate object. Issue-ID: POLICY-2971 Change-Id: If6dc6c54d5673cef46734a88d0a91ae868c11dcb Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-14Rename keywords used as column names in API and PAP JPAgregory.hayes2-5/+5
Using keywords as column names in JPA models is causing syntax errors during auto generation of DDL The errors are visible in the policy api and pap docker logs on startup This review renames the relevant columns Issue-ID: POLICY-2670 Signed-off-by: gregory.hayes <gregory.hayes@est.tech> Change-Id: I52a3156461940465c3945841c69a04fcb2f90117
2021-01-06Use annotations on parameterized typesJim Hahn13-85/+38
Updated the code to place validation annotations directly on the annotated types instead of using the @Items and @Entries annotations. Also added/updated junits for validation code. Issue-ID: POLICY-2648 Change-Id: Ia535da07a38cec77a74c5c3215b5ae784d7a4e1a Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-06Changed identifiers to concept identifiersliamfallon5-125/+25
The policy models tosca classes ToscaPolicyIdentifier and ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA concept, not just TOSCA policies so they are renamed to ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion respectively. The class ToscaPolicyTypeIdentifier is redundant and is replaced by ToscaConceptIdentifier. Issue-ID: POLICY-2900 Change-Id: Id0a37c42ea4e74f07b47e1694c4f8291c35879c9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-23Add Service Template TOSCA handlingliamfallon5-56/+256
Today we can only handle a single service template in the database. We should be able to handle multiple service templates and assign arbitrary policy types and policies to maned and versioned service templates. This review brings in the Java API in models provider for handling service templates in this way and uses a simplistic single-teplate implementation in models-tosca, that will work but still only handles a single service template under the hood. Issue-ID: POLICY-2900 Change-Id: Ia02dea8abe44b7f407e685090a4b8e0360889653 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-21Use annotations to do validationJim Hahn19-207/+160
Modified models to use annotations instead of function calls for most field validations. Created a few new validation annotations for use within models. Per review comments: - renamed Key to VerifyKey - enhanced VerifyKey to imply "@Valid", unless disabled Issue-ID: POLICY-2648 Change-Id: I2b53f218b0a2ab1ed1f5e278816a3509f1408972 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-12-17Use ValidationResult for models v2.0Jim Hahn31-873/+262
Policy models uses PfValidationXxx classes which are totally unrelated to ValidationResult in policy common. This precludes the use of various utility methods and annotations for doing validation. Modified policy models to use ValidationResult instead. This approach uses function calls, though a future approach could make use of annotations instead. Issue-ID: POLICY-2648 Change-Id: I9760f1dc46902ab6bef7f440f3caf5e951660a5d Signed-off-by: Jim Hahn <jrh3@att.com>
2020-12-14JPA concepts for TOSCAliamfallon26-232/+2911
Implement the Database persistence parts for the new TOSCA concepts so that those concepts can be written to and read from the database. First batch of comment fixes Issue-ID: POLICY-2900 Change-Id: I45191c1ff57cf1ea8563399db6cc8e51b2724813 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-03Add generic methods to TOSCA providers and utilsliamfallon3-29/+117
Generic methods for getting ehtire service templates are added to the TOSCA providers in models-tosca. These are needed to read service tempaltes containing entities that are not policy related. Issue-ID: POLICY-2900 Change-Id: If4c646037f51f8a18b66257426accc330905acf9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-02Remove unused importsliamfallon3-4/+4
Issue-ID: POLICY-2900 Change-Id: Iaba37b81473b60d3da15a52ffcccdaa16a5b7091 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-01Add extra authorative TOSCA conceptsliamfallon23-53/+389
This review brings in extra TOSCA concepts for Node types, nodes, and capabilities. The TOSCA handling is also amended to make the handling of equality consistent. Now, if filtering or ordering is required using an order rather than natural ordering, a comparator must be supplied by the user. Issue-ID: POLICY-2900 Change-Id: Ie40e86870b97eb993b1338bdc0666ac116f72f67 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-11-06Fix upcoming checkstyle issuesPamela Dragosh1-1/+2
When we upgrade to oparent, these will fail as oparent upgrades to 8.37 of puppycrawl which fixes a few bugs that should have flagged these previously. Issue-ID: POLICY-2887 Change-Id: Ia0ceab23ff3d5c177f657c5852115ab1b265c698 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-10-15Default should be an object on TOSCA propertiesliamfallon3-13/+26
Property default value is serialized to the database as Yaml and deserialized back into an object on a DB read. Issue-ID: POLICY-2844 Change-Id: I69f2843a93cd5f831359a0965223298b769498d9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-08-25Address more sonar issues in policy-modelsJim Hahn6-12/+14
Addressed sonar issues: - diamond operator Also removed a number of the "NOSONAR" comments now that we know how to address them without disabling sonar. Issue-ID: POLICY-2714 Change-Id: I440f4fa955968fd911616c2b6ee61b4b4d013821 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-14Remove legacy operational policy from modelsRam Krishna Verma4-390/+2
Removing all the legacy operational policy related concepts, providers, examples etc from models repo. Issue-ID: POLICY-2764 Change-Id: Ie820271381674ccc4eaef0bd6379f673f67701e7 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-06-18Changes for Checkstyle 8.32liamfallon26-83/+6
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-09Changing toString on ToscaPolicyXXXIdentifiersRossC3-0/+18
Issue-ID: POLICY-2078 Change-Id: I0e8aae118a52aaef7e372293396802b85782a22c Signed-off-by: RossC <ross.carter@est.tech>
2020-05-10Policy DB contents removed on DB deadlockliamfallon3-112/+101
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 policiesliamfallon1-9/+13
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-07Address sonar issues in modelsJim Hahn3-19/+9
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-19Allow fetch of old policy type verisonsliamfallon2-51/+53
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 Policiesjhh2-1/+12
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 Dragosh7-460/+2
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-03Return incoming service templates on createliamfallon1-6/+6
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 getliamfallon7-17/+93
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-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 handlingliamfallon6-8/+23
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 getliamfallon10-151/+308
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 containerliamfallon1-26/+46
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 checkingliamfallon5-12/+134
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 hierarchiesliamfallon5-7/+98
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 templatesliamfallon3-25/+201
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-28Add service template persistence providerliamfallon2-7/+131
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-13Read resource dirs in models prvider unit testsliamfallon1-46/+41
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>