A Discrete-Event Network Simulator
API
OpenFlow 1.3 software switch

This section documents the API of the ns-3 OpenFlow 1.3 compatible switch and controller interface. More...

Classes

struct  ns3::OFSwitch13Controller::BarrierInfo
 Structure to save barrier metadata used by the controller interface. More...
 
struct  ns3::OFSwitch13Controller::EchoInfo
 Structure to save echo request metadata used by the controller interface. More...
 
class  ns3::OFSwitch13Controller
 OpenFlow 1.3 controller base class that can handle a collection of OpenFlow switches and provides the basic functionalities for controller implementation. More...
 
class  ns3::OFSwitch13Device
 An OpenFlow 1.3 device that switches multiple CSMA segments via OpenFlow protocol. More...
 
class  ns3::OFSwitch13DeviceContainer
 Holds a vector of ns3::OFSwitch13Device pointers. More...
 
class  ns3::OFSwitch13ExternalHelper
 This helper extends the base class and can be instantiated to create and configure an OpenFlow 1.3 network domain composed of one or more OpenFlow switches connected to a single external real OpenFlow controller. More...
 
class  ns3::OFSwitch13Helper
 This is a base class that must be extended to create and configure an OpenFlow 1.3 network domain composed of one or more OpenFlow switches connected to single or multiple OpenFlow controllers. More...
 
class  ns3::OFSwitch13InternalHelper
 This helper extends the base class and can be instantiated to create and configure an OpenFlow 1.3 network domain composed of one or more OpenFlow switches connected to a single or multiple internal simulated OpenFlow controllers. More...
 
class  ns3::OFSwitch13LearningController
 An Learning OpenFlow 1.3 controller (works as L2 switch) More...
 
class  ns3::OFSwitch13Port
 A OpenFlow switch port, interconnecting the underlying NetDevice to the OpenFlow device through the OpenFlow receive callback. More...
 
class  ns3::OFSwitch13PriorityQueue
 This class implements the priority queuing discipline for OpenFlow queue. More...
 
class  ns3::OFSwitch13Queue
 The OpenFlow 1.3 queue interface. More...
 
class  ns3::OFSwitch13SocketHandler
 Class used to read/send single OpenFlow message from/to an open socket. More...
 
class  ns3::OFSwitch13StatsCalculator
 This class monitors a single OpenFlow switch device to collect statistics and periodically write them to an output file. More...
 
class  ns3::OFSwitch13Controller::PendingCommands
 Inner class to save pending commands waiting for handshake procedure. More...
 
struct  ns3::OFSwitch13Device::PipelinePacket
 Structure to save packet metadata while it is under OpenFlow pipeline. More...
 
class  ns3::QueueTag
 Tag used to hold the queue id before enqueueing a packet into OFSwitch13Queue. More...
 
class  ns3::OFSwitch13Device::RemoteController
 Inner class to save information of a remote active controller connected to this OpenFlow switch. More...
 
class  ns3::OFSwitch13Controller::RemoteSwitch
 Inner class to save information of a remote active OpenFlow switch connected to this controller. More...
 
class  ns3::TunnelIdTag
 Tag used to hold the tunnel metadata information (tunnel ID) when sending/receiving a packet to/from a logical port device. More...
 

Functions

struct ofpbuf * ns3::BufferFromPacket (Ptr< const Packet > packet, size_t bodyRoom, size_t headRoom=0)
 Create an internal BOFUSS buffer from ns3::Packet. More...
 
void ns3::EnableBofussLog (bool printToFile=false, std::string prefix="", bool explicitFilename=false, std::string customLevels="")
 Enable the logging system of the BOFUSS library. More...
 
Ptr< Packetns3::PacketFromBuffer (struct ofpbuf *buffer)
 Create a new ns3::Packet from internal BOFUSS buffer. More...
 
Ptr< Packetns3::PacketFromMsg (struct ofl_msg_header *msg, uint32_t xid=0)
 Create a new ns3::Packet from internal OFLib message. More...
 

Detailed Description

This section documents the API of the ns-3 OpenFlow 1.3 compatible switch and controller interface.

It follows the OpenFlow 1.3 switch specification https://www.opennetworking.org/sdn-resources/technical-library. It depends on the CPqD BOFUSS software switch available at https://github.com/ljerezchaves/ofsoftswitch13, compiled as a library. Check the manual for tutorials on how to compile and use this module.

Function Documentation

◆ BufferFromPacket()

struct ofpbuf * ns3::BufferFromPacket ( Ptr< const Packet packet,
size_t  bodyRoom,
size_t  headRoom = 0 
)

Create an internal BOFUSS buffer from ns3::Packet.

Takes a Ptr<Packet> and generates a buffer (struct ofpbuf*) from it, loading the packet data as well as its headers into the buffer.

Parameters
packetThe ns-3 packet.
bodyRoomThe size to allocate for data.
headRoomThe size to allocate for headers (left unitialized).
Returns
The OpenFlow Buffer created from the packet.

Definition at line 65 of file ofswitch13-interface.cc.

References ns3::Packet::CopyData(), ns3::Packet::GetSize(), NS_ASSERT, NS_LOG_FUNCTION_NOARGS, and pktSize.

Referenced by ns3::OFSwitch13Device::ReceiveFromController(), ns3::OFSwitch13Controller::ReceiveFromSwitch(), and ns3::OFSwitch13Device::SendToPipeline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnableBofussLog()

void ns3::EnableBofussLog ( bool  printToFile = false,
std::string  prefix = "",
bool  explicitFilename = false,
std::string  customLevels = "" 
)

Enable the logging system of the BOFUSS library.

By default, it will configure de logging system for maximum verbose dump on console. You can set the printToFile parameter to dump messages to file instead.

Parameters
printToFileDump log messages to file instead of console.
prefixFilename prefix to use for log files.
explicitFilenameTreat the prefix as an explicit filename if true.
customLevelsCustom vlog levels mod1[:facility[:level]] mod2[...

Definition at line 31 of file ofswitch13-interface.cc.

◆ PacketFromBuffer()

Ptr< Packet > ns3::PacketFromBuffer ( struct ofpbuf *  buffer)

Create a new ns3::Packet from internal BOFUSS buffer.

Takes a buffer (struct ofpbuf*) and generates a Ptr<Packet> from it, load the data as well as its headers into the packet.

Parameters
bufferThe internal buffer.
Returns
The ns3::Packet created.

Definition at line 103 of file ofswitch13-interface.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::OFSwitch13Device::SendOpenflowBufferToRemote(), and ns3::OFSwitch13Device::SendToSwitchPort().

+ Here is the caller graph for this function:

◆ PacketFromMsg()

Ptr< Packet > ns3::PacketFromMsg ( struct ofl_msg_header *  msg,
uint32_t  xid = 0 
)

Create a new ns3::Packet from internal OFLib message.

Takes a ofl_msg_* structure, pack the message using wire format and generates a Ptr<Packet> from it.

Parameters
msgThe OFLib message structure.
xidThe transaction id to use.
Returns
The ns3::Packet created.

Definition at line 80 of file ofswitch13-interface.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::OFSwitch13Controller::SendToSwitch().

+ Here is the caller graph for this function: