RUGGEDCOM NETCONF
Reference Guide
Chapter 3
NETCONF Sessions
Killing a Session 27
To kill a session, you need to know its <session-id>. To determine the <session-id> of another session,
attempt to <lock> a configuration. If the configuration is already locked by another session, the <session-id>
for the session is reported in the <rpc-error> message received from the unsuccessful <lock> attempt.
To kill a session where you know the <session-id>, issue the following:
<rpc message-id="2030" mlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <kill-session>
  <session-id>1968</session-id>
 </kill-session>
</rpc>>>>]]>
The device responds with the following message and kills the session:
<rpc-reply message-id="2030" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <ok/>
</rpc-reply>
To kill a session where you do not know the <session-id>, first attempt to <lock> a configuration. In this
example, we attempt to lock the already locked <running> configuration:
<rpc message-id="2040" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <lock>
  <target>
   <running/>
  </target>
 </lock>
</rpc>]]>]]>
The device responds with the following:
<?xml version="1.0" encoding="UTF-8"?>
 <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2040">
 <rpc-error>
  <error-type>protocol</error-type>
  <error-tag>lock-denied</error-tag>
  <error-severity>error</error-severity>
  <error-info>
   <session-id>1968</session-id>
  </error-info>
 </rpc-error>
</rpc-reply>]]>]]>
Incorporate the <session-id> into the <kill-session> command:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2041">
 <kill-session>
  <session-id>1968</session-id>
 </kill-session>
</rpc>
The device responds with the following message and kills the specified session:
<rpc-reply message-id="2041" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <ok/>
</rpc-reply>