ConfD User Community

ConfD Netconf session-id is not starting from 1


#1

Hi all
I found the session-id in ConfD Netconf is not starting from 1.
The session-id in Hello message sent by ConfD Netconf server is 12, sometimes it is 13.
But I found the session-id in LibNetconf server is starting from 1.

I want to know what is the initial value, and it must be 1 or random optiona.

session-id-type is mentioned in RFC6241 as below.

typedef session-id-type {
  type uint32 {
    range "1..max";
  }
  description
    "NETCONF Session Id";
}

#2

ConfD assigns a session id for each session that is created, whether it is from one of the northbound interfaces, like NETCONF, or internal use via the APIs. The session id sent via NETCONF is from this pool, so the session id may not start from 1, and you may see gaps (for example the next session id may not the next number in sequence, if there has been other activity which may have consumed a session id).

So it isn’t quite random, but you won’t find that it begins with 1. For example, if you execute ‘netconf-console --hello’ repeatedly, you will find the session id monotonically increase, but if you intersperse a CLI session between two ‘netconf-console --hello’ executions, you will see the session-id skip by 1.


#3

Then how we can get that user has logged in first time after server started ? or how many times he logged in after server started ? as we don’t know the starting session-id number. may be he logged in first with session-id 13 and next time with 14. Then on present session can we get that he logged in first time ?