diff options
author | YAMAMOTO Takashi <yamamoto@valinux.co.jp> | 2014-01-27 15:31:20 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-01-27 22:22:10 +0900 |
commit | d5c2c1f2e38476d043ff4f8e65f00f9de0c913af (patch) | |
tree | 38dc1df517113cb1c30306f3883dcdf4f4c35ed2 /doc | |
parent | bd235f1847d295b6d960981f03681db9d0dcc9c5 (diff) |
doc: improve RyuApp documentation
This includes a small code change; the default value of OFP_VERIONS
was changed to None from the lack of the attribute. No functional
changes are intended by this.
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/api_ref.rst | 8 | ||||
-rw-r--r-- | doc/source/ryu_app_api.rst | 95 |
2 files changed, 9 insertions, 94 deletions
diff --git a/doc/source/api_ref.rst b/doc/source/api_ref.rst index ed2fbce5..cc0aad20 100644 --- a/doc/source/api_ref.rst +++ b/doc/source/api_ref.rst @@ -1,7 +1,15 @@ +.. _api_ref: ******************************* Ryu API Reference ******************************* +.. XXX list all members explicitly to workaround a sphinx bug +.. XXX https://bitbucket.org/birkenfeld/sphinx/issue/1362 + +.. py:currentmodule:: ryu.base.app_manager +.. autoclass:: ryu.base.app_manager.RyuApp + :members: OFP_VERSIONS,_CONTEXTS,_EVENTS,close,context_iteritems,reply_to_request,send_event,send_event_to_observers,send_request,start + .. automodule:: ryu.controller.dpset :members: diff --git a/doc/source/ryu_app_api.rst b/doc/source/ryu_app_api.rst index 7306c2e5..e0b3cb08 100644 --- a/doc/source/ryu_app_api.rst +++ b/doc/source/ryu_app_api.rst @@ -99,100 +99,7 @@ See :ref:`ofproto_ref` for more info about OpenFlow messages. ryu.base.app_manager.RyuApp =========================== -The base class for Ryu applications. - -class attributes ----------------- - -A RyuApp subclass can have class attributes with the following special -names, which are recognized by app_manager. - -_CONTEXTS -````````` - -A dictionary to specify contexts which this Ryu application wants to use. -Its key is a name of context and its value is an ordinary class -which implements the context. The class is instantiated by app_manager -and the instance is shared among RyuApp subclasses which has \_CONTEXTS -member with the same key. A RyuApp subclass can obtain a reference to -the instance via its \_\_init\_\_'s kwargs as the following. - -.. code-block:: python - - _CONTEXTS = { - 'network': network.Network - } - - def __init__(self, *args, *kwargs): - self.network = kwargs['network'] - -_EVENTS -``````` - -A list of event classes which this RyuApp subclass would generate. -This should be specified if and only if event classes are defined in -a different python module from the RyuApp subclass is. - -OFP_VERSIONS -```````````` - -A list of supported OpenFlow versions for this RyuApp. -For example: - -.. code-block:: python - - OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION, - ofproto_v1_2.OFP_VERSION] - -If multiple Ryu applications are loaded in the system, -the intersection of their OFP_VERSIONS is used. - -instance attributes -------------------- - -A RyuApp instance provides the following attributes. - -\_\_init\_\_(self, \*args, \*kwargs) -```````````````````````````````````` - -RyuApp subclasses are instantiated after ryu-manager loaded -all requested Ryu application modules. -\_\_init\_\_ should call RyuApp.__init__ with the same arguments. -It's illegal to send any events in \_\_init\_\_. - -name -```` - -The name of the class used for message routing among Ryu applications. -(Cf. send_event) -It's set to __class__.__name__ by RyuApp.__init__. -It's discouraged to override this value. - -send_request(self, req) -``````````````````````` - -Make a synchronous request. -Set req.sync to True, send it to a Ryu application specified by req.dst, -and block until receiving a reply. -Returns the received reply. -The argument should be an instance of EventRequestBase. - -reply_to_request(self, req, rep) -````````````````````` - -Send a reply for a synchronous request sent by send_request. -The first argument should be an instance of EventRequestBase. -The second argument should be an instance of EventReplyBase. - -send_event(self, name, ev) -`````````````````````````` - -Send the specified event to the RyuApp instance specified by name. - -send_event_to_observers(self, ev) -````````````````````````````````` - -Send the specified event to all observers of this RyuApp. +See :ref:`api_ref`. ryu.controller.handler.set_ev_cls(ev_cls, dispatchers=None) =========================================================== |