Versions Compared

Key

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

...

URL : PUT http://<IP:PORT>/cps/v2/dataspaces/{dataspace-name}/notification-subscription/{subscription}

Query Parameters:

ParameterDescription
dataspace-name

dataspace name

subscription

subscribe or unsubscribe

...

Information about the subscription of notification will be persisted in Fragment table. For Example, if the notification is subscribed unsubscribed by anchor_id 28, fragment table will have below entry

...

The above entry from fragment table will be deleted when anchor is unsubscribed from subscribed to notification. 

Attributes field is empty because we don't need any further granular control of notification. In future if we need to implement further granular control of notification, we can use attributes fields 

Persistence using NEW dedicated YANG schema 

API 

URL : PUT http://<IP:PORT>/cps/v2/notification-subscription/{subscription}

Query Parameters:

ParameterDescription
subscription

subscribe or unsubscribe

We can create different dataspace and anchor specially for cps notification to persist notification subscription information. We propose to create below dataspace, schema and anchor for notification subscription.

EntityDescription
Dataspace NameCPS-Admin
Anchor Namecps-notification-subscription
schema setcps-notification-subscription
cps-notification-subscriptions@2024-06-18.yang


Code Block
titleSchema
collapsetrue
module subscription {
    yang-version 1.1;
    namespace "org:onap:ccsdk:sample";

    prefix notification-subscription;

    revision "2024-07-05" {
        description
            "Sample Model";
    }
    container cps-notification {
      list dataspaces {
        key "name";
        leaf name {
          type string;
        }
        list anchors {
          key "name";
          leaf name {
            type string;
          }
          list xpaths {
            key "xpath";
            leaf xpath {
              type string;
            }
          }
        }
      }
    }
}


Code Block
titleJSON payload
collapsetrue
{
    "notification-subscription": {
	    "dataspaces": [
		    {
			    "name": "dataspace01"
			},
			{
			    "name": "dataspace02",
			   "anchors": [
				    {
					    "name": "anchor01"
					},
					{
					    "name": "anchor02"
					}
				]
			},
			{
			    "name": "dataspace03",
			    "anchors": [
			     {
			         "name": "anchor01",
				     "xpaths" : [
				         {
						.    "xpath": "/bookstore/categories[@code='01']"
						 },
						 {
							 "xpath": "/bookstore/categories[@code='02']"
						 }
					 ]
				}
				]
			}	
		]
		
	}
}


When Notification is subscribed unsubscribed for above payload, below records will be added in fragment table. 

dataspace01 : all anchors subscribedunsubscribed

dataspace02: list of anchors subscribedunsubscribed

dataspace03: list of anchors and xpaths subscribed unsubscribed 

  

idxpathattributesanchor_idparent_idschema_node_id
1/notification-subscription/dataspaces[@name='dataspace01']
6

2/notification-subscription/dataspaces[@name='dataspace02']/anchors[@name='anchor01']
6

3/notification-subscription/dataspaces[@name='dataspace02']/anchors[@name='anchor02']
6

4/notification-subscription/dataspaces[@name='dataspace03']/anchors[@name='anchor01']

[.

"/bookstore/categories[@code='01", "/bookstore/categories[@code='02"

]

6

...

Using SchemaWithout Schema

Pros:

  1. consistent with cps modules. 

Cons:

  1. Need to create dataspace, anchor and schema in advance.
  2. schema is redundant . not used to parsing the payload. because of fixed payload structure 

Pros:

  1. Simplify 

Cons:

  1. Not consistent with other modules of CPS.
  2. Extra cps path in fragment table. need to ignore these xpaths in get datanodes API. 


...