It is possible to use yangcli-pro to connect to multiple NETCONF or RESTCONF servers at once.

The "named sessions" feature can be used for this purpose

  • Create named sessions
  • Connect to each named session
  • Switch between named sessions


Create Named Sessions


The easiest way to create named sessions is to connect to the server and create a session manually somehow.

Then the "session-cfg save" command is used to save the session as a named session configuration.


In this example the session is saved as "s1" and "s2".


> connect user=andy password=mypassword server=192.168.0.10
 ...

andy@192.168.0.10> session-cfg save=s1

Saving current session as 's1'

andy@192.168.0.10> session-cfg save=s2

Saving current session as 's2'

andy@192.168.0.10> close-session

>



Connect to Each Named Session


After disconnecting from the initial unnamed session, you can connect to multiple named sessions.


You can connect to a new named session from an existing named session.  

The old session is not lost. You can switch between the sessions on the command line


> connect session-name=s1

...

s1>  create-subscription

s1> connect session-name=s2

...

Incoming notification for session 2 [s1]:
notification {
  eventTime 2021-01-13T18:56:18Z
  netconf-session-start {
    username andy
    session-id 5
    source-host 192.168.0.10
  }
}

s2>  create-subscription

s2>



Switch Between Named Sessions


The session that gets input such as an RPC reply or a notification will be identified in the yangcli-pro logging messages.

Since there is only one command line, there can only be one session that is active for commands at a time.

The "session set-current" command is used to switch between named sessions.  

The current session will be identified in the command prompt.


s2> session set-current=s1

Session 's1' is now active

s1> session set-current=s2

Session 's2' is now active

s2>