fix failure of instantiating app

For example, app-A has app-X in CONTEXTS, and app-B depends on app-X as
SERVICE.  When app-B is specified in the app-lists before app-A, the
instantiating app-X fails by an assertion.

$ PYTHONPATH=. bin/ryu-manager ryu.app.quantum_adapter ryu.app.gre_tunnel
loading app ryu.app.quantum_adapter
loading app ryu.app.gre_tunnel
loading app ryu.controller.dpset
loading app ryu.controller.ofp_handler
loading app ryu.controller.ofp_handler
loading app ryu.controller.ofp_handler
instantiating app None of QuantumIfaces
creating context quantum_ifaces
instantiating app None of ConfSwitchSet
creating context conf_switch
instantiating app None of Network
creating context network
instantiating app None of Tunnels
creating context tunnels
instantiating app None of DPSet
creating context dpset
instantiating app ryu.app.gre_tunnel of GRETunnel
instantiating app ryu.controller.dpset of DPSet
Traceback (most recent call last):
  File "/opt/stack/ryu/bin/ryu-manager", line 19, in <module>
    main()
  File "/opt/stack/ryu/ryu/cmd/manager.py", line 77, in main
    services.extend(app_mgr.instantiate_apps(**contexts))
  File "/opt/stack/ryu/ryu/base/app_manager.py", line 434, in instantiate_apps
    self._instantiate(app_name, cls, *args, **kwargs)
  File "/opt/stack/ryu/ryu/base/app_manager.py", line 421, in _instantiate
    register_app(app)
  File "/opt/stack/ryu/ryu/base/app_manager.py", line 50, in register_app
    assert app.name not in SERVICE_BRICKS
AssertionError

This patch avoid the double loading of app in context and service.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: add bgpspaker module for non Ryu application usage

This enables you to use Ryu BGP feature as 'bgp speaker' python
library, that is, without ryu-manager, RPC API, REST API, or other Ryu
stuff, you can use Ryu BGP feature in your python application (just
import bgpspeaker.py). The sample code and the API reference docs are
included too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
app_manager: Let application module to use require_app()

Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
downgrade required version of msgpack-python

For Ubuntu 14.04, downgrade the required version of msgpack-python.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
contrib: import tinyrpc library

https://pypi.python.org/pypi/tinyrpc/0.5
https://github.com/mbr/tinyrpc

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ryu.lib.hub: add logging wrapper for wsgi server

This patch adds a wrapper to relay the log of the wsgi server to the logger.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: use TCP_NODELAY for bgp connection

Disables Nagle to send data immediately.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: use sendall with lock

With the current design, multiple greenlets calls sendall() on a
single tcp socket. This leads to a corrupted bgp message.

This patch introduces mutex to work around the problem. However, I
hope that we _fix_ the design where only one greenlet call sendall()
on a signel tcp socket in the future.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: catch socket error with sendall

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
app_manager: Stop checking h.callers in get_handlers()

dynamically registered handlers (vs. ones registered via
set_ev_cls/handler decorators) do not necessarily have h.callers.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
add debian files to make packages for Ubuntu

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ws_topology: Avoid controller name confliction

Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ws_topology: Handle WebSocket disconnection

Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add GUI app

Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bgp: support IPv6 peering

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ws_topology: shut up pep8 for long lines in a comment

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
document ryu.app.ofctl

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sw test tool: Enable IPv6 flow label maskable

OF 1.3.4 spec (B.15.1 Changes) says:

    Make IPv6 flow label maskable (EXT-101).

This patch makes IPv6 flow label maskable, and adds a test file for IPv6 flow label with masks.

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
package: add python-ryu-doc

This patch adds python-ryu-doc package which contains the HTML
documentation generated from doc/.
Also updates the man pages in doc/source/man/.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
app_manager: prevent loading unnecessary RyuApps

don't load RyuApps which is just imported and not defined in the module.
for example, if we run the script "test.py" as shown below by

$ ryu run test.py

the past implementation loads and instantiates not only Test but also RyuApp
and DPSet. this patch fix this wrong behavior

test.py
===

from ryu.base.app_manager import RyuApp
from ryu.controller.dpset import DPSet

class Test(RyuApp):
    _CONTEXTS = {'dpset' : DPSet}

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>