Skip to main content

Library to parse and generate OpenFlow messages

Project description

Openflow Tag Release Tests License

python-openflow is a low level library to parse OpenFlow messages. If you want to read an OpenFlow packet from an open socket or send a message to an OpenFlow switch, this is your best friend. The main features are: high performance, latest specification compliance, short learning curve and free software license.

This library is part of Kytos project, a collaborative project between SPRACE (from São Paulo State University, Unesp) and Caltech (California Institute of Technology). python-openflow was developed to be used with Kytos controller, but feel free to use this simple and intuitive library in another project with another controller.

Overview

This is just an overview for you to check whether this project fits your needs. For a more detailed documentation, please check the python-openflow API Reference Manual.

Usage

For example, see how it is easy to create a feature request message with this library. You can use ipython3 to get the advantages of autocompletion:

>>> from pyof.v0x01.controller2switch.features_request import FeaturesRequest
>>> request = FeaturesRequest(xid = 100)
>>> print(request.header.message_type)
Type.OFPT_FEATURES_REQUEST
>>> print(request.header.xid)
100

If you need to send this message via socket, call the pack() method to get its binary representation:

>>> binary_msg = request.pack()

Installation

You can install this package with pip package installer or from source code.

Installing from PyPI

python-openflow is in PyPI, so you can easily install it via pip3 (pip for Python 3) and also include this project in your requirements.txt

If you do not have pip3 you can install it on Ubuntu-base machines by running:

$ sudo add-apt-repository universe
$ sudo apt update
$ sudo apt install python3-pip

Once you have pip3, execute:

$ sudo pip3 install python-openflow

Installing source code

First you need to clone python-openflow repository:

$ git clone https://github.com/kytos/python-openflow.git

After cloning, the installation process is done by setuptools in the usual way:

$ cd python-openflow
$ sudo python3 setup.py install

Checking installation

That’s it! To check wether it is installed successfully, please try to import after running python3 or ipython3:

>>> import pyof
>>> # no errors should be displayed

Support

We are available in IRC and there is also a development mailing list. Details are available in the full documentation.

Contributing

Contributions are welcome either by creating issues in GitHub or in the form of pull requests. Before, please, read the contribution and hacking guides in the main documentation.

License

This software is under MIT-License. For more information please read the LICENSE file.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-openflow-1.1.0b0.tar.gz (74.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page