A OpenFlow switch port, interconnecting the underlying NetDevice to the OpenFlow device through the OpenFlow receive callback. More...
#include "ofswitch13-port.h"
Public Member Functions | |
OFSwitch13Port () | |
Default constructor. More... | |
OFSwitch13Port (struct datapath *dp, Ptr< NetDevice > netDev, Ptr< OFSwitch13Device > openflowDev) | |
Complete Constructor. More... | |
~OFSwitch13Port () override | |
Dummy destructor, see DoDispose. More... | |
Ptr< NetDevice > | GetPortDevice () const |
Get the NetDevice pointer from the underlying port. More... | |
uint32_t | GetPortNo () const |
Get the OpenFlow port number for this port. More... | |
Ptr< OFSwitch13Queue > | GetPortQueue () const |
Get the OpenFlow queue for this port. More... | |
struct sw_port * | GetPortStruct () |
Get a pointer to the internal BOFUSS port structure. More... | |
Ptr< OFSwitch13Device > | GetSwitchDevice () const |
Get the OFSwitch13Device pointer from this port. More... | |
bool | PortUpdateState () |
Update the port state field based on NetDevice status, and notify the controller when changes occurs. More... | |
bool | Send (Ptr< const Packet > packet, uint32_t queueNo=0, uint64_t tunnelId=0) |
Send a packet over this OpenFlow switch port. 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 TypeId | GetTypeId () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
void | NotifyConstructionCompleted () override |
Notifier called once the ObjectBase is fully constructed. More... | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize () |
Initialize() implementation. 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... | |
Private Member Functions | |
uint32_t | GetPortFeatures () |
Create the bitmaps of OFPPF_* describing port features. More... | |
bool | Receive (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) |
Called when a packet is received on this OpenFlow switch port by the underlying NetDevice. More... | |
Private Attributes | |
uint64_t | m_dpId |
OpenFlow datapath ID. More... | |
ObjectFactory | m_factQueue |
Factory for port queue. More... | |
Ptr< NetDevice > | m_netDev |
Underlying NetDevice. More... | |
Ptr< OFSwitch13Device > | m_openflowDev |
OpenFlow device. More... | |
uint32_t | m_portNo |
Port number. More... | |
Ptr< OFSwitch13Queue > | m_portQueue |
OpenFlow port Queue. More... | |
TracedCallback< Ptr< const Packet > > | m_rxTrace |
Trace source fired when a packet arrives at this switch port. More... | |
struct sw_port * | m_swPort |
BOFUSS port structure. More... | |
TracedCallback< Ptr< const Packet > > | m_txTrace |
Trace source fired when a packet will be sent over this switch port. More... | |
Additional Inherited Members | |
![]() | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
A OpenFlow switch port, interconnecting the underlying NetDevice to the OpenFlow device through the OpenFlow receive callback.
Introspection did not find any typical Config paths.
This class handles the BOFUSS internal sw_port structure.
ObjectFactory
Size of this type is 160 bytes (on a 64-bit architecture).
Definition at line 50 of file ofswitch13-port.h.
ns3::OFSwitch13Port::OFSwitch13Port | ( | ) |
|
override |
Dummy destructor, see DoDispose.
Definition at line 61 of file ofswitch13-port.cc.
References NS_LOG_FUNCTION.
ns3::OFSwitch13Port::OFSwitch13Port | ( | struct datapath * | dp, |
Ptr< NetDevice > | netDev, | ||
Ptr< OFSwitch13Device > | openflowDev | ||
) |
Complete Constructor.
Create and populate a new datapath port, notifying the controller of this new port.
dp | The datapath. |
netDev | The underlying NetDevice. |
openflowDev | The OpenFlow device. |
Definition at line 118 of file ofswitch13-port.cc.
References m_dpId, m_portNo, m_swPort, and NS_LOG_FUNCTION.
|
overrideprotectedvirtual |
Destructor implementation.
Reimplemented from ns3::Object.
Definition at line 67 of file ofswitch13-port.cc.
References m_netDev, m_openflowDev, m_portQueue, m_swPort, and NS_LOG_FUNCTION.
Get the NetDevice pointer from the underlying port.
Definition at line 218 of file ofswitch13-port.cc.
References m_netDev.
|
private |
Create the bitmaps of OFPPF_* describing port features.
Definition at line 269 of file ofswitch13-port.cc.
References third::channel, m_netDev, and NS_LOG_FUNCTION.
Referenced by NotifyConstructionCompleted().
uint32_t ns3::OFSwitch13Port::GetPortNo | ( | ) | const |
Get the OpenFlow port number for this port.
Definition at line 224 of file ofswitch13-port.cc.
References m_portNo.
Referenced by ns3::OFSwitch13Device::AddSwitchPort().
Ptr< OFSwitch13Queue > ns3::OFSwitch13Port::GetPortQueue | ( | ) | const |
Get the OpenFlow queue for this port.
Definition at line 230 of file ofswitch13-port.cc.
References m_portQueue.
struct sw_port * ns3::OFSwitch13Port::GetPortStruct | ( | ) |
Get a pointer to the internal BOFUSS port structure.
Definition at line 418 of file ofswitch13-port.cc.
References m_swPort.
Ptr< OFSwitch13Device > ns3::OFSwitch13Port::GetSwitchDevice | ( | ) | const |
Get the OFSwitch13Device pointer from this port.
Definition at line 236 of file ofswitch13-port.cc.
References m_openflowDev.
|
static |
Register this type.
Definition at line 84 of file ofswitch13-port.cc.
References ns3::TypeId::ATTR_CONSTRUCT, ns3::TypeId::ATTR_GET, ns3::GetDefaultQueueFactory(), m_factQueue, m_portQueue, m_rxTrace, m_txTrace, ns3::MakeObjectFactoryAccessor(), ns3::MakeObjectFactoryChecker(), ns3::MakePointerAccessor(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
overrideprotectedvirtual |
Notifier called once the ObjectBase is fully constructed.
This method is invoked once all member attributes have been initialized. Subclasses can override this method to be notified of this event but if they do this, they must chain up to their parent's NotifyConstructionCompleted method.
Reimplemented from ns3::ObjectBase.
Definition at line 139 of file ofswitch13-port.cc.
References ns3::ObjectFactory::Create(), GetPortFeatures(), m_factQueue, m_netDev, m_portNo, m_portQueue, m_swPort, ns3::MakeCallback(), NS_ABORT_MSG_IF, NS_ASSERT, NS_LOG_FUNCTION, ns3::PeekPointer(), Receive(), and time_msec().
bool ns3::OFSwitch13Port::PortUpdateState | ( | ) |
Update the port state field based on NetDevice status, and notify the controller when changes occurs.
Definition at line 242 of file ofswitch13-port.cc.
References m_netDev, m_swPort, and NS_LOG_INFO.
|
private |
Called when a packet is received on this OpenFlow switch port by the underlying NetDevice.
It will check port configuration, update counter and send the packet to the OpenFlow pipeline.
device | Underlying ns-3 network device. |
packet | The received packet. |
protocol | Next protocol header value. |
from | Address of the correspondant. |
to | Address of the destination. |
packetType | Type of the packet. |
Definition at line 326 of file ofswitch13-port.cc.
References ns3::Packet::Copy(), ns3::Packet::GetSize(), ns3::TunnelIdTag::GetTunnelId(), ns3::Packet::GetUid(), m_openflowDev, m_portNo, m_rxTrace, m_swPort, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and ns3::Packet::PeekPacketTag().
Referenced by NotifyConstructionCompleted().
bool ns3::OFSwitch13Port::Send | ( | Ptr< const Packet > | packet, |
uint32_t | queueNo = 0 , |
||
uint64_t | tunnelId = 0 |
||
) |
Send a packet over this OpenFlow switch port.
It will check port configuration, update counters and send the packet to the underlying device.
packet | The Packet to send. |
queueNo | The queue to use. |
tunnelId | The metadata associated with a logical port. |
Definition at line 364 of file ofswitch13-port.cc.
References ns3::Packet::Copy(), ns3::EthernetHeader::GetDestination(), ns3::EthernetHeader::GetLengthType(), ns3::Packet::GetSize(), ns3::EthernetHeader::GetSource(), ns3::Packet::GetUid(), m_netDev, m_swPort, m_txTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::Packet::RemoveHeader(), ns3::Packet::RemoveTrailer(), and ns3::Packet::ReplacePacketTag().
|
private |
OpenFlow datapath ID.
Definition at line 166 of file ofswitch13-port.h.
Referenced by OFSwitch13Port().
|
private |
Factory for port queue.
Definition at line 171 of file ofswitch13-port.h.
Referenced by GetTypeId(), and NotifyConstructionCompleted().
Underlying NetDevice.
Definition at line 169 of file ofswitch13-port.h.
Referenced by DoDispose(), GetPortDevice(), GetPortFeatures(), NotifyConstructionCompleted(), PortUpdateState(), and Send().
|
private |
OpenFlow device.
Definition at line 172 of file ofswitch13-port.h.
Referenced by DoDispose(), GetSwitchDevice(), and Receive().
|
private |
Port number.
Definition at line 167 of file ofswitch13-port.h.
Referenced by OFSwitch13Port(), GetPortNo(), NotifyConstructionCompleted(), and Receive().
|
private |
OpenFlow port Queue.
Definition at line 170 of file ofswitch13-port.h.
Referenced by DoDispose(), GetPortQueue(), GetTypeId(), and NotifyConstructionCompleted().
|
private |
Trace source fired when a packet arrives at this switch port.
Definition at line 161 of file ofswitch13-port.h.
Referenced by GetTypeId(), and Receive().
|
private |
BOFUSS port structure.
Definition at line 168 of file ofswitch13-port.h.
Referenced by OFSwitch13Port(), DoDispose(), GetPortStruct(), NotifyConstructionCompleted(), PortUpdateState(), Receive(), and Send().
|
private |
Trace source fired when a packet will be sent over this switch port.
Definition at line 164 of file ofswitch13-port.h.
Referenced by GetTypeId(), and Send().