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.
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.
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.
Metadata
Release files for python-openflow 2021.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-openflow-2021.1.tar.gz | 108.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_openflow-2021.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 307.1 kB
Release files / python-openflow-2021.1.tar.gz
| Download URL | python-openflow-2021.1.tar.gz |
|---|---|
| Size | 108.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d085181db3b8b9ea1eefd6b19bc644bca232fcfe9cb9cc83d343703a15264e7
|
|
BLAKE2b-256 checksum How to use checksums |
53d2d3939da429c3dcb6b93c3ecccb626c713af7e8396a176c03a61e77457dd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / python_openflow-2021.1-py3-none-any.whl
| Download URL | python_openflow-2021.1-py3-none-any.whl |
|---|---|
| Size | 198.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac09bafbffbd288e46564aad6d258276a75b4ae478ba0f38f187951ce8e3080d
|
|
BLAKE2b-256 checksum How to use checksums |
81b9bf4dc05ae97fcdc844ab21447f97f0dad6bb59d8ef6d9a34cb985e352198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for python-openflow 2021.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.