Concurrent Sessions#
Manage CLI Session#
In order to start a CLI scripting session, you establish a TCP/IP connection with the chassis using port 22611
, on the same IP address as when using Manager applications.
You then send lines of ASCII text to the chassis, terminated by CR/LF
, and receive lines of ASCII text in response. The first command should be a logon with the valid password for the chassis, or the session will be terminated.
You can use any client platform that is able to establish a TCP/IP connection and send and receive lines of text through it. Typical client platforms include Python, Java, Tcl, Perl, and Telnet. You may use client-side functionality to execute script commands conditionally or repetitively.
Important
All lines sent to the chassis must be terminated by CR/LF
. You will need to include these characters explicitly if the connection library of your platform does not do so automatically.
Note
Also please make sure to read all the responses sent back to you from the chassis, so that the buffer is empty when the connection is eventually closed down.
Xena also provides a simple interactive scripting client application, XenaScriptClient, that runs on Windows and allows you to manually type commands to the chassis and see its responses.
![XenaScriptClient](../_images/xena_script_client.png)
Fig. 1 XenaScriptClient#
To keep the session alive the client must show some activity every minute or so; else the chassis will assume that the client has stopped, and there are also routers that will kill a TCP session that is inactive for more than a few minutes. The simplest way is to send an empty line, and the chassis will also respond with an empty line. The timeout interval can be changed with the C_TIMEOUT
command so that for instance C_TIMEOUT 99999
effectively disables the timeout.
Multiple Concurrent Sessions#
The chassis support multiple concurrent scripting sessions, just like they support multiple concurrent interactive ValkyrieManager sessions. And like Manager sessions, scripting sessions interact with the chassis in its current state; establishing a scripting session does not in itself impact the chassis state.
Multiple users can operate on the chassis simultaneously. To ensure smooth operation, access restrictions apply.
All parameters can be read by anyone as long as that user has logged on using the C_LOGON
command. In order to set parameters on a chassis, module, or port, the corresponding resource must be reserved by that user. Users are identified by name, which is configured using the C_OWNER
command. Reservation state query and reservations can be done using the C/M/P_RESERVATION
and C/M/P_RESERVEDBY
commands.
Example:
Logging on to a chassis and reserving port 0 and 1 is done by the following commands:
C_LOGON "xena"
C_OWNER "JohnDoe"
1/0 P_RESERVATION reserve
1/1 P_RESERVATION reserve
Resources reserved by a user can be released by the same user using the command:
1/0 P_RESERVATION release
Resources can also be released by other users using the command:
1/0 P_RESERVATION relinquish
A description of what a resource is used for can be given using C/P_COMMENT
.
Example:
C_COMMENT "Live demo chassis. Resources can be relinquished without warning"
or
1/0 P_COMMENT "Port used until 5pm sat oct. 5, after which it can be relinquished"
1/1 P_COMMENT "Port used until 5pm sat oct. 5, after which it can be relinquished"
Any line starting with a semicolon is treated as a comment and ignored by the chassis, e.g.
;This this a comment
Commands to the chassis are not case-sensitive, and replies from the chassis are in uppercase.