Skip to content
Alex edited this page Nov 9, 2015 · 12 revisions

Information

ModuleTypeID (hex) 0x0000
ModuleTypeID (decimal) 0
Distribution support multiple, independent instances
Dependencies -

 

Description

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.

  • From the perspective of the OpenFlow switch the SwitchAdapter is its controller.
  • From the perspective of any other module inside the ZMF the SwitchAdapter represents an actual OpenFlow switch.

The SwitchAdapter basically only acts as a relay. For any more advanced functionality involving Switches, consult SwitchRegistryModule.

 

Configuration

Note: as the instanceId of a SwitchAdapter is equal to the SwitchId, the creation of a serverSocket and the OpenFlow handshake is conducted BEFORE the SwitchAdapter module is started. Therefore, the SwitchAdapter runnable actually acts as a Launcher, which will start a SwitchAdapter for each incoming connection. For this to work, the runner has to be started with two additional parameters - The OpenFlow version used for communicatingwith switches ("1.0" or "1.3) and the port to listen for incoming OpenFlow connections (e.g. 6633).

The configuration file for this module must define the following variables:

Config Type Description
ZSDN_SWITCH_ADAPTER
PACKET_IN
MULTICAST_GROUPS
Integer SwitchAdapters will evenly distribute their packetIns to each multicast group(see [SwitchAdapter#MulticastGroups]. This allows for load balancing (each PacketIn consumer module can subscribe to one or more multicast-groups). There can be [1,256] multicast groups.
ZSDN_SWITCH_ADAPTER_
FLUSH_STREAM
_AFTER_EVERY_MESSAGE
Boolean if true, the socket to the switches is flushed after every message. may decrease performance but may decrease latency and avoid stuck messages (not enough to auto-flush, remains in buffer indefinitely)
ZSDN_SWITCH_ADAPTER_
EXPERIMENTAL_FAST_
TOPIC_GENERATION
Boolean if true, the, Switch will use a faster, but untested topic generation method. Should be set false by default.

 

Services Provided (REQUEST/REPLY)

HandleOpenflowMessages

This enables batch processing of openFlow actions. All openFlow messages contained in the request will be sequentially executed as if they were received by the publish/subscribe api. This allows guaranteed and uninfluenced in-order delivery of the contained messages.

|Request-MessageType|[[REQUEST.SWITCH_ADAPTER.OPENFLOW.
HANDLE_OPENFLOW_MESSAGE|SwitchAdapter#MessageTypes]]| --- | --- |Request-Payload|Request-Container +
message HandleOpenflowMessagesRequest {}| |Reply-MessageType|[[REPLY.SWITCH_ADAPTER.OPENFLOW.
HANDLE_OPENFLOW_MESSAGE|SwitchAdapter#MessageTypes]]| |Reply-Payload|Reply-Container +
message HandleOpenflowMessagesReply {
repeated bytes open_flow_message = 1;
}|

Publishes Events (FROM)

OpenFlow from Switch

Any OpenFlow message the SwitchAdapter receives from the actual switch (with the Exception of HELLO, ECHO_REQUEST, ECHO_REPLY, ROLE_REPLY and ROLE_STATUS) is published using this MessageType.

IMPORTANT: The OpenFlow frame is published as-is, do not use protobuffers to parse Messages sent to this MessageType.

|From-MessageType|FROM.SWITCH_ADAPTER.OPENFLOW.*| --- | --- |From-Payload| raw OpenFlow frame|

Listens to Events (TO)

OpenFlow to Switch

The SwitchAdapter will forward any messages received for this MessageType (with the Exception of HELLO, ECHO_REPLY, ROLE_REQUEST) to the underlying switch. Every SwitchAdapter instance is subscribed to this MessageType using its own switchID (DPID) as value for SWITCH_INSTANCE.

IMPORTANT: The payload has to be a raw OpenFlow frame - do not use protobuf to serialize Messages sent to this MessageType.

|To-MessageType|[[TO.SWITCH_ADAPTER.
SWITCH_INSTANCE(switchID).OPENFLOW.*|SwitchAdapter#MessageTypes]]| --- | --- |To-Payload| raw OpenFlow frame|

 

MulticastGroups

In order to be able to distribute packetIns in a round-robin fashion to multiple recipients, the SwitchAdapter adds a multicast-byte to all packetIn messages. The config ZSDN_SWITCH_ADAPTER_PACKET_IN_MULTICAST_GROUPS influences how many multicast groups there are. Due to the nature of hierarchical topics, the introduction of this byte forces Modules that want subtopics of packetIn to subscribe once for each multicast-group - if they want to receive all messages. Otherwise (as intended for load balancing) modules subscribe only to one specific multicast group.

The SwitchAdapter will evenly publish all packetIns to the multicast groups.

MessageTypes

The Identifiers for OpenFlow, Ethertype and Protocol, are the same as the IDs in the corresponing headers. Through using that, we can just read the Headers and append the ID for the ZMF messages. Custom types are available for further OpenFlow, Ethertype or Protocol extensions.

For a detailed list of all supported topics, see the SwitchAdapter.topics file.

 

Implementation Details

In order to be able to run multiple SwitchAdapters on the same machine (using the same OpenFlow port), the executable of the SwitchAdapter has a single TCP ServerSocket and will start one actual SwitchAdapter for each incomming connection from an OpenFlow switch - if the OpenFlow Handshake succeeded. If the basic hello handshake succeeded, a feature request is sent to the switch. After a sucessful handshake and receiving of the feature reply message, a SwitchAdapter instance will be started, using a the switches ID as instanceId of the SwitchAdapter module - which allows other modules to publish to this SwitchAdapter instance.

  • A SwitchAdapter will respond to ECHO_REQUESTs of the Switch, and thus avoid a connection timeout.
  • A SwitchAdapters will termintate itself, when the connection to the switch ends(EOF).

 

Clone this wiki locally