summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src
AgeCommit message (Collapse)AuthorFilesLines
2022-12-01Filter on private properties of CM Handlesleventecsanyi4-2/+67
- 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 CPSpathlukegleeson11-149/+322
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 coverageleventecsanyi4-49/+7
- 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 Violationsleventecsanyi2-1/+3
- 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)ToineSiebelink2-8/+19
- 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 endpointbmiklos5-27/+136
- 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 onebmiklos14-217/+754
- 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 Identifieremaclee2-3/+33
- 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 Keenan2-0/+28
2022-07-29Query CmHandles using CPS pathlukegleeson3-3/+3
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 HandleDylanB95EST2-0/+28
-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 Keenan4-10/+44
2022-07-04Simplified 'External' lock reason Mappinglukegleeson4-10/+44
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 handleemaclee6-5/+61
- 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 Siebelink2-20/+21
2022-06-30Kafka consumer can not be turned offJosephKeenan2-20/+21
-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 endpointlukegleeson5-28/+102
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_sourabh3-4/+6
- 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-13Fix sonar code smellskissand2-1/+4
- https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=onap_cps&open=AYFC3OguDZ5Vb3SQMOU1 Issue-ID: CPS-1016 Change-Id: Ic8fdae78337da1ff2c239ae2dfae67e23e88a4bb Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
2022-06-09Merge "Fix sonar code smells"Toine Siebelink1-5/+1
2022-06-09Fix sonar code smellsemaclee1-5/+1
- Remove useless curly braces around statement (https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=onap_cps&open=AYD_5_HLFWip2-KRhcLs) - Define a constant (https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=onap_cps&open=AYEj9y6sq272EuFEMiu-) Issue-ID: CPS-475 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: Ib430fac481b29dba8725ed0dac4da3daa56a3984
2022-06-08Merge 2 'query' end points in NCMPkissand5-71/+181
- 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 implementationDylanB95EST3-65/+17
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-06-01Fixing CompositeState mappingmpriyank1-1/+9
- Mapper null check - NcmpServiceCmHandle mapping for the new composite state - Added global parameter for jackson to include only NON_NULL attributes in the response Issue-ID: CPS-1066 Change-Id: I1924fef45345c77873f9c788baa701311e72bea7 Signed-off-by: mpriyank <priyank.maheshwari@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 -> ClientJosephKeenan6-71/+191
-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 APImpriyank5-5/+203
- 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 endpointlukegleeson4-12/+43
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
2022-04-08Fix Sonar Qube Violations - Recurring taskDylanB95EST1-1/+2
Fix sonar issues in CPS. - Remove Unnecessary cast to List - Immediately return expession Issue-ID: CPS-475 Change-Id: Ic3fa2f3f92784682045a780d87c6737d04f37659 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-04-08Refactoring/ Adding Tests for ValidationDylanB95EST4-4/+4
Refactored classes affected by validation Have added tests for anywhere where validation is used Have refactored the parse and sync modules validation to be validated at the public api method Issue-ID: CPS-322 Change-Id: I4989cfd03300fbdca41571d0aa2d0b96978858ba Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-04-06Query based on Public CM PropertiesJosephKeenan2-1/+45
-Updated OpenAPI for new Endpoint -Will replace SQL with CPSPathQuery once investigation is complete -Functionality in place to determine if public properties match - -Added Unit and CSIT tests - small modifications may need to be made -CSIT tests enhanced to add additional nodes and tests Issue-ID: CPS-731 Change-Id: I403e603ce79c4a4a6994d51b459b5703510d5a83 Signed-off-by: DylanB95EST <dylan.byrne@est.tech> Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
2022-04-05Async: NCMP Rest impl. including Request ID generationsourabh_sourabh2-18/+104
- Restructured code and moved some of them at controller and service layer. - Unit is fixed and organized to it's belonging classes. Issue-ID: CPS-828 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I0919218e35b1d11cb579d707f376b76de80409da
2022-04-05[cps] Fix getResourceDataForPassthroughOperational endpointputhuparambil.aditya2-18/+4
Get endpoint only accepts application/json. Issue-ID: CPS-957 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: Ifc7426fbcd6073a39554014dc18b2107b6343b16
2022-04-05Merge "Structured Exception details for DMI"Bruno Sakoto2-3/+37
2022-04-04Structured Exception details for DMImpriyank2-4/+37
- Introduced DmiErrorMessage in API docs with 502 Bad Gateway - HttpClientRequestException will be thrown which will be exposed as 502 BAD Gateway for the client from NCMP Issue-ID: CPS-917 Change-Id: Iba8f159e8216bc1f63a9ab86208e5c802437e2e8 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-04-01Update CM-Handle registration responseRenu Kumari2-10/+137
- update openapi.yml with new response structure - send only details of failed cm-handle operations - updated csit to validate 200 status Issue-ID: CPS-896 Signed-off-by: Renu Kumari <renu.kumari@bell.ca> Change-Id: I3b868bcc5b8ff488c31faef51edc82c771452234
2022-03-30Additional validation for names/identifiersDylanB95EST4-6/+5
Implementing additional regex validation for names/identifiers in CPS - Introduces a CpsValidator - Applies to relevent java public API's - Tests have been updated where necessary Issue-ID: CPS-322 Change-Id: I29ab8820bb1fe0eee247e425d6bb018bcd38f28e Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-03-14Async: NCMP Rest impl. including Request ID generationsourabh_sourabh1-1/+3
- In case of invalid topic return http status 400 with error message - Unit test is modified to handle/validate InvalidTopicException Issue-ID: CPS-828 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I05645c92ccebb8aa422a47f6edcde7b64088a118
2022-03-14Merge "Replacing ModelMapper with MapStruct"Toine Siebelink7-28/+63
2022-03-11Merge "Async: NCMP Rest impl. including Request ID generation"Bruno Sakoto4-24/+69
2022-03-10Replacing ModelMapper with MapStructlukegleeson7-28/+63
- Removed Model Mapper from pom files - Replaced ModelMapper with MapStruct - Added Tests for MapStruct - Changed mapstruct annotations for individual variables to be null safe rather than all variables - Excluded generated code from code coverage - Set ModuleReferences input to required for SchemaSet so that ModuleReferences list set to empty list rather than null Issue-ID: CPS-127 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I43f874aea79f58dda5526c6fdead27d8474d90af
2022-03-10Removed ExtendedModuleReference Objectsourabh_sourabh1-1/+1
-Introduced ModuleReference with 2 prop name and revision -Removed default constructor of ModuleReference Issue-ID: CPS-592 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I27a8a521f133c0773ef0aa0b9700ac42f6bc613b
2022-03-10Async: NCMP Rest impl. including Request ID generationsourabh_sourabh4-24/+69
- Based on topic api can be sync or async - RequestId is generated using UUID - Used UriComponentBuilder to populate dmi service url. - New test cases are introduced to validate service url generation. Issue-ID: CPS-828 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I2696d5cb012d9274b0c1265f16aa9b2369657f05
2022-03-01Create Endpoint For Get Cm Handles By NameDylanB95EST6-32/+73
Create endpoint and implement logic for get cm handle details by cm handle name Issue-ID: CPS-817 Change-Id: I83bd2da9219d13fac715a08b19108028ca6f6751 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-02-28NCMP Java API depends on NCM-Rest-API (cyclic) through json properties on ↵DylanB95EST11-67/+225
Java API Using POJO and new converter class instead of previous object mapper Issue-ID: CPS-893 Change-Id: I75531f386f08cb172d2901a4bbe97ae22cc5937e Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-02-25Fix success response code CM Handle Registrationmpriyank4-26/+59
- changed registartion response code to 204 NO_CONTENT - improved exception handling for registration API - fixed failing csit related to changed response code - updated the release notes for CPS-892 and CPS-837 Issue-ID: CPS-892 Change-Id: I616e340debf1583b058e7ae6b8960972eec00f3e Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-02-14Improve logging in NCMPsourabh_sourabh1-0/+3
- Code to change to apply logs at runtime - Fix for minor code smell Issue-ID: CPS-855 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I93a556fe0fb7ca05a42e84eb5ec4f84afaa8fd92
2022-02-02[TECHDEBT] Align CPS NCMP REST API SpecificationJosephKeenan2-11/+21
- Updated ncmp.yml to align implementation with specification - Added new Exception classes to differentiate between server NCMP issues and client based NCMP issues - Added 500 error to specification - To be merged after https://gerrit.onap.org/r/c/cps/+/126848 - Added excpetion handlers for SerNcmpException & DmiRequestException Issue-ID: CPS-823 Signed-off-by: JosephKeenan <joseph.keenan@est.tech> Change-Id: If1c9c6c29c6ea2daa07753d7f766ef15c1ba4ca0
2022-01-28Support 'public' Cm Handle PropertiesDylanB95EST2-3/+5
Add support for new Public Additional Properties list to Register CM Handles API Issue-ID: CPS-677 Change-Id: I6efc88734da2416f72f71a403622e519398b502d Signed-off-by: DylanB95EST <dylan.byrne@est.tech>