policy/models.git
2 years agoRemove policies field from PdpUpdate message 65/121565/2
waynedunican [Thu, 27 May 2021 08:12:05 +0000 (09:12 +0100)]
Remove policies field from PdpUpdate message

Issue-ID: POLICY-3323
Change-Id: I14dafe4a20f95e2ebe4279e5b6ae141e2ee4fc48
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Signed-off-by: WayneDunican <wayne.dunican@est.tech>
2 years agoFix sonars in policy models 21/121321/2
Jim Hahn [Wed, 12 May 2021 17:25:06 +0000 (13:25 -0400)]
Fix sonars in policy models

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>
2 years agoMerge "Fix sonars in policy models"
Liam Fallon [Tue, 11 May 2021 12:28:31 +0000 (12:28 +0000)]
Merge "Fix sonars in policy models"

2 years agoMerge "Fix sonars in policy-models impls & simulators"
Liam Fallon [Tue, 11 May 2021 12:28:17 +0000 (12:28 +0000)]
Merge "Fix sonars in policy-models impls & simulators"

3 years agoFix sonars in policy models 35/121235/2
Jim Hahn [Mon, 10 May 2021 15:39:27 +0000 (11:39 -0400)]
Fix sonars in policy models

Fixed:
- use "var"

Issue-ID: POLICY-3094
Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix sonars in policy-models impls & simulators 33/121233/1
Jim Hahn [Mon, 10 May 2021 13:53:23 +0000 (09:53 -0400)]
Fix sonars in policy-models impls & simulators

Fixed:
- use "var"

Issue-ID: POLICY-3094
Change-Id: I65da54cae5a58966f21f981c6cea1259bfdf4239
Signed-off-by: Jim Hahn <jrh3@att.com>
simulators

Change-Id: I1144568485e62e0c72194caaf21ebf1ba88a6fef
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix sonars in policy-models actors 07/121207/3
Jim Hahn [Fri, 7 May 2021 22:07:09 +0000 (18:07 -0400)]
Fix sonars in policy-models actors

Fixed:
- use "var"
- don't throw generic Exception

Issue-ID: POLICY-3094
Change-Id: I020addb9511fd665b5fed48e7d40719e27039224
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Remove GroupValidationResult"
Jim Hahn [Mon, 3 May 2021 17:00:16 +0000 (17:00 +0000)]
Merge "Remove GroupValidationResult"

3 years agoRemove GroupValidationResult 16/120916/3
Jim Hahn [Mon, 26 Apr 2021 22:16:36 +0000 (18:16 -0400)]
Remove GroupValidationResult

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>
3 years agoAdd correct filter type prefix to query 31/120931/2
ktimoney [Tue, 27 Apr 2021 10:26:09 +0000 (11:26 +0100)]
Add correct filter type prefix to query

Added unit tests

Issue-ID: POLICY-3247
Change-Id: I27474948619b7256a1e504611531eecac15c27c1
Signed-off-by: ktimoney <kevin.timoney@est.tech>
3 years agoMerge "Add a new key class which uses @GeneratedValue to base classes"
Pamela Dragosh [Mon, 26 Apr 2021 12:55:35 +0000 (12:55 +0000)]
Merge "Add a new key class which uses @GeneratedValue to base classes"

3 years agoAdd a new key class which uses @GeneratedValue to base classes 46/120646/6
ktimoney [Tue, 13 Apr 2021 13:40:06 +0000 (14:40 +0100)]
Add a new key class which uses @GeneratedValue to base classes

This will provide an alternative unique key.
It will be used in place of PfTimestampKey in the PdpStatistics table.
We make use of the @GeneratedValue annotation to provide this feature.
Added DummyGeneratedIdEntity and unit tests
Added PfFilterFactory class
Added new filter classes

Issue-ID: POLICY-3189
Change-Id: I097eab318d2cb958e1157e35825fd6d35d429a25
Signed-off-by: ktimoney <kevin.timoney@est.tech>
3 years agoRefactor CommandLineArguments classes 15/120615/2
adheli.tavares [Thu, 15 Apr 2021 09:35:00 +0000 (10:35 +0100)]
Refactor CommandLineArguments classes

All CMD Args simulator classes to extend from CMD class on Common.
Fix all unit tests accordingly.

