OpenFlow 1.3 controller base class that can handle a collection of OpenFlow switches and provides the basic functionalities for controller implementation. More...
#include "ofswitch13-controller.h"
Classes | |
struct | BarrierInfo |
Structure to save barrier metadata used by the controller interface. More... | |
struct | EchoInfo |
Structure to save echo request metadata used by the controller interface. More... | |
class | PendingCommands |
Inner class to save pending commands waiting for handshake procedure. More... | |
class | RemoteSwitch |
Inner class to save information of a remote active OpenFlow switch connected to this controller. More... | |
Public Member Functions | |
OFSwitch13Controller () | |
Default constructor. More... | |
~OFSwitch13Controller () override | |
Dummy destructor, see DoDispose. More... | |
void | DoDispose () override |
Destructor implementation. More... | |
int | DpctlExecute (uint64_t dpId, const std::string textCmd) |
Execute a dpctl command to interact with the remote switch. More... | |
![]() | |
Application () | |
~Application () override | |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
void | SetStartTime (Time start) |
Specify application start time. More... | |
void | SetStopTime (Time stop) |
Specify application stop time. More... | |
![]() | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static void | DpctlSendAndPrint (struct vconn *vconn, struct ofl_msg_header *msg) |
Overriding BOFUSS dpctl_send_and_print and dpctl_transact_and_print weak functions from utilities/dpctl.c. More... | |
static TypeId | GetTypeId () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
uint32_t | GetNextXid () |
Ptr< const RemoteSwitch > | GetRemoteSwitch (uint64_t dpId) const |
Get the remote switch for this OpenFlow datapath ID. More... | |
virtual void | HandshakeSuccessful (Ptr< const RemoteSwitch > swtch) |
Function invoked after a successfully handshake procedure between this controller and a remote switch. More... | |
void | SendBarrierRequest (Ptr< const RemoteSwitch > swtch) |
Send a barrier request message to switch, and wait for a non-blocking reply. More... | |
void | SendEchoRequest (Ptr< const RemoteSwitch > swtch, size_t payloadSize=0) |
Send an echo request message to switch, and wait for a non-blocking reply. More... | |
int | SendToSwitch (Ptr< const RemoteSwitch > swtch, struct ofl_msg_header *msg, uint32_t xid=0) |
Send a OFLib message to a registered switch. More... | |
void | StartApplication () override |
Application specific startup code. More... | |
void | StopApplication () override |
Application specific shutdown code. More... | |
![]() | |
void | DoInitialize () override |
Initialize() implementation. More... | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Socket callbacks | |||||
Handlers used as socket callbacks to TCP communication between this switch and the controller.
| |||||
typedef std::map< uint32_t, EchoInfo > | EchoMsgMap_t | ||||
Map to store echo information by transaction id. More... | |||||
typedef std::map< uint32_t, BarrierInfo > | BarrierMsgMap_t | ||||
Map to store barrier information by transaction id. More... | |||||
typedef std::map< uint64_t, Ptr< PendingCommands > > | DpIdCmdMap_t | ||||
Map saving pair <datapath id / pending commands> More... | |||||
typedef std::map< Address, Ptr< RemoteSwitch > > | AddrSwMap_t | ||||
Map to store switch info by ip address. More... | |||||
typedef std::map< uint64_t, Ptr< RemoteSwitch > > | DpIdSwMap_t | ||||
Map to store switch info by datapath id. More... | |||||
uint32_t | m_xid | ||||
Global transaction idx. More... | |||||
uint16_t | m_port | ||||
Local controller tcp port. More... | |||||
Ptr< Socket > | m_serverSocket | ||||
Listening server socket. More... | |||||
EchoMsgMap_t | m_echoMap | ||||
Metadata for echo requests. More... | |||||
BarrierMsgMap_t | m_barrierMap | ||||
Metadata for barrier requests. More... | |||||
DpIdCmdMap_t | m_commandsMap | ||||
Commands scheduled for execution. More... | |||||
AddrSwMap_t | m_addrSwMap | ||||
Registered switches by address. More... | |||||
DpIdSwMap_t | m_dpIdSwMap | ||||
Registered switches by datapath id. More... | |||||
bool | SocketRequest (Ptr< Socket > socket, const Address &from) | ||||
TCP request from switch. More... | |||||
void | SocketAccept (Ptr< Socket > socket, const Address &from) | ||||
TCP handshake succeeded. More... | |||||
void | SocketPeerClose (Ptr< Socket > socket) | ||||
TCP connection closed. More... | |||||
void | SocketPeerError (Ptr< Socket > socket) | ||||
TCP connection error. More... | |||||
OpenFlow message handlers | |||||||
Handlers used by HandleSwitchMsg to process each type of OpenFlow message received from the switch. Some (non virtual) handlers can not be overwritten by derived class, as they must behave as already implemented. The current implementation of other virtual handler methods does nothing: just free the received message and returns 0. Derived controllers can override them as they wish to implement the desired control logic. Note that for HandleMultipartReply there are several types of multipart messages. Derived controllers can filter by the type they wish.
| |||||||
ofl_err | HandleEchoRequest (struct ofl_msg_echo *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
ofl_err | HandleEchoReply (struct ofl_msg_echo *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
ofl_err | HandleBarrierReply (struct ofl_msg_header *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
ofl_err | HandleHello (struct ofl_msg_header *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
ofl_err | HandleFeaturesReply (struct ofl_msg_features_reply *msg, Ptr< RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandlePacketIn (struct ofl_msg_packet_in *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleError (struct ofl_msg_error *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleGetConfigReply (struct ofl_msg_get_config_reply *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleFlowRemoved (struct ofl_msg_flow_removed *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandlePortStatus (struct ofl_msg_port_status *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleAsyncReply (struct ofl_msg_async_config *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleMultipartReply (struct ofl_msg_multipart_reply_header *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleRoleReply (struct ofl_msg_role_request *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
virtual ofl_err | HandleQueueGetConfigReply (struct ofl_msg_queue_get_config_reply *msg, Ptr< const RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
ofl_err | HandleSwitchMsg (struct ofl_msg_header *msg, Ptr< RemoteSwitch > swtch, uint32_t xid) | ||||||
Called when an OpenFlow message is received from a switch. More... | |||||||
void | ReceiveFromSwitch (Ptr< Packet > packet, Address from) | ||||||
Receive an OpenFlow packet from switch. More... | |||||||
Ptr< RemoteSwitch > | GetRemoteSwitch (Address address) | ||||||
Get the remote switch for this address. More... | |||||||
Additional Inherited Members | |
![]() | |
typedef void(* | DelayAddressCallback) (const Time &delay, const Address &from) |
Common callback signature for packet delay and address. More... | |
typedef void(* | StateTransitionCallback) (const std::string &oldState, const std::string &newState) |
Common signature used by callbacks to application's state transition trace source. More... | |
![]() | |
Ptr< Node > | m_node |
The node that this application is installed on. More... | |
EventId | m_startEvent |
The event that will fire at m_startTime to start the application. More... | |
Time | m_startTime |
The simulation time that the application will start. More... | |
EventId | m_stopEvent |
The event that will fire at m_stopTime to end the application. More... | |
Time | m_stopTime |
The simulation time that the application will end. More... | |
![]() | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
OpenFlow 1.3 controller base class that can handle a collection of OpenFlow switches and provides the basic functionalities for controller implementation.
Introspection did not find any typical Config paths.
For constructing OpenFlow configuration messages and sending them to the switches, this class uses the DpctlCommand function, which relies on command-line syntax from the dpctl utility. For OpenFlow messages coming from the switches, this class provides a collection of internal handlers to deal with the different types of messages.
No TraceSources are defined for this type.
Size of this type is 360 bytes (on a 64-bit architecture).
Definition at line 44 of file ofswitch13-controller.h.
|
private |
Map to store switch info by ip address.
Definition at line 386 of file ofswitch13-controller.h.
|
private |
Map to store barrier information by transaction id.
Definition at line 380 of file ofswitch13-controller.h.
|
private |
Map saving pair <datapath id / pending commands>
Definition at line 383 of file ofswitch13-controller.h.
|
private |
Map to store switch info by datapath id.
Definition at line 389 of file ofswitch13-controller.h.
|
private |
Map to store echo information by transaction id.
Definition at line 377 of file ofswitch13-controller.h.
ns3::OFSwitch13Controller::OFSwitch13Controller | ( | ) |
Default constructor.
Definition at line 34 of file ofswitch13-controller.cc.
References m_xid, and NS_LOG_FUNCTION.
|
override |
Dummy destructor, see DoDispose.
Definition at line 42 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Destructor implementation.
Reimplemented from ns3::Application.
Reimplemented in ns3::OFSwitch13LearningController.
Definition at line 63 of file ofswitch13-controller.cc.
References ns3::Application::DoDispose(), m_addrSwMap, m_barrierMap, m_commandsMap, m_dpIdSwMap, m_echoMap, m_serverSocket, and NS_LOG_FUNCTION.
Referenced by ns3::TunnelController::DoDispose().
int ns3::OFSwitch13Controller::DpctlExecute | ( | uint64_t | dpId, |
const std::string | textCmd | ||
) |
Execute a dpctl command to interact with the remote switch.
dpId | The OpenFlow datapath ID. |
textCmd | The dpctl command to execute. |
Definition at line 78 of file ofswitch13-controller.cc.
References second::cmd, GetRemoteSwitch(), m_commandsMap, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, and ns3::PeekPointer().
Referenced by QosController::ConfigureAggregationSwitch(), QosController::ConfigureBorderSwitch(), QosController::HandleConnectionRequest(), HandleFeaturesReply(), ns3::TunnelController::HandlePacketIn(), and ns3::TunnelController::HandshakeSuccessful().
|
static |
Overriding BOFUSS dpctl_send_and_print and dpctl_transact_and_print weak functions from utilities/dpctl.c.
Send a message from controller to switch.
vconn | The RemoteSwitch pointer, sent from controller to dpctl_exec_ns3_command function and get back here to proper identify the controller object. |
msg | The OFLib message to send. |
Definition at line 119 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by dpctl_send_and_print(), and dpctl_transact_and_print().
|
protected |
Definition at line 175 of file ofswitch13-controller.cc.
References m_xid.
Referenced by SendBarrierRequest(), SendEchoRequest(), and SendToSwitch().
|
private |
Get the remote switch for this address.
address | The socket address. |
Definition at line 625 of file ofswitch13-controller.cc.
References first::address, m_addrSwMap, NS_ABORT_MSG, and NS_LOG_FUNCTION.
|
protected |
Get the remote switch for this OpenFlow datapath ID.
dpId | The OpenFlow datapath ID. |
Definition at line 187 of file ofswitch13-controller.cc.
References m_dpIdSwMap, and NS_LOG_FUNCTION.
Referenced by DpctlExecute(), and ReceiveFromSwitch().
|
static |
Register this type.
Definition at line 48 of file ofswitch13-controller.cc.
References m_port, ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 467 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protected |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 326 of file ofswitch13-controller.cc.
References m_barrierMap, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.
Referenced by HandleSwitchMsg().
|
protected |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 300 of file ofswitch13-controller.cc.
References m_echoMap, ns3::Time::MS, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.
Referenced by HandleSwitchMsg().
|
protected |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 283 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION, and SendToSwitch().
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 419 of file ofswitch13-controller.cc.
References NS_LOG_ERROR, and NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protected |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 367 of file ofswitch13-controller.cc.
References DpctlExecute(), HandshakeSuccessful(), ns3::OFSwitch13Controller::RemoteSwitch::m_auxiliaryId, ns3::OFSwitch13Controller::RemoteSwitch::m_capabilities, m_commandsMap, ns3::OFSwitch13Controller::RemoteSwitch::m_dpId, m_dpIdSwMap, ns3::OFSwitch13Controller::RemoteSwitch::m_nBuffers, ns3::OFSwitch13Controller::RemoteSwitch::m_nTables, ns3::OFSwitch13Controller::PendingCommands::m_queue, NS_LOG_ERROR, and NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Reimplemented in ns3::OFSwitch13LearningController.
Definition at line 445 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 434 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protected |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 348 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION, SendBarrierRequest(), and SendToSwitch().
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 478 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Reimplemented in ns3::OFSwitch13LearningController, QosController, and ns3::TunnelController.
Definition at line 408 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 456 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 501 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
protectedvirtual |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 490 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleSwitchMsg().
|
private |
Called when an OpenFlow message is received from a switch.
Dispatches control messages to appropriate handler functions.
msg | The OFLib message received. |
swtch | The remote switch the message was received from. |
xid | The transaction id. |
Definition at line 516 of file ofswitch13-controller.cc.
References HandleAsyncReply(), HandleBarrierReply(), HandleEchoReply(), HandleEchoRequest(), HandleError(), HandleFeaturesReply(), HandleFlowRemoved(), HandleGetConfigReply(), HandleHello(), HandleMultipartReply(), HandlePacketIn(), HandlePortStatus(), HandleQueueGetConfigReply(), HandleRoleReply(), and NS_LOG_FUNCTION.
Referenced by ReceiveFromSwitch().
|
protectedvirtual |
Function invoked after a successfully handshake procedure between this controller and a remote switch.
Derived classes can override this function to implement any relevant logic, as sending initial configuration messages to the switch.
swtch | The remote switch. |
Reimplemented in ns3::OFSwitch13LearningController, QosController, Controller1, Controller0, and ns3::TunnelController.
Definition at line 181 of file ofswitch13-controller.cc.
References NS_LOG_FUNCTION.
Referenced by HandleFeaturesReply().
Receive an OpenFlow packet from switch.
packet | The packet with the OpenFlow message. |
from | The packet sender address. |
Definition at line 583 of file ofswitch13-controller.cc.
References ns3::BufferFromPacket(), ns3::OFSwitch13Controller::RemoteSwitch::GetDpId(), ns3::OFSwitch13Controller::RemoteSwitch::GetIpv4(), GetRemoteSwitch(), ns3::Packet::GetSize(), HandleSwitchMsg(), NS_LOG_DEBUG, NS_LOG_ERROR, and NS_LOG_FUNCTION.
Referenced by SocketAccept().
|
protected |
Send a barrier request message to switch, and wait for a non-blocking reply.
Note that current OpenFlow device implementation is single-threaded and messages are processed in the same order that are received from the controller, so a barrier request will simply be replied by the switch.
swtch | The remote switch to receive the message. |
Definition at line 260 of file ofswitch13-controller.cc.
References GetNextXid(), m_barrierMap, NS_LOG_ERROR, NS_LOG_FUNCTION, and SendToSwitch().
Referenced by HandleHello().
|
protected |
Send an echo request message to switch, and wait for a non-blocking reply.
swtch | The remote switch to receive the message. |
payloadSize | The ammount of dummy bytes in echo message. |
Definition at line 222 of file ofswitch13-controller.cc.
References GetNextXid(), m_echoMap, NS_LOG_ERROR, NS_LOG_FUNCTION, and SendToSwitch().
|
protected |
Send a OFLib message to a registered switch.
swtch | The remote switch to receive the message. |
msg | The OFLib message to send. |
xid | The transaction id to use. |
Definition at line 200 of file ofswitch13-controller.cc.
References GetNextXid(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::PacketFromMsg().
Referenced by ns3::TunnelController::HandleArpPacketIn(), QosController::HandleArpPacketIn(), QosController::HandleConnectionRequest(), HandleEchoRequest(), HandleHello(), SendBarrierRequest(), SendEchoRequest(), and SocketAccept().
TCP handshake succeeded.
Definition at line 652 of file ofswitch13-controller.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::OFSwitch13Controller::RemoteSwitch::m_address, m_addrSwMap, ns3::OFSwitch13Controller::RemoteSwitch::m_ctrlApp, ns3::OFSwitch13Controller::RemoteSwitch::m_handler, ns3::MakeCallback(), NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, port, ReceiveFromSwitch(), and SendToSwitch().
Referenced by StartApplication().
TCP connection closed.
Definition at line 689 of file ofswitch13-controller.cc.
References NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Socket::ShutdownRecv(), and ns3::Socket::ShutdownSend().
Referenced by StartApplication().
TCP connection error.
Definition at line 699 of file ofswitch13-controller.cc.
References NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::Socket::ShutdownRecv(), and ns3::Socket::ShutdownSend().
Referenced by StartApplication().
|
private |
TCP request from switch.
Definition at line 638 of file ofswitch13-controller.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::InetSocketAddress::IsMatchingType(), NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, and port.
Referenced by StartApplication().
|
overrideprotectedvirtual |
Application specific startup code.
The StartApplication method is called at the start time specified by Start This method should be overridden by all or most application subclasses.
Reimplemented from ns3::Application.
Definition at line 130 of file ofswitch13-controller.cc.
References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv4Address::GetAny(), ns3::Application::GetNode(), ns3::Socket::Listen(), ns3::TypeId::LookupByName(), m_port, m_serverSocket, ns3::MakeCallback(), NS_LOG_FUNCTION, ns3::Socket::SetAcceptCallback(), ns3::ObjectBase::SetAttribute(), ns3::Socket::SetCloseCallbacks(), SocketAccept(), SocketPeerClose(), SocketPeerError(), and SocketRequest().
|
overrideprotectedvirtual |
Application specific shutdown code.
The StopApplication method is called at the stop time specified by Stop This method should be overridden by all or most application subclasses.
Reimplemented from ns3::Application.
Definition at line 151 of file ofswitch13-controller.cc.
References ns3::Socket::Close(), m_addrSwMap, m_barrierMap, m_commandsMap, m_dpIdSwMap, m_echoMap, ns3::OFSwitch13Controller::RemoteSwitch::m_handler, m_port, m_serverSocket, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().
|
private |
Registered switches by address.
Definition at line 398 of file ofswitch13-controller.h.
Referenced by DoDispose(), GetRemoteSwitch(), SocketAccept(), and StopApplication().
|
private |
Metadata for barrier requests.
Definition at line 396 of file ofswitch13-controller.h.
Referenced by DoDispose(), HandleBarrierReply(), SendBarrierRequest(), and StopApplication().
|
private |
Commands scheduled for execution.
Definition at line 397 of file ofswitch13-controller.h.
Referenced by DoDispose(), DpctlExecute(), HandleFeaturesReply(), and StopApplication().
|
private |
Registered switches by datapath id.
Definition at line 399 of file ofswitch13-controller.h.
Referenced by DoDispose(), GetRemoteSwitch(), HandleFeaturesReply(), and StopApplication().
|
private |
Metadata for echo requests.
Definition at line 395 of file ofswitch13-controller.h.
Referenced by DoDispose(), HandleEchoReply(), SendEchoRequest(), and StopApplication().
|
private |
Local controller tcp port.
Definition at line 392 of file ofswitch13-controller.h.
Referenced by GetTypeId(), StartApplication(), and StopApplication().
Listening server socket.
Definition at line 393 of file ofswitch13-controller.h.
Referenced by DoDispose(), StartApplication(), and StopApplication().
|
private |
Global transaction idx.
Definition at line 391 of file ofswitch13-controller.h.
Referenced by OFSwitch13Controller(), and GetNextXid().