ZeroSDN Controller  1.0
A modular distributed Software-Defined Network Controller
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros
LinkDiscoveryModule::LinkDevice Class Reference

#include <LinkDiscoveryModule.hpp>

Public Types

enum  InsertResult { NO_VALID_PORT, SUCCESS_NEW, SUCCESS_MODIFY, SUCCESS_NO_CHANGE }
 

Public Member Functions

 LinkDevice (std::vector< uint32_t > availablePorts, uint64_t switchDpid, of_version_t ofVersion)
 
 ~LinkDevice ()
 
InsertResult insertLink (uint32_t port, std::shared_ptr< LinkDevice > linkedDevice, uint32_t endpointPort, uint64_t updateTime)
 
void flushOutDatedLinks (uint64_t borderDate, std::map< uint32_t, std::pair< std::shared_ptr< LinkDevice >, uint32_t >> &outDatedLinks)
 
std::map< uint32_t, std::pair
< std::shared_ptr< LinkDevice >
, uint32_t > > 
eraseLinkToDevice (uint64_t deviceId)
 
std::vector< uint32_t > getAvailablePorts ()
 
std::map< uint32_t,
LinkDeviceTimestampTupel
getActiveLinks ()
 
uint64_t getId ()
 
void clearAll ()
 
of_version_t getVersion ()
 

Member Enumeration Documentation

Enumerator
NO_VALID_PORT 
SUCCESS_NEW 
SUCCESS_MODIFY 
SUCCESS_NO_CHANGE 

Constructor & Destructor Documentation

LinkDiscoveryModule::LinkDevice::LinkDevice ( std::vector< uint32_t >  availablePorts,
uint64_t  switchDpid,
of_version_t  ofVersion 
)
inline

Constructor of a LinkDevice to initialize it. Requires the available network ports an the network id.

Parameters
availablePortsa inital list of available port of the represented LinkdDevice
switchDpidthe device id
LinkDiscoveryModule::LinkDevice::~LinkDevice ( )
inline

Member Function Documentation

void LinkDiscoveryModule::LinkDevice::clearAll ( )
inline
std::map< uint32_t, std::pair< std::shared_ptr< LinkDiscoveryModule::LinkDevice >, uint32_t > > LinkDiscoveryModule::LinkDevice::eraseLinkToDevice ( uint64_t  deviceId)

Threadsave function to erase links to a endpoint with the deviceId

Parameters
deviceIdthe id of the link endpoint device which have to be erased.
Returns
the erased links where the endpoint device his port of the link are mapped to the port of the source link device
void LinkDiscoveryModule::LinkDevice::flushOutDatedLinks ( uint64_t  borderDate,
std::map< uint32_t, std::pair< std::shared_ptr< LinkDevice >, uint32_t >> &  outDatedLinks 
)

Threadsave function to erase out dated linkes. The function returns over the out param outDatedLinks the removed links.

Parameters
borderDatathe time border to flush
outDatedLinksOut param to access the removed links of the flush. The result contains the erased Link with its endpoint port maped to the flushed device port.
std::map<uint32_t, LinkDeviceTimestampTupel> LinkDiscoveryModule::LinkDevice::getActiveLinks ( )
inline

Get a copy of the activeLinks inside the device. WARNING: the map is a copy but the shared pointers of the LinkDevices points to the original Objects

Returns
copy of the activeLinks, which maps the endpoint device with the endpoint port (contained inside the Tupel struct) to the port of the source device
std::vector<uint32_t> LinkDiscoveryModule::LinkDevice::getAvailablePorts ( )
inline

Returns a copy of the available ports of the device

Parameters
copyof the available ports
uint64_t LinkDiscoveryModule::LinkDevice::getId ( )
inline

Access the Id of the device

Returns
A copy of the device Id
of_version_t LinkDiscoveryModule::LinkDevice::getVersion ( )
inline
LinkDiscoveryModule::LinkDevice::InsertResult LinkDiscoveryModule::LinkDevice::insertLink ( uint32_t  port,
std::shared_ptr< LinkDevice linkedDevice,
uint32_t  endpointPort,
uint64_t  updateTime 
)

Threadsave function to insert a new link to the device. This requires a available port.

Parameters
portthe port of de device where the link is setup
linkDevicethe endpoint device which is connected to the port
endpointPortthe port at the endpoint device where the link is setup
updateTimethe timestamp of the link discovery.
Returns
InsertResult type to specify the result of the insert action. This is used to represent the different situations PORT_NOT_AVAILABLE / NEW_INSERT / MODIFY_ENTRY / NO_CHANGES

The documentation for this class was generated from the following files: