Fixed compilation problem on the PlanetLabFdNetDeviceHelper and improved documentation for the fd-net-device module.
--- a/src/fd-net-device/doc/fd-net-device.rst Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/doc/fd-net-device.rst Fri Apr 26 02:00:09 2013 +0200
@@ -223,21 +223,21 @@
::
+----------------------+ +-----------------------+
- | machine 1 | | machine 2 |
+ | host 1 | | host 2 |
+----------------------+ +-----------------------+
| ns-3 simulation | | |
+----------------------+ | Linux |
- | node 0 | | Network Stack |
+ | ns-3 Node | | Network Stack |
| +----------------+ | | +----------------+ |
| | ns-3 TCP | | | | TCP | |
| +----------------+ | | +----------------+ |
- | | ns-3 IP | | | | | |
- | | 10.1.1.1 | | | | IP | |
+ | | ns-3 IP | | | | IP | |
| +----------------+ | | +----------------+ |
- | | fd-net-device | | | | | |
+ | | FdNetDevice | | | | | |
+ | | 10.1.1.1 | | | | | |
| +----------------+ | | + ETHERNET + |
| | raw socket | | | | | |
- | +----------------+ | | +----------------+ |
+ |--+----------------+--| | +----------------+ |
| | eth0 | | | | eth0 | |
+-------+------+-------+ +--------+------+-------+
@@ -307,30 +307,26 @@
::
- +-----------------+
- | ns-3 simulation |
- | |
- | ------- |
- | | node | |
- | ------- |
- | | fd- | |
- | | net- | |
- | | device| |
- | ------- |
- | | |
- | | |
- ----|-------------
- | --- --- |
- | | | | | |
- | |TAP| |ETH| |
- | | | | | |
- | --- --- |
- | | |
- | host | |
- --------------|----
- |
- |
- ---- (Internet) -------
+ +-------------------------------------+
+ | host |
+ +-------------------------------------+
+ | ns-3 simulation | |
+ +----------------------+ |
+ | ns-3 Node | |
+ | +----------------+ | |
+ | | ns-3 TCP | | |
+ | +----------------+ | |
+ | | ns-3 IP | | |
+ | +----------------+ | |
+ | | FdNetDevice | | |
+ |--+----------------+--+ +------+ |
+ | | TAP | | eth0 | |
+ | +------+ +------+ |
+ | 192.168.0.1 | |
+ +-------------------------------|-----+
+ |
+ |
+ ------------ (Internet) -----
In the above, the configuration requires that the host be able to forward
@@ -382,7 +378,76 @@
PlanetLabFdNetDeviceHelper
##########################
-TODO: Write section
+PlanetLab is a world wide distributed network testbed composed of
+nodes connected to the Internet.
+Running ns-3 simulations in PlanetLab nodes using the
+PlanetLabFdNetDeviceHelper allows to send simulated traffic generated by
+ns-3 directly to the Internet. This setup can be useful to validate
+ns-3 Internet protocols or other future protocols implemented in ns-3.
+
+To run experiments using PlanetLab nodes it is required to have a
+PlanetLab account.
+Only members of PlanetLab partner institutions can obtain such accounts
+( for more information visit http://www.planet-lab.org/ or
+http://www.planet-lab.eu ).
+Once the account is obtained, a PlanetLab `slice` must be requested in
+order to conduct experiments.
+A slice represents an experiment unit related to a group of PlanetLab users,
+and can be associated to virtual machines in different PlanetLab nodes.
+Slices can also be customized by adding configuration tags to it
+(this is done by PlanetLab administrators).
+
+The PlanetLabFdNetDeviceHelper creates TAP devices on PlanetLab nodes
+using specific PlanetLab mechanisms (i.e. the vsys system), and
+associates the TAP device to a FdNetDevice in ns-3.
+The functionality provided by this helper is similar to that provided
+by the FdTapNetDeviceHelper, except that the underlying mechanisms
+to create the TAP device are different.
+
+::
+
+ +-------------------------------------+
+ | PlanetLab host |
+ +-------------------------------------+
+ | ns-3 simulation | |
+ +----------------------+ |
+ | ns-3 Node | |
+ | +----------------+ | |
+ | | ns-3 TCP | | |
+ | +----------------+ | |
+ | | ns-3 IP | | |
+ | +----------------+ | |
+ | | FdNetDevice | | |
+ |--+----------------+--+ +------+ |
+ | | TAP | | eth0 | |
+ | +------+ +------+ |
+ | 192.168.0.1 | |
+ +-------------------------------|-----+
+ |
+ |
+ ------------ (Internet) -----
+
+
+In order to be able to assign private IPv4 addresses to the TAP devices,
+account holders must request the `vsys_vnet` tag to be added to their slice
+by PlanetLab administrators.
+The vsys_vnet tag is associated to private network segment and only addresses
+from this segment can be used in experiments.
+
+The syntax used to create a TAP device with this helper is similar to that
+used for the previously described helpers:
+
+::
+
+ PlanetLabFdNetDeviceHelper helper;
+ helper.SetTapIpAddress (tapIp);
+ helper.SetTapMask (tapMask);
+ ...
+ helper.Install (node);
+
+
+PlanetLab nodes have a Fedora based distribution, so ns-3 can be installed
+following the instructions for ns-3 Linux installation.
Attributes
==========
@@ -437,27 +502,22 @@
* ``dummy-network.cc``: This simple example creates two nodes and
interconnects them with a Unix pipe by passing the file descriptors
from the socketpair into the FdNetDevice objects of the respective nodes.
-* ``fd2fd-onoff.cc``: Describe
-* ``fd-emu-onoff.cc``: Describe
-* ``fd-emu-ping.cc``: Describe
-* ``fd-emu-udp-echo.cc``: Describe
-* ``fd-planetlab-ping.cc``: Describe
-* ``fd-tap-ping.cc``: Describe
-* ``fd-tap6-ping.cc``: Describe
-
-TODO: What examples using this new code are available? Describe them here.
+* ``realtime-dummy-network.cc``: Same as dummy-network.cc but uses the real time
+ simulator implementnation instead of the default one.
+* ``fd2fd-onoff.cc``: This example is aimed at measuring the throughput of the
+ FdNetDevice in a pure simulation. For this purpose two FdNetDevices, attached to
+ different nodes but in a same simulation, are connected using a socket pair.
+ TCP traffic is sent at a saturating data rate.
+* ``fd-emu-onoff.cc``: This example is aimed at measuring the throughput of the
+ FdNetDevice when using the EmuFdNetDeviceHelper to attach the simulated
+ device to a real device in the host machine. This is achieved by saturating
+ the channel with TCP traffic.
+* ``fd-emu-ping.cc``: This example uses the EmuFdNetDeviceHelper to send ICMP
+ traffic over a real channel.
+* ``fd-emu-udp-echo.cc``: This example uses the EmuFdNetDeviceHelper to send UDP
+ traffic over a real channel.
+* ``fd-planetlab-ping.cc``: This example shows how to set up an experiment to send
+ ICMP traffic from a PlanetLab node to the Internet.
+* ``fd-tap-ping.cc``: This example uses the TapFdNetDeviceHelper to send ICMP
+ traffic over a real channel.
-Troubleshooting
-===============
-
-TODO: Write section
-
-Validation
-**********
-
-TODO: Validation of this device is not easy to automate since most
-What do the examples in examples_to_run.py test for?
-
-Describe how the model has been tested/validated. What tests run in the
-test suite? How much API and code is covered by the tests?
-
--- a/src/fd-net-device/examples/fd-emu-onoff.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/examples/fd-emu-onoff.cc Fri Apr 26 02:00:09 2013 +0200
@@ -20,15 +20,16 @@
*/
// +----------------------+ +-----------------------+
-// | client machine | | server machine |
+// | client host | | server host |
// +----------------------+ +-----------------------+
-// | node 0 | | node 1 |
+// | ns-3 Node 0 | | ns-3 Node 1 |
// | +----------------+ | | +----------------+ |
// | | ns-3 TCP | | | | ns-3 TCP | |
// | +----------------+ | | +----------------+ |
-// | | 10.1.1.1 | | | | 10.1.1.2 | |
+// | | ns-3 IPv4 | | | | ns-3 IPv4 | |
// | +----------------+ | | +----------------+ |
-// | | fd-net-device | | | | fd-net-device | |
+// | | FdNetDevice | | | | FdNetDevice | |
+// | | 10.1.1.1 | | | | 10.1.1.2 | |
// | +----------------+ | | +----------------+ |
// | | raw socket | | | | raw socket | |
// | +----------------+ | | +----------------+ |
@@ -40,36 +41,38 @@
// | |
// +----------------------------+
//
-// This example is aimed at meassuring the thoughput of the FdNetDevice
+// This example is aimed at measuring the throughput of the FdNetDevice
// when using the EmuFdNetDeviceHelper. This is achieved by saturating
-// the channel with TCP traffic. Then the thoughput can be obtained from
+// the channel with TCP traffic. Then the throughput can be obtained from
// the generated .pcap files.
//
-// To run this example you will need two computers (client & server).
+// To run this example you will need two hosts (client & server).
// Steps to run the experiment:
//
-// 1 - Connect the 2 computers with an Ethernet cable
-// 2 - Set the IP addresses on both Ethernet devices
+// 1 - Connect the 2 computers with an Ethernet cable.
+// 2 - Set the IP addresses on both Ethernet devices.
//
// client machine: $ sudo ip addr add dev eth0 10.1.1.11/24
// server machine: $ sudo ip addr add dev eth0 10.1.1.12/24
//
-// 3 - Set both Ethernet devices to promiscuous mode
+// 3 - Set both Ethernet devices to promiscuous mode.
//
// both machines: $ sudo ip link set eth0 promisc on
//
-// 4 - Give root suid to the raw socket creator binary
+// 4 - Give root suid to the raw socket creator binary.
+// If the --enable-sudo option was used to configure ns-3 with waf, then the following
+// step will not be necessary.
//
-// both machines: $ sudo chown root.root build/src/fd-net-device/ns3-dev-raw-sock-creator
-// both machines: $ sudo chmod 4755 build/src/fd-net-device/ns3-dev-raw-sock-creator
+// both hosts: $ sudo chown root.root build/src/fd-net-device/ns3-dev-raw-sock-creator
+// both hosts: $ sudo chmod 4755 build/src/fd-net-device/ns3-dev-raw-sock-creator
//
// 5 - Run the server side:
//
-// server machine: $ ./waf --run="fd-emu-onoff --serverMode=1"
+// server host: $ ./waf --run="fd-emu-onoff --serverMode=1"
//
// 6 - Run the client side:
//
-// client machine: $ ./waf --run="fd-emu-onoff"
+// client host: $ ./waf --run="fd-emu-onoff"
//
#include <iostream>
--- a/src/fd-net-device/examples/fd-emu-ping.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/examples/fd-emu-ping.cc Fri Apr 26 02:00:09 2013 +0200
@@ -18,22 +18,29 @@
// Allow ns-3 to ping a real host somewhere, using emulation mode
//
-// ------------
-// | node n0 |
-// | |
-// | --- |
-// | | | |
-// | |emu| |
-// | | | |
-// | --- |
-// | | |
-// ----|-------
-// |
-// (device on host system, set to promiscuous mode)
-// |
-// --------- (Internet) -------
+// +----------------------+
+// | host |
+// +----------------------+
+// | ns-3 simulation |
+// +----------------------+
+// | ns-3 Node |
+// | +----------------+ |
+// | | ns-3 TCP | |
+// | +----------------+ |
+// | | ns-3 IPv4 | |
+// | +----------------+ |
+// | | FdNetDevice | |
+// |--+----------------+--+
+// | | eth0 | |
+// | +------+ |
+// | | |
+// +----------|-----------+
+// |
+// | +---------+
+// .---------| GW host |--- (Internet) -----
+// +---------+
//
-// To use this example:
+/// To use this example:
// 1) You need to decide on a physical device on your real system, and either
// overwrite the hard-configured device name below (eth0) or pass this
// device name in as a command-line argument
@@ -52,6 +59,13 @@
// 'netstat -rn' command and find the IP address of the default gateway
// on your host. Search for "Ipv4Address gateway" and replace the string
// "1.2.3.4" string with the gateway IP address.
+/// 6) Give root suid to the raw socket creator binary.
+// If the --enable-sudo option was used to configure ns-3 with waf, then the following
+// step will not be necessary.
+//
+// $ sudo chown root.root build/src/fd-net-device/ns3-dev-raw-sock-creator
+// $ sudo chmod 4755 build/src/fd-net-device/ns3-dev-raw-sock-creator
+//
#include "ns3/abort.h"
#include "ns3/core-module.h"
@@ -77,7 +91,7 @@
{
NS_LOG_INFO ("Ping Emulation Example");
- std::string deviceName ("wlan0");
+ std::string deviceName ("eth0");
std::string remote ("173.194.34.51"); // example.com
//
@@ -162,7 +176,7 @@
ipv4->SetUp (interface);
//
- // When the ping appliation sends its ICMP packet, it will happily send it
+ // When the ping application sends its ICMP packet, it will happily send it
// down the ns-3 protocol stack. We set the IP address of the destination
// to the address corresponding to example.com above. This address is off
// our local network so we have got to provide some kind of default route
--- a/src/fd-net-device/examples/fd-planetlab-ping.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/examples/fd-planetlab-ping.cc Fri Apr 26 02:00:09 2013 +0200
@@ -19,34 +19,30 @@
// Allow ns-3 to ping a real host somewhere, using emulation mode and ping
// the simulated node from the host.
//
-// ------------------
-// | ns-3 simulation |
-// | |
-// | ------- |
-// | | node | |
-// | ------- |
-// | | fd- | |
-// | | net- | |
-// | | device| |
-// | ------- |
-// | | |
-// | | |
-// ----|-------------
-// | --- --- |
-// | | | | | |
-// | |TAP| |ETH| |
-// | | | | | |
-// | --- --- |
-// | | |
-// |PlanteLab | |
-// |host | |
-// --------------|----
-// |
-// |
-// ---- (Internet) -------
+//
+// +-------------------------------------+
+// | PlanetLab host |
+// +-------------------------------------+
+// | ns-3 simulation | |
+// +----------------------+ |
+// | ns-3 Node | |
+// | +----------------+ | |
+// | | ns-3 TCP | | |
+// | +----------------+ | |
+// | | ns-3 IPv4 | | |
+// | +----------------+ | |
+// | | FdNetDevice | | |
+// |--+----------------+--+ +------+ |
+// | | TAP | | eth0 | |
+// | +------+ +------+ |
+// | 1.2.3.4 | |
+// +-------------------------------|-----+
+// |
+// |
+// ------------ (Internet) -----
//
// To use this example:
-// 1) The ns-3 will create the TAP device for you in the host machine.
+// 1) A ns-3 creator binary will create the TAP device for you in the host machine.
// For this you need to provide the network address to allocate IP addresses
// for the TAP/TU device and the ns-3 FdNetDevice.
// 2) Once the experiment is running you can ping the FdNetDevice IP address from
@@ -82,7 +78,7 @@
std::string remote ("173.194.34.51"); // example.com
//
- // Make suer network and mask correspond to those assigned to your PlanetLab
+ // Make sure network and mask correspond to those assigned to your PlanetLab
// slice, through the tag vsys_vnet x.x.x.x/yy .
// In this case The network should be x.x.x.x and the mask should correspond to
// the prefix yy.
--- a/src/fd-net-device/examples/fd-tap-ping.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/examples/fd-tap-ping.cc Fri Apr 26 02:00:09 2013 +0200
@@ -19,30 +19,27 @@
// Allow ns-3 to ping a real host somewhere, using emulation mode and ping
// the simulated node from the host.
//
-// ------------------
-// | ns-3 simulation |
-// | |
-// | ------- |
-// | | node | |
-// | ------- |
-// | | fd- | |
-// | | net- | |
-// | | device| |
-// | ------- |
-// | | |
-// | | |
-// ----|-------------
-// | --- --- |
-// | | | | | |
-// | |TAP| |ETH| |
-// | | | | | |
-// | --- --- |
-// | | |
-// | host | |
-// --------------|----
-// |
-// |
-// ---- (Internet) -------
+// +-------------------------------------+
+// | host |
+// +-------------------------------------+
+// | ns-3 simulation | |
+// +----------------------+ |
+// | ns-3 Node | |
+// | +----------------+ | |
+// | | ns-3 TCP | | |
+// | +----------------+ | |
+// | | ns-3 IPv4 | | |
+// | +----------------+ | |
+// | | FdNetDevice | | |
+// |--+----------------+--+ +------+ |
+// | | TAP | | eth0 | |
+// | +------+ +------+ |
+// | 1.2.3.4 | |
+// +-------------------------------|-----+
+// |
+// |
+// ------------ (Internet) -----
+//
//
// To use this example:
// 1) ns-3 will create the TAP device for you in the host machine.
@@ -60,7 +57,9 @@
// - net-device-ip is be the IP address of the network device connected to the internet
// # iptables -t nat -A POSTROUTING -s <TAP-network-addres>/24 -j SNAT --to-source <net-device-ip>
//
-// 3) Before running the example make sure that the tap creator binary has root suid
+// 3) Before running the example make sure that the tap creator binary has root suid.
+// If the --enable-sudo option was used to configure ns-3 with waf, then the following
+// step will not be necessary.
//
// # chown root.root build/src/fd-net-device/ns3-dev-tap-device-creator
// # sudo chmod 4755 build/src/fd-net-device/ns3-dev-tap-device-creator
--- a/src/fd-net-device/examples/fd2fd-onoff.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/examples/fd2fd-onoff.cc Fri Apr 26 02:00:09 2013 +0200
@@ -29,10 +29,10 @@
// | fd-net-device |--------------| fd-net-device |
// +----------------+ +----------------+
//
-// This example is aimed at meassuring the thoughput of the FdNetDevice
+// This example is aimed at measuring the throughput of the FdNetDevice
// in a pure simulation. For this purpose two FdNetDevices, attached to
// different nodes but in a same simulation, are connected using a socket pair.
-// TCP traffic is sent at a saturating data rate. Then the thoughput can
+// TCP traffic is sent at a saturating data rate. Then the throughput can
// be obtained from the generated .pcap files.
//
// Steps to run the experiment:
--- a/src/fd-net-device/helper/planetlab-tap-creator.cc Thu Apr 25 22:08:40 2013 +0200
+++ b/src/fd-net-device/helper/planetlab-tap-creator.cc Fri Apr 26 02:00:09 2013 +0200
@@ -106,7 +106,6 @@
{
int control_fd;
struct sockaddr_un addr;
- int remotefd;
int ret;
control_fd = socket (AF_UNIX, SOCK_STREAM, 0);
@@ -142,8 +141,11 @@
{
FILE *in;
FILE *out;
+ char errbuff[4096];
int nbytes;
+ memset(errbuff, 0, 4096);
+
in = fopen (VSYS_VIFUP_IN, "a");
if (in == NULL)
@@ -151,7 +153,7 @@
ABORT_IF (in == NULL, "Failed to open " << VSYS_VIFUP_IN, 0);
}
- out = fopen (VSYS_VIFUP_DOWN, "r");
+ out = fopen (VSYS_VIFUP_OUT, "r");
if (out == NULL)
{
@@ -164,14 +166,12 @@
// close pipe to indicate end parameter passing and flush the fifo
fclose (in);
- nbytes = fread(if_name, 4096, 1, out);
+ nbytes = fread((void*)errbuff, 4096, 1, out);
// the error buffer will not be empty if we read an error
- ABORT_IF (strcmp(if_name, "") != 0, if_name, 0);
+ ABORT_IF (strcmp(errbuff, "") != 0, errbuff, 0);
fclose (out);
-
- return 0;
}
int