.\" Man page generated from reStructuredText. . .TH "PYTHON-OPENFLOWLIBRARY" "1" "Jan 03, 2020" "2019.2" "python-openflow library" .SH NAME python-openflowlibrary \- python-openflow library Documentation . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .sp [image: Experimental] [image] \fI\%Openflow\fP \fI\%Tag\fP \fI\%Release\fP \fI\%License\fP \fI\%Build status\fP \fI\%Code coverage\fP \fI\%Code\-quality score\fP .sp \fIpython\-openflow\fP 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. .sp This library is part of \fI\%Kytos project\fP, but feel free to use this simple and intuitive library in other projects. .sp \fBATTENTION:\fP .INDENT 0.0 .INDENT 3.5 \fIpython\-openflow\fP does not perform I/O operations. To communicate with a switch, you must write your own controller using this library or use our \fI\%Kytos SDN Platform\fP\&. .UNINDENT .UNINDENT .sp A quick start follows for you to check whether this project fits your needs. For a more detailed documentation, please check the \fI\%python\-openflow API Reference Manual\fP\&. .SH QUICK START .SS Installing .sp We use python3.6. So in order to use this software please install python3.6 into your environment beforehand. .sp 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. .sp 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: .sp First you need to clone \fIpython\-openflow\fP repository: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ git clone https://github.com/kytos/python\-openflow.git .ft P .fi .UNINDENT .UNINDENT .sp After cloning, the installation process is done by standard \fIsetuptools\fP install procedure: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ cd python\-openflow $ sudo python3.6 setup.py install .ft P .fi .UNINDENT .UNINDENT .sp Alternatively, if you are a developer and want to install in develop mode: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ cd python\-openflow $ pip3.6 install \-r requirements/dev.txt .ft P .fi .UNINDENT .UNINDENT .SS Basic Usage Example .sp See how it is easy to create a feature request message with this library. You can use ipython3 to get the advantages of autocompletion: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C >>> from pyof.v0x01.controller2switch.features_request import FeaturesRequest >>> request = FeaturesRequest() >>> print(request.header.message_type) Type.OFPT_FEATURES_REQUEST .ft P .fi .UNINDENT .UNINDENT .sp If you need to send this message via socket, call the \fBpack()\fP method to get its binary representation to be sent through the network: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C >>> binary_msg = request.pack() >>> print(binary_msg) b"\ex01\ex05\ex00\ex08\ex14\exad\(aq\ex8d" >>> # Use a controller (e.g. Kytos SDN controller) to send "binary_msg" .ft P .fi .UNINDENT .UNINDENT .sp To parse a message, use \fBunpack_message()\fP: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C >>> from pyof.v0x01.common.utils import unpack_message >>> binary_msg = b"\ex01\ex05\ex00\ex08\ex14\exad\(aq\ex8d" >>> msg = unpack_message(binary_msg) >>> print(msg.header.message_type) Type.OFPT_FEATURES_REQUEST .ft P .fi .UNINDENT .UNINDENT .sp 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. .SH AUTHORS .sp For a complete list of authors, please open \fBAUTHORS.rst\fP file. .SH CONTRIBUTING .sp If you want to contribute to this project, please read \fI\%Kytos Documentation\fP website. .SH LICENSE .sp This software is under \fIMIT\-License\fP\&. For more information please read \fBLICENSE\fP file. .sp Here you will find examples on how to use python\-openflow for both unpack raw binary openflow messages and create new openflow messages and pack them as binary data to be sent throughtout your network. .SH PACKING EXAMPLES .INDENT 0.0 .INDENT 3.5 .SH TODO .sp Write a full list of examples, with simples messages and also more complex ones .UNINDENT .UNINDENT .SH UNPACKING EXAMPLES .INDENT 0.0 .INDENT 3.5 .SH TODO .sp Write unpacking examples, showing how the library behaves on simple and complex messages. .UNINDENT .UNINDENT .INDENT 0.0 .IP \(bu 2 Beraldo Leal .IP \(bu 2 Artur Baruchi .IP \(bu 2 Carlos Eduardo Moreira dos Santos .IP \(bu 2 Diego Rabatone Oliveira .IP \(bu 2 Macártur de Sousa Carvalho .IP \(bu 2 Raphael Cóbe .IP \(bu 2 André Tadeu .UNINDENT .sp The MIT License (MIT) .sp Copyright (c) 2016 Kytos Team .sp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: .sp The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. .sp THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SH AUTHOR Kytos Project .SH COPYRIGHT 2017, Kytos Project .\" Generated by docutils manpage writer. .