aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-08-18Add topic checkerJim Hahn2-1/+380
Added a method to check the readiness of a bidirectional topic. Issue-ID: POLICY-3531 Change-Id: I2fefae7ba1ea5ed9ed33140717d05828e6dec94d Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-18Integrating prometheus with Policy componentsa.sreekumar13-41/+292
With this change, all PF components can export prometheus metrics by default. The prometheus metrics servlet will be running on /metrics servletPath.. If the metrics shouldn't be exported, just add a flag "promethus": false in the restServerParameters of default configuration file. This brings up prometheus servlet on /metrics servletPath. Also as part of standard servlet support, "servletUriPath" and "servletClass" are 2 other fields added to RestServerParameters which can be used to add standard servlets. This can be revisited later if needed. Basically, any servlet can be added by passing these fields, for example, to add prometheus metrics servlet on /test/metrics, add the below to restServerParameters: "servletUriPath": "/test/metrics", "servletClass": "io.prometheus.client.exporter.MetricsServlet" In addition, we can later go to individual components and add more metrics, say for e.g., deployedPoliciesCounter/undeployedPoliciesCounter etc on PAP, executedEvents/failedEvents etc on PDP and so on. This will look something like below, for e.g. in policy-pap component: io.prometheus.client.Counter counter = Counter.build() .name("policies_deployed_total") .help("Number of policies deployed.").register() Whenever a policy is deployed, just call counter.inc() Usage of code like above in the individual component will expose such data as well as part of the exposed metrics. Change-Id: Id667f27b15c012398421ba657b5324cc1d82cf1f Issue-ID: POLICY-3524 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca> Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-08-04refactor slf4j logger to common utilTaka Cho4-4/+3
avoid EELF lib dependency, was suggested to move to common util instead Issue-ID: POLICY-3087 Change-Id: I79a2f5ba32fd3fc496ef3f72a02f4696b766f9c7 Signed-off-by: Taka Cho <takamune.cho@att.com>
2021-08-02refactor slf4j Marker to common repoTaka Cho3-0/+286
slf4j Marker logger is using in drools-pdp and clamp. was suggested to move to common repo to reduce duplicated codes. And possibly other repo would be used also. Issue-ID: POLICY-3087 Change-Id: If14b89c18e28f517f83a2b9a8dcce201333a919e Signed-off-by: Taka Cho <takamune.cho@att.com>
2021-07-13Update Pam's email INFO.yamlDragosh, Pamela (pd1248)1-1/+1
Issue-ID: POLICY-3484 Change-Id: I57aa0b25c104acaa5529f95ee2cbf4e5c73195ab Signed-off-by: Dragosh, Pamela (pd1248) <pd1248@att.com>
2021-07-02Merge "Use UUID for topic consumer instance"Jim Hahn2-11/+36
2021-07-02Wait after fetch exception on topicJim Hahn2-10/+52
When dmaap is inaccessible for some reason, the topic source frequently enters a fast fail loop, rapidly filling up the log. Modified the code to wait the configured fetchTimeout when this occurs. With any luck, this will also fix the sporadic kubernetes crash-fail loops sometimes seen with the xacml-pdp pod. Modified to limit how long it will sleep after a failure, regardless of the fetchTimeout that was specified. Issue-ID: POLICY-3457 Change-Id: I88e360fb1d31197b46f4959e5ea0ea2d741ad25c Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-01Use UUID for topic consumer instanceJim Hahn2-11/+36
Modified the code so that if the consumer group is defined, but the consumer instance is not, then policy-endpoints will generate a UUID for the consumer instance. Made the logic a little more straight-forward in response to a review comment. Issue-ID: POLICY-3405 Change-Id: If74440bdb01525bc463a28e5b8a9a2eca89a855a Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-29Address sonars in commonJim Hahn4-58/+74
Fixed: - use "var" - duplicate code block Issue-ID: POLICY-3284 Change-Id: I8cd7f2588353a2e7702c90d37d7b9f972634dca9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-29Merge "Add name generator for PAP and PDPs"Ajith Sreekumar2-1/+23
2021-06-28Merge "Update policy-common for checkstyle 8.43"Liam Fallon1-1/+2
2021-06-28Update policy-common for checkstyle 8.43liamfallon1-1/+2
Issue-ID: POLICY-3206 Change-Id: I6d14a62e6619e2162e68846853feb36b95274866 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-06-25Add name generator for PAP and PDPsJim Hahn2-1/+23
Added a method that PAPs and PDPs can use to generate a unique name or identifier to be used in PAP-PDP messages. Issue-ID: POLICY-3410 Change-Id: I22b075b123f79ba05e0884f743296c4bc64842b9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-22Move Validators and RestClientParameters in policy-commonFrancescoFioraEst4-0/+159
Issue-ID: POLICY-3402 Change-Id: I7479027e3ea1e960266264c2d13cd69e2103710b Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
2021-06-18Merge "Fix new checkstyle issues in policy-common"Jim Hahn4-6/+5
2021-06-18Merge "Use lombok in policy-endpoints"Jim Hahn24-399/+104
2021-06-18Fix new checkstyle issues in policy-commonJim Hahn4-6/+5
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3284 Change-Id: I2a8bf2b460fda7972ce573f14df5af52d46c9993 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-18Use lombok in policy-common utils-testJim Hahn6-46/+19
Issue-ID: POLICY-3394 Change-Id: I85504848afc268be7419654dc95ed555d870272c Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-18Merge "Use lombok in policy-common utils"Jim Hahn22-224/+109
2021-06-17Merge "Use lombok annotations in IM and ONAP logging"Jim Hahn20-467/+129
2021-06-17Use lombok in policy-common utilsJim Hahn22-224/+109
Issue-ID: POLICY-3394 Change-Id: I42a18c115c3ca7110f37fc0ae8aeea3f2bbffb37 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-17Use lombok in policy-endpointsJim Hahn24-399/+104
Issue-ID: POLICY-3394 Change-Id: I8dfb0814d5cc544b2c334dc11a3e69ef407f163f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-17Use lombok annotations in IM and ONAP loggingJim Hahn20-467/+129
Issue-ID: POLICY-3394 Change-Id: I25db6b4b13bad8754889eaedb93197cae7d27c4d Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-16Use lombok in common paramsJim Hahn14-240/+80
Also condensed some Map calls. Issue-ID: POLICY-3394 Change-Id: I850fcad5a72d92271da76b0731195e8b93dd4089 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-01Validator should report serialized field nameJim Hahn3-4/+15
The validator reports field names as they appear in the class rather than as they appear on the wire, which may be confusing to the client. Modified the code to use the serialized name instead. Note: this will require tweaks to some junits in some of the other policy repos. Issue-ID: POLICY-3333 Change-Id: I867dafdc87cd78dec3d3c6fe0236a744284314a3 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-27Fix sonar issues in commonJim Hahn1-1/+1
Fixed sonar issue: - class should not be abstract Issue-ID: POLICY-3284 Change-Id: I9c4aa149b7321cbcaff8dce5e2999315a06f19b0 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-24Merge "Enhance toString methods in factory classes"Jim Hahn28-236/+89
2021-05-21Fix sonar duplicate code issueJim Hahn2-50/+109
Issue-ID: POLICY-3284 Change-Id: I78c3a8ac92e18e2b0088eb07e27a4e97866d6182 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-21Enhance toString methods in factory classesJim Hahn28-236/+89
The factory classes in policy-endpoints have toString() methods that return "[]" for their list contents. Updated the code to provide a list of the keys rather than just an empty list. Also replaced some toString() methods with lombok. Also replace StringBuilder with concatenation in some cases. Issue-ID: POLICY-3298 Change-Id: I64fca21a4b009f7e09fcc482b5d156753fb7e680 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-07Change java.util.regex to re2jJim Hahn20-20/+28
Sonar complains about java.util.regex. Thought I used re2j when creating all of the patterns, but apparently not. Fixed that oversight. Issue-ID: POLICY-3284 Change-Id: Idbec112ab0d4c3b477ce357f8a556d95e4dea083 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Fix sonars in policy-commonJim Hahn83-452/+496
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-29Remove GroupValidationResultJim Hahn46-2552/+278
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. Added Size annotation, used to verify minimum lengths of maps and collections. Added ClassName annotation, used to verify that a property contains the name of a class that is actually in the classpath. Added another addResult() method to make it easier when replacing calls to GroupValidationResult setResult() method with BeanValidationResult. Issue-ID: POLICY-2059 Change-Id: Id4da24886908723006624c5d53edeb034102299d Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-13Merge "Revert "Modify StandardCoder to handle empty source""Pamela Dragosh2-55/+7
2021-04-13Revert "Modify StandardCoder to handle empty source"Jim Hahn2-55/+7
This reverts commit 04623fef95f2b164d79ad48de2ef3708d02eda80. Reason for revert: prefer consistency with gson Issue-ID: POLICY-3172 Change-Id: Ic2501abcc68ec1186142a7e520e7985c43fd3315 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-13Add command line handleradheli.tavares8-2/+523
Added a Handler for command line classes to share common strucutures. Issue-ID: POLICY-3128 Change-Id: I662911c467faf5c39b8db018bb1a564fba7587a6 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-04-07Modify StandardCoder to handle empty sourceJim Hahn2-7/+55
Currently, if the source string or source file is empty, the StandardCoder just returns null. Modified it to throw an exception in those cases. However, if the string reference is null, it will still return null. Issue-ID: POLICY-3172 Change-Id: Ie7d5e1b0328a24d94a75af8d18a341faebbe5d5f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-25Use self-signed-cert property for HTTP clientsJim Hahn1-5/+4
Currently, the HttpClient code sets self-signed-certs to true whenever https is specified. This is insecure. Modified the code to set the value based on the property, defaulting to false. Issue-ID: POLICY-3145 Change-Id: Ie88cf2411ae44a7c53bc8943f615a74c5b87d1aa Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-18Add utility to generate keystore for testingJim Hahn3-0/+291
Added a class that will generate a keystore containing a self-signed certificate. Issue-ID: POLICY-3147 Change-Id: I25e7307c2e73dbacae24c8fce616bf2ada93df9f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-12Remove more unnecessary plugins from commonJim Hahn1-42/+1
Issue-ID: POLICY-3126 Change-Id: I2f39e14c9cea0ec58709e24995aab536f2df7990 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-12Address plugin-not-found issuesJim Hahn8-368/+6
Removed references to archetype-packaging and lifecycle-mapping, where unnecessary due to pom inheritance. Issue-ID: POLICY-3126 Change-Id: Ie31edcb7ae31e1bb495904fce2c8ed56d9bf10f5 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-10Bump version to 1.9.0 in commonJim Hahn11-13/+13
Issue-ID: POLICY-3105 Change-Id: I1fd654fef96a1e41f150ea13baf39acc882f6bb2 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-24Update info.yaml in commonRam Krishna Verma1-2/+2
Issue-ID: POLICY-3028 Change-Id: Id67f1f5205fe0522b8f909015a7cf503d82a585c Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2021-02-23Bump version to 1.8.1-SNAPSHOT in commonJim Hahn11-11/+11
Issue-ID: POLICY-3088 Change-Id: I1cc2d1d26c337d67b0ecadd852e43b603902415e Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-22Release artifacts 1.8.0 of common8.0.0-ONAPJim Hahn1-0/+4
Issue-ID: POLICY-3088 Change-Id: I2419754fc055bb350ebb9299a69c5e2d81fac173 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-22Point to non-snapshots in commonJim Hahn1-1/+1
Issue-ID: POLICY-3088 Change-Id: I3b3afdc15fb006c6b5fc6b223aa4d3ff6f112f31 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-18Remove duplicate code from type adaptersJim Hahn11-263/+195
Extracted a common superclass, StringTypeAdapter, out of the gson type adapter classes. Issue-ID: POLICY-2914 Change-Id: I4bbd2a6e8372e7f42c4952ba9ff03eed97473fb2 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-18Add more java.time adaptersPamela Dragosh9-2/+560
The time extensions require these adapters for anyone using our gson adapter to serialize/deserialize the DecisionRequest. Issue-ID: POLICY-2810 Change-Id: I64a7e4a5a256c77bd67dab867664e41b61cd0050 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2021-02-12Make gson type adapters more genericJim Hahn2-10/+24
Enhanced ZonedDateTime adapter so a date format string can be provided. Simplified InstantAsMillis adapter. Issue-ID: POLICY-2905 Change-Id: Ic4ddba19391b165d6a7528ce18c22541d12324c7 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-11Fix sonars from depeendency upgradeJim Hahn2-7/+7
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner. Issue-ID: POLICY-2914 Change-Id: Iaf10f676c380adb9785e836cb15792596b378e4e Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-10More sonar issues in commonJim Hahn11-68/+56
Addressed the issues: - use of eq() in verify() - remove @NamedQueries - use computeIfAbsent() Issue-ID: POLICY-2914 Change-Id: I265bc98f0f326e7b4ce86c25e68fc4859bd7fb02 Signed-off-by: Jim Hahn <jrh3@att.com>