summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main
AgeCommit message (Collapse)AuthorFilesLines
2022-07-25De-registration: send event(s) using central statesourabh_sourabh2-15/+38
- refactored method "parseAndRemoveCmHandlesInDmiRegistration" - added method to send events for DELETING and DELETED - introduced private method in state handler - updated unit tests for registration spec - added unit test to cover new private method in state handler Issue-ID: CPS-1003 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: Ifc1d1e94b7103d85b6352b196edf7075257c211a Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2022-07-20Refractor code to use the new LcmEvent schemabmiklos5-48/+83
-Old schema deleted and comments from tests are removed -EventDateTimeFormatter utility added -From LcmEventsCreator.populateLcmEvent the NcmpServiceCmHandle param removed and tests are fixed accordingly -Changes made in test of the LcmEventsCreator for payload testing to make it more clear Issue-ID: CPS-1147 Change-Id: Id87c81f2755a6617a0fc68ba92a3d0e3170fd20f Signed-off-by: bmiklos <miklos.baranyak@est.tech>
2022-07-14Code Refactoring Ncmp* to Lcm* as per new scopempriyank7-48/+44
- Refactored code to reflect the LcmEvents scope now. - Test cases updated and dependencies reviewed. - You can find few occurences of NcmpEvent for now but that will be cleaned up once we implement CPS-1104 which is for LcmEvent schema - UPCOMING: LcmEvent schema and then the code to publish the events on cmHandleStates - LATER : LcmEvents based on public properties update. Issue-ID: CPS-1137 Change-Id: I9f395ed733b4028e706205894c36a38412e3452e Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-07-08CmHandleState Handlermpriyank4-13/+234
- State handler taking care of ADVISED, READY and LOCKED state transition at the moment. - For now I have not removed the actual code but eventually state handler will take care of persisting the state and publishing of the events - Rebased code to add the global parameter related to dataSyncCache - UPCOMING : The classes will be prefixed/renamed with LCM once we have the LcmEvent created with new schema Issue-ID: CPS-1118 Change-Id: Ic45d95169eb0c06cfb35c907d34380dbcbf2da11 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-07-07Merge "Define Initial Data Sync Enabled Flag and state"Joseph Keenan1-4/+13
2022-07-07Define Initial Data Sync Enabled Flag and stateDylanB95EST1-4/+13
- Define the initial Data Sync Cache enabled through configuration parameter - Set the data sync enabled flag based on this - And in turn define the initial sync state of the Data Sync Issue-ID: CPS-1119 Change-Id: I43bf03c79481291bf47c9b672f7bf408d789df61 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-07-06Merge "Move persistence methods from NCMPproperty handler"Joseph Keenan3-41/+41
2022-07-06Merge "Distributed map setup for Module and Data Sync"Toine Siebelink1-0/+68
2022-07-06Distributed map setup for Module and Data Syncmpriyank1-0/+68
- Introduce the hazelcast dependency and check how the builds react to it. - Data Sync and Module Sync Map config. - Added basic test scenarios. - Updating the artifact-id from hazelcast-all to hazelcast-spring and version is 4.2.5. (5.1.2 is latest but has known vulnerabilities) - Refactored the code as per the onsite review session - Upcoming : Actual sub-task which will use the distributed maps in respective use cases. Issue-ID: CPS-1050 Change-Id: I60314c4ff95c267b186b20862aef93a5c389a971 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-07-05Move persistence methods from NCMPproperty handleremaclee3-41/+41
Issue-ID: CPS-1117 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: If6a0c620970a2a34a601267c6610f85e4bc07f60
2022-07-04Move persistence related methodsemaclee4-56/+118
-created new method in inventory persistence service for getting module references Issue-ID: CPS-1117 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: Ic1f3c180a62a7211e19982d8f3570829db58370e
2022-07-04Merge "Simplified 'External' lock reason Mapping"Joseph Keenan3-12/+12
2022-07-04Simplified 'External' lock reason Mappinglukegleeson3-12/+12
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-01Add Logging to specify next retryDylanB95EST1-3/+7
Adding logging to specify the next time in minutes until the retry mechanism will attempt to unlock the cm handle if it is not yet ready to be unlocked Issue-ID: CPS-1076 Change-Id: Ic2b011966c779f13ad8380ebfd7d4b4354e6b3e1 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-07-01Merge "use separated get methods for every cmHandle instead of one "get all" ↵Toine Siebelink1-14/+17
query"
2022-07-01use separated get methods for every cmHandle instead of one "get all"kissand1-14/+17
query Issue-ID: CPS-1085 Change-Id: Ifac152f606b25b7a7d143315dba6d73698ef914e Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
2022-07-01Merge "Allow Module Re-Sync"Toine Siebelink2-0/+20
2022-06-30Allow Module Re-Synclukegleeson2-0/+20
Allows the Resync of an already synced CmHandle Currently: Advised -(create schemaset)-> Ready -(manual write)-> Advised -> Locked as schemaset for cmhandle already exists With this: Advised -(create schemaset)-> Ready -(manual write)-> Advised -(delete schemaset, create schemaset)-> Ready Included some logging Renamed ModuleSyncSpec -> ModuleSyncWatchdogSpec to match class Issue-ID: CPS-1045 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I408fbea698b7926dbf5d0cddc74acf1b00235b1f
2022-06-30Composite state transition code changesourabh_sourabh3-23/+51
- Code cannge to set datastore to Unsynchronized when state moves from advice to ready - if resource data is not available or there is any issue while reading data from simulator then state will be set to synchronized else remain unsynchronized. - Handle serialization failure on empty bean. Issue-ID: CPS-1000 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ie51a787770da649e00aaefc00341756f92f9fa83
2022-06-30Add method to get YANG module sources for CM handleemaclee8-13/+47
- 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 "Fix performance degradation bug"Joseph Keenan3-88/+142
2022-06-30Merge "Retry Module-Sync based on from last failure"Toine Siebelink3-8/+37
2022-06-30Merge "Kafka consumer can not be turned off"Toine Siebelink2-6/+14
2022-06-30Kafka consumer can not be turned offJosephKeenan2-6/+14
-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-30Fix performance degradation bugkissand3-88/+142
- do NOT use cpsPath query for gettign individual CM Handles - change order of queries for more efficency (property query first) Issue-ID: CPS-1085 Change-Id: Ia3bdf4f0d245a2b128557352685d2aa17c1f939c Signed-off-by: kissand <andras.zoltan.kiss@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2022-06-29Get cm-handle state endpointlukegleeson2-0/+21
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-29Retry Module-Sync based on from last failureDylanB95EST3-8/+37
Retry algorithm for module-sync based on last failure Poll Lock Reason, check if lock has surpassed minimum time based on last update time and lock reason Issue-ID: CPS-1076 Change-Id: Ifbbabd2b403f88f1bbe3fae3f125b1e9cb2091aa Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
2022-06-28Unable to change state from LOCKED to ADVISEDsourabh_sourabh7-40/+59
-Refactor Cm Handle Registration to deal with null pointer during Module Sync Retry -Add Last Update Time to cm handle registration -Add Fetch Descendants Option as paramater for get misbehaving locked cm handles -Fixes issue when state that goes to advised after retry mechanism won't be retried again Issue-ID: CPS-1097 Change-Id: Iffe1cef3479a796ea5c78b293a0bd24a86d13efd Signed-off-by: DylanB95EST <dylan.byrne@est.tech> Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
2022-06-27Merge "Introducing DELETING and DELETED Cmhandle State"Joseph Keenan1-1/+1
2022-06-23Remove operation from NcmpEventmpriyank5-54/+12
- Remove operation field from NcmpEvent schema as it is not required - Code refactoring corresponding to removal of operation field - Fixed test cases around it - UPCOMING: Some sort of state machine to handle the event publishing Issue-ID: CPS-1100 Change-Id: Ib89b86bd1408de2808b01d37a48ee44a2601f83d Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-06-23Introducing DELETING and DELETED Cmhandle Statelukegleeson1-1/+1
Issue-ID: CPS-1101 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I527b47cd98150a753c0d7ba89332a52b414b6834
2022-06-22Data Sync Watchdog Processsourabh_sourabh8-43/+261
- 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-21Merge "Quick fix for performance degradation bug"Toine Siebelink1-6/+9
2022-06-21Merge "Publish LCM Events"Joseph Keenan5-4/+33
2022-06-21Merge "Exclude CM-Handles that are not in state 'READY'"Toine Siebelink1-0/+16
2022-06-20Publish LCM Eventsmpriyank5-4/+33
- Publish LCM Create Event when watchdog process moves the cmHandle state from ADVISED to READY - Publish LCM Update Event when public properties are updated, no event when DMI propertis are updated - Publish LCM Delete Event when a cmHandle is been removed - Related test scenarios update - See User Story CPS-1034 for related sub-tasks Issue-ID: CPS-1090 Change-Id: I70d81fde7c80794ea13a10cd1f235a7012b20b3c Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-06-17Quick fix for performance degradation bugkissand1-6/+9
Issue-ID: CPS-1085 Change-Id: I15715ef37909d4e2fe2f1f80e621a21c8037fbd0 Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
2022-06-16Merge "Fix sonar code smells"Joseph Keenan3-19/+19
2022-06-15Merge "Retry CM-Handles that are LOCKED, Failed-to-Sync"Joseph Keenan3-4/+49
2022-06-15Retry CM-Handles that are LOCKED, Failed-to-Syncputhuparambil.aditya3-4/+49
Watchdog added to fetched locked cm handles by Lock reason and operation sync state Tests updated Issue-ID: CPS-878 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: I0ecc519e93b097ec3d309db7f686fb23a0fc59b2
2022-06-15NcmpEvent creation and Mappingmpriyank2-0/+155
- Mapping class to create header and event payload based on type of operation i.e CREATE, UPDATE and DELETE. - Service class to get CmHandle public properties, create event and delegate request to event publisher. - Modification in NcmpEvent schema json to mark field as String instead of URI - Test scenarios - UPCOMING: Call the service method from relevant code to actually publish the event. Issue-ID: CPS-1037 Change-Id: I6bb7de4b27e602c4d8ee6a5528a866e5f7e8799a Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-06-14Exclude CM-Handles that are not in state 'READY'JosephKeenan1-0/+16
Exclude CM-Handles which are not in state ready from ncmp operations Issue-ID: CPS-877 Change-Id: I59783c860091d99e328cec9ccafb34c09b277753 Signed-off-by: DylanB95EST <dylan.byrne@est.tech> Signed-off-by: lukegleeson <luke.gleeson@est.tech> Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
2022-06-13Fix sonar code smellskissand3-19/+19
- 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-4/+5
2022-06-09Remove Model Sync From RegistrationToineSiebelink6-30/+34
Decouple the model sync from registration process Sync now only happens during the watchdog process Cm Handles are persisted in state ADVISED when registartion is successful Issue-ID: CPS-876 Change-Id: Ia3353a0ab1c65a9db553e09138d5690d4f915727 Signed-off-by: DylanB95EST <dylan.byrne@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
2022-06-09Fix sonar code smellsemaclee1-4/+5
- 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-09Merge "Ncmp Producer Setup"Toine Siebelink1-0/+67
2022-06-08Merge 2 'query' end points in NCMPkissand8-136/+464
- 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-07Ncmp Producer Setupmpriyank1-0/+67
- Ncmp Kafka Publisher setup - Test scenarios - Refactored existing test class which were using kafka producer and consumer properties to use from common MessageSpec - Upcoming : Implementation Proposal and Actual logic to publish the correct event Issue-ID: CPS-1035 Change-Id: I93ae392e8c4e4c85d88ca7858332e79b59e85535 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
2022-06-01Module Sync Lock State implementationDylanB95EST11-87/+192
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>