Subscription to Notification

I am trying to create a subscription to a change in database. i want the server to send a notification to the client when ever there is a change in a particular variable value.
I am trying to follow the netconf_notification example and the RFC-5277 doc but i cant get it to work.

i have added this in the Yang model
notification alarm{
leaf alarm{
type leafref {
path " /xxxx/xxxx/alarm"
}
}

create a stream and try to create a subscription for this using
create-subscriptionon
xmlns=“urn:ietf:params:xml:ns:netconf:notification:1.0”>
stream>abcd /stream>
/create-subscription>
i get a ok reply but after that when i make changes to that variable i dont get any message

Please provide suggestions or a good example to help me get this working

First of all, without including your code, it is difficult to guess what may have gone wrong.

Did you invoke the confd_notification_send( ) API call in your code upon the specific changes in your database? If yes, can you respond with your code fragment?

To help with your debugging, you can also look at netconf.log (log for troubleshooting NETCONF operations) and the NETCONF traffic trace log to see if there are any error messages or notifications are being generated or not from your code.

You can enable those two NETCONF related logs in confd.conf as follows:

<logs>
  <netconfLog>
    <enabled>true</enabled>
    <file>
      <enabled>true</enabled>
      <name>./netconf.log</name>
    </file>
  </netconfLog>
  <netconfTraceLog>
    <enabled>true</enabled>
    <filename>./netconf.trace</filename>
    <format>pretty</format>
  </netconfTraceLog>
</logs>

Hi,
I looking to this in a standard way without using the confd lib.
we have the confd library on one machine and the northbound API on another machine. the notrhbound API is creating a subscription to the default NETCONF stream using

create-subscriptionon
xmlns=“urn:ietf:params:xml:ns:netconf:notification:1.0”>
stream>NETCONF /stream>
/create-subscription>

and i want the Northbound API to be notified whenever there is any change in the Confd Server database.

As of now when i change some value in the confd server i get a netconf-session-start and immediately netconf-session-end at the client but no information about any data change.

I would like to know if this feature is supported, if yes what are the functions i need to call to trigger this.

Thank You

Perhaps the following will help.

I have modified the standard netconf-notifications example in confd-basic-6 as follows:

Added the following to notif.yang at the top level:

leaf test {
  type string;
}

This allows me to make configuration changes to the example project at runtime.

I have then created a XML file for creating my NETCONF stream as follows:

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <stream>NETCONF</stream>
  </create-subscription>
</rpc>
]]>]]>

I have modified confd.conf with changes in my previous post to enable NETCONF tracing.

After I have started the example with “make all start”, I then start my NETCONF stream subscription as follows:

$ netconf-console -s all netconf-sub.xml

I then start up a cli session as follows:

bash-3.2$ make cli
$HOME/confd-basic-6/ConfD/bin/confd_cli --user=admin --groups=admin \
            --interactive || echo Exit
Welcome to ConfD Basic

The CLI may only be used during product development.
Commercial use of the CLI is prohibited.
You must disable the CLI in confd.conf for production.
For more information, visit http://www.tail-f.com.
admin connected from 127.0.0.1 using console on WAITAI-M-K092
WAITAI-M-K092# config 
Entering configuration mode terminal
WAITAI-M-K092(config)# test test123
WAITAI-M-K092(config)# commit
Commit complete.

The following is what I have received on my netconf-console terminal:

<?xml version="1.0" encoding="UTF-8"?>
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2015-08-10T10:36:58.427756-07:00</eventTime>
  <netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications">
    <changed-by>
      <username>admin</username>
      <session-id>0</session-id>
      <source-host>127.0.0.1</source-host>
    </changed-by>
    <datastore>running</datastore>
    <edit>
      <target xmlns:notif="http://tail-f.com/ns/test/notif">/notif:test</target>
      <operation>replace</operation>
    </edit>
  </netconf-config-change>
</notification>

Following is the output of my netconf.trace file:

10-Aug-2015::10:36:58.431 **< sess:11 write:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2015-08-10T10:36:58.427756-07:00</eventTime>
  <netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications">
    <changed-by>
      <username>admin</username>
      <session-id>0</session-id>
      <source-host>127.0.0.1</source-host>
    </changed-by>
    <datastore>running</datastore>
    <edit>
      <target xmlns:notif="http://tail-f.com/ns/test/notif">/notif:test</target>
      <operation>replace</operation>
    </edit>
  </netconf-config-change>
</notification>

To find out the exact configuration parameter value changes in your YANG data model through NETCONF notifications, you will need to add your own custom NETCONF notifications for it and write ConfD client application code to generate them accordingly.

1 Like

Hi,

I am also trying to somewhat similar . I want the Northbound API to be notified whenever there is any change in the Confd Server database.

I am writing the program in java though and the java docs for this is not great as such.
I want to send a commitnotification .

I created new socket which is listening to the commit type notifications.
When I create a subscriber for the same and run it , i get following kind of error :

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>protocol</error-type>
    <error-tag>operation-not-supported</error-tag>
    <error-severity>error</error-severity>
    <error-message xml:lang="en">Unsupported capability :notification</error-message>
    <error-info>
      <bad-element>create-subscription</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

my subscriber.xml looks like -

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <create-subscription 
    xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  </create-subscription>
</rpc>
]]>]]>

Can someone please help me get what is the error here ? I have not created any stream and subscribed to default NETCONF notifications.
Also , is there any good java example for the same?

Thanks,
Pooja

Your subscriber.xml is missing the stream to be subscribed. To subscribe to the NETCONF stream as you have mentioned, you should add the following in between the create-subscription block:

<stream>NETCONF</stream>

If you include your code, we may be able to help debug the source of the error.

You can request sample Java example from your support team.

Hi pomishra,

I believe your issue simply is that you did not enable the notification capability for NETCONF in your ConfD configuration file, i.e. confd.conf.

  <netconf>
...
    <capabilities>
...
      <notification>
        <enabled>true</enabled>
      </notification>
    </capabilities>
  </netconf>

That worked. Thanks a lot !

Hi,

Can you please share RFC which mentions about having ‘you will need to add your own custom NETCONF notifications for it and write ConfD client application code to generate’?

Of course there is no RFC that says exactly that. But RFC 6470, which defines these notifications says:

   netconf-config-change:
      Generated when the NETCONF server detects that the <running> or
      <startup> configuration datastore has been changed by a management
      session.  The notification summarizes the edits that have been
      detected.

(note well summarizes) and

         leaf target {
           type instance-identifier;
           description
             "Topmost node associated with the configuration change.

Thus it is clearly not the intent that the notification should carry the exact/full details of the change.

But you don’t have to add your own custom notifications to get more details - another possibility is for the client to issue one or more <get-config> requests to learn the new configuration when a <netconf-config-change> notification has been received. The <edit> list in the notification can then be used to construct appropriate (e.g.) XPath filters.

Actually, we have been looking if full details of change including payload/changed data can be sent as part of notification.

Yes, we can read the notification construct XPath filters and send get-config to find changed configuration. But is it this an costly/additional operation for netconf client? Also when we want netconf client to receive notification from multiple netconf server, this could have a potential performance impact and also we have keep multiple port open always.