Issue-ID: POLICY-3129
Change-Id: If69e432679772df15b06ce7e316c7c876b69773d
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
3 years agoClose DB in junits 70/120370/3
Jim Hahn [Fri, 9 Apr 2021 13:49:48 +0000 (09:49 -0400)]
Close DB in junits

Modified some of the junits to close the DB.
In addition, one of the junits was apparently dependent on a previous
test method adding records to the DB, thus the test methods were
actually order dependent, even though no annotations were used to
enforce the order.  Modified that method to insert the data, itself, so
the test methods are no longer order dependent.

Issue-ID: POLICY-3171
Change-Id: I778c12796340f2a665b4ba00588c823c925c078c
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse distinct names in DB junits 43/120343/1
Jim Hahn [Thu, 8 Apr 2021 21:26:18 +0000 (17:26 -0400)]
Use distinct names in DB junits

Junits for models often use the same memory DB name which may leave
garbage in the DB from one test to the next.  Modified the code to use
distinct names for each XxxTest class.

Issue-ID: POLICY-3171
Change-Id: I2a4a0b4949d532d6949f5d39396288c54d03688b
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Fix Sonar Issues models-tosca-simple"
Jim Hahn [Fri, 26 Mar 2021 19:18:01 +0000 (19:18 +0000)]
Merge "Fix Sonar Issues models-tosca-simple"

3 years agoFix Sonar Issues models-tosca-simple 49/119849/3
lapentafd [Tue, 23 Mar 2021 17:46:41 +0000 (17:46 +0000)]
Fix Sonar Issues models-tosca-simple

Tests refactoring to reduce number of assertions

Issue-ID: POLICY-3094
Change-Id: I8a9a02100e5d103f574cf2cb89d2e924d0f56507
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoMerge "Fix sonar issues for tests in policy-models"
Jim Hahn [Wed, 24 Mar 2021 12:41:04 +0000 (12:41 +0000)]
Merge "Fix sonar issues for tests in policy-models"

3 years agoMerge "Delete keystores from models"
Ram Krishna Verma [Mon, 22 Mar 2021 21:45:40 +0000 (21:45 +0000)]
Merge "Delete keystores from models"

3 years agoFix write failure on PDP statistics 60/119560/1
liamfallon [Fri, 19 Mar 2021 18:18:10 +0000 (18:18 +0000)]
Fix write failure on PDP statistics

Due to the precision of time stamps being saved to the nearest second,
a millisecond precision timestamp was being compared to a second
precision timestamp, causing the write to fail. This change fixes that.

A unit test is also added to test for this on the provider.

In addition, a USE-MARIADB flag is being introduced, which allows unit
tests to be run against a locally installed MariaDB instance so that the
unit tests can be verified against MariaDB locally rather than H2, the
default in Gerrit.

Issue-ID: POLICY-3146
Change-Id: I878f160956e89506743dc074679ee81ac1c48216
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoDelete keystores from models 57/119557/3
Jim Hahn [Fri, 19 Mar 2021 17:08:02 +0000 (13:08 -0400)]
Delete keystores from models

The Keystores are no longer needed in the tarballs, as they are supplied
externally by the CSITs and Helm charts.  Deleted those files.
Also modified the junits to use utils-test to generate keystores at
runtime, thus deleted the junit keystore file, too.

Issue-ID: POLICY-3143
Change-Id: Idd24b735a908476765d40bdcb5c741257edc7bb6
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix sonar issues for tests in policy-models 15/119615/1
lapentafd [Thu, 18 Mar 2021 12:06:14 +0000 (12:06 +0000)]
Fix sonar issues for tests in policy-models

Tests refactoring to reduce number of assertions

Issue-ID: POLICY-3094
Change-Id: I445462f0ec5d49474b10c1940c7fa12e687636de
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoMerge "Fix Sonar Issues in models-pdp"
Pamela Dragosh [Thu, 18 Mar 2021 12:59:09 +0000 (12:59 +0000)]
Merge "Fix Sonar Issues in models-pdp"

3 years agoUpdate policy-keystore with newer certificates 87/119387/2
jhh [Tue, 16 Mar 2021 15:34:48 +0000 (10:34 -0500)]
Update policy-keystore with newer certificates

Issue-ID: POLICY-3139
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Id4a882b40ef142d0414518c5d5ab90367f0bbb73
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
3 years agoFix Sonar Issues in models-pdp 57/119357/2
lapentafd [Fri, 12 Mar 2021 13:48:03 +0000 (13:48 +0000)]
Fix Sonar Issues in models-pdp

