Filed in: Testing.Nanonet · Modified on : Wed, 02 Mar 16
Let's consider that you are working within an SR-enabled environment and have fetched the Nanonet sources (or you are in the Virtual Machine).
The basic idea of Nanonet is that it takes as input a description of a network (nodes, links, delays, IGP weights) and generates a list of commands that will create a network namespace for each node, a virtual Ethernet pair for each link, and automatically generate IPv6 addresses and static routes.
First, we need to describe the network. Create a file
topos/test.ntfl with the following content:
A B 1 3 A C 2 3 B C 1 3
Each line represents a link. The first two columns are node names. A node is created upon its first occurence. The third column is the IGP weight (integer), and the fourth column is link delay in milliseconds (float). Note that all links are symmetric, i.e. it is not possible to specify asymmetric weights or delays. Also, an IPv6 address is automatically generated and assigned for each node and for each interface.
Now, we have to generate the topology file. Run the following command:
$ tools/ntfl2topo.sh topos/test.ntfl Test > topos/test.py
It will create the topology name
Test into the files
Finally, we can generate the commands by doing:
$ ./build topos/test.py Test
The program will generate the topology, IPs, routes and output the commands required to instantiate the topology into the file
Test.sh. We suggest that you have a look at this file in order to catch a better glimpse at the inner workings of the framework.
Now that the commands file is ready, we just need to execute it:
# sh Test.sh
And we are done. In order to enter a node, for example to enter node A, run the following command:
# ip netns exec A bash
Then, you can execute any command within the node.
Important: Nanonet computes static routes for each node so that any node is reachable from any other node, however the routes are computed only for the loopback addresses, not the interfaces address. Thus, you have to force the source IP of packets to be the loopback address. For exemple, if you wish to ping node C from node A (with loopbacks loC and loA), do the following:
$ ping6 -I loA loC