Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

#IssueNotesDecision
1Do we need to update existing update notification to send delta notification or delta notification along with existing notification. 
29-Sep-2023: We decided to implement delta notification separately without changing the existing update notification. 

Event Schema

For delta notification we can use the existing cps data update event schema (cps-data-update-event-schema.json). 

2Using Liquibase v. Yang Model for storing new metadata per anchor in CPS Core
29-Sep-2023: We decided to use yang model to persisting delta notification subscription. No DB change is required. notification subscription information will be stored in Fragment table. 
3generic text field OK for future refinement, maybe consider json?
29-Sep-2023: subscription information will be persisted in JSON format 

Event Schema

proposal for notification schema:

Cloud event Definition


Element

Name

Parent

Type

Mandatory

Description

Format

(example) Value

1Headerid
StringYesrandom id for cloud event header. UUID is suggested

2source
StringYessource of informationfixed value
#1idUUID of the event2source
urn:cps:org.onap.cps
3specversion
StringYescloud event version specfixed value1.0
4type
StringYestype of eventfixed valuedataUpdateEvent
5dataschema
StringYesdata schemafixed value
urn:
cps:org.onap.cps:data-updated-event-schema:
v14type
org.onap.cps.data-updated-delta-event
5content
{
"operation": "UPDATE",
"
anchorName": "Anchor1",
"dataspaceName": "dataspace1",
"schemaSetName": "schemaset1",
"
observedTimestamp": timestamp,
"data":
Code Block
languagetext
titledata body
collapsetrue
[
  {
    "action": "ADD",
    "xpath": "/bookstore/categories/[@code=3]",
    "payload": {
      "code": 3,
      "name": "kidz"
    }
  },
  {
    "action": "DELETE",
    "xpath": "/bookstore/categories/[@code=1]",
    "payload": {
      "code": 1,
      "name": "Fiction"
    }
  },
  {
    "action": "UPDATE",
    "xpath": "/bookstore/categories/[@code=2]",
    "payload": {
      "name": "Comic"
    }
  }
]
}
1.0.0
6Payloaddata
ObjectYesThe actual data payload. Details will be provided below.

7observedTimestampdataStringYesThe timespamp of the event. timestamp2024-01-17 12:34:43
8dataspaceNamedataStringYesThe dataspace name where data is changed.
dataspace01
9schemaSetNamedataStringNoThe schemaset name for which data is changed.
bookstore
10anchorNamedataStringYesThe anchor name for which data is changed.
anchor01
11operationdataStringYesThe operation performed on data. 

CREATE

UPDATE

DELETE


12xpathdataStringYesThe XPath which is changed 
/bookstore


Controlling Notification

 It is important to control the delta notification notifications for better performance. we need to decide on below options to control delta notification.

...

Pros:

  1. Dynamically control notification and per request level. 

Cons: 

  1. there could be issue with access control

...

Pros:

  1. Only allowed dataspace/anchor's delta update will be sent in notification

Cons:

  1. Not practical because we can't control the notification dynamically.  

. Notifications in cps-core will be controlled at Anchor level. By default notifications will be disabled for all anchors. notification can be enabled/disabled for an anchor or all anchors of a dataspace using below REST API. 

API to controlling delta notification 

Delta notification can be enabled/disabled by an additional admin API for list of anchors in a dataspace or all anchors in a dataspace. 

API :  PUT https://IP:PORT/cps/api/v2/dataspace/<dataspace-name>/deltanotification/<subscribe or unsubscribe>


Request Body :

["anchor01", "anchor02"]

Note: if no anchors list provided in request body than notification will be enabled/disabled for all the anchors for given dataspace. 

Persisting notification subscription 

Add schema for notification subscription and add subscription information in to Fragment table when delta notification is subscribed. delete the fragment when delta notification is unsubscribed.

below actions will be performed when delta notification will be subscribed for the dataspace.  

  • schema set will be added to the dataspace when notification is subscribed.
  • An Anchor will be added to dataspace for notification subscription.
  • Subscription data will be added into fragment as per schema set. 

schema yaml file to be used as below. 

Code Block
titledelta-notification.yaml
collapsetrue
module notifications {
    yang-version 1.1;
    namespace "org:onap:ccsdk:sample";

    prefix delta-notification;

    revision "2024-01-10" {
        description
        "Sample Model";
    }
	container deltanotification {

        leaf notification-subscription {
            type string;
        }
	}
}


Implementation details of delta notification

...

Pros: 

  1. control the notification dynamically.

Cons:

  1. Need to persist notification information in DB. 

...

Implementation of controlling delta notification 

While creating an anchor client need to provide an optional parameter (query parameter/header) to receive delta notification in Kafka. by default, delta notification will be disabled for all anchors. 

delta notification can be disabled for an anchor in anchor update API. 

...

  1. For data nodes update operation, generate delta report by comparing previous and current configuration after successful update. 
  2.  Process data update delta event and send notification as described in event schema above.