Tests refactoring to reduce number of assertions

Issue-ID: POLICY-3094
Change-Id: I23369c341c43df71b84392501d33739453f7c81f
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoMerge "Fix Sonar Issues on policy-models-tosca"
Jim Hahn [Mon, 15 Mar 2021 16:39:21 +0000 (16:39 +0000)]
Merge "Fix Sonar Issues on policy-models-tosca"

3 years agoFix Sonar Issues on policy-models-tosca 76/119076/4
lapentafd [Tue, 9 Mar 2021 15:13:05 +0000 (15:13 +0000)]
Fix Sonar Issues on policy-models-tosca

Tests refactoring to reduce number of assertions

Removed lines 167-169 in PfKeyImplTest

Issue-ID: POLICY-3094
Change-Id: I94ef11068811c81108b0fbf3e5b878d02ab25306
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoRemove more unnecessary plugins from models 77/119277/2
Jim Hahn [Fri, 12 Mar 2021 22:24:33 +0000 (17:24 -0500)]
Remove more unnecessary plugins from models

Issue-ID: POLICY-3126
Change-Id: If93ce1a3412cd7342a78e478ea2684ff9bf6dd97
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAddress plugin-not-found issues 54/119254/2
Jim Hahn [Fri, 12 Mar 2021 14:39:42 +0000 (09:39 -0500)]
Address plugin-not-found issues

Removed references to archetype-packaging and lifecycle-mapping, where
unnecessary due to pom inheritance.

Issue-ID: POLICY-3126
Change-Id: Ia1124da66239b57d6a05cdbdcce7866a38f59120
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoBump version to 2.5.0 in models 08/119108/1
Jim Hahn [Wed, 10 Mar 2021 19:53:36 +0000 (14:53 -0500)]
Bump version to 2.5.0 in models

Issue-ID: POLICY-3105
Change-Id: I01fe35f16609f9b8d98fb2083c8b18fc7ce3ccf3
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Add support for localName based filtering in PfReferenceTimestamp key."
Jim Hahn [Wed, 10 Mar 2021 16:42:35 +0000 (16:42 +0000)]
Merge "Add support for localName based filtering in PfReferenceTimestamp key."

3 years agoBump models to 2.4.2-SNAPSHOT 84/118984/1
Jim Hahn [Tue, 9 Mar 2021 16:56:51 +0000 (11:56 -0500)]
Bump models to 2.4.2-SNAPSHOT

Issue-ID: POLICY-3127
Change-Id: Ie37871c54dc5e7eab0ee7d553c6b38ea0e720a29
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoRelease models 2.4.1 artifacts 61/118961/1
Jim Hahn [Tue, 9 Mar 2021 14:37:54 +0000 (09:37 -0500)]
Release models 2.4.1 artifacts

Issue-ID: POLICY-3127
Change-Id: I2350bed3a5679ac5edb87544c732c4c094b7c028
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAdd support for localName based filtering in PfReferenceTimestamp key. 59/119059/1
rameshiyer27 [Tue, 9 Mar 2021 12:49:39 +0000 (12:49 +0000)]
Add support for localName based filtering in PfReferenceTimestamp key.

Issue : Currently we have a requirement to filter control loop
statistics based on the UUID of the element which is "localName" of the
PfREferenceTimestamp key. Adding UUID as part of filterMap in
getFiltered() method which also requires this minor change in buildFilter.

Issue-ID: POLICY-3051
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Idb9f4fc47c439f84bf8fc784bd9e228a2e05d8e9

3 years agoMerge "Use Date instead of Timestamp"
Jim Hahn [Mon, 8 Mar 2021 21:07:40 +0000 (21:07 +0000)]
Merge "Use Date instead of Timestamp"

3 years agoUse Date instead of Timestamp 73/118873/4
Jim Hahn [Fri, 5 Mar 2021 20:50:47 +0000 (15:50 -0500)]
Use Date instead of Timestamp

Use of Timestamp in JPA classes appears to cause
EntityNotFoundException.  Changed from Timestamp back to Date.

Issue-ID: POLICY-3125
Change-Id: I3ee29675849e3feda2641e9b240207c96fd975d4
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix 4 newly added Sonar bugs 55/118855/1
lapentafd [Fri, 5 Mar 2021 09:53:05 +0000 (09:53 +0000)]
Fix 4 newly added Sonar bugs

