aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/test
AgeCommit message (Collapse)AuthorFilesLines
2024-02-08Correct use of Spock setup and cleanup methods (no need for @Before @After)ToineSiebelink1-5/+1
- unfortunately we copied the bad test code for logging about 4 times alraedy... - simplified setup for WatchdogSchedulingConfigurerSpec Issue-ID:CPS-465 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I8d068541263272fdf99a6e30d365d85e31726432
2024-02-07Replace sleep with PollingConditionsJvD_Ericsson2-15/+16
Issue-ID: CPS-1950 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I0e23c697ef6b5a134295728f352f2dff7be05a62
2024-02-01Extend API: Get Module Definitionshalil.cakal1-28/+74
- 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-18Use PollingConditions to improve intermittent test failureJvD_Ericsson1-10/+18
Set timeOutInMilliSeconds to 100 (default was 0) Issue-ID: CPS-1950 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I0028f0cd5e5e89d979d4200df77dbd7a42105622
2023-12-18Remove Notification code for updated eventsmpriyank1-2/+1
- 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-13Modify cmHandle registration for alternateIdleventecsanyi1-1/+4
- added alternate id to the interface for persisting the new value - updated unit tests to validate the new field Issue-ID: CPS-1985 Signed-off-by: leventecsanyi <levente.csanyi@est.tech> Change-Id: I81e61f2ea2ecc5d8c0938af00fa81a99e27e2e23
2023-11-24Fix @Ignore testleventecsanyi1-4/+1
- removed EventPublisherSpec - fixed toDataStores test Issue-ID: CPS-1874 Signed-off-by: leventecsanyi <levente.csanyi@est.tech> Change-Id: I857c7bcb0aa52604da6692545456769a4ec151ec
2023-11-06Step 1 and 2 of release processmpriyank1-2/+2
- Sync the openapi docs and the release notes - Also commenting a test scenario coz of unrelated failure. will be fixed later Issue-ID: CPS-1949 Change-Id: I27c955e569acdfe1f699f345fa583f7bce95e76a Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2023-11-02Initial Registration with trustLevel on NCMPseanbeirne1-8/+10
- Updated NcmpServiceCmHandle class to include registration trustLevel Issue-ID: CPS-1902 Signed-off-by: seanbeirne <sean.beirne@est.tech> Change-Id: I7c97928f5cdd82f3036a57ea5f0c149e2872f4f1
2023-10-25Update return body of RestOutputCMHandleemaclee1-95/+107
Issue-ID: CPS-1869 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: I946db9e6785fc50775d1c5ff18e7462e8bad9af6
2023-10-19Code coverage: Update YANG schema set using moduleSetTagsourabh_sourabh1-8/+11
- Code coverage is increased to 98. - New groovy test is added to cover new code. Issue-ID: CPS-1798 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ia979be3f43ec8e4bbf6f8cb66a8a5e748118f19b Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-10-11Expose REST endpoint to update YANG schema set using moduleSetTagsourabh_sourabh2-9/+9
- Added new schema to upgrade model into component. - Modified Ncmp rest input mapper to add upgradedCmHandles attributes. - Modified cm handle state mapper to add new lock reason. - Added new method to parse and upgrade Cm handles in DmiRegistration. - YANG data converter is modified to add "module-set-tag" atribute. - Cm handle new query method is added for cps path without appending ancestor. - Modified setCompositeStateForRetry to add lock reason. - New lock reason category is added. - Existing module sync service is modified to upgrade the model "syncAndCreateOrUpgradeSchemaSetAndAnchor". - Sync util method "getModuleSyncFailedCmHandles" to modified to add another lock reason "LOCKED_MISBEHAVING". - Added new attribute "UpgradedCmHandles" into DmiPluginRegistration and DmiPluginRegistrationResponse. - New attribute "moduleSetTag" is added into NcmpServiceCmHandle. - New model "UpgradedCmHandles" is added. - New method "updateSchemaSetWithExistingModules" is added into cps module service to update cm handle with exsting model. - Code coverage is reducced to 96 percentage that would be addressed and pushed into new patch. Issue-ID: CPS-1798 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I540acb404e38fc434de87a0d959bfde710a18b03 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-10-10Conflicting Error codesourabh_sourabh1-12/+12
-Used common error codes for NCMP responses Issue-ID: CPS-1904 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Id2beaa9f3d49dffd0a193b05fbaa7a6dd801e34a Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-09-25Refactoring persistence classessourabh_sourabh2-29/+30
- Created a common ncmppersistence pkg inside ncmp service "api/impl" pkg". - Move "inventery" into "api/impl" pkg. - Created common class named as "NcmpPersistence" inside "ncmppersistence" pkg. - Move all the commin constants and methods into "NcmpPersistence". - SubscriptionPersistence and InventoryPersistence extends "NcmpPersistence". - Find and replace all the constants of NCMP. Issue-ID: CPS-1883 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Id3e678109766d680589fa7aab965ea251a55f075 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-09-22Reinstate Spring Boot 3.0 after revertegernug2-1/+3
Issue-ID: CPS-1789 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: Iee5c514ccdba36a387f83948d8a3ba26e6b1de5b
2023-09-18Set lock state and reason upon requestleventecsanyi2-5/+5
- added new LockReasonCategories and improved SyncUtils.isReadyForRetry - refactored logic aroudn retry times - refactored unit tests Issue-ID: CPS-1860 Signed-off-by: leventecsanyi <levente.csanyi@est.tech> Change-Id: I4382d6ad1fa0a7d9dacb8c8281b0458a5afc0375
2023-07-21Increase timeout for PollingConditionsegernug1-2/+2
Test failing due to timing issues. Increasing timeout to rectify. Issue-ID: CPS-475 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: I89b512809922470f10940fcdd739f057b8f9c80e
2023-07-20Refactor ncmp request handlers (fix async issue)ToineSiebelink4-68/+240
- simplified request handlers (sub)classes (no more need for default interface) - fix issue with async execution of data operation requests (wasn't really async) - removed redundant (unreachable) check in production code - Improved code coverage (branches) ncmp request handlers added UNIT test - removed MVC test scenarios now covered by appropriate unit level tests - applied Spock Polling Condition for verifying async call Issue-ID: CPS-475 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: Ibe601c709de65080fa8898f2419fdbd92c5ba27d
2023-07-11Combine alreadyDefinedException classesdanielhanrahan1-10/+9
Issue-ID: CPS-1774 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I52ff9074a9f8188e8635a811b0d2713a97cb4b10
2023-06-22NCMP : Replacing the word 'Batch' as 'DataOperation'.raviteja.karumuri2-40/+41
Issue-ID: CPS-1754 Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech> Change-Id: Ie9f56effb160582ba7177331fb6260b2bde2342b
2023-05-25NCMP: Update existing Batch endpoint (Moving url param into rest body)sourabh_sourabh2-23/+75
- NCMP batch endpoint is updated to accept details into request payload. - Removed unused code of previous impl. Issue-ID: CPS-1635 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ic290b750557da06b861c5a4a9bb12debc495ec2e Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-05-09NCMP: Delete DatastoreType enum from cps-ncmp-restsourabh_sourabh1-3/+3
- Delete duplicate enum of datastore - Use datastore from cps-ncmp-service Issue-ID: CPS-1635 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I36484d6a327c81d81741b18a932fc6a1febfc520
2023-05-03Refactor datatrore handling in API requestsToineSiebelink3-112/+63
- Fully parameterized datastore(name) - Improved controler testing to verify all parameter handling - Simplified service inject (alwasy using contructors instead of @AutoWire) - Added delay to fix isuse with intermitting failign test that tests invocation of a method that is executed on a separate thread Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: Iba5d118d2484badee9c7c90ec7694882f6557d16
2023-04-27CPS-1553 :REST endpoint to accept collection of cm handles for GET operationsourabh_sourabh2-50/+93
-Introduced an interface having all un-implemented or default defination of any method that is further extended or implemented by abstract or stubbed controller. -Exposed an endpoint to accept bulk request -Modified an existing methods for more readability. (Parameterized datasource for ... methods) -Code impl. for getResourceDataFromDmi method to send bulk request to new proposed dmi-plugin endpoint that would accept bulk request. -We need to investigate a groovy test that fails only into onap CICD pipeline. For now it's commented out by added TODO tag. (org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy:205) Issue-ID: CPS-1553 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ieac39690956e3a0eab41068db57c5d93a16d04f0 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2023-04-03500 Error Response on NCMP ID-Searches Testingseanbeirne1-1/+43
Issue-ID: CPS-1563 Signed-off-by: seanbeirne <sean.beirne@est.tech> Change-Id: Idc393e90d31b369095bc2b122537e17a4464a364
2022-12-01Filter on private properties of CM Handlesleventecsanyi2-1/+49
- Moved cm handle query validation to cps-ncmp-service (where it belongs!) - Added new enum type for private/public field types - Created new methods for private and public queries - Added new REST endpoint - Created service methods for filtering on different types of properties - Refactored getPublicPropertyPairs and queryCmHandleAnyProperties - Added unit test for the controller layer - Fixed refactoring suggestions - Imporved code coverage with unit tests - Refactoring - Added new functionality to NcmpRestInputMapper - Updated version number to 3.2.1-SNAPSHOT and updated release-notes.rst Issue-ID: CPS-1236 Change-Id: I0ddf6866473f7c3c6b8507d222d441bf97ca6bdc Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
2022-11-15Query data NCMP-Operational with CPSpathlukegleeson3-20/+85
New GET Endpoint: /v1/ch/{cm-handle}/data/ds/{ncmp-datastore-name}/query?cps-path={CPSPath} Implemented error for {ncmp-datastore-name} other than operational - (Toine) Refactored and renamed (abstract) handler for better re-use Mainly by introducing a separate handler for OperationalQuery Reviewers Toine, Sourabh, Priyank Issue-ID: CPS-1002 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: Iaca018869d95d4ce800072431baa190050a6dad0
2022-10-19Improve code coverageleventecsanyi1-1/+6
- Fixed and refactored unit test to get over the 97% coverage baseline. - Removed unused exception. Issue-ID: CPS-475 Change-Id: I6dbcba58b880a584f6d9346e2aca6c763e5d2081 Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
2022-10-17Fix SonarQube Violationsleventecsanyi1-1/+0
- Fixed SonarCube issue: added private constructor to TopicValidator and a unit test. Issue-ID: CPS-475 Change-Id: I4379522f023f32c8999a3ee595392bfbab147050 Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
2022-09-13Handle partial failure (improvements)ToineSiebelink1-8/+12
- catching of failures on retry of individual nodes - extract cm handle id from xpaths (can only report xpaths in cps core) - add test for same Issue-ID: CPS-1232 Issue-ID: CPS-1126 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: Ice2032c8b15fea97ae0aaa4d1ed642b3499228fa
2022-09-07Handle invalid operations on merged datastore endpointbmiklos1-19/+44
- Move the other endpoints under the same thats handling the get - Add exceptions to handle invalid cases - Add new tests for testing the invalid cases Issue-ID: CPS-1001 Issue-ID: CPS-1219 Change-Id: I26fd57b5921f976cde7089b4cf1e8c0e5d8dc43b Signed-off-by: bmiklos <miklos.baranyak@est.tech>
2022-09-01Implement merging all ncmp datastore endpoints into onebmiklos4-108/+250
- Merging all endpoints under /v1/ch/{cm-handle}/data/ds/ncmp-datastore:* to /v1/ch/{cm-handle}/data/ds/{ncmp-datastore-name} - Implementing missing tests from parent - Introducing abstract class to keep the common code and just pass in the supplier to be executed in sync or async manner - Removed the existing get endpoints for passthrough-running, passthrough-operational and operational and merged them into a common get endpoint Issue-ID: CPS-1178 Issue-ID: CPS-1001 Change-Id: I6956c81d5acfa8fb11217bcc16cb795b62070fa3 Signed-off-by: bmiklos <miklos.baranyak@est.tech>
2022-09-01Get all cm handles by DMI plugin Identifieremaclee1-0/+19
- api added to get cm handles by dmi plugin identifier - response object refactored from RestOutputCmHandle to collection of Strings (cm handle ids) - added public and private methods in CmHandleQueries to get cm handle ID by dmi plugin - added unit tests including test to show that there are no duplicates on response Issue-ID: CPS-1136 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: Ia3bdc16172a90ad3a3f9ae11cddcad1352188726
2022-08-02Merge "Enable/Disable Data Sync for Cm Handle"Joseph Keenan1-0/+14
2022-07-29Query CmHandles using CPS pathlukegleeson2-2/+2
Added withCpsPath condition parameter Validated to prevent misuse and blocking of querying using private properties Updated OpenAPI with examples and links to documentation Moved methods related to cmHandle querying using cps path from InventoryPersistence to CmHandleQueries Renamed private method deleteSchemaSetAndListElementByCmHandleId to deleteCmHandleByCmHandleId Issue-ID: CPS-977 Change-Id: I83827215b7e58de74f8f62cd0140516d217d93f1 Signed-off-by: lukegleeson <luke.gleeson@est.tech>
2022-07-28Enable/Disable Data Sync for Cm HandleDylanB95EST1-0/+14
-Create API Which will enable/disable data sync enabled flag -Default functionality of module sync watchdog is to set to false -Remove global config param -Will set initial sync state based on data sync enabled flag -Throws an Exception if the same data sync enabled flag tries to be set -Throws Exception if state is not in READY -Data Sync enabled must be true to complete data sync process - Delete all resource data within fragment table related to synced cm handle when data sync is set to false Issue-ID: CPS-1133 Change-Id: Ib47bbd8293f083c1d705d91bd0def74e6a105c72 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-07-04Merge "Simplified 'External' lock reason Mapping"Joseph Keenan2-6/+21
2022-07-04Simplified 'External' lock reason Mappinglukegleeson2-6/+21
Refactored LOCKED_MISBEHAVING -> LOCKED_MODULE_SYNC_FAILED CompositeStateMapper will change internal reason LOCKED_MODULE_SYNC_FAILED to external reason LOCKED_MISBEHAVING for client payloads Changed openapi description of lock-reason to reflect only enum currently available LOCKED_MISBEHAVING Issue-ID: CPS-1099 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I9cda45f6c30b94684ee1c8ad0c49e35a3a824d52
2022-07-01Modify Unit test for module definitionemaclee1-3/+3
Issue-ID: CPS-1064 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: I9f17d95ba6fb2c7be5a10b1612bcc8db69f8a64d
2022-06-30Add method to get YANG module sources for CM handleemaclee3-4/+36
- part of this commit includes renaming the enum SyncState to DataStoreSyncState Issue-ID: CPS-1064 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: I6bf419141a1b33f09871946445cdfff422c8c354
2022-06-30Merge "Kafka consumer can not be turned off"Toine Siebelink1-1/+2
2022-06-30Kafka consumer can not be turned offJosephKeenan1-1/+2
-NOTE: Build will fail until docker-compose version issues on build server are fixed --Ticket raised https://jira.linuxfoundation.org/plugins/servlet/theme/portal/2/IT-24219 -added flag for async -added response if async is triggered without being enabled & associated test -modified to use one global flag for notifications Issue-ID: CPS-1088 Signed-off-by: JosephKeenan <joseph.keenan@est.tech> Change-Id: If9d988b4dcb71bf37c1b1bf9464090782708ffc2
2022-06-29Get cm-handle state endpointlukegleeson3-21/+78
Added new get cm-handle state endpoint Refactored RestOutputCmHandleState to CmHandleCompositeState Created new RestOutputCmHandleCompositeState OpenApi object ^This is done so that we get '"state: {" at the start of JSON response Refactored RestOutputCmHandleStateMapper to CmHandleStateMapper Added more detailed composite state to get cmHandleDetails endpoint tests Rebased code Code rebased on top of 129658: Unable to change state from LOCKED to ADVISED | https://gerrit.onap.org/r/c/cps/+/129658 which fixes output error Issue-ID: CPS-1019 Signed-off-by: mpriyank <priyank.maheshwari@est.tech> Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I361117c98c256a4aa578c13d21926bc6d7876a15
2022-06-22Data Sync Watchdog Processsourabh_sourabh2-3/+5
- Get all the Cm Handles state in READY and Operational datastores sync state in UNSYNCHRONIZED - Get a random Cm Handle - Get the first resource data from the node - Save the data in Cps Db - Update the Operational datastores sync state to SYNCHRONIZED Issue-ID: CPS-1052 Issue-ID: CPS-1053 Issue-ID: CPS-1054 Change-Id: I9a20391ef30e6d56c4d789a92b8bf42cd3756c62 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech> Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2022-06-08Merge 2 'query' end points in NCMPkissand3-10/+84
- merge two endpoint for a same backend - use xPath query instead of sql query - modify searches endpoint to return a cmHandle object with all public properties - handle old (deprecated) queries - handle public property queries - create useful examples - use more verbose error messages - simplify openapi yamls - create new query service - change second endpoint name to a better matched name - modify legacy tests with new requirements - create new tests for the new scenarios Issue-ID: CPS-1016 Change-Id: I7476e9dbd510ec93b5b48ce85d477ecb2dadffff Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
2022-06-01Module Sync Lock State implementationDylanB95EST2-45/+16
Implementation of Lock state for module sync watchdog Cm Handle state is locked if any exception is found during sync process Make changes around READY state method in line with the new schema set Add last updated time to composite state Remove running datastore references as this is being done at a later time Issue-ID: CPS-875 Change-Id: I6bd159faefef2fa84dbf536c292ff0a132793381 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-05-31Handle RestTemplate Error handling so NCMP cna report correct server statusToineSiebelink1-3/+3
- Moved resposne handling to DmRestClient - Clean up incorrect/redundant tests in CmProxyDataServiceImplSpec Issue-ID: CPS-1056 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I78ba87d6af7255d85758893cfef237d75227875a
2022-05-25Async request response NCMP -> ClientJosephKeenan3-30/+49
-Added consumer for DMI events and producer for forwarding to client -Added schemas for events -Updated tests -Added new module for ncmp events -Used mapstruct for event mapping Issue-ID: CPS-830 Change-Id: I096d08af9d69092cf8651e11eaa00ce441fc3605 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Signed-off-by: JosephKeenan <joseph.keenan@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
2022-05-24Enhanced response with Complex State in APImpriyank3-5/+120
- Introduced RestOutputCmHandleState in API specs of retrieveCmHandleDetailsById - Mapper to map CompositeState to RestOutputCmHandleState - Enhanced existing test cases and introduced new one to test the mapping result Issue-ID: CPS-1047 Change-Id: I34fa198287e5d920bc0cea312ee4e368f3be2b90 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-05-20Get cm-handle public properties endpointlukegleeson3-10/+24
Added RestOuputCmHandlePublicProperties OpenApi Object Added Get cm-handle public properties endpoint Added rest and service layer functionality for endpoint with tests Fixed Copyright Checker violations Issue-ID: CPS-1018 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: Ifc13cde350a49f6ba705a09e31853dc9c73be168