NETCONF User Configuration

The yangcli-pro program can be configured to associate a name with a set of user parameters to start a NETCONF user with a server. These named users are saved in a configuration file. Use the --autousers parameter to suppress automatic loading of this file. The default is to load this file at start-up and save it upon exit.

By default, the users configuration is saved in $HOME/.yumapro/yangcli_pro_users.conf. To override this file, set --autousers=false and use the users-cfg command to load a specific users configuration file.

Creating New Users

To create a new user, use the user-cfg 'create' command.

> user-cfg create=usr1 user-name=admin password=admin

A new user is created: user-id=usr1 name=admin password=admin

> user-cfg show usr1

User 'usr1':
  user: admin
  password: admin
  connected: false

>

Saving Users

To save a user, the text configuration file can be edited or the user-cfg 'save' command can be used.

> connect user=andy server=myserver password=mypassword

   ... startup screen ...

andy@myserver> user-cfg save user-A

Saved current user as 'user-A'

andy@myserver>

Multiple Users

Multiple users can be active at once, however only one command at a time can be sent. This will be improved in a future release. Just use the start-session command to start a different session. Only one instance of each named session with its user can be active at the same time.

Saving the Configured Users

The user configuration can be saved or loaded at run-time, even if the --autousers=true parameter is used (the default). The users-cfg command is used to load and save this file.

session-A> users-cfg save

Saved 2 sessions OK to '~/.yumapro/yangcli_pro_users.conf'

session-A>

To save the user to a different file, simply provide the filespec in the 'users-cfg save' command:

session-A> users-cfg save myusers.conf

Saved 2 users OK to '**myusers.conf**'

session-A>

Loading Additional Configured Users

Additional users can be added to the configuration in memory with the users-cfg "load" command. The named users in the file cannot conflict with names already in use or the duplicate users will be skipped.

session-A> users-cfg load users.conf

Loaded 3 sessions OK from 'users.conf'

session-A>

Displaying the Configured Users

The users that are available can be displayed with the users-cfg 'show' command. The --brief and --full extensions are available for this command.

session-A> users-cfg show

Saved users source: '~/.yumapro/.yangcli_pro_users.conf'
User 'userA':
   user: userNameA
   password: password A
   connected: false

User 'userB':
   user: userNameB
   password: password B
   connected: false

User 'userC':
   user: userNameC
   password: password C
   connected: false

Displaying Users

To see information about a specific user, use the user-cfg 'show' command:

> user-cfg show userA
User 'userA':
   user: userNameA
   password: password A
   connected: false

Saved User Configuration File Format

The saved sessions are stored in a YumaPro configuration file.

The file contents must conform to the following YANG container definition:

container saved-users {
 ncx:abstract;
 description
   "Represents all the saved users in
    the ~/.yumapro/yangcli_pro_users file.
    Use the 'users' command to access this file.
    Edit by hand only if you follow this YANG definition.";

   list userid {
     description
      "The list of users to use.";

     key name;

     leaf name {
       type nt:NcxName;
       description
       "The id of the saved user.";
     }

     leaf user {
      type nt:NcxName;
      mandatory true;
      description
       "The user name of the session.";
     }

     choice pass {
      mandatory true;
      leaf password {
        type string;
        ncx:password;
        description
          "User password to use for NETCONF users.
           If none, then user will be prompted before connecting.";
      }
      leaf no-password { type empty; }
    }
    uses ywapp:SshKeyParms;
    uses ywapp:SslKeyParms;
    uses CommentParm;
  }
}

User Configuration File Example

The following example file shows a valid user configuration file:

saved-users {
  userid  'userA' {
    user 'userNameA'
    password 'passwordA'
    public-key '$HOME/.ssh/id_rsa.pub'
    private-key '$HOME/.ssh/id_rsa'
    ssl-fallback-ok true
    ssl-trust-store '$HOME/.ssl/trust-store.pem'
    ssl-key '$HOME/.ssl/yangapi-client.key'
    ssl-certificate '$HOME/.ssl/yangapi-client.crt'
  }
  userid  'userB' {
    user 'userNameB'
    password 'passwordB'
    public-key '$HOME/.ssh/id_rsa.pub'
    private-key '$HOME/.ssh/id_rsa'
    ssl-fallback-ok true
    ssl-trust-store '$HOME/.ssl/trust-store.pem'
    ssl-key '$HOME/.ssl/yangapi-client.key'
    ssl-certificate '$HOME/.ssl/yangapi-client.crt'
  }
 }