Added casting for 4 asserts in policy/models/base

Issue-ID: POLICY-3094
Change-Id: Ibc97be3eca366a7e9b8b9611bc284f2473acff6e
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoMerge "Refactor models for common type handling"
Liam Fallon [Thu, 4 Mar 2021 16:13:36 +0000 (16:13 +0000)]
Merge "Refactor models for common type handling"

3 years agoMerge "Fix sonar issues on policy-models"
Jim Hahn [Thu, 4 Mar 2021 14:13:06 +0000 (14:13 +0000)]
Merge "Fix sonar issues on policy-models"

3 years agoRefactor models for common type handling 67/118767/1
liamfallon [Tue, 2 Mar 2021 10:55:31 +0000 (10:55 +0000)]
Refactor models for common type handling

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>
3 years agoFix sonar issues on policy-models 50/118750/2
lapentafd [Mon, 1 Mar 2021 17:09:28 +0000 (17:09 +0000)]
Fix sonar issues on policy-models

Tests refactoring to reduce number of assertions to less then 25

Issue-ID: POLICY-3094
Change-Id: Icd3d83c7f8168dd81df13a584229eab36c646f37
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
3 years agoFix Reference Key columns persistence issue in db 20/118720/5
rameshiyer27 [Mon, 1 Mar 2021 18:46:33 +0000 (18:46 +0000)]
Fix Reference Key columns persistence issue in db

Problem: When PfReferenceTimestamp Key is persisted in db, the parent
class fields are ignored which causes inconsistent data while saving and
fetching in db.

Fix: JPA is not supporting inheritance in @Embeddable classes. Hence
included the super class as @Embedded property in PfReferenceTimestamp
key. @Embedded properties are unable to be queried directly. Slightly
modified Dao methods to support querying @embedded fields.

Issue-ID: POLICY-3049
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I5c2e03a5ae98525764a64dd6cce1a1298c5f9816

3 years agoMerge "Fix Null key issue in PfReferenceTimestampKey"
Liam Fallon [Thu, 25 Feb 2021 16:36:11 +0000 (16:36 +0000)]
Merge "Fix Null key issue in PfReferenceTimestampKey"

3 years agoFix Null key issue in PfReferenceTimestampKey 01/118501/2
rameshiyer27 [Tue, 23 Feb 2021 15:10:39 +0000 (15:10 +0000)]
Fix Null key issue in PfReferenceTimestampKey

isNUllKey check for PfReferenceTimestamp key is always returning false as the parent class is
validating the child object in its method which has additional parameters (timestamp).
Fixing the issue by validating only the fields of parent class.

Issue-ID: POLICY-3069
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Ie22d09552c9d0cedb7535bda359df0d70e1ebe77

3 years agoUpdate info.yaml in models 86/118386/1
Ram Krishna Verma [Wed, 24 Feb 2021 14:54:18 +0000 (09:54 -0500)]
Update info.yaml in models

Issue-ID: POLICY-3028
Change-Id: I9e3038fed7b4322cbf050fa56ffe77ee01e50a20
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoBump models to 2.4.1-SNAPSHOT 87/118287/1
Ram Krishna Verma [Tue, 23 Feb 2021 16:31:06 +0000 (11:31 -0500)]
Bump models to 2.4.1-SNAPSHOT

Issue-ID: POLICY-3088
Change-Id: I7f6cc0ab5299200315c78f6e6c79c79349d2608c
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoRelease models 2.4.0 version 46/118246/1
Ram Krishna Verma [Tue, 23 Feb 2021 14:43:29 +0000 (09:43 -0500)]
Release models 2.4.0 version

Issue-ID: POLICY-3088
Change-Id: I19c9020011dc4145894f726c1327670d409a7d78
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoPoint to non-snapshots in models 37/118237/1
Jim Hahn [Tue, 23 Feb 2021 13:19:13 +0000 (08:19 -0500)]
Point to non-snapshots in models

Issue-ID: POLICY-3088
Change-Id: I2789f3435514de5ef2be3f07f8419434bda89d6d
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoRefactor timestamp property in policy models to use Instant 17/118017/6
rameshiyer27 [Tue, 16 Feb 2021 16:25:18 +0000 (16:25 +0000)]
Refactor timestamp property in policy models to use Instant

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

