second try
[vsorcdistro/.git] / ryu / doc / source / ofproto_base.rst
1 **************************************************
2 OpenFlow version independent classes and functions
3 **************************************************
4
5 .. py:currentmodule:: ryu.ofproto.ofproto_parser
6
7 Base class for OpenFlow messages
8 --------------------------------
9
10 ..    XXX
11 ..    the descrption of _TYPE is inlined from ryu/lib/stringify.py.
12 ..    this is a work around for a sphinx bug.
13 ..    https://bitbucket.org/birkenfeld/sphinx/issue/741/autodoc-inherited-members-wont-work-for
14
15 .. autoclass:: MsgBase
16    :members: to_jsondict, from_jsondict
17
18    .. attribute::
19     _TYPE
20
21     _TYPE class attribute is used to annotate types of attributes.
22
23     This type information is used to find an appropriate conversion for
24     a JSON style dictionary.
25
26     Currently the following types are implemented.
27
28     ===== ==========
29     Type  Descrption
30     ===== ==========
31     ascii US-ASCII
32     utf-8 UTF-8
33     ===== ==========
34
35     Example::
36
37         _TYPE = {
38             'ascii': [
39                 'hw_addr',
40             ],
41             'utf-8': [
42                 'name',
43             ]
44         }
45
46 Functions
47 ---------
48
49 .. autofunction:: ofp_msg_from_jsondict