summaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-22Java 17 Upgradeadheli.tavares40-361/+363
Issue-ID: POLICY-4669 Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-02-13Remove annotations in modelslapentafd9-32/+0
Removing last annotations in order to remove dependencies in parent Issue-ID: POLICY-3465 Change-Id: Id7a070120d452e33af805b08b37dd1eba1374615 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2023-02-07Replace Eclipselink with Hibernateliamfallon7-37/+73
Issue-ID: POLICY-4533 Change-Id: I77a6c44c96013963e141265758629cae83e49876 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-03-14Fix metadataSet serialization for db persistence and retrieval.rameshiyer272-2/+38
PDP fails to parse metadataSet from PDP_UPDATE message. MetadataSet(Lob) needs to be serialized and de-serialized for storage/retrieval to preserve the format. Issue-ID: POLICY-3934 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I5f7a0649639f142c7afb4dd93cc8081ebaac4081
2022-02-16Fix return type of get node templates providerrameshiyer271-3/+3
The return type for fetching node templates can be just a List of ToscaNodetemplates. Removing the map with node template keys as it provides redundant keys in the output. Issue-ID: POLICY-3832 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I43d357fc24af9fd4d127cce139b6d21c53cc98d1
2022-02-10Add policy metadataSet handling as node templatesrameshiyer276-9/+416
Each metadataSet is represented as a 'node_template' in Tosca mapped to a specific node type. Support added for db operations of node templates as independent entities. Detailed documentation available here : https://wiki.onap.org/display/DW/Enable+Handling+of+Policy+Type+Metadata Issue-ID: POLICY-3832 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I6c189142b1778ba858aae27cd92d4f136d950208
2022-01-11Fix issues in existing entity classesa.sreekumar6-21/+23
Issues identified in the entity classes are fixed in this review. Some fixes doesn't affect the table structure at all. Tables actually affected by some of these fixes are not really used today, and doesn't contain any data. A separate review is raised for the db-migrator changes. Change-Id: I0efdf2c5f17e12225f1b443b5fe8e27c578229f7 Issue-ID: POLICY-3871 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-10-06Support in_range TOSCA Constraintliamfallon3-2/+109
The TOSCA in_range constraint is not supported, causing errors to be thrown in TOSCA control loop constraint edits. Issue-ID: POLICY-3695 Change-Id: I95dec4118ce8572c5b76d528878c6782856e0a53 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-09-02Add check for null for policies and policy typessaul.gill1-3/+10
Add check when reading policies and policy types from db Issue-ID: POLICY-3606 Change-Id: I7a1d96e4be1841243619e89c31dabc3e761dd17a Signed-off-by: saul.gill <saul.gill@est.tech>
2021-06-21Fix new checkstyle issues in modelsJim Hahn1-1/+0
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3094 Change-Id: I85314bc0249cba0020a0aefbc250851a2b646dd9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-17Use lombok annotations for tosca, rest, sdncJim Hahn2-14/+7
Issue-ID: POLICY-3396 Change-Id: I3c9e5ee7ea6da2bab4fe37504d39f7ce63868887 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-12Fix sonars in policy modelsJim Hahn1-17/+9
Fixed: - a few other "var" cases - use re2j instead of java.util.regex - use correct class for constants - remove unused constants Issue-ID: POLICY-3094 Change-Id: Ifcb2b0623e8df0527f0a279e666d062422978ded Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-10Fix sonars in policy modelsJim Hahn21-48/+48
Fixed: - use "var" Issue-ID: POLICY-3094 Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-29Remove GroupValidationResultJim Hahn1-5/+4
Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: I245e4a647fcbb718faa63a7543f9f81c85da958c Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-03Refactor models for common type handlingliamfallon11-148/+189
Currently we have handling for "type" and "type_version" on TOSCA Policy class. However, the concept of a "type" and "type_version" also exists on the ToscaCapabilityAssignment, the ToscaNodeTemplate, and the ToscaRequriement classes. This review makes the type handling on Policy generic, thus extending it to the other three types. Issue-ID: POLICY-2983 Change-Id: Ia20e3a8c485f4841257075df08e0784eac415770 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-02-19Refactor timestamp property in policy models to use Instantrameshiyer271-9/+10
Updated JPA classes to use java.sql.TImestamp rather than Instant. Issue-ID: POLICY-3069 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: If5b874ec96931d4b8dd142d46a9980e83a4708fc
2021-02-18Merge "Remove more duplicate code from models"Ram Krishna Verma3-85/+111
2021-02-17Remove more duplicate code from modelsJim Hahn3-85/+111
Addressed sonar "duplicate code" issue by extracting a common ToscaNameVersion class from the XxxIdentifier classes. Also removed junit test for class that no longer exists and renamed another junit to match the renaming of the class being tested. Issue-ID: POLICY-2905 Change-Id: I4a28cd7de2478f2771a864439c0b440ad8310299 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-17Fix sonars from removal of duplicate codeJim Hahn2-8/+8
The work to remove duplicate code from models introduced as many new sonars as it eliminated. :-( Addressed the following new issues: - visibility of constructor - use of more specific assertThat() calls Also added two junit test file that were somehow previously left out. Issue-ID: POLICY-2905 Change-Id: I7a0206bd157412d3c6d98bfe21797f106b37ac65 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-16Fix duplicate code in Jpa classesJim Hahn22-764/+606
Addressed the following issues: - remove duplicate code; extracted a common class containing properties Issue-ID: POLICY-2905 Change-Id: I80c423ab45c0c6823d338a034762d222ec334288 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-10More sonars in modelsJim Hahn9-109/+55
Addressed the following: - make constructors protected - check exception type - too many assertions - remove annotation lists - use "<>" - reduce cognitive complexity - extract constant - multiple method calls in one assert - don't use eq() in verify() - indentation Issue-ID: POLICY-2905 Change-Id: I25bb3951f781250e9cdfe8f5f3b80cb63e129184 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-07Make filters on TOSCA entities genericliamfallon9-166/+55
The classes PolicyTypeFilter and PolicyFilter only work on Policy types and policies. However they just filter on name/version/type/typeversion so there is no reason that the filters could not be applied to other entities. This commit adapts the PolicyTypeFilter to EntityFilter and PolicyFilter to TypedEntityFilter, so the filters can be applied to collections of any ToscaEntity class. Issue-ID: POLICY-2995 Change-Id: I8fcf76ee8c8497836b3286b35f928b0c341dac34 Signed-off-by: liamfallon <liam.fallon@est.tech>
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>