Difference between revisions of "Network Simulation Cradle Integration"

From Nsnam
Jump to: navigation, search
(fix nsc wakeup call description, add ISendCallback)
(update project status.)
Line 8: Line 8:
 
== Limitations ==
 
== Limitations ==
  
The existing porting effort is in a very early stage. At this time, ns3-nsc
+
The existing porting effort is still in an early stage.
is only able to complete a TCP handshake. In particular,
+
ns3-nsc is able to run the tcp-large-transfer example
the ns-3 code is not yet able to detect state
+
that is included in ns-3.
transitions in the nsc TCP connections. This means
+
However, at this time the socket that accepts the
that e.g. the ConnectionSucceeded callback is never scheduled.
+
connection leaks the listen socket and
Another problem is that -- unlike the ns-3 TCP code --
+
nsc-tcp is piggybacked within a ns-3 tcp connection (increasing all packets by 40 bytes).
writes are not queued while in SYN_SENT state. Although
+
the ns-3 queueing mechanism could be adapted without much
+
effort, there are two problems:
+
* the ns3-part is never informed about events, e.g. completion of connect() or incoming connections
+
* the ''listening socket'' would need to call nscSock->accept() once it is informed about an incoming connection to get a new socket to read transmitted data from.
+
 
+
  
 
== NSC API ==
 
== NSC API ==
Line 61: Line 55:
 
== Plan ==
 
== Plan ==
  
* Add required support to allow ns-3 to detect state transitions in NSCs connections.
 
* allow ns-3 to schedule the connectionSucceeded/connectionFailed callbacks
 
* Add required calls to accept() and friends to allow NSC TCP endpoints to ''transmit'' data.
 
* make the tcp-large-transfer example work with ns-3-nsc
 
 
* Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
 
* Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
 +
* allow nsc to use layer2 code directly without having to piggyback data inside ns3-tcp
 
* extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.
 
* extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.
 +
* allow different nodes to use all kinds of nsc stacks in the same simulation.
  
The first step is to get proper trace support to allow easier debugging/testing during development.
 
 
Depending on whats required/requested this project will also extend nsc to support a more
 
Depending on whats required/requested this project will also extend nsc to support a more
 
recent linux kernel release, but this will happen only after the main intergration into ns-3 is complete.
 
recent linux kernel release, but this will happen only after the main intergration into ns-3 is complete.
  
 
== Current Status ==
 
== Current Status ==
A [http://hg.strlen.de/cgi-bin/hgwebdir.cgi/ns-3-nsc/ forward-port] (to a recent version of ns-3-dev) based on Tom Hendersons earlier nsc integration work has been done.
+
The [http://hg.strlen.de/cgi-bin/hgwebdir.cgi/ns-3-nsc/ ns-3-nsc integration repository]
This port also uses the latest nsc release (0.3.0).
+
contains the current status. This port uses the latest nsc release (0.3.0).
 
To ease debugging, PcapWriter::WritePacket was changed to unconditionally skip the
 
To ease debugging, PcapWriter::WritePacket was changed to unconditionally skip the
 
ns-3 TCP/IP header. This allows to load trace files into e.g. wireshark to see
 
ns-3 TCP/IP header. This allows to load trace files into e.g. wireshark to see
 
the 'real' packets sent/received by NSC.
 
the 'real' packets sent/received by NSC.
For reasons outlined above in the [[Network_Simulation_Cradle_Integration#Limitations|Limitations]] section, only the TCP
+
Work on this is ongoing, the current focus is to move all ns-3 glue code off to its own
handshake can be seen at this time.
+
files within src/internet-node (mostly completed):
 +
 
 +
* src/internet-node/nsc-tcp-socket-impl.cc contains ns-3s tcp-socket code, with nsc modifications.
 +
* src/internet-node/nsc-tcp-l4-protocol.cc contains the ns3 tcp-l4 code, with nsc modifications.
  
Full-Time work (starting with trace support) is expected to commence June 1st.
+
At this time, both are essentially copies of their ns-3 counterpart; this makes it easier to
 +
see the actual nsc modifications in diff output; the redundant (and unused) parts will be removed later.
 +
AddInternetStack() has been changed to create a NscTcpL4Protocol() object unconditionally, this is
 +
currently the only major modification to ns-3 code (in fact, removing this modification disables
 +
nsc support).

Revision as of 20:56, 24 May 2008

Network Simulation Cradle Integration

Network Simulation Crade (nsc) is a project to allow real-world network stacks to be used in simulated networks. A porting effort to bring nsc to version 3 of the network simulator was started by Tom Henderson. This Project continues this work and also will update at least the Linux network stack to current git (2.6.26).

Limitations

The existing porting effort is still in an early stage. ns3-nsc is able to run the tcp-large-transfer example that is included in ns-3. However, at this time the socket that accepts the connection leaks the listen socket and nsc-tcp is piggybacked within a ns-3 tcp connection (increasing all packets by 40 bytes).

NSC API

NSC provides its API in the form of a number of classes which are defined in sim/sim_interface.h in the nsc directory.

These are:

INetStack

INetStack contains the 'low level' operations for the operating system network stack, e.g. in and output functions from and to the network stack (think of this as the 'network driver interface'. There are also functions to create new TCP or UDP sockets.

ISendCallback

This is called by NSC when a packet should be sent out to the network. This simulator should use this callback to re-inject the packet into the simulator so the actual data can be delivered/routed to its destination, where it will eventually be handed into Receive() (and eventually back to the receivers NSC instance via INetStack->if_receive() ).

INetStreamSocket

This is the structure defining a particular connection endpoint (file descriptor). It contains methods to operate on this endpoint, e.g. connect, disconnect, accept, listen, send_data/read_data, ...

IInterruptCallback

This contains the wakeup callback, which is called by NSC whenever something of interest happens. Think of wakeup() as a replacement of the operating systems wakeup function: Whenever the operating system would wake up a process that has been waiting for an operation to complete (for example the TCP handshake during connect()), NSC invokes the wakeup() callback to allow the simulator to check for state changes in its connection endpoints.


Plan

  • Integrate nsc into ns-3 without circumventing ns-3s tcp/ip infrastructure
  • allow nsc to use layer2 code directly without having to piggyback data inside ns3-tcp
  • extend ns-3 API so users can create "Linux-Nodes", "FreeBSD-Nodes", etc.
  • allow different nodes to use all kinds of nsc stacks in the same simulation.

Depending on whats required/requested this project will also extend nsc to support a more recent linux kernel release, but this will happen only after the main intergration into ns-3 is complete.

Current Status

The ns-3-nsc integration repository contains the current status. This port uses the latest nsc release (0.3.0). To ease debugging, PcapWriter::WritePacket was changed to unconditionally skip the ns-3 TCP/IP header. This allows to load trace files into e.g. wireshark to see the 'real' packets sent/received by NSC. Work on this is ongoing, the current focus is to move all ns-3 glue code off to its own files within src/internet-node (mostly completed):

  • src/internet-node/nsc-tcp-socket-impl.cc contains ns-3s tcp-socket code, with nsc modifications.
  • src/internet-node/nsc-tcp-l4-protocol.cc contains the ns3 tcp-l4 code, with nsc modifications.

At this time, both are essentially copies of their ns-3 counterpart; this makes it easier to see the actual nsc modifications in diff output; the redundant (and unused) parts will be removed later. AddInternetStack() has been changed to create a NscTcpL4Protocol() object unconditionally, this is currently the only major modification to ns-3 code (in fact, removing this modification disables nsc support).