3 years agoMerge "Remove more duplicate code from models"
Ram Krishna Verma [Thu, 18 Feb 2021 16:34:29 +0000 (16:34 +0000)]
Merge "Remove more duplicate code from models"

3 years agoMerge "Use new version of A&AI APIs"
Ram Krishna Verma [Thu, 18 Feb 2021 16:24:17 +0000 (16:24 +0000)]
Merge "Use new version of A&AI APIs"

3 years agoAdd time and date attributes to DecisionRequest 01/118001/1
Pamela Dragosh [Wed, 17 Feb 2021 21:43:43 +0000 (15:43 -0600)]
Add time and date attributes to DecisionRequest

These are optional for clients, but may be necessary in
configurations where the application enforcing a guard is
running in a different time zone. Allows some flexibility
instead of always using the time zone that the xacml pdp
is running in.

Issue-ID: POLICY-2810
Change-Id: I4057e5956e59803cc9505fae0ee4e2f67eaf0358
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
3 years agoRemove more duplicate code from models 94/117994/1
Jim Hahn [Wed, 17 Feb 2021 19:27:03 +0000 (14:27 -0500)]
Remove more duplicate code from models

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>
3 years agoUse new version of A&AI APIs 13/115213/3
Jim Hahn [Fri, 20 Nov 2020 21:44:12 +0000 (16:44 -0500)]
Use new version of A&AI APIs

Just changed the version numbers; the APIs appear to be the same
otherwise.
Also removed unused APIs from the A&AI simulator.

Issue-ID: POLICY-2788
Change-Id: I8c0ae11c1e42f487b34286d5dfd4ca536bb2c07b
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix sonars from removal of duplicate code 58/117958/3
Jim Hahn [Wed, 17 Feb 2021 15:10:39 +0000 (10:10 -0500)]
Fix sonars from removal of duplicate code

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>
3 years agoPAP Deployment API changes - change url to uri 15/117915/3
a.sreekumar [Tue, 16 Feb 2021 16:56:47 +0000 (16:56 +0000)]
PAP Deployment API changes - change url to uri

Change-Id: I6fa4b001a0c4573a34e1cefe0d32ca969ca5096e
Issue-ID: POLICY-2526
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
3 years agoMerge "Fix duplicate code in Jpa classes"
Pamela Dragosh [Tue, 16 Feb 2021 21:38:02 +0000 (21:38 +0000)]
Merge "Fix duplicate code in Jpa classes"

3 years agoAdd PfReference Timestamp key in policy-models-base to support timestamp 77/117777/5
rameshiyer27 [Thu, 11 Feb 2021 07:33:34 +0000 (07:33 +0000)]
Add PfReference Timestamp key in policy-models-base to support timestamp
property

Issue-ID: POLICY-3011
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I7a9db3a4fb0345e0979952e5c086523cc1d960f9

3 years agoMerge "Updating PAP deployment API to reflect actual status"
Liam Fallon [Tue, 16 Feb 2021 14:40:11 +0000 (14:40 +0000)]
Merge "Updating PAP deployment API to reflect actual status"

3 years agoFix duplicate code in Jpa classes 18/117818/3
Jim Hahn [Fri, 12 Feb 2021 18:55:31 +0000 (13:55 -0500)]
Fix duplicate code in Jpa classes

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>
3 years agoFix the Naming policy example 32/117832/2
sebdet [Mon, 15 Feb 2021 09:49:17 +0000 (10:49 +0100)]
Fix the Naming policy example

Change the attribute derived_from of the policy.data.increment-sequence attribute in the Naming policy example.
It should inherit from tosca.datatypes.Root

Issue-ID: POLICY-3067

Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I7a62b8c662b90a8481bb609d6a39e33ab9e7dada

3 years agoUpdating PAP deployment API to reflect actual status 06/117806/6
a.sreekumar [Fri, 12 Feb 2021 16:57:58 +0000 (16:57 +0000)]
Updating PAP deployment API to reflect actual status

Change-Id: I1fb0232d2f5fe37e95e87babb233a824212439ff
Issue-ID: POLICY-2526
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
3 years agoMerge "Use type adapters from common"
Ram Krishna Verma [Mon, 15 Feb 2021 17:39:48 +0000 (17:39 +0000)]
Merge "Use type adapters from common"

