Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-689

Extend Websocket streams for data-less notifications

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 1.13.0
    • None
    • restconf-nb

      In one of our customers, the use case was to listen to changes in a particular yangtree. however the data underneath was quite huge, thereby causing the heap running over and the controller crashing in response to lot of changes in the subtree. Hence, we had to fallback to a mechanism to detect just a change in the yangtree from a northbound application and on detection of the change, do a bulk get of the data. that was more effective.

       

      In supporting this usecase, the current implementation needed an extension. Currently,  WebSocket stream notification contains notification metadata with data.  However, there is no way to avoid collecting data during notification processing in the websocket server. Hence, we decided to add  a new filter named "odl-skip-notification-data", similar to "odl-leaf-nodes-only" in the subscription API.

       

      1. Create Stream:

      POST http://\controller-ip:8181/restconf/operations/sal-remote:create-data-change-event-subscription
      {
        "input": {
          "path": "/network-topology:network-topology",
          "sal-remote-augment:datastore": "CONFIGURATION",
          "sal-remote-augment:scope": "SUBTREE",
          "sal-remote-augment:notification-output-type": "JSON"
        }
      }
      
      Response:
      {
        "output": {
          "stream-name": "data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=SUBTREE"
        }
      }

       

      2. Subscribe:

      GET http://{{controller-ip}}:8181/restconf/streams/stream/data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=SUBTREE?&odl-skip-notification-data=true
      
      Response:
      {
          "location": "ws://localhost:8185/data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=SUBTREE"
      }

      3. Get Notification:

      GET  ws://localhost:8185/data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=SUBTREE
      

      4. Write to topology or any respective data tree:

      5. Websocket JSON Response -

      {
         "notification":{
            "xmlns":"urn:ietf:params:xml:ns:netconf:notification:1.0",
            "data-changed-notification":{
               "xmlns":"urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote",
               "data-change-event":{
                  "path":"/network-topology:network-topology",
                  "operation":"updated"
               }
            },
            "eventTime":"2020-05-05T20:22:23.293+05:30"
         }
      }
      

            nikhil.soni.lumina Nikhil Soni
            nikhil.soni.lumina Nikhil Soni
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: