nettle-frp-0.1: FRP for controlling networks of OpenFlow switches.

Nettle.FRPControl.NettleSF

Contents

Description

Nettle signal functions and drivers. These drivers take care of low level details, such as message numbering, correlation of stats requests and replies, translation of higher level flow rules expressed using packet predicates to low level flow rules expressed in terms of matches.

Synopsis

Nettle Signal Functions

runNettleSF :: SF (Event (SwitchID, SwitchMessage), i) (Event SwitchCommand, o) -> SF (Event SwitchMessage, i) (SwitchOutput, o)Source

Runs a signal function carrying messages and commands as defined in this module, converting it into a signal function in terms of basic switch messages and switch output, which can be run using the switch driver provided in SwitchInterface.

simpleNettleDriver :: ServerPortNumber -> SF (Event (SwitchID, SwitchMessage)) (Event SwitchCommand, Event String) -> IO ()Source

Runs a signal function with a single input stream of switch messages and two output streams, one for switch commands and one for messages to the standard output device; starts a switch server at the specified port.

Switch event sources

arrivalE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, SwitchFeatures)Source

Outputs an event whenever a switch connects with the controller. The event carries the SwitchID of the switch.

departureE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, IOException)Source

Outputs an event whenever the switch disconnects from the controller. The event carries the SwitchID of the switch and an IOException value indicating the reason for the disconnection.

featureUpdateE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, SwitchFeatures)Source

Outputs an event whenever a switch sends a switch features update. The event carries the SwitchID of the sending switch and the SwitchFeatures data.

portUpdateE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, PortStatus)Source

Outputs an event whenever a switch sends a port status update. The event carries the SwitchID of the sending switch and the PortStatus.

switchErrorE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, SwitchError)Source

Outputs an event whenever a switch sends an error message. The event carries the SwitchID of the sending switch and the SwitchError.

packetInE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, PacketInfo)Source

Outputs an event whenever a switch sends a packet in message. The event carries the SwitchID of the sending switch and the PacketInfo.

filteredPacketInE :: PacketPredicate -> Event (SwitchID, SwitchMessage) -> Event (SwitchID, PacketInfo)Source

Packet-in events, filtered by a packet predicate applied to the packet carried by the packet-in event. The output stream will only include Packet-in messages that satisfy the filter criteria.

flowRemovedE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, FlowRemoved)Source

Outputs an event whenever a switch notifies the controller of a flow removal.

portStatReplyE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, [(PortID, PortStats)])Source

Outputs an event whenever a switch sends a port statistics information to the controller. This information may be communicated with several messages; the statistics from several messages related to the same statistics request are aggregated and output in one event from this signal function.

flowStatReplyE :: Event (SwitchID, SwitchMessage) -> Event (SwitchID, [FlowStats])Source

Outputs an event whenever a switch sends a flow statistics information to the controller. This information may be communicated with several messages; the statistics from several messages related to the same statistics request are aggregated and output in one event from this signal function.

Switch commands

data SwitchCommand Source

Type of switch commands

deleteFlowRules :: SwitchID -> PacketPredicate -> SwitchCommandSource

Delete all flow entries whose match conditions fall inside a given packet predicate.

clearTables :: SwitchID -> SwitchCommandSource

Clear the flow table of a switch. clearTables switch = deleteFlowRules switch anyPacket.

requestFeatures :: SwitchID -> SwitchCommandSource

Request switch features

addFlowRules :: [(Priority, (PacketPredicate, ActionSequence, TimeOut, TimeOut))] -> SwitchID -> SwitchCommandSource

Add a collection of flow rules to a switch.

(<+>) :: Monoid o => o -> o -> oSource

Infix binary operator for mappend.

noOp :: Monoid o => oSource

Another name for the unit element of a Monoid, specialized to the HasSwitchCommands class.

(==>) :: PacketPredicate -> ActionSequence -> FlowRuleSource

A synonym for the tupling operator, specialized to packet predicates. Provides suggestive infix syntax useful in writing addFlowRule commands.