File: python-openflowlibrary.1

package info (click to toggle)
python-openflow 2021.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: python: 6,906; sh: 4; makefile: 4
file content (237 lines) | stat: -rw-r--r-- 6,845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
.\" 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 R
$ 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 R
$ 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 R
$ 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 R
>>> 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 R
>>> 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 R
>>> 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 <beraldo AT ncc DOT unesp DOT br>
.IP \(bu 2
Artur Baruchi <abaruchi AT ncc DOT unesp DOT br>
.IP \(bu 2
Carlos Eduardo Moreira dos Santos <cadu AT ncc DOT unesp DOT br>
.IP \(bu 2
Diego Rabatone Oliveira <diraol AT ncc DOT unesp DOT br>
.IP \(bu 2
Macártur de Sousa Carvalho <macartur.sc AT gmail DOT com>
.IP \(bu 2
Raphael Cóbe <rmcobe AT ncc DOT unesp DOT br>
.IP \(bu 2
André Tadeu <andretadeu AT ncc DOT unesp DOT br>
.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.
.