Git Product home page Git Product logo

python-openflow's Introduction

Overview

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.

Attention

python-openflow does not perform I/O operations. To communicate with a switch, you must write your own controller using this library or use our Kytos SDN Platform.

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.

python-openflow's People

Contributors

abaruchi avatar ajoaoff avatar andretadeu avatar beraldoleal avatar cemsbr avatar cmagnobarbosa avatar diraol avatar erickvermot avatar gleybersonandrade avatar hdiogenes avatar josemauro avatar keniachang avatar lucasgsfelix avatar macartur avatar niehaus avatar raphaelmcobe avatar renanrodrigo avatar rmotitsuki avatar slinksoft avatar viniarck avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.