openflow: OpenFlow

[ library, network ] [ Propose Tags ] [ Report a vulnerability ]

This package implements the OpenFlow 1.0 and a large part of the OpenFlow 1.3 protocols. It defines a collection of data types representing the logical contents of OpenFlow messages, defines serialization and deserialization methods using the binary package, and provides some simple servers that can be used with these data types.


[Skip to Readme]

Modules

  • Network
    • Data
      • Network.Data.Ethernet
        • Network.Data.Ethernet.AddressResolutionProtocol
        • Network.Data.Ethernet.EthernetAddress
        • Network.Data.Ethernet.EthernetFrame
        • Network.Data.Ethernet.LLDP
      • Network.Data.IPv4
        • Network.Data.IPv4.DHCP
        • Network.Data.IPv4.IPAddress
        • Network.Data.IPv4.IPPacket
        • Network.Data.IPv4.UDP
      • OF13
        • Network.Data.OF13.Message
        • Network.Data.OF13.Server
      • Network.Data.OpenFlow
        • Network.Data.OpenFlow.Action
        • Network.Data.OpenFlow.Error
        • Network.Data.OpenFlow.FlowTable
        • Network.Data.OpenFlow.Match
        • Network.Data.OpenFlow.MatchBuilder
        • Network.Data.OpenFlow.Messages
        • Network.Data.OpenFlow.MessagesBinary
        • Network.Data.OpenFlow.Packet
        • Network.Data.OpenFlow.Port
        • Network.Data.OpenFlow.Statistics
        • Network.Data.OpenFlow.Switch
      • Network.Data.Util

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.3.0, 0.3.1
Dependencies aeson (>=0.7.0.6), base (>=4.4.0.0 && <=5), bimap (>=0.2.4), binary (>=0.7.0), bytestring, containers, deepseq, deepseq-generics (>=0.1.1.2), hashable (>=1.2.1.0), network (>=2.6.0.2) [details]
License LicenseRef-OtherLicense
Author Andreas Voellmy <andreas.voellmy@gmail.com>
Maintainer Andreas Voellmy
Category Network
Home page https://github.com/AndreasVoellmy/openflow
Source repo head: git clone git://github.com/AndreasVoellmy/openflow.git
Uploaded by AndreasVoellmy at 2017-10-03T05:58:19Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1696 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2017-10-03 [all 3 reports]

Readme for openflow-0.3.1

[back to package description]

OpenFlow Build Status

OpenFlow is a Haskell library that implements OpenFlow protocols 1.0 and 1.3. It defines data types that model the logical content of the various OpenFlow protocol messages and provides serialization and deserialization methods using the binary package. It also provides basic functions to start servers that use these representations.

Installation

To build a controller using this library, you need to install GHC and install this library. For information on how to install Haskell, head over to https://www.haskell.org. To install this library, clone this repository, enter the cloned directory, and then run cabal install.

Getting Started

To write an OpenFlow 1.3 controller, start with the following template, and then fill in the messageHandler function:

import Network.Data.OF13.Message
import Network.Data.OF13.Server

main :: IO ()
main = runServerOne 6633 factory
  where factory sw = handshake sw >> return (messageHandler sw)

handshake :: Switch -> IO ()
handshake sw = sendMessage sw [Hello { xid = 0, len = 8 }]

messageHandler :: Switch -> Maybe Message -> IO ()
messageHandler _ Nothing = putStrLn "Disconnecting"
messageHandler sw (Just msg) = print msg >> sendMessage sw [FeatureRequest 1]

Place the above source into a file, for example, Main.hs. Assuming you have installed ghc and this library, you can then run ghc --make Main.hs to build an executable from Main.hs. You can then run it as Main.

The above main program calls runServerOne which will wait for a single OpenFlow 1.3 server to connect on port 6633 and then will run the given factory function. The factory function performs an initial handshake, which, in this bare bones example, consists of sending a Hello message to the switch, and then returns a message handler function messageHandler that will be used to interact with that switch until the connection is terminated. When the server receives an OpenFlow 1.3 message m, it will run messageHandler (Just m) and when the connection is terminated, the server runs messageHandler Nothing. The message handler can do anything, but typically it sends messages to the switch. To do this, use the sendMessage function.