[NETCONF-679] RESTCONF RFC8040 compliance: SSE support Created: 29/Apr/20  Updated: 03/Aug/20  Resolved: 03/Aug/20

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: Aluminium

Type: Improvement Priority: High
Reporter: Valentin Mayamsin Assignee: Lukas Baca
Resolution: Done Votes: 0
Labels: restconf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File SSE_Test.postman_collection.json    
Issue Links:
Blocks
is blocked by AAA-199 possibility to enable async requests Resolved

 Description   

Currently RESTCONF notifications are delivered only over Websocket. According to RFC8040[1] notifications must be sent over Server-Sent Events[2]

[1] https://tools.ietf.org/html/rfc8040#section-3.8
[2] https://www.w3.org/TR/2015/REC-eventsource-20150203/

 

 

how to test this:

1)./target/assembly/bin/client "feature:install odl-mdsal-model-inventory odl-netconf-mdsal odl-restconf odl-netconf-topology odl-netconf-connector-all odl-restconf-nb-rfc8040"

2)from postman collection call "1. create" and "2.get"

3)connect to url for example with curl :

curl -v -X GET http://127.0.0.1:8181/rests/notif/data-change-event-subscription/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE -H "Content-Type: text/event-stream" -H "Authorization: Basic YWRtaW46YWRtaW4="

4) 3.update and 4. delete configuration and you must see data in SSE channel

 

 



 Comments   
Comment by Jamo Luhrsen [ 12/May/20 ]

Hi hjslgfsd7, do you know of any person/team committed to working on this ticket for the Aluminium release?

Comment by Luis Gomez [ 12/May/20 ]

As commented in the Kernel call, we need to make sure SSE implementation conforms RFC8650 (https://tools.ietf.org/html/rfc8650). This should not be much of concern because this newer RFC already says: "The streaming of notifications that encapsulate the resulting information push is done via the mechanism described in Section 6.3 of [RFC8040]."

Comment by Lukas Baca [ 03/Jun/20 ]

There is one additional possibility sending ping as event(now is sending as data) but in RFC8040 is:

The SSE specification supports the following additional fields:
 "event", "id", and "retry". A RESTCONF server MAY send the "retry"
 field, and if it does, RESTCONF clients SHOULD use it. A RESTCONF
 server SHOULD NOT send the "event" or "id" fields, as there are no
 meaningful values that could be used for them that would not be
 redundant to the contents of the notification itself.

 

 

But probably will be nicer send it as event to split data part and keep-alive part

Comment by Jamo Luhrsen [ 25/Jun/20 ]

tcere, rovarga, any chance we can get a little progress on this? I think the patch was updated to keep
both websocket as well as SSE (for backward compatibility). The netconf patch also depends on a AAA patch:
https://git.opendaylight.org/gerrit/c/aaa/+/89860

Comment by Kailash Khalasi [ 15/Jul/20 ]

blukas I have tested the build from your patch ([gerrit patch|https://git.opendaylight.org/gerrit/c/netconf/+/90229]) The SSE support looks like its working. Can you confirm my results when subscribing to the event-stream:

 

 


[jenkins@ip-10-1-97-74 ~]$ curl -v -X GET http://127.0.0.1:8181/rests/notif/data-change-event-subscription/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE -H "Content-Type: text/event-stream" -H "Authorization: Basic YWRtaW46YWRtaW4="
* About to connect() to 127.0.0.1 port 8181 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8181 (#0)
> GET /rests/notif/data-change-event-subscription/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8181
> Accept: */*
> Content-Type: text/event-stream
> Authorization: Basic YWRtaW46YWRtaW4=
>
< HTTP/1.1 200 OK
< Set-Cookie: JSESSIONID=node0remdbub5qc81g4ikedstbyu53.node0; Path=/; HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 14-Jul-2020 23:15:31 GMT
< Content-Type: text/event-stream
< Transfer-Encoding: chunked
<

: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
data: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
data: <eventTime>2020-07-15T23:17:06.438654Z</eventTime>
data: <data-changed-notification xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote">
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes</path>
data: <operation>created</operation>
data: <data>
data: <nodes xmlns="urn:opendaylight:inventory">
data: <node>
data: <id>agent-007dd</id>
data: </node>
data: </nodes>
data: </data>
data: </data-change-event>
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes/opendaylight-inventory:node/opendaylight-inventory:node[opendaylight-inventory:id='agent-007dd']</path>
data: <operation>created</operation>
data: <data>
data: <node xmlns="urn:opendaylight:inventory">
data: <id>agent-007dd</id>
data: </node>
data: </data>
data: </data-change-event>
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes/opendaylight-inventory:node/opendaylight-inventory:node[opendaylight-inventory:id='agent-007dd']/opendaylight-inventory:id</path>
data: <operation>created</operation>
data: <data>
data: <id xmlns="urn:opendaylight:inventory">agent-007dd</id>
data: </data>
data: </data-change-event>
data: </data-changed-notification>
data: </notification>
data:
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
: ping
data: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
data: <eventTime>2020-07-15T23:19:22.668968Z</eventTime>
data: <data-changed-notification xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote">
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes</path>
data: <operation>deleted</operation>
data: </data-change-event>
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes/opendaylight-inventory:node/opendaylight-inventory:node[opendaylight-inventory:id='agent-007dd']</path>
data: <operation>deleted</operation>
data: </data-change-event>
data: <data-change-event>
data: <path>/opendaylight-inventory:nodes/opendaylight-inventory:node/opendaylight-inventory:node[opendaylight-inventory:id='agent-007dd']/opendaylight-inventory:id</path>
data: <operation>deleted</operation>
data: </data-change-event>
data: </data-changed-notification>
data: </notification>
data:

 

 

Comment by Lukas Baca [ 15/Jul/20 ]

yes this looks good. We can see ping message as comment. And in same time data messages

Generated at Wed Feb 07 20:15:37 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.