aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/test
AgeCommit message (Collapse)AuthorFilesLines
2020-03-19Allow fetch of old policy type verisonsliamfallon1-53/+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-09Add optional controllerName in Op. Legacy Policiesjhh1-1/+3
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-06TOSCA Compliant Guard PoliciesPamela Dragosh9-573/+80
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 createliamfallon1-3/+3
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-18Add safe entity delete, fix multiple entity getliamfallon6-16/+340
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-13Update models-tosca for hetter handlingliamfallon5-21/+36
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 getliamfallon9-79/+231
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-0/+123
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 checkingliamfallon7-113/+177
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 hierarchiesliamfallon22-142/+400
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 templatesliamfallon2-6/+212
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 Hernandez3-1/+178
2020-01-28Add service template persistence providerliamfallon3-1/+178
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 testsliamfallon1-10/+10
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-10Fix policy-models to support data type propertiesliamfallon1-10/+10
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 duplicationliamfallon1-10/+10
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 policiesliamfallon2-0/+129
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 typesliamfallon7-201/+322
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-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-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-09Add metadata to propertiesPamela Dragosh2-0/+234
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 templateliamfallon2-41/+45
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-08-27Replace copyTo methods with copy constructorsJim Hahn10-58/+28
Deleted the copyTo() method from PfConcepts and replaced uses with deep-copy constructors. Also added mapMap() and makeCopy() methods to PfUtils to facilitate. Change-Id: Id6391bb806ef0dfab6c1089278bf2b514c7e303e Issue-ID: POLICY-1600 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-27Use ToStringTester from utils-testramverma3-3/+5
Changing ToStringTester from utils to utils-test Bump up common to 1.5.1-SNAPSHOT Change-Id: I7427673c73bd1cc52d5f24a0542e89eb33a39ae8 Issue-ID: POLICY-1746 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-06-18Change getCanonicalName to getName in modelsJim Hahn6-6/+6
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 the bug of cannot return multiple versions of particular tosca ↵Pamela Dragosh1-1/+1
policy and policy type"
2019-06-17Fix the bug of cannot return multiple versions of particular tosca policy ↵Chenfei Gao1-1/+1
and policy type Issue-ID: POLICY-1807 Change-Id: I831c720993930a911d301a82b59a74cda7cb0c50 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2019-06-17Fix simple sonar issues in models-toscaJim Hahn33-1088/+787
Change-Id: I36a91fbbd95df7aff2656a97dd09b778cdbb798f Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-17Merge "Allow multiple versions of entities to be returned"Jorge Hernandez4-9/+56
2019-06-14Allow multiple versions of entities to be returnedliamfallon4-9/+56
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-06-13Remove isNullVersion from identifier classJim Hahn1-4/+0
ToscaPolicyIdentifierOptVersion had an isNullVersion() method which is not being used. Removed this version, thus eliminating the need to include a jackson @JsonIgnore annotation. Change-Id: I03309099a1173591736f69b82b549ebce7994169 Issue-ID: POLICY-1653 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-07Fix version field to represent policy version instead of type versionChenfei Gao1-2/+10
Added changes to make version field in return of GET guard policy call represent the version of guard policy instead of its type version. Issue-ID: POLICY-1809 Change-Id: Ie8db6e89d8439576ee5f6ee99c3222386775b195 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2019-05-22Fix name/version regexp in model keysliamfallon2-4/+4
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/deleteliamfallon2-45/+104
Issue-ID: POLICY-1777 Change-Id: I5b07ad1acdb4a614a50cb15978130c19bc5786f7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-16Allow policy type prefix on policy guard policy idliamfallon1-1/+30
In order to identify the policy type of a guard policy, we need to have the first part of the policy id as the policy type identifier prefix. Issue-ID: POLICY-1776 Change-Id: I1d6a3c4b122d978ff7ef40ce76ced7f160ebd4fa Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-07Set default and check existance of Policy Typeliamfallon10-15/+115
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-05-05Serializaiton of properties to DB as JSONliamfallon2-2/+2
Properties should be serialized to JSON prior to writing to database and deserialized from JSON when read from database. Issue-ID: POLICY-1736 Change-Id: I5ad3fd4a87079f4557f5fcb825395f0b4bec3318 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-02Fix bug in guard policy metadata creationliamfallon1-0/+7
Issue-ID: POLICY-1728 Change-Id: Ie33a30a811fcd8c128dfac87c17dcb37da6d42b4 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-19Fix a bug in adding one-digit policy-version in metadataChenfei Gao1-3/+3
Original change of adding single digit policy-version in tosca policy metadata does not take effect actually. It is added into metadata of authorative tosca policy but not jpa tosca policy. Identify the issue at the last minute and fix it. Issue-ID: POLICY-1442 Change-Id: I8aefa546f757f7841554e3caf00ccc476d23ebf5 Signed-off-by: Chenfei Gao <cgao@research.att.com>
2019-04-15Add conversion from plain Ident to IdentOptVersionJim Hahn1-2/+23
Added a "copy constructor" that copies an Ident to an Ident with an optional version. The reverse does not make sense, so did not add that (e.g., version may be null or may just be a prefix, while the version in Ident is major.minor.patch). Change-Id: Ifd3935a998cd4c1cb5113a59c5f36a7d9baf79ff Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-14Add prefix matching for policy versionJim Hahn1-0/+17
Re-introduced regular expressions to match policy version so that the policy version found in the metadata, which is just the major number, can be matched with a policy's version, which is of the form, major.minor.patch. Simplified equals() test, as we already know "text!=null". Added filterPrefixPred() and modified policy filter to use it when matching versions, as it is simpler to use when matching a version prefix. Also added tests to PfObjectFilterTest to test each of the XxxPred() methods. Change-Id: I0734873f701a539e883fe25b8eecfdde60cc8b6d Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12Add validation methods for PAP REST APIJim Hahn4-15/+112
Also made the identifier classes comparable. Stupid tabs. Change-Id: I54c0595c6a2c61a1b72b58fe1d667657f9d5d71e Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12UNit test and minor fixes for DB parsliamfallon5-47/+31
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>