Material for home exam 1

Home exam 1 relies on the simulator ns-3. This page points to files to download and collects FAQs.

ns3 has an actively maintained documentation on the web, which can be found here: https://www.nsnam.org/doxygen/index.html

You can download the simulator from here: https://www.nsnam.org/releases/

The latest release in autumn 2019 is ns-3.30 and we are using this in the course. Several interesting variations of TCP have just recently been added to the simulator and are now available for the first time. We are not using them in this course.

A reasonable basis for discovering TCP senders and receivers that communicate in the so-called dumbbell-topology was created by the Github user josch.

A variation that I patched for ns-3.30 can be found in the undervisningsmaterial folder here: /studier/emner/matnat/ifi/IN5060/h19/undervisningsmaterial/dumbbell-sim.cc

This variation has been updated to be more readable and contain various examples for tracing. The version 2 can be found here: /studier/emner/matnat/ifi/IN5060/h19/undervisningsmaterial/v2/dumbbell-sim.cc

In my configuration, I have added it to the ns-3.30/examples/tcp/folder of my ns3 installation, and I have added a line to the wscript file. The updated wscript file is here: /studier/emner/matnat/ifi/IN5060/h19/undervisningsmaterial/wscript

FAQ

How to pass command line arguments to a simulation if you start it with "waf"?

You can use a command like

./waf --run "examples/tcp/dumbbell-sim --tcpcaa=TcpVegas"

The "..." tell waf to pass the arguments to the simulation instead of interpreting them for waf itself.

How are the objects in the dumbbell simulation connected with each other?

The following figure illustrates the basic relations of the objects that you find in the dumbbell-sim.cc source code.

 

The figure above shows a red queue as well as several blue queues. I want to illustrate with this that there are queues in the reverse direction for every pair of connected NetDevices. So, there is actually a queue in the reverse direction for every single one of those links, and TCP does require that other direction for sending acknowledgements. It's just not terribly important for us because there is no bottleneck in the reverse direction.

How do you count packet losses?

Many TCP versions including NewReno and BIC are increasing the sending rate of a sender until they experience packet loss. These packets should be dropped in the network at the outgoing interface of a router.

A dumbbell topology where packet are sent from left to right should be loosing packets at the left queue of the central link (you should make sure that this link is the bottleneck by giving it the smallest bandwidth).

The dumbbell example by josch attempts to use the following callback installation to print when a packet is dropped:

ns3::Config::Connect("/NodeList/*/DeviceList/*/*/TxQueue/Drop",ns3::MakeCallback(&TxQueueDropTracer));

but when you run the simulation, this does not happen. The problem seems to be that packets are no longer dropped by the Queue itself but by the QueueDisc (queueing discipline, that is an instance of the algorithm used for dropping).

The following is capable of printing the packet content whenever a packet is dropped.

static void DevicePacketsDropTrace (ns3::Ptr<const ns3::QueueDiscItem> p)
{
    std::cout << std::setw(8) << ns3::Simulator::Now().GetSeconds() << " ";
    std::cout << "Dropped pkt ";
    p->Print( std::cout );
    std::cout << std::endl;
}

[...]

int main(int argc, char *argv[])
{
[...]
        // anywhere after the line: stack.Install(routers);
        Ptr<TrafficControlLayer> tc = routers.Get(0)->GetObject<TrafficControlLayer>();
        Ptr<QueueDisc> qd = tc->GetRootQueueDiscOnDevice( routerdevices.Get(0) );
        qd->TraceConnectWithoutContext( "Drop", MakeCallback(&DevicePacketsDropTrace) );
[...]
}

The following is can tell you at the end of main() but before ns3::Simulator::Destroy(); the total number of dropped packets:

        Ptr<TrafficControlLayer> tc = routers.Get(0)->GetObject<TrafficControlLayer>();
        Ptr<QueueDisc> qd = tc->GetRootQueueDiscOnDevice( routerdevices.Get(0) );
        QueueDisc::Stats st = qd->GetStats();
        std::cerr << "Drops: " << st.nTotalDroppedPackets << std::endl;
Publisert 3. sep. 2019 15:09 - Sist endret 8. sep. 2021 09:24