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

A Module representing one OpenFlow switch. More...

#include <SwitchAdapter.hpp>

Inheritance diagram for SwitchAdapter:

Public Member Functions

 SwitchAdapter (const uint64_t switchId, std::shared_ptr< Poco::Net::SocketStream > socketStream, std::shared_ptr< Poco::Net::StreamSocket > switchSocket, const of_version_t ofVersion)
 
 ~SwitchAdapter ()
 
virtual zmf::data::ZmfOutReply handleRequest (const zmf::data::ZmfMessage &message, const zmf::data::ModuleUniqueId &sender) override
 

Protected Member Functions

virtual bool enable ()
 
virtual void disable ()
 

Detailed Description

A Module representing one OpenFlow switch.

The SwitchAdapter wraps each OpenFlow capable switch as a ZMF Module instance. An OpenFlow switch connects to a SwitchAdapter instance as it would normally connect to a controller.

Author
Alexander Kicherer
Andre Kutzleb
Matthias Hoppe
Date
28.06.2015
created on 28.6.2015
Remarks
Refactored / rewritten by Andre Kutzleb on 18.07.2015
IMPROVEMENT: Consider making nagles algorithm toggleable to optimize throughput to the switch
IMPROVEMENT: only passively answers echos and never times out currently.
IMPROVEMENT messages from zmf to switch: default is also the case for "illegal"(unknown/garbage) openFlow messages. may have to filter those as well (unknown type)

Constructor & Destructor Documentation

SwitchAdapter::SwitchAdapter ( const uint64_t  switchId,
std::shared_ptr< Poco::Net::SocketStream >  socketStream,
std::shared_ptr< Poco::Net::StreamSocket >  switchSocket,
const of_version_t  ofVersion 
)

Constructs (but does not start) A SwitchAdapter.

Parameters
switchIdthe switchId of the switch represented by this SwitchAdapter.
socketStreamthe stream connected to the socket socket representing the connection to the switch.
switchSocketthe socket representing the connection to the switch.
ofVersionthe OpenFlow version used for communicating with the switch.
SwitchAdapter::~SwitchAdapter ( )

Destructor: In case this module is not correctly disabled by ZMF, disable is called so that no socket or thread is left behind by the SwitchAdapter.

Member Function Documentation

void SwitchAdapter::disable ( )
protectedvirtual

Closes the socket to the switch and stops the thread listening on the connection from the switch.

bool SwitchAdapter::enable ( )
protectedvirtual

starts a subscription for topic TO.SWITCH_ADAPTER.SWITCH_INSTANCE(this.switchId).OPENFLOW.* which will be handled by handleOpenFlowFromZmf.

Also starts a thread listing on the connection to the switch.

Returns
true of enable successful, false if the socket to the switch is closed or startup otherwise failed.
zmf::data::ZmfOutReply SwitchAdapter::handleRequest ( const zmf::data::ZmfMessage &  message,
const zmf::data::ModuleUniqueId &  sender 
)
overridevirtual

Handles a ZMF request message - handles bundle deploy.

Parameters
messagethe received ZMF message
senderthe ID of the sender of the received ZMF message
Returns
a to the message

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