1. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 1
B.Tech (Ordinary Bachelor Degree) in Networking
Technologies
(Programme DT080a)
Team Assignment Report
NS-3 Testbed for MPEG-DASH Evaluation
Submitted by
Anthony Galpo
20 May 2015
2. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 2
Abstract - Video-based content streaming technology has grown rapidly over the past few
years. It has grown so rapidly that it is estimated 61% of the Internet traffic this year
contains internet video streaming(“Broadband Access in the 21st Century,” n.d.).
Particularly in north America's internet traffic almost 50% of the traffic consists of both
Netflix and YouTube which are both video-based streaming websites(Protalinski, n.d.).
These creates problems throughout networks as it will also be carrying multiple other traffic
types, all of which are growing in intensity. Due to limited bandwidth resource network,
content adaptation and video adaptation are seen as promising solution(Rovcanin and
Muntean, 2013). Dynamic Adaptive Streaming over HTTP or known as MPEG DASH is a
standard for adaptive streaming over HTTP that could potentially replace existing
proprietary technologies like Adobe Dynamic Streaming, Apple HTTP Live Streaming and
Microsoft Smooth Streaming(Ozer, 2011)
This paper contains NS-3 Test bed for MPEG-DASH Evaluation, NS-3 is a network
simulator that will need to be set up and configured on a Linux machine. The network set-up
will be simulated through ns-3 and the devices will be two interconnected computers with
different roles as one will be a server and the other one will be a client. Linux containers are
created and will act as nodes to implement and facilitate the network simulation.
3. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 3
Contents
Abstract - ..................................................................................................................................2
1. Introduction: ........................................................................................................................4
2. Research/Background:.......................................................................................................5
2.1 Adaptive Bitrate Streaming: ....................................................................................5
2.2 Different Types of Adaptive Bitrate Streaming:...................................................5
2.2.1 Adobe Dynamic HTTP Delivery..........................................................................5
2.2.2 Microsoft Smooth Streaming................................................................................5
2.2.3 Apple HTTP Live Streaming................................................................................5
2.2.4 MPEG-DASH..........................................................................................................6
2.3 Simulation..................................................................................................................6
2.3.1 NS-3 Network simulator.......................................................................................7
2.4 Operating System:.....................................................................................................8
2.4.1Linux based OS(Ubuntu): ......................................................................................8
The proposed solution:...........................................................................................................9
Proposed solution 1: .......................................................................................................9
Proposed solution 2: .....................................................................................................11
The implementation:.............................................................................................................12
Real node and Simulated network using physical computers...............................12
NS-3 Installation:...........................................................................................................12
NS-3 Logical Topology and Code (.cc File):..............................................................16
Solution Implementation 1: Using Physical computers as Real Nodes:...............18
Solution Implementation 2: Using Virtual machine(LXC) as Real Nodes:...........21
NS-3 Setting up LXC containers: ................................................................................21
Results and evaluation:........................................................................................................27
Solution 1 Results and evaluation: .............................................................................27
Solution 2 Results and evaluation: .............................................................................28
Conclusion:.............................................................................................................................30
References:..............................................................................................................................31
Appendix:...............................................................................................................................33
Topology.cc File:............................................................................................................33
4. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 4
1. Introduction:
Increase of online video streaming has increased dramatically over the past few
years and is expected to triple the amount of video-on-demand traffic by 2016 and
every second, nearly a million minutes of video content will cross the network by
2018(“The Zettabyte Era—Trends and Analysis,” 2014)., while global mobile video
traffic will increase by 10-fold and by 2019 almost 72% of the global mobile traffic
will consist of mobile video("Jim Brady- Cisco Visual Networking Index (VNI)
Mobile Forecast Projects Nearly 10-fold Global Mobile Data Traffic Growth Over
Next Five Years",2015). Areas that expand using video content distribution includes
education, business and healthcare. Universities and other colleges has now adopted
and provide free video tutorials or classes to aid students during their study.
Businesses often now have video meetings or interviews and as for healthcare there
have been an increase of patients purchasing consultation online and having the
consultations over Skype(Khan, 2014).
The project goal is to create a testbed for evaluation of MPEG-DASH formatted
video streaming delivery. This is achieved by creating a small network using two
physical machines or two virtual machines with simulated network using NS-3.
Since NS-3 only runs on a Unix/Linux based systems this project will be made and
simulated using Ubuntu operating system.
The scope of this project is to have three machines with Ubuntu installed, these
machines have their own role. There will be a server machine that will be running
Apache web server, a client machine that will have VLC player software that will
run the streamed video, and the host machine that will act as host for both where the
NS-3 code will run and connect both server and client.
This document also includes a summary of solutions and approaches the team did to
meet the project goals and scope.
5. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 5
2. Research/Background:
2.1 Adaptive Bitrate Streaming:
Adaptive Bitrate Streaming (ABS) is a technology that sends out streams of video
data to viewers that are connected to the internet, it is called 'adaptive' because it
changes the quality of the video sent depending on the viewers connection speed
and the viewers device type(Ozer, 2011). A manifest file is created where a catalogue
of segments and bitrates are written, when a user accesses the multimedia file, the
PC automatically requests the segments from the lower bit rate stream within the
given manifest file. The user's video player will compare the user's download speed
against the bit rate of the initial segment. If the download speed is higher it will
request for the next higher bit rate segment, this will continue until the closest match
is found between the current bandwidth of the user and the current bit rate
segment(“What is Adaptive Bitrate Streaming? | Encoding.com HelpEncoding.com
Help,” 2014).
2.2 Different Types of Adaptive Bitrate Streaming:
There are few types of Adaptive Bitrate Streaming out in the market. Adobe HTTP
Dynamic HTTP Delivery, Microsoft Smooth Streaming, Apple HTTP Live Streaming
and MPEG-DASH standard.
2.2.1 Adobe Dynamic HTTP Delivery
HTTP Dynamic Streaming(HDS) is owned and created by Adobe(“FAQ | HTTP
Dynamic Streaming,” 2015). It delivers network efficient HTTP streaming media for
Adobe integrated software's. HDS supports not only adaptive bit rate streaming but
also quality of services(QoS) monitoring and DVR functionality.
2.2.2 Microsoft Smooth Streaming
Microsoft Smooth Streaming is owned and supported by Microsoft(“Smooth
Streaming : The Official Microsoft IIS Site,” 2015). It is part of an IIS Media Services
extension that enables adaptive streaming media to Silverlight and other clients over
HTTP.
2.2.3 Apple HTTP Live Streaming
Owned and support by Apple, provides a service that lets you send audio and video
over HTTP from an ordinary web server for playback on iOS-based devices. i.e.
iPhone, iPad, Apple TV and desktop. HTTP Live Streaming supports multiple
alternate streams at different bit rates, therefore the client software can adjust
streams depending on the clients network bandwidth(“Introduction,” 2014).
6. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 6
2.2.4 MPEG-DASH
MPEG-DASH(Moving Picture Experts Group-Dynamic Adaptive Streaming over
HTTP) is a working group of ISO/IEC in charge of the development of international
standards for compression, decompression, processing, and coded representation of
moving pictures, audio and their combinations(“Discover MPEG,” 2015). DASH is
made to be implemented as a standard for delivering multimedia over Internet.
DASH provides a standard solution for the efficient and easy streaming of
multimedia using existing available HTTP infrastructure, which enables the
deployment of the streaming services using existing low cost and wide-spread
Internet infrastructure without any provisions(“Discover MPEG,” 2015). It supports
both on-demand and live streaming. Although it can support and use any type of
media it has specific provisions for MPEG-4 file format and MPEG-2 Transport
Streams.
One great feature about DASH is that it the client has the control over the streaming
session, which enables the HTTP server to not have to cope with additional load of
stream adaptation management in large scale deployments. This gives the client the
choice of streaming various CDNs hence achieving further load balancing of the
network for client's benefit. DASH also provides a dynamic switching of different
media tracks and enables dynamic ad-insertion and slicing of various live and on-
demand content(“Discover MPEG,” 2015).
2.3 Simulation
A simulator is a software program that is designed to imitate a 'real' event. These
software simulators are often used for either learning or testing real events. A
network simulator software is designed to create a network simulation of a network
without having the physical requirements and financial requirements of the a real
network. This software is often used as to create a prototype network which will be
functioning the same as the real network where they can alter the network as they
pleased. Although network simulators are great they do not accurately represent the
'real' world network where risks occurs like environmental conditions that will cause
the network to shutdown.
7. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 7
2.3.1 NS-3 Network simulator
NS-3 is a free, open source software that builds and maintains a discrete-event
network simulator for education and research purposes(“What is ns-3 « ns-3,” n.d.).
REAL was introduced in 1988 by engineer Keshav. It was mainly used to observe
traffic flow on the network. It then lead to the creation of the previous versions of
NS-3, which are NS-1 and NS-2. NS-3 goal is to develop and maintain an open
environment for researchers to contribute and share their software. Although older
versions of NS-3 exist it is not backwards-compatible with its predecessor NS-2.
These simulators are both written in C++ though NS-2 APIs are not supported by
NS-3(“Tutorial,” 2015).
NS-3 provides a simulation engine for users for users to conduct simulation
experiments and also provides models of how packet data networks works and
perform. Some reasons researchers use NS-3 for simulation is that it is some studies
are hard to perform or not possible to perform with real systems. NS-3 focuses more
on modelling how Internet protocols and networks work, although NS-3 is not
limited to the Internet systems, where some users use it for non-Internet-based
systems(“Tutorial,” 2015).
There are many simulations tools that exist for network simulation studies. NS-3
provides features that does not exist on other network simulation tools. Below is a
list of NS-3 that distinguish it from other network simulation software.
NS-3 libraries are designed as a set that can be combined with other external
software libraries. It also have several external network animators and data
analysis and visualisation tools. However, it is expected that the user will
have to work at the command line and with C++ and/Python software
development tools(“Tutorial,” 2015).
NS-3 is not supported software product. Support however is done on best-
effort basis on NS-3 user mailing list also a group is made on Google groups
specially created to support NS-3 users.
NS-3 does not only run on Linux systems but also can run on FreeBSD,
Cygwin for Windows and native Windows Visual Studio is the process on
being supported.
For NS-3 there are terms that are used commonly for networking environments
which have a specific meaning and use in the simulation of network. Since there are
so many terms that are within NS-3, below is a list of terms that have been used
within the project.
8. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 8
Node: A basic computing device that is used to connect to a network. This is
represented in C++ by a class Node which provides methods and managing
representations of computing devices in simulations.(“Tutorial,” 2015).
Application: In NS-3, Applications are used to run on NS-3 Nodes to drive
simulation in the simulated world. This is represented in C++ by a class
Application which provides methods for our version of user-level
applications in simulations(“Tutorial,” 2015).
Channel: This is the media where the data flows in the network. In NS-3
nodes connect to an object through a communication channel. Channel class
provides methods for communication management of subnetwork objects and
connecting nodes to them.
Net Device: In NS-3 Net Device is 'installed' within a Node which allows it to
communicate with other Nodes in the simulation through Channels. It is
represented in C++ by a class called NetDevice which provides method to
manage connections to Node and Channel objects.
2.4 Operating System:
Operating system is responsible for managing computer hardware and software
resources. It is a software that is essential for applications to function. There few
different OS that is out. i.e. Windows OS, Linux Based OS, Apple iOS.
2.4.1Linux based OS(Ubuntu):
Most if not all Linux based OS are open source which means it is free for everyone to
get. Ubuntu is one of them, it is open source which is free to download for everyone
to use and share, it is secure with a built-in firewall and virus protection software,
also making it one of the safest operating systems around. It is accessible for
everyone with 40 different languages packages and has a huge online based support
community.
Due to the fact that NS-3 only works with Linux based systems Ubuntu is the perfect
operating systems for this project as it is fast, safe, reliable and user friendly with a
great graphics user interface. A huge online support community is an advantage
because it will make it easier for the project to troubleshoot in case the issues get out
of our knowledge.
9. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page 9
The proposedsolution:
A simulated network will be created through the use of NS-3 simulator. However,
NS-3 will need to interact with the real world. The main function of NS-3 is to
simulate the network traffic between communicating nodes. There are a number of
options to set-up NS-3 to communicated and interact with real world(Dowell, 2010).
Simulated Nodes and Simulated Networks:
This approach uses purely NS-3 code, within the code (.cc file) the nodes, device
and the simulation is created. This path will provides a good knowledge of how NS-
3 simulator works but does not suit as the project solution as there is no way of
getting into the server and client as it will only show results of the network.
Therefore, there will be no streaming of MPEG-DASH video format because the
simulation will only show the results of the communication between the server and
client.
Real Nodes and Simulated Networks:
This approach uses real nodes with NS-3 simulating the network. This is ideally the
best solution for the project requirement. This enables the use of real applications
without actually building a large network of computers. Nodes are created virtually
and connect them via simulated network.
There are plenty of approaches in NS-3 using real nodes and simulated networks
solution. Para virtualisation and NS-3 Tap bridge are two solutions that are best to
work for this project's requirements.
Proposed solution 1:
NS-3 Tapbridge:
This method is a special net device which is designed to integrate into "real nodes"
internet hosts(Doxygen, 2015). The 'real nodes' will be the network interfaces of the
machines which are used to attach to another computer. The idea is to use TapBridge
modes to connect the nodes created in the simulation into so called 'real nodes'
which are physical computers in this case.
Logical Diagram and Data flow:
This solution there will be three physical machines to be set-up. Each machine have
different functions. There will be a machine solely used for running a web server
application, a client machine responsible for running a VLC player and a host
machine responsible for running the NS-3 code simulator to establish a connection
between the server and the client. The team decided that we will based the physical
placement of the computer based on the chosen logical diagram. Therefore, on the
10. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
10
left side the server computer is placed, in the middle is the host computer and on the
right side is the client computer. TCP protocol is used in the network to guarantee
delivery of the video file data. A pcap file will be generated when the connection
have been established and there is an exchange of data between server and client.
This pcap file will be used to read and analyse the packets and data transfer between
both machines. This will provide us a good indication of how MPEG-DASH video
streaming format is a good standard for video streaming.
The design of logical diagram is shown below on Fig.3.1. The idea of this diagram is
to have multiple servers and client created within the simulation. A point-to-point
connection is established between the server and client. The design of the topology
was implemented to us during a session interview with the project lecturer. Our
ideal project design topology was a much simpler design that what was required. It
was to only have one server node and a client node.
Fig.3.1.(Galpo, 2015a)
Applications:
To be able to start a video stream a web server application is required to run on one
of the computers. Apache HTTP server is a widely used web server software around
the world and that is why this application have been chosen to run as the server
application(“Welcome! - The Apache HTTP Server Project,” 2015). It is very simple
to implement and a wide range of video tutorials to aid us to implement this
proposed solution. As for the client side a VLC player will be used to play the video
streamed from the web server application.
Physical connection:
The server and client will be connected to the host computer by a cross-over cable.
As both machines are at the same type and based on what we learned from previous
modules that same type of devices must be connected using cross-over cable unless
the machine have been installed with newly developed technology that allows them
11. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
11
to communicate using straight-through cable. Before any physical connection is
made the host machine will have to have two network cards installed for both server
and client computers to connect to the host.
Proposed solution 2:
Para virtualisation:
This method a virtual machine environment is created within a host machine and a
network is simulated within the host machine. Para virtualisation is lightweight
therefore it is suitable for running a number of instances of virtual nodes in NS-
3(Dowell, 2010). Example of this is using Linux containers where two containers are
created and connected using a simulated network created within NS-3 code(.cc file).
The virtual nodes that are created are TAP to the containers then the containers will
run applications such as an Apache server which will stream MPEG-DASH video
format and a VLC player which will play the video.
Logical Diagram and Data flow:
This solution will only use one machine as a host. Linux containers are created
within the machine and the simulation is also run within it. This has a huge
advantage over the first implemented solution as the will be no need of any type of
physically setting up machines. This solution purely focuses on using the terminal.
The server and client applications will be installed within the Linux containers. Once
these containers have been set-up and configured they will stay in the machine and
will not be deleted/destroyed unless destroy command is implemented.
The data flow between the containers will be the same as what is in solution 1 which
is TCP protocol and a point-to-point connection between nodes. The simulation code
will be also the same which is topology.cc although the modifications on the code
will be different as the TapBridgeHelper will not attach itself to a "real node'. A pcap
file is also generated during the simulation. After the simulation the pcap file will
then be analysed by using Wireshark application. The network topology of the
simulation will be the same as proposed in the first solution the only difference will
be is that instead of using physical machines we are going to be using Linux
containers.
Application:
Instead of the Apache web server being installed on a computer, it will be installed
inside a Linux container along with the VLC player on the client side.
Physical connection:
As this solution purely uses Linux containers there will be no need of any physical
connection set-ups.
12. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
12
The implementation:
Real node and Simulated network using physical computers.
In this implementation section three computers are connected together to perform
the simulated network. Each computers are required to have Ubuntu operating
systems installed. Due to the computers having already Windows 7 installed, a dual
boot system is configured on the machines. Ubuntu operating systems ISO is
downloaded from the Ubuntu download webpage, the ISO file is then burned into a
DVD using the installed DVD drive on the machine. On the boot menu the CD-DVD
drive option is prioritised and the Ubuntu operating system installation begins. User
configuration, hard disk space and RAM memory usage is configured based on the
needed specifications of project. Most of the computer's hard drive space and RAM
memory are set as high as possible to minimise down time during the project
implementation. The PC's super user account has been keep within the group to
prevent any implications on the projects progress, although a guest account has been
set up for others to use the PC's.
NS-3 Installation:
This section contains the details of how NS-3 was installed. NS-3 is developed on
GNU/Linux platforms, thus having Ubuntu installed onto the machines.
Prerequisites: NS-3 requires packages to be installed. On Fig.4.1 is a lists of packages
are required to support different NS-3 options and applications(“Installation -
Nsnam,” 2015).
Fig.4.1 (Galpo, 2015b)
13. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
13
These packages have different roles and are required by NS-3 to run applications
and options. These are some explanation why these packages are needed for the
project requirement. This packages include the installation of qt4 development tools
which is required and needed for NetAnim animator. Mercurial needs to work with
NS-3 development repositories. Bazaar is needed for running python bindings. A
debugging and reading pcap packet traces packages which is important for the
project as the traffic between the network will be traced using Wireshark software
which reads pcap files are installed. For flex lexical analyser and bison parser
generator a network simulation cradle package is needed. To be able to experiment
with virtual machines an lxc(Linux container) package is installed. These packages
also includes GTX-based configuration system, doxygen related inline
documentation, ns-3 manuals and tutorials, Support for openflow module, Support
for Gustavo Carniero's NS-3-pyviz visualizer and MPI-based distributed
emulation(“Installation - Nsnam,” 2015).
After the prerequisite packages are installed, the NS-3 file had to be installed. There
are few ways of installing NS-3, through Bake, or using Mercurial repositories on the
server http://code.nsnam.org or through Tarball. Due to its simplicity, the team has
decided to go through installing NS-3 using Tarball. This process made simpler
because the process has been pre-packaged for us. All that was needed was to pick a
release package, download it and decompress it. Fig.4.2. shows the line of
commands that are needed to download and install NS-3 into the computer.
Fig.4.2.(Galpo, 2015c)
The 'cd' command takes us to the home directory. Then 'mkdir' command lets us
create a folder named tarballs. For NS-3 to be installed inside the tarballs folder,
putting in 'cd tarballs' get us inside tarballs folder. 'wget' downloads the latest NS-3
release and 'tar' command decompresses the downloaded file and installs NS-3
which in this case is NS-3.22 the latest release of NS-3 network simulator.
Building NS-3 is the next step to progress and completely ustilise the network
simulator. Fig.4.3. shows the line of command needed to build NS-3 with build.py
under ns-all-inone-3.22 folder. It also enables examples and tests as they are not built
by default in NS-3.
14. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
14
Fig.4.3.(Galpo, 2015d)
This build.py program will get the NS-3 project configured in the most useful way.
This program is also responsible for building all available modules. As a result of the
build.py working and all examples and test have been rightly configure a display
message will show up on the terminal similar to Fig.4.4.
Fig.4.4.(Galpo, 2015e)
NetAnim Installation and Usage:
This section provides the steps taken to install NetAnim, an offline animator based
on the Qt toolkit. It animates a network using an XML trace file produced during
building a NS-3 code(.cc file) (“NetAnim - Nsnam,” 2015).
Fig.4.5. shows the line of commands to enable NetAnim on NS-3.
Fig.4.5.(“NetAnim - Nsnam,” 2015)
15. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
15
The 'hg clone' command downloads NetAnim from NS-3 official website. NetAnim
version 3.106 is downloaded as this is the version that will work with the current
NS-3.22 software. After the commands have been entered it will create and
executable file named "NetAnim" in the directory. "./NetAnim" command will start
the application. Fig.4.6. shows the NetAnim application when starts.
Fig.4.6.(Galpo, 2015f)
For the topology.cc file to generate an XML file by using "AnimationInterface anim
(Topology.xml)" line of code was added into it also the nodes are set into position by
using "anim.SetConstantPosition (Node.get(n), x.x. , y.y) ". This XML file is then
loaded from the NetAnim simulator. Fig.4.7 shows the lines of code set to generate
XML file and set node positions.
Fig.4.7. (Galpo, 2015g)
16. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
16
NS-3 Logical Topology and Code (.cc File):
A valid logical diagram is needed for the project to start. This is the first important
bit of the project as there will be a logical image of how the simulated network
should work. Under Fig.4.8. is the logical topology of the project.
Fig.4.8.(Galpo, 2015a)
There are two main nodes in which are connected via point-to-point connection. One
side of the connection there are four servers. On the other side are clients. The idea is
to have a network simulator according to the logical diagram. The point-to-point
connection communicate via TCP protocol for streaming to work. As we were not
able to create an NS-3 base code for this project due to the lack of experience in C++
we were given a topology.cc code to start with. The topology.cc code was then
modified to be able to generate an XML file for us to load it into NetAnim to be able
to visually see the servers and client communicating with each other.
17. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
17
Fig.4.9.(Galpo, 2015h)
Fig.4.9 shows NetAnim animation of topology.cc. As seen the packets sent on each
nodes are displayed as arrows. These packets are also stored within the XML file
with the details of each node. These details include IP addresses and MAC addresses
of each node. Although this is not the project scope this animation provides good
information on how the server and client should communicate with each other.
Fig.4.10. shows a diagram of how the packets were sent between the nodes.
18. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
18
Fig.4.10 (Galpo, 2015i)
Solution Implementation 1: Using Physical computers as Real Nodes:
Although NetAnim has showed the animation the real project requirement was to
have an application running on the server and sending over an MPEG-DASH file
format throughout the network. This can only be done if the nodes are actually real
network nodes and are connected using a simulated network. To be able to attach
'real nodes' to NS-3 simulator a special function is needed in the code which is called
Tapbridge. Tapbridge primary purpose is to integrate "real" internet hosts
(Computers that support Tun/Tap devices) into NS-3 simulations(Doxygen, 2015).
Tapbridge works by attaching itself to the actual device in this case the network
cards set up on the host machine.
Fig.4.11(Galpo, 2015j)
Basically, there are three PC's set up for this. On the left side of Fig.4.11 is the server
PC its main function is to act as a Web server. Apache Web server is installed on this
PC with IP address set to static to be able to communicate to Host Machine. On the
right side of the diagram is the client PC. It has VLC player installed on the PC to
play the video stream sent by the server. As for the Host Machine it will have two
19. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
19
added network card each card connects to different PC in this case one for the server
and one for the client. The Host Machine has only one function, it is to run
topology.cc code to simulate a network between Server and Client. The topology.cc
has been modified adding the Tap Bride helper model class into each of the node.
Since there are four servers and four clients created by the code we attached one tap
bridge model to one of the client and one of the servers.
There are three types of TapBridge modes, TapBridge ConfigureLocal Mode,
TapBridge UseLocal Mode and TapBridge UseBridge Mode. We used TapBridge
UseBridge Mode is the best suitable TapBridge for this project as we can configure
the Bridges with their own interface since we have two different network card
interfaces it will be ideal to create a bridge attach the corresponding network
interface onto the appropriate bridge. There are two bridges set up using the 'brtcl
addbr' command. The interfaces are then loaded into the bridge using 'tunctl'
command. Fig.4.12 illustrates how bridges work.
Fig.4.12(Galpo, 2015k)
So basically the interface is 'loaded' into the bridge. The PC knows which interface it
is as the MAC address is called out in the third command line. The interface IP
address does not matter anymore as it will 'inherit' the bridge IP Address. The same
in the client side the network interface will be put into a bridge called 'Clientbridge'
with an IP address of 192.168.1.2. This set-up is configured in the terminal and the
user has to be super user which 'sudo' is for as configuration needs to have admin
privileges.
20. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
20
To be able to tell the computer what is going on, the topology.cc file has to be
modified adding the TapBridgeHelper method. Fig.4.13. illustrates the lines of code
added into topology.cc to let the PC know what is going on during building
simulation.
Fig.4.13(Galpo, 2015l)
The mode is set to UseBridge as it is the required mode to use bridges and device
name of Clientbridge as it was set up into that name. The last line of code indicates
that the node 0 which is one of the derNodes created by the simulator is where the
device is attached. A 'device' is created and installed into the node within the code
which is why both csmaNodes and csmaDevices have to be called.
Fig.4.14(Galpo, 2015m)
Fig.4.14 shows the bit of code to install Tapbridge into a server node. The tapbride
code is located just after the remote server have been set because if the code was put
before it the tapbridge code will not recognise where the derDeviceAdjacencyList is
21. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
21
created. For the server side derNode 1 and derDeviceAdjacencyList is chosen to be
the acting server for this project.
After the modifications on the code have been finalised and the bridges have been
configured it is time to connect both server PC and client PC to the host PC. Using a
cross-over cable as the network card interfaces are quite old. Static IP addresses are
set into both server and client. Server being set with IP address 192.168.1.1 and the
client being set with IP address 192.168.1.2. Both of PC have a subnet mask of
255.255.255.255. On the host machine the IP address of the interfaces are also been
set to static, the same IP address to where the interface is connected. Both server and
client are able to ping host PC but should unable to ping each other as the
topology.cc will act as a connection between them. The terminal has to be opened,
the topology.cc is ran through using the "./waf --run topology" command. This will
then open up the connection between server and client. Apache web server will run
on the server side and will stream an MPEG-DASH format file over the simulated
network. The client should be able to access the streamed video file and play it
through VLC player installed on the client. A pcap file will be generated while the
simulation is running. This pcap file is then opened using Wireshark and packets are
then analysed. There should be a three-way handshake between the two PCs as the
protocol used in this network simulation is TCP.
Solution Implementation 2: Using Virtual machine(LXC) as Real Nodes:
Implementation of the first proposed solution was to connect two physical
computers into a host machine and run the simulated within the host machine. In
this solution implementation there is only one computer being used throughout.
This have a great advantage over the first solution as it will not take as much time
setting this up as the configurations are not destroyed until a 'destroy/delete'
command is implemented in the terminal.
Ubuntu operating system can support virtual machine manipulation. There are a lot
of types of virtual machine software that could be installed in Ubuntu. We are
dealing particularly on one specific virtual machine tool software which is called
Linux Containers. LXC is an API and tool that lets the user create and manage
systems or application containers(“Linux Containers - LXC - Introduction,” 2015).
Here containers will act like the PC's on the first proposed solution. The left
container will act as a server and the right container will act as a client.
NS-3 Setting up LXC containers:
The first step of this proposed solution is to get the Linux container tools(lxc) into the
computer system(Craigdo and Vedranm, 2013). Doing this will require a command
22. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
22
line typed into the terminal and super user privileges('sudo command before the
download command line'). Fig.4.15. shows the command line needed to download
and install linux containers into the computer with Ubuntu based systems.
Fig.4.15.(Galpo, 2015n)
To explain how LXC containers and the simulation works, Fig.4.16. shows a simple
diagram of the network.
Fig.4.16.(Galpo, 2015o)
Based on the diagram two containers have to be created. The left side of the diagram
is the server. Apache Web server application runs on the container. On the right side
23. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
23
of the diagram is the Client, VLC player application will be running and will be
playing the MPEG-DASH video format. TapBridgeHelper will act as the 'connector'
between the base code (topology.cc simulation) and the lxc containers. Bridge is set-
up for the TapBridgeHelper to work.
Now to set-up containers, some checks have to be done on the TapBridge
configuration files. These file are located under src/Tapbridge/examples/lxc-
left.conf. This file is a configuration that is shown in diagram Fig.4.16 as 'veth' where
a network stack is created, a peer network device is created with one side assigned
to the container and the other on the bridge specified by the lxc.network.link
(Craigdo and Vedranm, 2013). The bridge and the lxc.network.link name have to
match. Fig.4.17. shows the configurations inside lxc-left.conf.
Fig.4.17.(Galpo, 2015p)
As shown in Fig.17. br-left is set as the lxc.network.link which means when setting
up the bridges the names have to match what the lxc.network.link is set up as. In this
case br-left for server and br-right for the client. Fig.4.18. shows the commands to set
up the bridges which is done in the terminal with super user privilege.
Fig.4.18.(Galpo, 2015q)
The bridges are referenced to the conf files, these bridge will act as "signal paths" to
get packets in and out of the containers. Tap devices are then created to get packets
from the bridges into its process. Fig.4.19. shows the command lines for setting up
the Tap devices. The names of the Tap devices are set to left and right to make it
convenient for us.
Fig.4.19.(Galpo, 2015r)
24. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
24
Before the Tap devices are added to their corresponding bridges, IP addresses have
to be set to 0.0.0.0 and 'up' to activate the interfaces. Fig.4.20. shows the command
lines needed for this set up.
Fig.4.20.(Galpo, 2015s)
Once the Tap devices are up and configured. They are then added to their
corresponding bridges. Tap-right added into br-right and tap-left added into br-left.
The bridges are then assigned with IP addresses and activated using the 'up'
command. Fig.4.21 shows the command lines for this set up.
Fig.4.20.(Galpo, 2015t)
To make sure that bridges are up and running 'sudo brctl show' command will show
information about the bridges. Fig.4.21. displays both br-left and br-right
information.
Fig.4.21.(Galpo, 2015u)
At this current configuration only STP and ARP traffic is allowed to flow accross the
bridges, because of this the whole simulation will not work and to avoid this issue
kernel has to have ethernet filtering disabled. Fig.4.22. shows the commands needed
to fix this issue.
Fig.4.22.(Galpo, 2015v)
After the ethernet filtering has now been disabled in the kernel. It is time to create
containers. Fig.4.23. shows the commands to create containers. First container
created is the left side which will act as the server and the right side is created after
25. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
25
to act as the client. To determine if the containers have been created 'sudo lxc-ls' will
show a list of containers that have been created in the computer. Note that the
containers will remain in the computer until they are destroyed using 'sudo lxc-
destroy -n *container name*' command.
Fig.4.23.(Galpo, 2015w)
After creating the containers it is then ideal to test and simulate the topology.cc file.
before that some check has to be done on the containers to see if they have been set
up properly. To run a container the command 'sudo lxc-start -n *container name*'
has to be typed into the terminal. Fig.4.24. displays the network interface
configurations on both left and right containers. As you can see on the diagram left
containers IP address has been set to 10.0.0.1 and the right containers IP address is
configured to 10.0.0.2. This shows that the containers have been configured perfectly.
Both containers should not be able to ping each other yet as the simulation has not
been ran. This is why a third terminal is opened. This terminal sole purpose is to
simulate topology.cc. Once the code as been ran and simulated with no errors both
the containers should be able to ping each other.
Fig.4.24. (Galpo, 2015x)
Before the simulation is ran the topology.cc file has to be modified. TapbridgeHelper
is added on the nodes the same modifications made on proposed solution 1,
although there is a slight changed in DeviceName which are going to be changed
into br-left for the derNode and br-right for the csmaNode.
26. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
26
Fig.4.25. shows the additional piece of code that is needed for the computer to know
what is going on. The TapbridgeHelper identifies which of the bridges is used and
attach it to the simulation.
Fig.4.25. (Galpo, 2015y)
Now to run the topology.cc simulation 'sudo ./waf --run Topology' command is
used. If there are no errors both left and right containers should be able to ping each
other. Once they are pinging and working the lxc container on the left needs to have
an apache server installed and running while the right container has to have a VLC
player installed to be able to play MPEG-DASH video format. The client should have
no problem playing the video once the server has started streaming the video file.
27. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
27
Results and evaluation:
Solution 1 Results and evaluation:
The expected result for this solution was that the Server and Client should be able to
talk to each other. We were able to connect the server to host computer where we
tested the communication between them and it was perfectly fine as we expected.
We set the IP addresses on the server computer to 192.168.1.1 and on the network
interface on host computer to 192.168.1.1 and both were able to ping each other. The
client computer was set up with IP address 192.168.1.2 and on the host interface
192.168.1.2 was also set. Both pinging as expected result. Although at the start we
tested if the connection between them will work using straight through cable and the
result were expected that it will fail as the network card interfaces are quite old and
do not have the capabilities to know that it is the same type of device that it was
connected into.
Physically setting up the computers is the easy part. The hardest part was to
communicate and build the topology.cc to simulate a network and connected both
server and client using NS-3 simulator. This was very tricky as the topology.cc was
hard to understand due to the team lack of C++ programming skills. We managed to
install TapBridgeHelper onto one of the csmaNodes on the client side of the
simulation and we had issues having to attach/install TapBridgeHelper onto one of
the derNodes on the server side of the topology. We were unable to figure out how
to do it so we were not able to simulate a network on host machine.
As topology.cc was too complicated for us to use to simulate a network on both
machines, we tried to just create two nodes with point-to-point connection and
attach TapBridgeHelper on each node. One acting as a server and on the other a
client. Although we made a much simpler code we were unable to execute it
properly. We weren't good enough C++ programmers to be able to create and
implement the intended simplified code. We carried out a lot of tests including using
examples on the NS-3 tutorials. We modified first.cc sample code and attach
TapBridgeHelper onto each nodes but unable to find a solution of the build errors.
Overall, this proposed solution was too difficult for us to implement. Although we
tried as much as we did we were unable to manufacturer the expected results of this
proposed solution. We reached a point of setting up the computers and establish a
connection to the host computer but unable to execute the NS-3 network simulation.
The advantage of this solution is that when it is up and running there will be no
issue on running applications on the server side and client side as they are on their
own. Installing Apache web server on the server computer would have been straight
forward enough and while the simulation is working we would have been able to
28. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
28
stream the video and watch it on the client side on the VLC player. Also during the
streaming we would have been able to capture the packets being sent between two
machines using Wireshark.
Although we had some programming background it was not enough for us to
implement and create our own NS-3 simulation code. We were able to ping both
machine within the host but it was not using NS-3 simulation, it was through setting
up a bridge connection using terminal. This test was done for us to determine there
are no issues on the host machine and the issue was on the code itself. Although we
were not able to execute this solution we were able to learn during this time and
found that virtual machine could be the solution we are looking for hence, finding
proposed solution 2 which is dealing with Linux containers.
Solution 2 Results and evaluation:
This solution was found due to the fact that we were unable to execute the first
proposed solution. As we were unable to connect both physical machines we have
now moved on to virtual machines within Ubuntu OS. The setting up of the
containers were straight forward through the help of HOWTOs instructions created
by NS-3 developers. Before topology.cc was ran to simulate a network connection
between two containers it was ideal to test the vitual-tap-csma.cc file under
Tapbridge/examples folder. This test was to evaluated and understand what the
TapBrigdeHelper does and to create a connection between the two Linux containers.
The result of the test was as expected on the HOWTO instruction that both Linux
containers will be able to ping each other as long as the simulation is running
uninterrupted.
After a successful test on establishing connection between the containers with the
use of the example code from the TapBridge/example folder it was time to move on
and modify the topology.cc code and attach the TapBridgeHelper accordingly and
run the simulation. The topology.cc code was modified by adding a
TapBridgeHelper attaching it to one of the csmaNodes and one on the derNodes. A
test has then ran over and the topology.cc was ran using './waf --run' command and
the test failed as the error stated that it cannot attach itself to one of the derNode
devices that have been created. This error was due to the fact that the server nodes
and devices are created in a loop, therefore the TapBridgeHelper conditions we not
met. After doing some research we were unable to find a solution for this so in this
case we tried a different approach to the issue. Instead of installing the TapBridge
into the derNodes we changed it to attach itself to one of csmaNodes. So both
TapBridge are now attached on two csmaNodes. The simulation ran perfectly with
the containers able to ping with each other.
29. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
29
Right after containers have established a connection we tried to install an Apache
web server application on one of the containers. Due to the fact that the containers
were configured to have their own separate network from the host machine it was
not possible to install Apache on server container as it cannot download the
packages to install Apache web server. On the client side VLC player was also not
installed because of this issue we were not able to stream a video over the network.
We did a lot of research and we were not able to find a solution for this issue. It is
possible to install an application on Linux containers but it was hard for us to find
how due to the fact that we lack knowledge on Linux operating systems. Unable to
produced the right command lines to set up the Linux container to be able to transfer
Apache package from the host machine into the container we were forced to
conclude that this proposed solution was unsuccessful.
Linux container have its disadvantages. As when setting up the containers the IP
addresses were set to static meaning they were on their own separate network. They
were unable to establish a connection to the internet. Therefore, the containers were
unable to install the applications needed to stream the video data and the web
player. Also Linux container lack Graphics User Interface (GUI), due to this it made
it twice as hard to implement the proposed solution.
Overall, this proposed solution had the right path up until the part of installing the
applications needed for the video streaming. We did have experience in dealing with
Linux Operating systems before but it was not enough for us to implement and
execute the project proposed solutions.
30. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
30
Conclusion:
Overall, over the past weeks of research and implementing solutions we were unable
to meet the goals of the project. Due to our lack of knowledge in Linux and C++
programming we were unable to fully implement the solutions of the project. On the
simulation side NS-3 seems to have issues with different machines. I have noticed
that when we installed NS-3 on three computers one did not build properly. This has
been the issue at the start of the project. We did not have the proper computers at the
start until we transferred to the project lab which is an upgrade on the last
computers we had. The process of installing NS-3 and Ubuntu took way too much
time for us and there is not much materials online that really helped us on
understanding the simulator. Since NS-3 uses C++ programming we struggled on
understanding the programs and tutorial that is why we were unable to make our
own code to build a network simulator. There was not enough video material that
would explain to us how to be able to create a small server/client connection using
NS-3 that is why we struggled. NS-3 Documentations are very nicely written and
explained a lot of materials but we just did not have enough knowledge to
understand, implement and troubleshoot the errors we were having within NS-3.
Although the project was a struggle it was rewarding to see some of the results we
had during the implementation of the project specially during the NetAnim
animation showed how the topology.cc works and how they communicated with
each other. I learned more about Linux based operating systems throughout the
project. It helped me learn how to bridge connections on Ubuntu which was very
useful. The project helped improved my knowledge on using the command line
terminal. I was able to use the basic command lines that were thought to us during
on the operating systems module. Also I felt that the time was an issue during this
project as there are so many things that could have been accomplished if we would
have been given more time.
Finally, although we did not meet the project goals it was very rewarding for me to
have learned that there are a lot of network related technologies that I have yet to
learn. This project was an eye opening and will therefore be helping me in the near
future in terms of project management, documentation of reports, troubleshooting
and research. In the future I would eventually want to see this project taken over
again and hopefully to have met the project goals.
31. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
31
References:
Broadband Access in the 21st Century: Applications, Services, and Technologies
[WWW Document], n.d. . Cisco. URL
http://cisco.com/c/en/us/solutions/collateral/service-provider/service-
provider-strategy/white_paper_c11-690395.html (accessed 4.12.15).
Craigdo, Vedranm, 2013. HOWTO Use Linux Containers to set up virtual networks -
Nsnam [WWW Document]. URL
https://www.nsnam.org/wiki/HOWTO_Use_Linux_Containers_to_set_up_
virtual_networks (accessed 5.14.15).
Discover MPEG [WWW Document], 2015. URL http://mpeg.chiariglione.org/about
(accessed 5.22.15).
Dowell, C., 2010. HOWTO make ns-3 interact with the real world - Nsnam [WWW
Document]. URL https://www.nsnam.org/wiki/HOWTO_make_ns-
3_interact_with_the_real_world (accessed 5.11.15).
Doxygen, 2015. NS-3: Tap Bridge Model [WWW Document]. URL
https://www.nsnam.org/docs/release/3.9/doxygen/group___tap_bridge_
model.html (accessed 5.13.15).
FAQ | HTTP Dynamic Streaming [WWW Document], 2015. URL
http://www.adobe.com/ie/products/hds-dynamic-streaming/faq.html
(accessed 5.11.15).
Galpo, A., 2015a. Project Logical Topology Diagram.
Galpo, A., 2015b. NS-3 Packages.
Galpo, A., 2015c. NS-3 Tarball Installation.
Galpo, A., 2015d. NS-3 Build.py.
Galpo, A., 2015e. NS-3 Build.py Display Message.
Galpo, A., 2015f. NetAnim Application display.
Galpo, A., 2015g. NetAnim Generate XML and Set node position code.
Galpo, A., 2015h. NetAnim Topology.cc Animation.
Galpo, A., 2015i. NetAnim Topology.cc Packet Animation.
Galpo, A., 2015j. TapBridge Network Diagram.
Galpo, A., 2015k. TapBridge Bridge Set up.
Galpo, A., 2015l. TapBridge Client side code.
Galpo, A., 2015m. Tapbridge Server code.
Galpo, A., 2015n. NS-3 LXC Download and Install command.
Galpo, A., 2015o. NS-3 LXC Diagram.
Galpo, A., 2015p. LXC lxc-left.conf Code.
Galpo, A., 2015q. LXC Bridge command lines.
Galpo, A., 2015r. LXC Tap command line.
Galpo, A., 2015s. LXC Interface IP setup and activation.
Galpo, A., 2015t. LXC Bridges IP address set up and activate.
Galpo, A., 2015u. LXC Bridge show bridge command display.
Galpo, A., 2015v. LXC ethernet filtering disabled.
Galpo, A., 2015w. LXC creating container commands.
Galpo, A., 2015x. LXC left and right display configuration.
Galpo, A., 2015y. LXC TapbridgeHelper Code.
32. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
32
Installation - Nsnam [WWW Document], 2015. URL
https://www.nsnam.org/wiki/Installation (accessed 5.12.15).
Introduction [WWW Document], 2014. URL
https://developer.apple.com/library/ios/documentation/NetworkingIntern
et/Conceptual/StreamingMediaGuide/Introduction/Introduction.html
(accessed 5.22.15).
Khan, A., 2014. The Doctor Will Skype You Now - US News [WWW Document]. US
News World Rep. URL http://health.usnews.com/health-news/patient-
advice/articles/2014/08/06/the-doctor-will-skype-you-now (accessed
4.12.15).
Linux Containers - LXC - Introduction [WWW Document], 2015. URL
https://linuxcontainers.org/lxc/introduction/ (accessed 5.14.15).
NetAnim - Nsnam [WWW Document], 2015. URL
https://www.nsnam.org/wiki/NetAnim (accessed 5.13.15).
Ozer, J., 2011. What is Adaptive Streaming? - Streaming Media Magazine [WWW
Document]. Streaming Media Mag. URL
http://www.streamingmedia.com/Articles/Editorial/What-Is-.../What-is-
Adaptive-Streaming-75195.aspx (accessed 5.11.15).
Protalinski, E., n.d. Netflix First in North American Internet Traffic, Doubles in
Mobile [WWW Document]. Web. URL
http://thenextweb.com/insider/2013/05/14/sandvine-netflix-owns-one-
third-of-north-american-traffic-at-peak-has-doubled-its-mobile-share-in-12-
months/ (accessed 4.12.15).
Rovcanin, L., Muntean, G.-M., 2013. A DASH-based Performance-oriented Adaptive
Video Distribution Solution.
Smooth Streaming : The Official Microsoft IIS Site [WWW Document], 2015. URL
http://www.iis.net/downloads/microsoft/smooth-streaming (accessed
5.22.15).
The Zettabyte Era—Trends and Analysis [WWW Document], 2014. . Cisco. URL
http://cisco.com/c/en/us/solutions/collateral/service-provider/visual-
networking-index-vni/VNI_Hyperconnectivity_WP.html (accessed 4.12.15).
Tutorial [WWW Document], 2015. URL
https://www.nsnam.org/docs/release/3.23/tutorial/singlehtml/index.html
(accessed 5.22.15).
Welcome! - The Apache HTTP Server Project [WWW Document], 2015. URL
http://httpd.apache.org/ (accessed 5.15.15).
What is Adaptive Bitrate Streaming? | Encoding.com HelpEncoding.com Help
[WWW Document], 2014. URL http://help.encoding.com/knowledge-
base/article/what-is-adaptive-bitrate-streaming/ (accessed 5.11.15).
What is ns-3 « ns-3 [WWW Document], n.d. URL
https://www.nsnam.org/overview/what-is-ns-3/ (accessed 5.11.15).
39. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
39
}
// end flow monitor
int
main (int argc, char *argv[])
{
GlobalValue::Bind ("SimulatorImplementationType", StringValue
("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
PacketMetadata::Enable ();
LogComponentEnable ("DashSimulation", LOG_LEVEL_ALL); // prints
simulation messages
//LogComponentEnable ("TcpL4Protocol", LOG_LEVEL_INFO);
//LogComponentEnable ("TcpSocketImpl", LOG_LEVEL_ALL);
//LogComponentEnable ("PacketSink", LOG_LEVEL_ALL);
//LogComponentEnable ("TcpDashHost", LOG_LEVEL_ALL);
//LogComponentEnable ("TcpSocketBase", LOG_LEVEL_ALL);
// Set up some default values for the simulation.
/* Config::SetDefault ("ns3::TcpEchoClientApplication::PacketSize",
UintegerValue (183));
// Config::SetDefault ("ns3::TcpEchoClientApplication::Interval", TimeValue
(Seconds (1.0)));
Config::SetDefault ("ns3::TcpEchoClientApplication::MaxPackets",
UintegerValue (1));*/
uint32_t N = 3;
uint32_t nCsma = 3;// 20; //nCsma-1 learners
std::string trFile = "video"; //TCP dump, trace file
std::string tcpType = "Reno"; // TCP type
//std::string tcpType = "Tahoe"; // TCP type
40. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
40
// bool enableFlowMonitor = true;
// bool bgTraffic = false;
// Set up command line parameters used to control the experiment.
// Allow the user to override any of the defaults and the above
// Config::SetDefault()s at run-time, via command-line arguments
CommandLine cmd;
cmd.AddValue ("nCsma", "Number of "extra" CSMA nodes/devices",
nCsma);
cmd.AddValue ("nNodes", "Number of Servers", N);
cmd.Parse (argc, argv);
// Set the TCP Socket Type
Config::SetDefault ("ns3::TcpL4Protocol::SocketType",
TypeIdValue(TypeId::LookupByName ("ns3::Tcp" + tcpType)));
nCsma = nCsma == 0 ? 1 : nCsma;
// Create 2 nodes.
NS_LOG_INFO ("Create nodes.");
NodeContainer p2pNodes;
p2pNodes.Create (2);
// Createl LAN nodes
NodeContainer csmaNodes;
csmaNodes.Add (p2pNodes.Get (1)); // on the local network
csmaNodes.Create (nCsma);
// reate proxy node
NodeContainer proxyNode;
proxyNode.Add (p2pNodes.Get (0)); // proxy
// crate Remote Host nodes
NodeContainer derNodes;
derNodes.Create (N);
41. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
41
//Collect an adjacency list of nodes for the p2p topology
std::vector<NodeContainer> derAdjacencyList (N);
// std::vector<NodeContainer> learnerAdjacencyList (M);
for(uint32_t i=0; i<derAdjacencyList.size (); ++i)
{
derAdjacencyList[i] = NodeContainer (proxyNode, derNodes.Get (i));
}
// crexate the channels without any IP addressing information
NS_LOG_INFO ("Create channels.");
PointToPointHelper p2p;
// set local routers
p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
p2p.SetDeviceAttribute ("Mtu", UintegerValue (1500));
NetDeviceContainer p2pDevices;
p2pDevices = p2p.Install (p2pNodes);
//std::cout << "MTU P2P " << p2pNodes.Get(0)->GetDevice(0)->GetMtu() <<
std::endl;
NS_LOG_INFO("MTU P2P " << p2pNodes.Get(0)->GetDevice(0)->GetMtu());
//set local network
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));
NetDeviceContainer csmaDevices;
csmaDevices = csma.Install (csmaNodes);
// Use the TapBridgeHelper to connect to the pre-configured tap devices for
42. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
42
// the left side. We go with "UseBridge" mode since the CSMA devices
support
// promiscuous mode and can therefore make it appear that the bridge is
// extended into ns-3. The install method essentially bridges the specified
// tap to the specified CSMA device.
TapBridgeHelper tapBridge;
tapBridge.SetAttribute ("Mode", StringValue ("UseBridge"));
tapBridge.SetAttribute ("DeviceName", StringValue ("tap-left"));
tapBridge.Install (csmaNodes.Get (0), csmaDevices.Get (0));
// set remote Servers
TimeValue val (Time("0ms"));
std::vector<NetDeviceContainer> derDeviceAdjacencyList (N);
for(uint32_t i=0; i<derDeviceAdjacencyList.size (); ++i)
{
std::ostringstream delaySt;
delaySt << 15 + (i) * 35 << "ms";
std::ostringstream dataRate;
dataRate << 15 - (i) * 3 << "Mbps";
val.Set(Time(delaySt.str())); // required for delays
p2p.SetDeviceAttribute ("DataRate", StringValue (dataRate.str()));
p2p.SetDeviceAttribute ("Mtu", UintegerValue (1500));
p2p.SetChannelAttribute ("Delay", val);
derDeviceAdjacencyList[i] = p2p.Install (derAdjacencyList[i]);
//csmaDevices = csma.Install (csmaNodes);
//std::cout << "MTU P2P " << p2pNodes.Get(0)->GetDevice(0)->GetMtu()
<< std::endl;
}
43. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
43
tapBridge.SetAttribute ("DeviceName", StringValue ("tap-right"));
tapBridge.Install (derNodes.Get (1), derDeviceAdjacencyList[1].Get(1));
// Install network stacks on the nodes
InternetStackHelper internet;
internet.Install (derNodes); // proxy node part of this
internet.Install (p2pNodes.Get (0));
internet.Install (csmaNodes);
// add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
std::vector<Ipv4InterfaceContainer> derInterfaceAdjacencyList (N);
for(uint32_t i=0; i<derInterfaceAdjacencyList.size (); ++i)
{
std::ostringstream subnet;
subnet<<"10.1."<<i<<".0";
NS_LOG_INFO (subnet.str ().c_str ());
ipv4.SetBase (subnet.str ().c_str (), "255.255.255.0");
derInterfaceAdjacencyList[i] = ipv4.Assign (derDeviceAdjacencyList[i]);
}
// local routers
ipv4.SetBase ("10.1.150.0", "255.255.255.0");
Ipv4InterfaceContainer p2pInterfaces;
p2pInterfaces = ipv4.Assign (p2pDevices);
// local nodes
ipv4.SetBase ("10.1.200.0", "255.255.255.0");
Ipv4InterfaceContainer csmaInterfaces;
csmaInterfaces = ipv4.Assign (csmaDevices);
//Turn on global static routing
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
44. NS-3 Test bed for MPEG-DASH Evaluation
Anthony Galpo
DT080A/3
Page
44
NS_LOG_INFO("Create Learner Application.");
uint16_t port = 50001;
// Create the OnOff applications to send TCP to the servers
OnOffHelper clientHelper ("ns3::TcpSocketFactory", Address ());
clientHelper.SetAttribute ("OnTime", StringValue
("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper.SetAttribute ("OffTime", StringValue
("ns3::ConstantRandomVariable[Constant=0]"));
NS_LOG_INFO ("Create clients.");
//normally wouldn't need a loop here but the server IP address is different
//on each p2p subnet
ApplicationContainer clientApps;
for(uint32_t i=0; i<nCsma; ++i)
{
AddressValue remoteAddress
(InetSocketAddress (derInterfaceAdjacencyList[i].GetAddress (1), port));
clientHelper.SetAttribute ("Remote", remoteAddress);
clientApps.Add (clientHelper.Install (csmaNodes.Get (i)));
}
clientApps.Start (Seconds (1.0));
clientApps.Stop (Seconds (10.0));
NS_LOG_INFO("Create DER Applications.");
// currently all DERs have the same settings
PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", Address ());
ApplicationContainer derApps;
for(uint32_t i=0; i<derInterfaceAdjacencyList.size (); ++i)
{
Address derLocalAddress (InetSocketAddress
(derInterfaceAdjacencyList[i].GetAddress (1), port));