# Session id is being repeated in netconf request

**URL:** <https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602>\
**Category:** NETCONF\
**Created:** [January 16, 2024, 3:01pm UTC](https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602 "2024-01-16T15:01:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankitrathore](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ankitrathore](https://dmap-community.ductus.global/u/ankitrathore)\
**Post date:** [January 16, 2024, 3:01pm UTC](https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602/1 "2024-01-16T15:01:30Z")

</div>

i am updating config via netconf multiple times and i can see the same session id is being repeated after few minutes for a different request… is there any way to have this sessionid unique?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [January 22, 2024, 2:02pm UTC](https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602/2 "2024-01-22T14:02:42Z")

</div>

The session ID can be repeated if ConfD restarts. You can use maapi\_set\_next\_user\_session\_id() to prevent that.

---

<div class="post-metadata">

**Author:** ![ankitrathore](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ankitrathore](https://dmap-community.ductus.global/u/ankitrathore)\
**Post date:** [January 23, 2024, 12:20pm UTC](https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602/3 "2024-01-23T12:20:06Z")

</div>

@cohult how can ii generate the custom sessionid for the below code? i need sessionid because sessionname doesnot come in the callback

DeviceUser user = new DeviceUser(“admin”, “admin”, “admin”);  
Device device = new Device(“cmaas”, user, “10.69.90.141”, 32390);  
device.setDefaultReadTimeout(30);  
try {  
device.  
device.connect(“admin”);  
device.newSession(“test-sess”);  
} catch (JNCException e) {  
e.printStackTrace();  
} catch (IOException e) {  
e.printStackTrace();  
}

```
    NetconfSession nc = device.getSession("test-sess");
    System.out.println("Executing RPC on sessionId" + nc.sessionId);

```

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [January 23, 2024, 9:29pm UTC](https://dmap-community.ductus.global/t/session-id-is-being-repeated-in-netconf-request/4602/4 "2024-01-23T21:29:12Z")

</div>

@ankitrathore, The NETCONF server set the session ID, not the client. See:  
[https://www.rfc-editor.org/rfc/rfc6241#section-8.1](https://www.rfc-editor.org/rfc/rfc6241#section-8.1)  
I do not know much about JNC, other than that the source code is available here:

> **[GitHub - tail-f-systems/JNC: JNC (Java NETCONF Client) is the name of a Java...](https://github.com/tail-f-systems/JNC)**
>
> JNC (Java NETCONF Client) is the name of a Java library for communicating with NETCONF agents, and a plugin for pyang (http://code.google.com/p/pyang/) to generate Java classes from YANG models, to...