3 years agoMerge "More sonars in models"
Jim Hahn [Fri, 12 Feb 2021 22:33:23 +0000 (22:33 +0000)]
Merge "More sonars in models"

3 years agoUse type adapters from common 13/117813/1
Jim Hahn [Fri, 12 Feb 2021 15:11:53 +0000 (10:11 -0500)]
Use type adapters from common

Addressed the following sonar issue:
- remove duplicate code by using gson type adapters from common

Issue-ID: POLICY-2905
Change-Id: I7a832ce3e15387ed25061caec3e057f150828dad
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMore sonars in models 10/117810/1
Jim Hahn [Fri, 12 Feb 2021 14:26:24 +0000 (09:26 -0500)]
More sonars in models

Addressed the following issues:
- change visibility of constructor
- assert exception type

Issue-ID: POLICY-2905
Change-Id: Iaededb32802e4facbbc776ae51d05d2ef5c60b93
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Alter PDP_UPDATE message to store lists of delpoyed/undeployed policies"
Ram Krishna Verma [Fri, 12 Feb 2021 14:37:42 +0000 (14:37 +0000)]
Merge "Alter PDP_UPDATE message to store lists of delpoyed/undeployed policies"

3 years agoAlter PDP_UPDATE message to store lists of delpoyed/undeployed policies 56/117756/3
waynedunican [Thu, 11 Feb 2021 16:31:38 +0000 (16:31 +0000)]
Alter PDP_UPDATE message to store lists of delpoyed/undeployed policies

Update the PdpUpdate class to store lists of deployed and undeployed
policies while maintaining it's current original full list of policies.
This will ensure that the changes to send policy updates only in the
PDP_UPDATE message will not effect the PDPs they can support updated
policies.

Issue-ID: POLICY-2112
Change-Id: I1a6e9d426ed3a8a3b4469a8b72ef57441e50545e
Signed-off-by: waynedunican <wayne.dunican@est.tech>
3 years agoFix sonars from depeendency upgrade 66/117766/1
Jim Hahn [Thu, 11 Feb 2021 22:06:38 +0000 (17:06 -0500)]
Fix sonars from depeendency upgrade

The dependency upgrades in policy-parent caused some new sonars.  In
particular, initMocks() has been deprecated - replaced with calls to the
Mockito Runner, in most cases.  Changed to openMocks() in one case and
removed unnecessary stubbings.

Issue-ID: POLICY-2905
Change-Id: I9aa098aa7aaebba09f6dcea4cac69ac1e5fbd4d6
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMore sonars in models 20/117720/5
Jim Hahn [Wed, 10 Feb 2021 21:17:10 +0000 (16:17 -0500)]
More sonars in models

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>
3 years agoSet target-database property 09/117609/1
Jim Hahn [Fri, 5 Feb 2021 16:03:41 +0000 (11:03 -0500)]
Set target-database property

The new version of eclipselink doesn't recognize mariaDB by default.
Added an optional property, databaseType, to the DB parameter class,
which defaults to "MySQL" if not set.  ("MySQL" is what web discussions
indicated should be used for mariaDB.)

Issue-ID: POLICY-3005
Change-Id: I7af9b65a53e0090944af6ce40d5cffa13a4123d7
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Make filters on TOSCA entities generic"
Jim Hahn [Mon, 8 Feb 2021 18:31:06 +0000 (18:31 +0000)]
Merge "Make filters on TOSCA entities generic"

3 years agoMake filters on TOSCA entities generic 73/117573/1
liamfallon [Sun, 7 Feb 2021 14:51:45 +0000 (14:51 +0000)]
Make filters on TOSCA entities generic

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>
3 years agoGive better messages than NPE for missing data 61/117561/2
Jim Hahn [Fri, 5 Feb 2021 16:13:31 +0000 (11:13 -0500)]
Give better messages than NPE for missing data

When data is not available to actor operations, an NPE is generally
thrown.  Modified the code to provide more info about what is missing
than simply NPE.

Issue-ID: POLICY-2913
Change-Id: I37b6eadd966e0693508a6d552b7db4edf5410018
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Upgrade io.grpc library in CDS actor"
Ajith Sreekumar [Fri, 29 Jan 2021 14:36:21 +0000 (14:36 +0000)]
Merge "Upgrade io.grpc library in CDS actor"

