aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-28JSON list support when updating multiple datanodesdanielhanrahan1-21/+6
updateDataNodesAndDescendants if supplied with a JSON list such as {"branch": [{"name":"Name1"}, {"name":"Name2"}]} would only replace the first node /test-tree/branch[@name='Name1'], and ignore any remaining list items. This is caused by the use of a legacy buildDataNode, which returns only a single DataNode from JSON, even if the JSON contained a list. Issue-ID: CPS-1889 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I257491b6bc3f047a64eb241eaac70fd457b24347
2023-09-22Reinstate Spring Boot 3.0 after revertegernug4-4/+4
Issue-ID: CPS-1789 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: Iee5c514ccdba36a387f83948d8a3ba26e6b1de5b
2023-09-20Revert "Migrate CPS to Spring-boot 3.0"Toine Siebelink4-4/+4
This reverts commit 9693ec51cf6526082f0ad0c3ad208d144cbbb163. Reason for revert: Bug fix delivery Change-Id: I73bdc1528192c662983b0bbef73b10b6d612a719 Signed-off-by: egernug <gerard.nugent@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2023-09-20Merge "Use YangParserFactory to generate schema context"Toine Siebelink1-9/+13
2023-09-20Use YangParserFactory to generate schema contextdanielhanrahan1-9/+13
This is presented as a fix for ClassDefNotFoundErrors from opendaylight yang parser Issue-ID: CPS-1866 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: If2d1a8f0319cad0a9517ea3652446e2e43f51fd4
2023-09-14Migrate CPS to Spring-boot 3.0egernug4-4/+4
Issue-ID: CPS-1789 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: I932fca8a50cedf2ae0604401c5e2b27896e4d449
2023-08-18Merge "Device heartbeat listener"Luke Gleeson1-0/+12
2023-08-18Device heartbeat listenermpriyank1-0/+12
- Infrastructure code to have the kafka listener and distributed set in place - performance tested locally - testware added Issue-ID: CPS-1642 Change-Id: I775dbe6e6b520b8777faa08610db439877757572 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2023-08-18CPS-Core : Expose a java interface to update schema setsourabh_sourabh3-0/+25
- Exposed an interface to update anchor by schema set name. - New interface is implemented into RI model. - New native query is exposed to update id with given schema set name. - A new integration test is written to test new interface into cps core. Issue-ID: CPS-1800 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ibf44712e11b53cb6673b04b9e3fd864321c90839 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-08-03Merge "Support pagination in query across all anchors(ep4)"Luke Gleeson6-15/+106
2023-08-02Support pagination in query across all anchors(ep4)rajesh.kumar6-15/+106
Add pagination query parameters in query across all anchors API pagination parameters (pageIndex and pageSize) are optional default is to query all fragments each pageSize represents number of records(number of anchors) TotalRecords is returned in response header to find number of pages. - If pagination option is provided in request then query number of anchors equal to pageSize. pageIndex is used for setting offset. - return number of records(one anchor per record) as per pagesize and pageSize Issue-ID: CPS-1605 Change-ID: I73f97f986a817d423f93a8d922dcd9647b2504bc Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>
2023-07-31Add 'direct' keyword to descendants option to query direct children (ep1)Rudrangi Anupriya1-3/+3
-added 'direct' keyword also to Fetch Descendants Option along with 'all' and 'none' to Query direct child. -added unit tests to test direct keyword Issue-ID: CPS-1784 Change-Id: Icb7f59fbeebb03703626132d6d5d2cfde0e5ab4d Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2023-07-31Increase code coverage in cps-service moduleToineSiebelink7-195/+35
- After last rebase I had to remove 3 unused recent cloud eventd specific exceptions/constructors - Moved the only used new exception from SPI to the relevant util package (please NOTE not all exceptions belong in SPI and always question need for new exception when there is no specific handling, try to use standard or existign CPS exception instead!) - Increased cps-service module (line) coverage from 95 to 100% - Added tests for missing exceptions (handling i.e. thrown up) - Removed incorrect SPI defined OperationNotYetSupportedException (replaced with standard java exception instead) - Fixed some legacy issues with existign test classes I modified (unnecessary setup, conventions etc) - Increased coverage for DataNodeBuilder - Added or modified test to include more spi models - Added tests for Hazelcast Configs - Added more tests for json object mapper - Added test and fixed error handling in YangUtils/XmlFileUtils (it was incorrectly converting a config exception to a data validation exception) Issue-ID: CPS-475 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I5852ba01bc5b33ae361b8f29daae9868f05baa35
2023-07-28Add 'direct' keyword to descendants option to query direct children (ep1)Rudrangi Anupriya1-3/+5
-added 'direct' keyword also to Fetch Descendants Option along with 'all' and 'none' to Query direct child. -added unit tests to test direct keyword Issue-ID:CPS-1784 Change-Id: Iab7f59fbeebb03703626132c6d5c2afde0e5ab4d Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2023-07-27Merge "Subscription Creation: NCMP to Client CloudEvent transformation"Luke Gleeson2-0/+98
2023-07-26Subscription Creation: NCMP to Client CloudEvent transformationhalil.cakal2-0/+98
- Delete legacy avc subscription event and event outcome schemas - Change subscription response and outcome sample json file contents - Change ncmp event response code to support avc subscriptions - Add mapper that maps cloud event to subscription event response - Add mapper that maps subscription event outcome to cloud event - Change subscription event response consumer to consume CloudEvents - Change time out task to support response event instead client id and name - Change subscription event response mapper to support Cloud Event - Change subscription outcome mapper to group subscription responses as per details and status - Change subscription status to have fromString functionality - Change all unit tests to support new functionalities - Add cps exceptions for cloud event and outcome type - Add details field in yang model - Change data node helper to supoort details field - Consolidate final subscription response codes - Fix code smells reported by SonarLint Issue-ID: CPS-1739 Change-Id: I5eadeb8ef40d3d7befb762b5a8d2139fe3c85d7e Signed-off-by: halil.cakal <halil.cakal@est.tech>
2023-07-20Merge "Apostrophe handling in CpsPathParser"Toine Siebelink1-1/+1
2023-07-20Apostrophe handling in CpsPathParserdanielhanrahan1-1/+1
Apostrophe is not currently handled correctly, and having apostrophe in the xpath will lead to various errors. For example, normalizing this xpath works: /path[@name="I'm quoted"] -> /path[@name='I\'m quoted'] However the resulting xpath will throw a PathParsingException if parsed! (Thus path normalization is not idempotent.) - Use '' for escaping apostrophe in single quoted leaf value, to comply with XPath standard (and use "" for escaping in "). - Use Liquibase to make existing data comply with new rules. - Leaf values in data leaves are now unescaped, e.g. "I'm quoted" - Quoting is now consistent for leaf/text/contains conditions. Issue-ID: CPS-1769 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Iafc287f738254d7f99706c6bc548091c0ecd5aa0
2023-07-18Persisting a list element to a parent list (ep2)Rudrangi Anupriya1-2/+10
Post List Element does not allow for create List Element, only appends onto existing node as children -Add a check in saveListElements to see if the parent xpath is a root path ("/").If root node store list element as top node. Else add passed list element to parent xpath node. -Add test for scenario for above -Add test scenario Saving list element data fragment under Root node -Add Integration Tests Add and Delete top-level list (element) data nodes with root node -Update bookstore model with TopLevelList datanode Issue-ID: CPS-1586 Change-Id: Iaa7f59fbeebb03703626132c6d5c2afde0e7ab4b Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
2023-07-17Improved code coverage for CpsDataServiceImplToineSiebelink1-6/+3
- Added (extended) test to cover missed scenarios - Removed unnecesarry null check from Production code - Improved error messages in production code - Removed duplicate test - Cleaned up existign test somewhat (labels and aligment) Issue-ID: CPS-475 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I9761ad6d4777a6bcfee4cbe1b876dd39fa218fc8
2023-07-13Fix handling of special characters in prefix namesdanielhanrahan2-12/+13
This fixes issues with special characters like square brackets - Make PrefixResolver use CpsPathParser instead of regex - Make DataMapUtils use CpsPathParser instead of String parsing Issue-ID: CPS-1758 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I6dd66eee398a46a69c0229059195f5096ab6fdec
2023-07-11Combine alreadyDefinedException classesdanielhanrahan2-60/+20
Issue-ID: CPS-1774 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I52ff9074a9f8188e8635a811b0d2713a97cb4b10
2023-06-27Normalize parent xpath when building datanodes in CpsDataServicedanielhanrahan1-2/+4
Data nodes are being saved with non-normalized xpaths, resuling in data nodes that cannot be operated on. This affects all operations including get, query, update, and delete. Issue-ID: CPS-1765 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I5352182d79daec67805753ca5943b1a86c18159f
2023-06-27NCMP : Handle non-existing and non-ready cm handlessourabh_sourabh1-0/+16
- Modified data operation schema to contains cm handle as steing and response content field name as result. - Added a new common cloud event builder for NCMP to create an event. - Added data operation event creater that uses cloud event builder to create a cloud event. - Introduced a new method onto json object mapper to convert json object to bytes. - Modified EventDateTimeFormatter and added a new method to convert date timestamp into offsetdateTime. - Added a new code into ResourceRequestUtil to identify non-ready cm handle and non-existing cm handle and later publish it as cloud event to tha client given topic. - Introduced CpsApplicationContext to get spring mannaged bean into non spring managed java object. Issue-ID: CPS-1583, CPS-1614 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I24a39d2cb2c54dea25cd2f17e7748e21cd83a088 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-05-11Move integration test for moduleServiceToineSiebelink2-10/+1
- all modules service interation test moved - added some aditional scenarios to increase coverage - removed unused method(s) - remove javdoc on private methods - some minor refactoring like replace 'var' with correct type Issue-ID: CPS-1687 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I03ff1f3562cfe38318e8b9af81be47a1fe667da2
2023-05-10Move integration test (DataService)ToineSiebelink1-9/+0
- dropped ri module coverage to alow for move - removed performance tests (already better tests in intergration module) - added 'save' iue cases in new integration-test - removed no longer used version for save single data node (todo: remove old tests for similar functionality, will wait until new test cover same) Issue-ID: CPS-1687 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I4c2e788e0a313938a923cd1e7e52584d739ec6f4
2023-05-09Support for Patch across multiple data nodes--global3-23/+19
- Added new method updateMultipleDataLeaves to perform Update on multiple data nodes - Deprecated singular method of update data node(updateDataLeaves) - Refactored code where singular version was used - Updated release notes Issue-ID: CPS-1006 Signed-off-by: <as00745003@techmahindra.com> Change-Id: If67280e2dd3ad566de9a8217489f168415e624bc
2023-05-05[CPS] RI: Code Refactoringraviteja.karumuri1-12/+0
# Replace '[\s\S]' to '.' as it is same as '.' while grouping in regex # Updated the groovy files to add 'assert' and to replace deprecated method # Removed deprecated 'storeDataNode' method. Issue-ID: CPS-1594 Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech> Change-Id: Iaa5f8b0cc8d66473c993060a8fc5a54e37e373b1
2023-05-02Align the hazelcast cluster namesmpriyank2-6/+7
- We need to align the hazelcast cluster names as members of the same cluster can join each other. We will still have exclusivity as the instance names and configs are different for each distributed object. - Exposing env variable to override the cluster name depending on the env it is run on. - Modified test cases to validate the cluster names as well Issue-ID: CPS-1637 Change-Id: Ib0f8c80dc9b2268f976b0c2d3ccd6d64792d4781 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2023-04-28Timeout for Subscription Create Partial Responselukegleeson2-45/+88
- Implemented default 30s timeout for DMI Responses - Placeholders have been TODO'd for Outcome Response generation and Persisted Subscription Updating - Refactored common HazelcastCacheConfig methods - Some tests required a blocking variable due to seperate thread usage Issue-ID: CPS-1599 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I2b1a35e93939daa0524d379ac4736d714ef61a6f
2023-04-26[CPS] RI, Service: Code Refactoringraviteja.karumuri1-9/+0
# Remove unused method "updateDataNodeAndDescendants" # Remove unused production code Issue-ID: CPS-1594 Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech> Change-Id: Id909e9da3e9181c181dfdfe62f051451d8e488a2
2023-04-24Extend capability of distributed cachempriyank1-1/+19
- Extend cache configs to be able to work in stanalone mode as well as in cluster mode in kubernetes. - Expose the parameters to enable or disable the feature. - to make it work in standalone mode autodiscovery config will take care , and to run it on kubernetes enable the kubernetes option and provide the service name property. Issue-ID: CPS-1637 Change-Id: I704c4aa11e65b17b5be80048e4246079014d8bb7 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2023-04-11Populate Dataspace field of DataNodedanielhanrahan1-1/+14
Issue-ID: CPS-1603 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I85aca8bccc28d36aa4cefa0a32cb9bdf2156618a
2023-03-21Query data nodes across all anchors under one dataspacerajesh.kumar5-1/+62
Issue-ID: CPS-1396 Change-ID: I73f97f986a817d423f93a8d922dcd9647b1412ab Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>
2023-03-20CPS-1526 Fix response message for PATCH operationarpitsingh2-4/+12
- Fixed the Response code and message when trying to update multiple data trees at once - Response code changed to 400 - Since the patch operation across multiple data trees is not supported when xpath is set to root node xpath, appropriate message is returned in response - Existing functionality of updating one data node with root node xpath remains as it is. - Updated API documentation and release notes Issue-ID: CPS-1526 Signed-off-by: arpitsingh <as00745003@techmahindra.com> Change-Id: I5d25a06bb5d407316ccfb2f85877cbe56a9f6f31
2023-03-15Merge "Forward Subscription Information to DMI Plugin(s)"Priyank Maheshwari1-0/+40
2023-03-14Reduce dataspace/anchor lookups in CpsDataServicedanielhanrahan3-74/+70
- Use Anchor object instead of names in processDataUpdatedEventAsync - Use Anchor object instead of names in buildDataNodes - Avoid unnecessary ArrayList copy in updateDataNodesAndDescendants Issue-ID: CPS-1536 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I46936a655a3d151357e55b68e1c4161e07100e84
2023-03-13Forward Subscription Information to DMI Plugin(s)lukegleeson1-0/+40
Note: Implemented common EventsPublisher class Issue-ID: CPS-1431 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I292a95f2c990a140f5fd63622ca4eba3f8284b9e
2023-03-13Fetch fragment entities using recursive SQL querydanielhanrahan1-0/+8
- Add SQL query that can fetch needed fragments to any given depth - Update getFragmentEntities to use new query - Remove now unused FragmentRepositoryMultiPathQuery - Remove unused TempTableCreator method - Result: getDataNodesForMultipleXpaths is up to 10 times faster Issue-ID: CPS-1525 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I07cbc9da5ab994ce7e0c2b02d7ca05089f05dab0
2023-03-09Add new metrics to the get data node methodkissand1-0/+3
Issue-ID: CPS-1509 Change-Id: I2eded9a23b56f5263591c710c7a707cf281f93d7 Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
2023-03-01Add DataNodeNotFoundException to deleteDataNodesdanielhanrahan1-0/+38
Current implementation of NCMP handle de-registration relies on DataNodeNotFoundException being thrown to report errors. - Make deleteDataNodes throw DataNodeFoundExceptionBatch - Update performance test timings Issue-ID: CPS-1481 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ib833bdb4a23d24e1784bdaf4e5e5e8a9acb41c54
2023-02-27Expand CPS Service Integration Test (framework)ToineSiebelink1-4/+18
- Created package structure - Created several test bases - Created complete test set for Admin service - Created first test for Data service - Added human-readable toString() to FetchDescendantsOption for test reporting and debuging purposes - Renamed fetch descendants (enum) direct children option for consistency with others options - TODO: Add sample performance test (and base) Issue-ID: CPS-475 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I75317686161be41662b6bf81314a9cd425ddd6eb
2023-02-20Merge "CPS-1401 Implement V2 of GET Data Node API"Luke Gleeson4-45/+53
2023-02-17CPS-1401 Implement V2 of GET Data Node APIarpitsingh4-45/+53
- Modified the GET Data Node API so it returns all the data nodes when xpath set to root "/" - Fragment Repository now returns a collection of Fragment Entities - Instead of returning only the first Fragment Entity now all fragment entities are returned when xpath is set to root - The Fragemnt Entities are further processed to a Collection of Data Nodes. As opposed to singular Data Node in current implementation. - Finally the DataRestController also returns a Collection of Data Nodes when xpath is set to root and valid data is present - Response body changed from JSON object to JSON Array. - Exception handling for invalid xpath and non-existing xpath is now done separately at persistence layer. - Refactored code against CPS-1422 - Deprecated getDataNode method from Service and Persistence layer - Modified V1 of Get Data Node API to use the getDataNodes method and get the first data node from the collection returned. - Modified NCMP to use getDataNodes method - NCMP still does not support multiple data nodes. It retrieves the first data node from the collection returned by getDataNodes Signed-off-by: arpitsingh <as00745003@techmahindra.com> Change-Id: I494a5740a53f65376d135fcb9f1e2e8900a2803e
2023-02-16Improve batch delete schemasets performancedanielhanrahan7-12/+89
- Bulk delete anchors and datanodes associated with schemasets. Improves de-registration performance by approx 10% Issue-ID: CPS-1423 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ie38e8b4c64356bf5935d8c7a5d3f5bfa73fb1714
2023-02-15Bulk delete schemasets in CM handle deregistrationdanielhanrahan4-6/+47
- Batch delete schema sets in single query - Call deleteUnusedYangResourceModules once per batch, not per CM handle - Results for deregistering 10k: 14 mins before; 6 mins after Issue-ID: CPS-1423 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ia3a86a0dc88677323e2f386253a99022a7f02603
2023-02-01Create plural version of deleteDataNodedanielhanrahan3-8/+39
- Add method to CpsDataService to batch delete data nodes and lists - Use native queries to batch delete fragment entities by xpaths, for data nodes and lists - Add performance tests for batch delete - Refactor FragmentNativeRepository - Add single-column version of createTemporaryTable - Renamed metric cps.data.service.datanode.batch.delete to cps.data.service.datanode.all.delete Issue-ID: CPS-1438 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I1851f9c7ef0b1be4bd421b3352d9697a2dd23f79
2023-01-31Introduce InstrumentationToineSiebelink7-17/+179
- Add instrumentation related dependency - Added Timed Instrumentation - CPS-Service Crud methods - CPS Yang parsing - NCMP Registration methods - NCMP Events handling - Remove manual Gauge for YanResources Cache as (better!) instrumentation is already built into the 3PP - Sorted dependecies alphabetically (as we used to enforce, to prevent duplicates) - Added ## P E R F O R M A N C E T E S T R E S U L T S ### mini report - (unrelated) test improvement (because of bug that turned out to be invalid) Reviewers: Sourabh,Priyank, Luke Issue-ID: CPS-1457 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I34b20bece2f59488b022b8effa9470704c57be4d
2023-01-23Merge "Added depth parameter in query nodes API."Toine Siebelink1-0/+38
2023-01-23Added depth parameter in query nodes API.rajesh.kumar1-0/+38
Issue-ID: CPS-1381 Change-ID: I73f97f986a817d423f93a8d922dcd9647b1206bb Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>