\section{The first virtual attempt}

\begin{figure}[ht]
\includegraphics[height=4in,width=5in]{single_netjig.eps} 
\caption{NetJig interface diagram}
\label{netjig}
\end{figure}

User Mode Linux was used to help automate the tests. A user mode linux
is built which contains the required code. A number of
root file systems are prepared by ``make uml''. Each contain the
configuration for a specific node in the network: east, west, sunrise,
sunset, nic and japan.

The apparatus shown arranges to run one of these ``machines'' with
inputs and outputs connected to sources of replayed data.

The network interfaces are managed by ``uml\_netjig'' - a program that is
a variation of User-Mode-Linux's uml\_switch (formerly called uml\_router).
uml\_netjig opens a pair of network sockets for each network interface,
and then starts the expect script.

The TCL expect script shown, host-test.tcl, starts the User-Mode-Linux
machine with options to have it boot into single user mode. This is done using
the standard expect command ``spawn'' - the script can then interact
with the sub-processes standard in and out. As User-Mode-Linux will
connect stdin/stdout as the console of the machine, the script
can control the virtual machine. 

The first thing that the script does it configure the machine. The
enclosing uml\_netjig script is waiting for this script to
exit. host-test.tcl sets up all of the required parameters, and
then it calls fork(2).

The parent exits, while the child continues to manage the console. If the
child were to exit, the virtual machine would have no console and it would
be impossible to capture further output.

When the parent exits, the uml\_netjig can then continue. It opens 
any files that it was been told to read, and plays the packets it finds
back on the public or private interfaces. If told to, the uml\_netjig
process will answer any ARP requests that it sees.

In addition, it records any packets that are emitted by the process
under test and stores them in a file.

When the last packet has been played, then uml\_netjig assumes that
the test is over, and exits. The enclosing script then arranges to shutdown
the user-mode-linux process using uml\_mconsole.

The enclosing script then converts the captured network files (written
in libpcap format) to text using tcpdump, and compares that to a file
of expected values.

The captured console output is also compared. 

Both the libpcap and the console output files are first put through some
scripts to canoncalize them. In the case of console output, this means
removing things like date stamps, kernel versions, ... from the kernel
boot messages. There are also a number of KLIPS things that get in the
way. Where possible, we have either removed them, or regularized them to
make the scripts simpler.

\subsection{Review of first attempt}

The worst problem with this system is that it only manages a single
virtual machine. This means that the first attempt does not test
any automatic keying.

The second worst problem is that it can not perform tests that do not
involve replaying packets. For instance, one can not run a invoke
a process on the console that sends packets and capture them. That part
will work, but since there are no packets to replay, there is no way to
know when the test has completed.

The third problem is that once the host-test.tcl program has detached
itself into the background, no further console control is possible.
This means, in particular, there is no way to gather statistics at the
end of the test (such as number of packets that have gone through, or
current state of the eroute table). There is in fact, no way to even
determine when the test is over.



