Skip to content

[RFC-8040; 6.4] JSON-formatted notifications events over restconf #591

@5721309

Description

@5721309

Hello! Does clixon support sending notification events formatted as JSON?

I can't make it work with following YANG-definition:

notification entity-status {
        leaf state {
                type enumeration {
                    enum ONLINE;
                    enum OFFLINE;
                    enum UNKNOWN;
                }
                mandatory true;
        }
}

And corresponding XML that is returned by callback:

<event xmlns="urn:example:events">
      <entity-status xmlns="urn:example:events">
             <state>ONLINE</state>
      </entity-status>
</event>

I do subscribe to event stream with this command:

curl  -X GET -H "Accept: text/event-stream" -H "Cache-Control: no-cache" -H "Connection: keep-alive" http://localhost:8080/streams/entity-status

But it returns XML instead of JSON:

data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
   <eventTime>2025-01-01T00:00:01.000000Z</eventTime>
   <event xmlns="urn:example:events">
      <entity-status xmlns="urn:example:events">
             <state>ONLINE</state>
      </entity-status>
   </event>
</notification>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions