aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca
AgeCommit message (Collapse)AuthorFilesLines
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 genericliamfallon17-387/+168
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 conceptsliamfallon4-2/+167
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 Dragosh3-4/+36
2021-01-18Create ToscaConceptIdentifier from ToscaEntityKeyliamfallon2-1/+6
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 ToscaConceptIdentifierliamfallon3-4/+36
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 Hahn2-1/+69
2021-01-14Add copy constructor to ToscaNodeTemplateliamfallon2-1/+69
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 identifiersliamfallon9-166/+69
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 handlingliamfallon10-87/+605
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 Hahn20-208/+161
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 Hahn52-1139/+535
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 TOSCAliamfallon36-321/+3222
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 utilsliamfallon6-29/+362
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 conceptsliamfallon25-57/+393
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-27Bump models master to 2.4.0 SNAPSHOTJim Hahn1-1/+1
Bumping minor version now that guilin branch has been created. Issue-ID: POLICY-2875 Change-Id: Iec7868062610a3acca6f883f999615ccc109f850 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-10-19Bump models to 2.3.6 snapshotJim Hahn1-1/+1
Issue-ID: POLICY-2869 Change-Id: I98223c20d6d1d6d9bf5bd958d9d3ed4aacdf17e6 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-10-16Merge "Default should be an object on TOSCA properties"Pamela Dragosh4-13/+83
2020-10-15Default should be an object on TOSCA propertiesliamfallon4-13/+83
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-10-09Bump models to 2.3.5Jim Hahn1-1/+1
Issue-ID: POLICY-2863 Change-Id: Iba0dfe78576a2ad1551c165e3b9f53fa3c55259a Signed-off-by: Jim Hahn <jrh3@att.com>
2020-10-09Bump models to 2.3.4 snapshotJim Hahn1-1/+1
Issue-ID: POLICY-2863 Change-Id: I9d764a0cd695aa95a5880fd20b594e465d14c658 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-10-07Bump models to 2.3.3Jim Hahn1-1/+1
Issue-ID: POLICY-2839 Change-Id: Ifd7f45854904545b4f2973e1429cb791ac00b600 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-09-08Bump models to 2.3.2Jim Hahn1-1/+1
Issue-ID: POLICY-2789 Change-Id: I19b397ecb165bea30059142d9d4c5357ceba9825 Signed-off-by: Jim Hahn <jrh3@att.com>
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-24Merge "Remove legacy operational policy from models"Jim Hahn9-934/+8
2020-08-20Sonar Fixes policy/models, removing model-yamluj426b16-133/+149
Change-Id: Icd82ea1aef90e4d638b13958519aac5ed5a53f73 Issue-ID: POLICY-2714 Signed-off-by: uj426b <uj426b@att.com>
2020-08-19Upgrade new tcagen2 policy typePamela Dragosh7-15/+15
The old cdap policy type is deprecated by DCAE. Thus, we are simply replacing with the new tcagen2 policy type. Issue-ID: POLICY-2772 Change-Id: I1442340729b5f820f2e265b9b86f6f6f84f49bca Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-14Remove legacy operational policy from modelsRam Krishna Verma9-934/+8
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-07-09Bump policy/models to 2.3.1-SNAPSHOTRam Krishna Verma1-1/+1
Issue-ID: POLICY-2695 Change-Id: I64473cc81ae48942010472f15faac75c13cb0b7d Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-07-01Fix broken models build due to json upgradeJim Hahn1-0/+7
The json dependency was moved to policy-parent and the "version" property removed which broke the policy-models build. Removed the "version" from the pom. Also removed the jetty-security "version" from the pom, as it is no longer needed either. Also added asm dependency, because upgrade of openpojo version caused breakage in one of the TestPojos. Issue-ID: POLICY-2387 Change-Id: I3c2315b3cbea05de76b6dfcc289f9323af77745b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-19Merge "Changes for Checkstyle 8.32"Ram Krishna Verma58-118/+6
2020-06-18Changes for Checkstyle 8.32liamfallon59-120/+6
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-18Replaced try/catch blocks in policy/models with assertj assertions.waynedunican1-8/+3
Issue-ID: POLICY-2451 Change-Id: I095beb674196d5ec5c4dd9b93d3a56cca5ee4788 Signed-off-by: waynedunican <wayne.dunican@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-19Bump models master to 2.3.0-SNAPSHOTRam Krishna Verma1-1/+1
Issue-ID: POLICY-2514 Change-Id: I6a3d4e588a0ff0d15fccf49de66c51ea7d709b4b Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-05-19Bump models to 2.2.7-SNAPSHOTRam Krishna Verma1-1/+1
Issue-ID: POLICY-2514 Change-Id: Ie482926a56a5250be5d78a97aa7c1c19311a292c Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
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-24Bump models patch 2.2.6-SNAPSHOTPamela Dragosh1-1/+1
Also point to parent, common snapshots Issue-ID: POLICY-2510 Change-Id: Iad79c341bcfb8cb6bb828ee71e199ba3bb9a838b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
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-14Bump models to 2.2.5-SNAPSHOTRam Krishna Verma1-1/+1
Issue-ID: POLICY-2378 Change-Id: I5461bafd3c2d19f4f457da0816bba117a2d8b550 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-04-11Bump models patch 2.2.4-SNAPSHOTPamela Dragosh1-1/+1
Issue-ID: POLICY-2378 Change-Id: I51c6c57bdcc0299c25b5ee05f47c20f4542bc02d Signed-off-by: Pamela Dragosh <pdragosh@research.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>