NETCONF Group Configuration
The yangcli-pro program can be configured to manage the session groups. It associates a group name with a set of sessions to start NETCONF sessions with servers.
A group name is not allowed to have the same name as any session name. This allows the 'session set-current' command to select a group or an individual session.
The named groups and their sessions are saved in a configuration file. Use the --autosessions 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 group configuration is saved in
$HOME/.yumapro/yangcli_pro_sessions.conf
. To override this file, set
--autosessions=false and use the sessions-cfg command to load
a specific sessions configuration file.
Create group
The group command is used to create a group. The 'session' parameter must also be present.
Example of 'group create':
> group create=AB session=session-A session=session-B
> group create=a1a2a3 session=a1 session=a2 session=a3
List group
The group 'list' command is used to list the names of all the groups.
> group list
Group 'AB'
This group is not connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 0
number_of_sessions: 2
Session 'session-A' connected:false
Session 'session-B' connected:false
Group 'a1a2a3'
This group is not connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 0
number_of_sessions: 3
Session 'a1' connected:false
Session 'a2' connected:false
Session 'a3' connected:false
>
Delete group
The group 'delete' command is used to delete a group.
> group delete=AB
> group delete=a1a2a3
> group list
No groups found
>
Add group
The group 'add' command is used to add sessions to a named group. The 'session' parameter must also be present.
> group add=AB session=session-B
> group list
Group 'AB'
This group is not connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 0
number_of_sessions: 2
Session 'session-A' connected:false
Session 'session-B' connected:false
Remove Group
The group 'remove' command is used to remove the sessions from a name group. The 'session' parameter must also be present.
> group remove=AB session=session-A
> group list
Group 'AB'
This group is not connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 0
number_of_sessions: 1
Session 'session-B' connected:false
Show Group
The group 'show' command is used to show the name of the group to show.
Example of 'group show':
> group show=AB
Group 'AB'
This group is not connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 0
number_of_sessions: 1
Session 'session-B' connected:false
>
Connect Group
The group 'connect' command is used to start a named group with session group parameters: lost-ok, missing-connect-ok, missing-ok, reconnect-interval, and reconnect-tries.
The default parameters value are false.
> group connect=AB
yangcli-pro: Starting NETCONF session for andy on localhost over ssh on port 830
NETCONF session established for xxxxx on localhost
... startup screen ...
AB>
Client Session Id: 1
Server Session Id: 1
---------
---------
---------
NETCONF session established for xxxxx on localhost
... startup screen ...
AB>
Client Session Id: 2
Server Session Id: 2
---------
---------
---------
AB> group list
Group 'AB'
This group is fully connected.
missing-ok: false
missing-connect-ok: false
lost-ok: false
reconnect-interval: 30
reconnect-tries: 5
connected_cnt: 2
number_of_sessions: 2
Session 'session-A' connected:true
Session 'session-B' connected:true
Help Group
Use command of help 'group' to print all the group help text.
> help group
group
Manage the yangcli-pro session groups.
A group name is not allowed to have the same name as any
...
input
default parameter: session
choice groupcmd <Mandatory>
case connect
leaf connect [NcxIdentifier]
Connect to all sessions in the specified group.
leaf missing-ok [boolean] [d:false]
If truew, then it is OK to manage this group if 1 or
more sessions identified in...
leaf missing-connect-ok [boolean] [d:false]
If true, then it is OK to manage this group if 1 or
more sessions identified in ...
leaf lost-ok [boolean] [d:false]
If true, then it is OK to manage this group if 1 or
more sessions are lost after...
leaf reconnect-tries [uint32] [d:5]
Indicates the number of times yangcli will attempt
to reconnect to a session if ...
leaf reconnect-interval [uint32] [d:10]
Indicates the number of seconds yangcli will wait to
re-establish a connection i...
leaf create [NcxIdentifier]
Name of the group to create. The 'session' parameter
must also be present
leaf delete [NcxIdentifier]
Name of the group to delete
leaf add [NcxIdentifier]
Name of the group to add some sessions. The 'session'
parameter must also be presen...
leaf remove [NcxIdentifier]
Name of the group to remove some sessions. The
'session' parameter must also be pres...
leaf show [NcxIdentifier]
Name of the group to show
leaf list [empty]
List the names of all the groups saved-sessions {
leaf-list session [NcxIdentifier] <Mandatory>
Name of a session that is being added to the group.
>
Saving Groups
To save a group, the text configuration file can be edited or the sessions-cfg 'save' command can be used. The session configuration can be saved or loaded at run-time, even if the --autosessions=true parameter is used (the default). The sessions-cfg command is used to load and save this file.
AB> sessions-cfg save
session 'session-A' {
user 'andy'
password 'xxxxx'
public-key '$HOME/.ssh/id_rsa.pub'
private-key '$HOME/.ssh/id_rsa'
server 'localhost'
ncport 830
protocols "netconf1.0 netconf1.1"
}
session 'session-B' {
user 'andy'
password 'xxxxx'
public-key '$HOME/.ssh/id_rsa.pub'
private-key '$HOME/.ssh/id_rsa'
server 'localhost'
ncport 830
protocols "netconf1.0 netconf1.1"
}
group 'AB' {
missing-connect-ok false
missing-ok false
lost-ok false
reconnect-interval 30
reconnect-tries 5
session 'session-A'
session 'session-B'
}
}
Changing the Active Group
To change the active group and issue commands to a different server, use the session 'set-current' command. This command will cause all subsequent remote commands to be sent to the servers associated with the named group.
a1a2a3> session set-current AB
Group 'AB' is now active
AB>