3 years agoUpgrade io.grpc library in CDS actor 70/117170/3
Ram Krishna Verma [Wed, 27 Jan 2021 21:31:45 +0000 (16:31 -0500)]
Upgrade io.grpc library in CDS actor

Upgrading to latest version of io.grpc 1.35.0 to fix security issues. The methods named loadBalancerFactory and nameResolverFactory have been removed in the latest version. After going through the grpc-java codebase found that the one's we were using to initialize those factories are made default. Confirmed my understanding by posting a query on grpc-java github repo.

Issue-ID: POLICY-2936
Change-Id: I238700ac3f384ff8e5fdef6c3f2ccfb54bff7005
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoAdd copy constructors to concepts 79/117179/1
liamfallon [Thu, 28 Jan 2021 10:42:12 +0000 (10:42 +0000)]
Add copy constructors to concepts

Copy constructors for ToscaServiceTemplate and ToscaTopologyTemplate.

Issue-ID: POLICY-2971
Change-Id: Idb4abf8bce40593e0bf18614b8c647688dd5748d
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoMerge "Remove "Jpa" from table name"
Ram Krishna Verma [Wed, 20 Jan 2021 19:05:01 +0000 (19:05 +0000)]
Merge "Remove "Jpa" from table name"

3 years agoRemove "Jpa" from table name 90/116990/1
Jim Hahn [Tue, 19 Jan 2021 22:24:40 +0000 (17:24 -0500)]
Remove "Jpa" from table name

The DB table names of the various JpaXxx classes do not include the
"Jpa" prefix.  Removed it from the new Jpa class.

Issue-ID: POLICY-2648
Change-Id: I7f56502d75db05631749780138e989009eb93c83
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Convert Model Exception to Runtime Exception"
Ram Krishna Verma [Tue, 19 Jan 2021 22:23:10 +0000 (22:23 +0000)]
Merge "Convert Model Exception to Runtime Exception"

3 years agoMerge "Allow providers other than PolicyModelsProvider"
Ram Krishna Verma [Tue, 19 Jan 2021 22:21:53 +0000 (22:21 +0000)]
Merge "Allow providers other than PolicyModelsProvider"

3 years agoAllow providers other than PolicyModelsProvider 49/116949/2
liamfallon [Mon, 18 Jan 2021 11:34:12 +0000 (11:34 +0000)]
Allow providers other than PolicyModelsProvider

This change separates the database initiation and close functions of the
DatabasePolicyModelsProviderImpl class into an abstract class that does
the database DAO initiation and closing, and a domain specific part,
that does the manipulation of the policy models in the database.

This means that other providers, that wish to manipulate other objects
in the database, can specialize the AbstractModelsProvider class and use
its common DAO initiation and clsoing functionality, but can have their
own domain specific code.

The abstract class also now supports the Closeable interface.

Note that the exiting JUnit tests provide 100% coverage on
AbstractModelsProvider.

Issue-ID: POLICY-2971
Change-Id: Ibe59c02ab127ddbd9355d892b94a5d315507a8e6
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoConvert Model Exception to Runtime Exception 47/116947/3
liamfallon [Mon, 18 Jan 2021 11:17:28 +0000 (11:17 +0000)]
Convert Model Exception to Runtime Exception

Sometimes the exception thrown by the database providers has to be
converted to a runtime exception, especiall if the database provider is
running in a thread (called by the rum() method that does not return
exceptions). It is convenient to have a constructor on the
PfModelRuntimeException class that takes a PfModelException class as its
argument, thus creating the runtime exception.

Also the mapMap method in pfUtils is updated to allow the key of the map
to be templated. By doing this, the utility can be used for maps that
are keyed with types other than String (such as UUID).

Issue-ID: POLICY-2971
Change-Id: Ib0b3678de531fd383753a1cd0ce47a06f4079ec0
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoMerge "Add PfKey translation to ToscaConceptIdentifier"
Pamela Dragosh [Tue, 19 Jan 2021 13:18:06 +0000 (13:18 +0000)]
Merge "Add PfKey translation to ToscaConceptIdentifier"

