aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src
AgeCommit message (Collapse)AuthorFilesLines
8 daysAdd schema to persist notification subscription informationrajesh.kumar7-0/+691
Add required schema to persist notification subscription information. It should contain - Schema yang file - New Dataspace, Anchors or any other database entity - Refactore duplicate code in NCMP Issue-ID:CPS-2427 Change-Id: I56c34400dc73c71b936a51260efd300924ababdc Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>
2024-12-05Moved common classes under the api package under apileventecsanyi80-173/+178
- moved common classes under the api package - moved Spec files Issue-ID: CPS-2512 Change-Id: I88046280ce359ce8cc488ad37d4e6f85406b0dbf Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
2024-12-03Add tests of attribute-axis featuredanielhanrahan3-6/+36
Following TDD, functional acceptance tests are added for attribute-axis feature. This covers xpaths such as '//books/@title' - Add stub to CpsQueryService throwing UnsupportedOperationException - Add tests showing expected behaviour (tests currently ignored) - Implementation will be provided in following commmit for CPS-2416 Issue-ID: CPS-2416 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I71817e66b28dfc21e7b75243fd0135f3cceddb8e
2024-11-29Merge "XML content support on Replace list content"Priyank Maheshwari3-8/+39
2024-11-28De-Registration without Orphaned Module CheckToineSiebelink5-8/+103
- Testware updates to measure time spent for de-registration - Removed orphan check from module delete methods - Using @scheduled to run Db Cleaner method once (see https://lf-onap.atlassian.net/wiki/spaces/DW/pages/52494359/CPS-2478+Module+Sync+Inefficiencies#De-Registration:-Test-Measurements-With-and-Without-Orphanage-removal for reasoning) - Updated integration tests to call orphan check where need (after schema set deletion) Issue-ID: CPS-2478 Change-Id: I513af9d8bb88486a242284b58e0363a527346dd4 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2024-11-28XML content support on Replace list contentRudrangi Anupriya3-8/+39
Here to bring Support for XML Response Entity in Replace List content - Add ContentTypeInheadr in cpsData.yml to support application/xml - Add contentTypeInHeader parameter to accept xml in DataRestController.java - Modify the code return xml Data - written testcase for above changes made Issue-ID: CPS-2411 Change-Id: Ibb7ffb66ccdd03703266123c6d5c2eade0e7cb4a Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-11-19Merge "Test to highlight ModuleSetTag Inefficiencies"Sourabh Sourabh1-2/+2
2024-11-18Test to highlight ModuleSetTag InefficienciesToineSiebelink1-2/+2
- Add (micrometer) instrumentation to expose inefficiencies - Add test config for micrometer - Add setup methods in base to create many cm handles - Set module sync parallelism to 2 for testing - Add clean up methods for hazelcast related tests - added test to show inefficiencies - POC 1 use hazelcast set to prevent multiple threads working on same ModuleSetTag - POC 2 'cache' module set tags per thread to prevent DB looks ups - Main inefficiency left: create schemaset for EACH cm Handled even if same tag. No easy PoC... Change-Id: Idf46b44c475a24727dd7084bb613459f4c29be55 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2024-11-17XML content support for only cps Query v2Rudrangi Anupriya2-38/+42
Here to bring Support for XML Response Entity in query data nodes - Add ContentTypeInheadr in cpsQueryV2.yml to support application/xml - Add contentTypeInHeader parameter to accept xml in QueryRestController.java - Implement logic to convert data to xml - written testcase for above changes made Issue-ID: CPS-2359 Change-Id: Ieb7eeb66ccbb03703626132c6d5c2eade0e7cb4b Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-11-07Merge "Removing ONAP O-Parent as parent from CPS"Toine Siebelink1-2/+2
2024-11-05Removing ONAP O-Parent as parent from CPSsourabh_sourabh1-2/+2
- Fixed checkstyle and license validation. - Updated checkstyle configuration (`onap-java-style.xml` and `check-license.xml`) to ensure compatibility with Maven Checkstyle Plugin version 3.3.1 - Removed obsolete properties causing build failures. - Improved code style rules to meet ONAP Java guidelines. - Vulnerabilities scan are now configured on parent pom.xml - Fixed all code style. Issue-ID: CPS-2470 Change-Id: I1e72af604415aa7587cbe1dff471ed0323e29aa3 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-11-05XML content support on get a nodeRudrangi Anupriya4-1/+190
Here to bring Support for XML Response Entity In GET A NODE - Made changes in components.yml to support contentType as application/xml - Add ContentTypeInheadr in cpsDataV2.yml to support application/xml - Add contentTypeInHeader parameter to accept xml in DataRestController.java - Implemented Logic to convert DataMaps To XML Data - written testcase for above changes made Issue-ID: CPS-2280 Change-Id: Ibe7ffb66ccbb03703626132c6d5c2eade0e7ab4b Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-10-24Refactor: Improve code quality and compliance with SonarQube standardssourabh_sourabh1-13/+12
- Consolidated multiple `if` statements to enhance readability and maintainability. - Replaced traditional `instanceof` checks followed by casting with the new pattern matching syntax for improved type safety and clarity. - Removed unnecessary casts and streamlined code in `addYangLeafList` and `addDataNodeFromNormalizedNode` methods. Issue-ID: CPS-1957 Change-Id: I46696dc184b6b3c3d0fe3a6bd12267a4e0d76193 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-10-09Implementation of Data validation feature in Create a Node APIArpit Singh11-32/+236
Added support to validate JSON/XML data without the need of persisting it in the databse. - added "dryRunInQuery" flag as a new query parameter - added new method as part of CpsDataService layer to perform data validation - added new method in yang parser "validateData" to validate data without persisting it Issue-ID: CPS-2361 Change-Id: I43dd33cc6120576d0fac606d5c4b0168d107311d Signed-off-by: Arpit Singh <as00745003@techmahindra.com>
2024-10-08Merge "Policy Executor: handle errors, part 2 (fighting between IntelliJ and ↵Sourabh Sourabh1-0/+2
Checkstyle best practices)"
2024-10-03[BUG] Fix memory leak related to using arrays in Hibernatedanielhanrahan1-12/+10
The use of arrays like String[] instead of Collection<String> in JpaRepository methods is causing a memory leak, most likely due to a bug in the hypersistence-utils dependency which provides the feature. Note code using arrays in JDBC (via jdbcTemplate) is not affected. This patch removes most uses of arrays in Java, except one needed for FragmentPrefetchRepository using JDBC setArray(), which is safe. Issue-ID: CPS-2430 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I94f8c3d4c8c32ebe0978c08d3226a196a95bf3b9
2024-10-03Policy Executor: handle errors, part 2ToineSiebelink1-0/+2
(fighting between IntelliJ and Checkstyle best practices) - non-2xx responses are processed using web client exceptions - handle unknown host exception - upgraded spotbugs (checkstyle and related mvn plugin) - fixed some small spotbugs due to upgrade - added commented instructions in docker compose to enable debugging - added some environment variables for policy executor configuration - extract out Sleeper in stub service to achieve 100% coverage - added cause to Policy Executor exceptions where applicable - ignored (new) spotbug rule about catch NPE because of issue in 3pp - ignored (new) spotbug rule about \n in string due to multiline string block Issue-ID: CPS-2412 Change-Id: I6835a73320c436cbeea12cc7a06f15899eec7bf1 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2024-10-03Update JIRA and Wiki links host name from wiki.onap.org to lf-onap.atlassian.netsourabh_sourabh5-7/+7
Issue-ID: CPS-2432 Change-Id: I53f380a4fe0968d1ec9f1393651c7c43f03d0d95 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-09-24Remove Hazelcast cache for prefix resolver (CPS-2417 #2)danielhanrahan9-519/+22
This patch removes the AnchorDataCache from CPS, which is used for prefix resolution in get/query operations. As such, Hazelcast is no longer a dependency of CPS, only NCMP. - Changed PrefixResolver to be more efficient. - Removed AnchorDataCache and associated classes. - Moved HazelcastCacheConfig to NCMP. - Removed Hazelcast dependency from cps-service/pom.xml This shows good performance improvements in some APIs such as v2 GET which is nearly 2x faster (also 5x faster including base patch). Issue-ID: CPS-2417 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I24768469f24e90b70f7a6187faa4f5b3d75777d2
2024-09-24Reduce anchor lookups related to PrefixResolver (CPS-2417 #1)danielhanrahan3-21/+7
Instead of looking up same Anchor many times inside a for-loop, do it once outside the loop. This greatly improves performance in some cases, such as v2 GET API: - /cps/api/v2/dataspaces/{dataspace}/anchors/{anchor}/node Testing shows 3x faster response time. Issue-ID: CPS-2417 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I80d97d8cc24372eed70626ed840cad985cbe0a4b
2024-09-17Refactored cps-ri package structureleventecsanyi15-26/+24
- fixed import order and moved package structure Issue-ID: CPS-2293 Change-Id: Ie2f9f057f261577054530feee7480850ba4b41e1 Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
2024-09-10Renaming Delta Operations as per RFC 9144Arpit Singh5-20/+20
RFC 9144 recommends naming convention for operations that can be performed on any datastore. The recommended names are: - create - remove - replace Whereas in CPS Delta feature these operaitions were named: - add - remove - update So, "add" and "update" operations have been changed to "create" and "replace" respectively. Issue-ID: CPS-2393 Change-Id: Ie39f5f8ccc91e96cf484ca7fbc833a6be8758054 Signed-off-by: Arpit Singh <as00745003@techmahindra.com>
2024-08-13CPS-NCMP: Slow cmHandle registration when we use moduleSetTag, alternateId ↵sourabh_sourabh4-0/+77
and dataProducerIdentifier - Created a new repo. service for fragment table that executes a native sql query to find first ready cm handle id based on moduleset tag and then returns list of module references. - Exposed a new interface into module service that is used by module sync service to get list of midule refs by module set tag. Issue-ID: CPS-2353 Change-Id: I438dbd1ed37c1ff4e15f792e93a095aa604120bc Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-08-01XML content support on add list elementRudrangi Anupriya3-14/+22
Issue-ID: CPS-2287 Change-Id: Ibb7ffb66ccbb03703266132c6d5c2eade0e7cb4a Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-07-24Update response message for data validation failureArpit Singh2-9/+5
- Make the response message more informative and cleaner in case of data validation failure. - Updated message body will not contain the entire jsonData as part of response sent back to the user Issue-ID: CPS-2306 Change-Id: I28aab1450779af98ccdd11701e78bdfcdbc18cf0 Signed-off-by: Arpit Singh <as00745003@techmahindra.com>
2024-07-18Integration test to validate DMI service URLsourabh_sourabh1-1/+1
- New groovy test is written to validate if dmi service url is encoded correctly. Issue-ID: CPS-2317 Change-Id: I048bf37dd3ba4f37df7dace927f55bf8dd899922 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-07-16XML content support on replace a node with descendantsRudrangi Anupriya3-24/+60
Issue-ID: CPS-2282 Change-Id: Ibb7ffb65ccbb03703266712c6d5c2eade0e7ab4b Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-06-25Fix incorrect use of getAnchors(dataspace, schemasets)danielhanrahan7-62/+112
There is an issue in a method deleteDataNodes(dataspace, anchors) where it doesn't send data update events. This is because it fetches anchors using a method getAnchors(dataspace, schemaSetNames), when it needs to fetch anchors by name: getAnchors(dataspace, anchorNames) Changes: - Rename getAnchors method using schemasets to getAnchorsBySchemaSetNames - Add a method getAnchors(dataspace, anchorNames) - Update test of deleteDataNodes method using getAnchors so it checks that data update events are sent Issue-ID: CPS-2254 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I55fe853f0a9278a66a5724bf4cf2723b0e2fbc8b
2024-06-19Addressed an adaptability issuesourabh_sourabh1-5/+5
- Defined a constant instead of duplicating literal "No data nodes 4 times. Issue-ID: CPS-478 Change-Id: I2b980a228217e85424342d4c2b9e97c5cfa618d1 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-06-06CPS Delta API 2: Delta between anchor and payloadArpit Singh7-20/+299
- Second API to get Delta between an anchor and JSON payload - added new API getDeltaByDataspaceAnchorAndPayload - added controller and service layer methods getDeltaByDataspaceAnchorAndPayload - Core Delta algorithm remains same as the first API. getDeltaByDataspaceAnchorAndPayload will call getDeltaBetweenDataNodes Issue-ID: CPS-1836 Signed-off-by: Arpit Singh <as00745003@techmahindra.com> Change-Id: Id74cd930ce48e5cb414aa62c5381b79675788a37
2024-06-05XML content support on update node leavesRudrangi Anupriya3-19/+22
Issue-ID: CPS-2071 Change-Id: Ibe7f59fbfcbb03703626132c6d5c2afde0e7ab4b Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2024-05-08Conditional cps change eventsmpriyank2-8/+24
- introduced a parameter to control the cps core change event notifications. we should be able to disable these notifications without affecting other notification flows. - fixed the LayeredArchitectureTest as we are accessing the Anchor model in the events package now. Issue-ID: CPS-2213 Change-Id: Id875925bc14de1cc6e8fa3193c0df470e09fe43f Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2024-05-03[BUG] Correctly parse observedTimestampmpriyank3-9/+20
- Using the DateTimeUtility to parse the passed OffsetDateTime and using it for conversion to string - Moving to actual src/main/java from test side as it is to be used in the prod code as well and only keeping the methods in use. - Added test to fix the coverage issue Issue-ID: CPS-2211 Change-Id: I2b4325bb77a6da7fd470986b1da293f455650375 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2024-04-30Add Notification support in cps corerajesh.kumar6-5/+344
Add notification support using cloud events Issue-ID:CPS-2068 Change-Id: I56c34400dc73c71b936a51260efd240223babacd Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>
2024-04-26Faster module searches (CPS-2190 #3)danielhanrahan3-6/+4
This greatly improves performance of module searches by eliminating unneeded SQL queries via Hibernate lazy fetching. Issue-ID: CPS-2190 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ie9e65017d0027366456f1741cc37b10679317b25
2024-03-19Configure Hazelcast to have 1 backup to reduce memorydanielhanrahan2-8/+5
Currently Hazelcast is configured to have 3 synchronous backups and 3 asynchronous backups. These are separate, meaning there will be 7 copies in the cluster (1 original + 3 sync + 3 async backups). Even if only 1 instance of CPS/NCMP is running, it will have 7 copies in memory. Given that CPS/NCMP is typically only deployed using 1 or 2 instances, the settings are changed to 1 synchronous backup (same as Hazelcast's default configuration). This change has been tested and shown to reduce heap usage by around 100MB during 20K CM-handle registration. Issue-ID: CPS-2146 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I4a5f6d83bc35e2c13cfb32002e38dc365da34c8e
2024-02-12Fix test failure by ordering leaf-listsdanielhanrahan1-4/+9
YANG specifies two ways that leaf-lists can be ordered: - ordered-by user: original order in JSON is preserved - ordered-by system (default): it is up to the system how to order For leaf-lists to preserve same order as the JSON, the Yang module must specify 'ordered-by user'. To ensure consistent behaviour even when system ordering is used, the leaf-list is sorted during parsing. - Add 'ordered-by user' to authors field in bookstore.yang - Sort leaf-list during parsing when using 'ordered-by system' - Add new tests to verify ordering Issue-ID: CPS-2057 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I6ab688ec2fa4a22182e853d1a8b26642f278c40a
2024-02-07Orphaned modules are removed from the DB before cmhandle removalsourabh_sourabh1-1/+1
- changed sequence of delete schema set by cascade to remove unused yang resource modules at last. Issue-ID: CPS-2031 Change-Id: Icefc075165231cc4b9b170e04a2d12af645529e9 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2024-02-01Add integration test for extending API: Get Module Definitionshalil.cakal1-1/+5
- Add new module: bookstore-types - Import the new module from stores module - Change integration testwares to comply with the new module - Add new integration test for retrieving module definition Issue-ID: CPS-1135 Change-Id: Ib51c998ceeab50d3fcea212ed55c8ab50ca09257 Signed-off-by: halil.cakal <halil.cakal@est.tech>
2024-02-01Extend API: Get Module Definitionshalil.cakal4-7/+50
- add query parameters: module-name and revision to OpenAPI - extend the controller method to hande the new parameters - add the new method stack to the service layer - extend the SQL query to support the new parameters - add unit and integration testwares Issue-ID: CPS-1135 Change-Id: I089ad2ad71effb58ac0ba809e9f441d6cdb59c4f Signed-off-by: halil.cakal <halil.cakal@est.tech>
2024-01-25CloudEvents support for cps-corempriyank2-0/+330
- Moving cloud events dependencies to the cps-service module instead of cps-ncmp-service - Testware has moved and new tests also introduced - EventsPublisher also moved Issue-ID: CPS-2040 Change-Id: Ibafb15e7e9efbdbe1e00e2b4f0da820bbcead004 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2024-01-19CPS 1824: Delta Between 2 Anchors release notesArpit Singh2-18/+17
Updated release notes for Delta Feature Issue-ID: CPS-1824 Signed-off-by: Arpit Singh <as00745003@techmahindra.com> Change-Id: I1c2403391e85aec6a9e34f0ff616c17b100bf6a9
2024-01-18Merge "CPS Delta API: Update action for delta service"Toine Siebelink4-42/+185
2024-01-17Clear instance based Schema Context Cache upon validation errorsToineSiebelink14-505/+628
- retry yang parser exceptions one time by clearing cache - split yangUtils into YangParserHelper (instance based) and YangUtils for non-parsering static methods - removed public methods only used from test. Refactored to use variation with (empty) parent path - removed use of optional for parentPath, easier to handle with just an empty string! - make methods no longer used in production code in YangUtils are private - udpate testware to use proper public methods instead of private methods of yang utils / parser (helper) Issue-ID:CPS-2000 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I0c7590a5e1495d047006e7136f1bd873be37f7b0
2024-01-16CPS Delta API: Update action for delta serviceArpit Singh4-42/+185
- Added code for Update action in Delta service - added method to get updated Leaf data: getUpdatedLeavesBetweenSourceAndTargetDataNode - added method to compare Leaf data common in source and target data node - added method to process leaves unique to target data node - added method to compare leaves: compareLeaves - added method to store updated data to a DeltaReport: addUpdatedLeavesToDeltaReport - Added corresponding testware Issue-ID: CPS-1824 Signed-off-by: Arpit Singh <as00745003@techmahindra.com> Change-Id: I3de07ea3227988784a0892f6a92c238ecf00a7fa
2024-01-09Remove inefficient saveListElementsBatch APIdanielhanrahan4-70/+7
CpsDataService::saveListElementsBatch method is not needed as saveListElements supports saving multiple list elements in a single operation. This both simplifies implementation and greatly improves performance when saving list elements, as the Yang parser need only run once for the whole batch. - Change InventoryPersistence to save CM-handles in batches of 100 using existing CpsDataService::saveListElements method. - Remove not needed CpsDataService::saveListElementBatch. Issue-ID: CPS-2019 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I8b74dda2917e094d064b42f2c0e4d57029b90395
2024-01-08Clean up cps temporal related notification codeJvD_Ericsson1-7/+0
- remove 'test' level folder - remove schemas but leave structure - remove 'data-updated' from test application.yaml - remove NOTIFICATION_DATASPACE_FILTER_PATTERNS from docker-compose Issue-ID: CPS-2005 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I3962d795c760de6ba5ff353e85894895437ad5e7
2023-12-18Remove the dependency-cycle between beansToineSiebelink13-182/+273
- Splitting admin service into AnchorService and DataspaceService (this resolves the cyclic dependency) - Improved Delete dataspace integration error tests (were depending on execution order, now independent) Issue-ID: CPS-871 Change-Id: I47efedb6eb4bd2900f72d689616b7b7b62df2938 Signed-off-by: halil.cakal <halil.cakal@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2023-12-18Remove Notification code for updated eventsmpriyank17-1149/+51
- removed existing code for sending notifications to topic cps.dataupdated events formerly used by cps-temporal - corresponding testware removed or updated - unnecessary to fetch anchor details for delete and replace operation removed which might gain minor performance boost - yaml configurations , documentation removal and update - Added missing test for AsyncConfig to comply with coverage check Issue-ID: CPS-2005 Change-Id: I1848f7f229cb713fe8c0302ea50328e7451652ee Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2023-12-13Introduce Schema Set upgrade methodsourabh_sourabh4-16/+65
- Incl. integration test - Prod code is changed to use new method that update yand module. - updated module resource to return multiple modules. Issue-ID: CPS-1806 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I751d9393ce78a3be9daeaff6d0252738c02115e0 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>