[Xorp-users] questions about xorpsh

Mark Handley M.Handley@cs.ucl.ac.uk
Fri, 11 Nov 2005 08:38:43 +0000


On 11/10/05, faradayelec.qmul.ac.uk <ee05m204@elec.qmul.ac.uk> wrote:
>
> Hi:
>   I am writing a program that automates the command line you put in xorpsh,
> can you tell me how the xorpsh communicate with other software? I can not
> find the interface

xorpsh has two modes, and they're handled differently.

 - operational mode, where you can monitor the state of the router.
 - configuration mode, where you can change the state of the router.

In operational mode, xorpsh reads xorp/etc/templates/*.cmds to
discover the commands to run to provide feedback to the user.  When
the user types the relevant command, xorpsh directly runs the
corresponding command.  For example, in fea.cmds:

show interfaces $(interfaces.interface.*) {
    %command: "fea/tools/show_interfaces -i $3" %help: HELP;
    %module: interfaces;
    %tag: HELP "Show information about a single network interface";
}

This states that the user can run the command "show interfaces" with
the third parameter taken from the set of configured interfaces:
$(interfaces.interface.*) refers to a set of nodes from the
configuration tree.

The actual program to run to provide the output is fea/tools/show_interfaces
and this command should only be available when the "interfaces" module
has been configured in the xorp configuration.



Configuration mode is much more complex.  To change the config, xorpsh
talks to the rtrmgr.  This process involves a login phase when xorpsh
starts up and authenticates the user to the rtrmgr, then it is sent
the current running config.  If the config changes in future (because
another user changes it), the rtrmgr will send deltas.  If xorpsh
wants to change the config, it sends deltas to the rtrmgr as a single
commit, and the rtrmgr will apply those changes, reconfigure the
routing processes, and report success or failure.

The XRLs by which this communication between rtrmgr and xorpsh takes
place are rtrmgr.xif (implemented by rtrmgr) and rtrmgr_client.xif
(implemented by xorpsh).  You can find these in xorp/xrl/interfaces

Most of this is documented in the rtrmgr design documentation, which
you can get from http://www.xorp.org/design_docs.html

Cheers,
Mark