Skip to main content

Library to parse and generate OpenFlow messages

Project description

WARNING: As previously announced on our communication channels, the Kytos project will enter the “shutdown” phase on May 31, 2021. After this date, only critical patches (security and core bug fixes) will be accepted, and the project will be in “critical-only” mode for another six months (until November 30, 2021). For more information visit the FAQ at <https://kytos.io/faq>. We’ll have eternal gratitude to the entire community of developers and users that made the project so far.

Experimental Openflow Tag Release License Build status Code coverage Code-quality score

python-openflow is a low level library to parse and create 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, short learning curve and free software license.

This library is part of Kytos project, but feel free to use this simple and intuitive library in other projects.

A quick start follows for you to check whether this project fits your needs. For a more detailed documentation, please check the python-openflow API Reference Manual.

Quick Start

Installing

In order to use this software please install python3.6 or greater into your environment beforehand.

We are doing a huge effort to make Kytos and its components available on all common distros. So, we recommend you to download it from your distro repository.

But if you are trying to test, develop or just want a more recent version of our software no problem: Download now, the latest release (it still a beta software), from our repository:

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 standard setuptools install procedure:

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

Alternatively, if you are a developer and want to install in develop mode:

$ cd python-openflow
$ pip3 install -r requirements/dev.txt

Basic Usage 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()
>>> print(request.header.message_type)
Type.OFPT_FEATURES_REQUEST

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

>>> binary_msg = request.pack()
>>> print(binary_msg)
b"\x01\x05\x00\x08\x14\xad'\x8d"
>>> # Use a controller (e.g. Kytos SDN controller) to send "binary_msg"

To parse a message, use the unpack() function:

>>> from pyof.utils import unpack
>>> binary_msg = b"\x01\x05\x00\x08\x14\xad'\x8d"
>>> msg = unpack(binary_msg)
>>> print(msg.header.version)
UBInt8(1) # OpenFlow 1.0
>>> print(msg.header.message_type)
Type.OFPT_FEATURES_REQUEST

Please, note that this library do not send or receive messages via socket. You have to create your own server to receive messages from switches. This library only helps you to handle OpenFlow messages in a more pythonic way.

Authors

For a complete list of authors, please open AUTHORS.rst file.

Contributing

If you want to contribute to this project, please read Kytos Documentation website.

License

This software is under MIT-License. For more information please read 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-2021.1.tar.gz (108.5 kB view details)

Uploaded Source

Built Distribution

python_openflow-2021.1-py3-none-any.whl (198.6 kB view details)

Uploaded Python 3

File details

Details for the file python-openflow-2021.1.tar.gz.

File metadata

  • Download URL: python-openflow-2021.1.tar.gz
  • Upload date:
  • Size: 108.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for python-openflow-2021.1.tar.gz
Algorithm Hash digest
SHA256 1d085181db3b8b9ea1eefd6b19bc644bca232fcfe9cb9cc83d343703a15264e7
MD5 1496d157d662ae9301494663eaf3999a
BLAKE2b-256 53d2d3939da429c3dcb6b93c3ecccb626c713af7e8396a176c03a61e77457dd7

See more details on using hashes here.

File details

Details for the file python_openflow-2021.1-py3-none-any.whl.

File metadata

  • Download URL: python_openflow-2021.1-py3-none-any.whl
  • Upload date:
  • Size: 198.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for python_openflow-2021.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac09bafbffbd288e46564aad6d258276a75b4ae478ba0f38f187951ce8e3080d
MD5 1d5ee8d0abe5f3a784e5385bfba545a3
BLAKE2b-256 81b9bf4dc05ae97fcdc844ab21447f97f0dad6bb59d8ef6d9a34cb985e352198

See more details on using hashes here.

Supported by

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