Testing

From OpenHIP
Jump to: navigation, search

This page covers automated testing that is part of the OpenHIP source.

The hiptest.py testing script is a CORE Python script located in hipv2/src/util/scripts/hiptest.py.

Prerequisites

The hiptest.py testing script requires

  1. a Linux kernel 2.6.27 or greater with network namespaces support enabled: Network namespaces (netns), also known as Linux containers (lxc), are a form of lightweight virtualization found in the Linux kernel. Modern Linux distributions such as Ubuntu 11.10 or Fedora 16 already have netns support enabled. The test script uses CORE Python modules to create multiple virtual HIP nodes on one machine.
  2. CORE emulator: You need to first download and install CORE in order to use the testing script. See the CORE Quickstart page for installation instructions. hiptest.py uses the CORE Python modules.
  3. xterm and X11: The interactive testing shell uses two xterms, so xterm and X11 are required. However, the automated tests run in the background from a terminal, without the need for X11.
  4. tunctl: Usually provided in a package such as 'uml-utilities' (Ubuntu).

Currently the code must be recompiled using ./bootstrap.sh --enable-vpls && ./configure --enable-vpls=files in order to run the make check test for VPLS mode.

Interactive Testing

To launch an interactive testing shell, do the following:

 cd openhip
 ./bootstrap.sh && ./configure
 make
 cd src
 sudo make shell

Two xterm terminals should open up, with shells on each of two virtual nodes. Each node will already be configured and running HIP. Try typing ls to see symlinks to the HIP configuration files and binaries.

Note that you do not need to perform a make install, the compiled binaries in the hipv2/src directory will be used instead.

To test basic HIP connectivity, first find the LSI of the second node n2; from the n2 shell type:

 ifconfig hip0

Note the 1.x.x.x LSI assigned to the hip0 interface; now go to the n1 (node 1) shell and type:

 ping 1.238.48.57

Where the 1.x.x.x address is the LSI of n2 discovered previously. The ping should successfully exchange ICMP packets over HIP. You can see what is happening by looking at the hip.log files on either node. You can run tcpdump -nli eth0 to see HIP and ESP traffic, or run Wireshark on the host machine and capture on the Linux bridge device connecting the two nodes. Other things to try would be playing with various configuration settings, readdressing the nodes (use ifconfig or ip addr commands), or try running different TCP or UDP applications.

The virtual nodes share the same filesystem as the host machine. The /var/log and /var/run directories are unique for each node, and are bind mounted to the /tmp/pycore.nnnnn/nX.conf session directory. The /usr/local/etc/hip directory is also unique per node, and points to cached configuration files in the ~/.hiptest/ directory. Note that changes to the configuration files are persistent across tests because of this cache; simply remove the cache directory or file and it will be recreated on the next run.

When you are finished using the test environment, run sudo core-cleanup.sh to shut down the nodes and clean up.

Automated Testing

Run All Automated Tests

To perform automated tests of the OpenHIP code, use the following:

 cd openhip
 ./bootstrap.sh && ./configure
 make
 cd src
 sudo make check

This will launch the hiptest.py CORE Python script that runs HIP several times, for testing the base exchange, mobility, rekeying, etc. Each test will return a pass or fail, and use colored output from make.

Run Individual Tests

You can list the individual tests using the following:

 cd openhip/src
 python util/scripts/hiptest.py -h

To run one of the tests, use the test name as the argument to hiptest.py:

 cd openhip/src
 sudo python util/scripts/hiptest.py bex

The above command will run the base exchange test, for example. The return code of the test will be 0 for pass and 1 for fail. Various status messages are printed in the terminal.