yangcli-pro can store session configurations so they can be reused as a "named session".

If the "default" session is used, then yangcli-pro can only connect to 1 server at a time.

But if named sessions are used, then yangcli-pro can connect to multiple sessions at once.


Create a named session


The easiest way to create a named session is to create a session manually with the connect command


Example:


> connect server=192.168.0.10 user=lab password=my-secret-pass


Once connected, use the session-cfg save command to save the session parameters.

If the session name is already used, then that session will be updated and the old contents replaced with the new session parameters.


lab@192.168.0.10> session-cfg save=session-A

Saving current session as 'session-A'

lab@192.168.0.10> 



The next time you want to connect using these session parameters use the session parameter in the connect command:


> connect session=session-A




Connecting to a Second Session


While connected to a named session you can start another named session or start a new default session:


> connect session=session-A

session-A> connect server=localhost user=lab2 password=new-password

lab2@localhost>




Switching Between Sessions


To switch between active sessions, use the session command:


lab2@localhost> session set-current=session-A

Session 'session-A' is now active

session-A> session set-current=default

Session 'default' is now active

lab2@localhost>



List All Named Sessions


To show a summary of the named sessions use the sessions-cfg command:


session-A> sessions-cfg show

Saved sessions source: '~/.yumapro/.yangcli_pro_sessions.conf'

Session 'session-A':
   user: andy
   server: localhost
   connected: true


The 'show connected' command can be used for a brief summary:


session-A> show connected

2 sessions connected:

Session 'session-A':  server: localhost
Session 'default':  server: 192.168.0.95