3 years agoCreate ToscaConceptIdentifier from ToscaEntityKey 43/116943/1
liamfallon [Mon, 18 Jan 2021 09:25:34 +0000 (09:25 +0000)]
Create ToscaConceptIdentifier from ToscaEntityKey

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>
3 years agoAdd PfKey translation to ToscaConceptIdentifier 30/116930/1
liamfallon [Sat, 16 Jan 2021 09:11:48 +0000 (09:11 +0000)]
Add PfKey translation to ToscaConceptIdentifier

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>
3 years agoMerge "Do not log filter to error log"
Liam Fallon [Fri, 15 Jan 2021 18:14:08 +0000 (18:14 +0000)]
Merge "Do not log filter to error log"

3 years agoMerge "Add copy constructor to ToscaNodeTemplate"
Jim Hahn [Fri, 15 Jan 2021 14:58:27 +0000 (14:58 +0000)]
Merge "Add copy constructor to ToscaNodeTemplate"

3 years agoMerge "Rename keywords used as column names in API and PAP JPA"
Jim Hahn [Fri, 15 Jan 2021 14:38:15 +0000 (14:38 +0000)]
Merge "Rename keywords used as column names in API and PAP JPA"

3 years agoDo not log filter to error log 07/116907/1
Jim Hahn [Fri, 15 Jan 2021 12:33:45 +0000 (07:33 -0500)]
Do not log filter to error log

The DAO code was logging the query filter to the error log.  Modified to
log it to the debug log.

Issue-ID: POLICY-2648
Change-Id: I372c77cb4fa1e5c4cb645d82b26ab0bba4a00826
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAdd copy constructor to ToscaNodeTemplate 89/116889/1
liamfallon [Wed, 13 Jan 2021 10:04:43 +0000 (10:04 +0000)]
Add copy constructor to ToscaNodeTemplate

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>
3 years agoRename keywords used as column names in API and PAP JPA 72/116872/4
gregory.hayes [Wed, 13 Jan 2021 20:35:46 +0000 (20:35 +0000)]
Rename keywords used as column names in API and PAP JPA

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

3 years agoRemove extra logging from cds actor 07/116807/3
Ram Krishna Verma [Wed, 13 Jan 2021 20:24:35 +0000 (15:24 -0500)]
Remove extra logging from cds actor

Issue-ID: POLICY-2885
Change-Id: I5b7cb219f55a25153d50260d62292b92cfe39323
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoAdd more methods to query deployment status 60/116760/2
Jim Hahn [Tue, 12 Jan 2021 16:52:29 +0000 (11:52 -0500)]
Add more methods to query deployment status

Issue-ID: POLICY-2648
Change-Id: I398fa1332eb5a862dabd97ed409ef6413bb0c202
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAdd PDP-Policy deployment table to DB 90/116690/3
Jim Hahn [Thu, 7 Jan 2021 14:07:05 +0000 (09:07 -0500)]
Add PDP-Policy deployment table to DB

Added a table to record the PDP policy deployment status, which is
required for making PAP stateless.

Issue-ID: POLICY-2648
Change-Id: Ibe40ce00aca7a600051edcac49e55651c1c0164f
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse annotations on parameterized types 79/116679/1
Jim Hahn [Tue, 5 Jan 2021 16:11:26 +0000 (11:11 -0500)]
Use annotations on parameterized types

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>
3 years agoChanged identifiers to concept identifiers 66/116566/5
liamfallon [Mon, 4 Jan 2021 12:15:18 +0000 (12:15 +0000)]
Changed identifiers to concept identifiers

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>
3 years agoMerge "Add Service Template TOSCA handling"
Liam Fallon [Wed, 23 Dec 2020 18:28:33 +0000 (18:28 +0000)]
Merge "Add Service Template TOSCA handling"

3 years agoAdd Service Template TOSCA handling 48/116448/3
liamfallon [Thu, 17 Dec 2020 12:10:21 +0000 (12:10 +0000)]
Add Service Template TOSCA handling

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>
3 years agoAllow wild-card in supportedPolicyTypes 07/116507/1
Jim Hahn [Tue, 22 Dec 2020 15:10:40 +0000 (10:10 -0500)]
Allow wild-card in supportedPolicyTypes

Changes to the validation code broke the validation check for the
supportedPolicyTypes field in PdpSubGroup - it no longer supports wild-
cards in the name.  Modified the validation annotation in
PfSearchableKey to allow wild-card names.

Issue-ID: POLICY-2648
Change-Id: Ibd2853025ce72ed88697dd9a7d6d5eed2b28475e
Signed-off-by: Jim Hahn <jrh3@att.com>