47 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
852c2e882f datapath_connection_factory deal with None datapath.id
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-06-20 06:41:30 +09:00
YAMAMOTO Takashi
2caf583a7e use dpid_to_str in some places
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-05-18 04:43:22 +09:00
YAMAMOTO Takashi
359efd73aa controller: stop catching GreenletExit
no longer necessary after the hub changes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-05-10 00:36:34 +09:00
YAMAMOTO Takashi
fe6f94434c controller: fix send queue draining again
and this time add comments to explain the intention.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-05-01 22:18:39 +09:00
YAMAMOTO Takashi
9e6d3053c0 sweep the tree to change from gevent to ryu.lib.hub
mostly mechanical changes.
also, change the requirement from gevent to eventlet.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-05-01 22:18:39 +09:00
YAMAMOTO Takashi
e3fb48a0e0 TLS: test cli options consistently in the same line
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-03-18 22:26:35 +09:00
Yoshihiro Kaneko
2ac7a9cf6c ryu.controller.controller.Datapath: keep handler list regardless of state
The list of handler to be called for the OFP message should be kept
even if the state is changed in a handler.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-03-18 16:34:51 +09:00
FUJITA Tomonori
9fcc42d2e1 ofp: send events to others before calling own handlers
Some own handlers change the state so needs to send events before
calling own handlers.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-03-07 16:44:54 +09:00
FUJITA Tomonori
3dc0c13445 RyuApp: allows observers to specify state
This fixes the following exception:

>   $ ryu-manager ryu_app(OF1.2 app)
>   $ sudo mn --controller remote 127.0.0.1
>   $ sudo ovs-vsctl set bridge s1 protocols='[OpenFlow10,OpenFlow12]'
> connected socket:<socket fileno=4 sock=127.0.0.1:6633 peer=127.0.0.1:60456> address:('127.0.0.1', 60456)
> EVENT ofp_event->dpset EventOFPStateChange
> connected socket:<socket fileno=10 sock=127.0.0.1:6633 peer=127.0.0.1:60457> address:('127.0.0.1', 60457)
> EVENT ofp_event->dpset EventOFPStateChange
> hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x11bf550>
> unsupported version 0x1. If possible, set the switch to use one of the versions [3]
> error msg ev version: 0x3 msg_type 0x1 xid 0xc84d9220 type 0x1 code 0x1 0x3 0x1 0x0 0x5f 0xc8 0x4d 0x92 0x20 0x0 0x0 0x0 0x0 0x75 0x6e 0x73 0x75 0x70 0x70 0x6f
> +0x72 0x74 0x65 0x64 0x20 0x76 0x65 0x72 0x73 0x69 0x6f 0x6e 0x20 0x30 0x78 0x31 0x2e 0x20 0x49 0x66 0x20 0x70 0x6f 0x73 0x73 0x69 0x62 0x6c 0x65 0x2c 0x20 0x73
> +0x65 0x74 0x20 0x74 0x68 0x65 0x20 0x73 0x77 0x69 0x74 0x63 0x68
> EVENT ofp_event->dpset EventOFPPortStatus
> DPSET: A port was modified.(datapath id = None, port number = 1)
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/gevent/greenlet.py", line 390, in run
>     result = self._run(*self.args, **self.kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/ryu-1.6-py2.7.egg/ryu/base/app_manager.py", line 86, in _event_loop
>     handler(ev)
>   File "/usr/local/lib/python2.7/dist-packages/ryu-1.6-py2.7.egg/ryu/controller/dpset.py", line 192, in port_status_handler
>     self.port_state[datapath.id].modify(port.port_no, port)
> KeyError: None
> <Greenlet at 0x11bc518: <bound method DPSet._event_loop of <ryu.controller.dpset.DPSet object at 0xd0df10>>> failed with KeyError

Reported-by: HIYAMA Manabu <hiyama.manabu@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-27 21:29:14 +09:00
YAMAMOTO Takashi
4523b1b64c change --foo_bar options to --foo-bar
rename options. (s/_/-/)
according to Isaku Yamahata, this makes us look similar to openstack.

caveat: no backward compat is provided.  you need to update both of
config files and cli options.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-25 20:08:15 +09:00
YAMAMOTO Takashi
0af7056b7d switch from openstack.common.cfg to oslo.config.cfg
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-24 13:07:59 +09:00
YAMADA Hideki
b083da401f controller: fix that sender thread is never terminated
Empty q.get() is blocking send thread.
Because of this issue, datapath state never transit to DEAD.

This fixes commit 83e3709a0d70f889e794d1c5f70c1c1eb73075f7.
  - controller: fix send_q draining
      83e3709a0d

Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-24 12:56:22 +09:00
YAMAMOTO Takashi
6be8ef3906 use openstack.common.cfg instead of gflags
make most of modules use openstack.common.cfg instead of gflags

caveats: no config file compatibility is provided.  (flagfile vs ini file)

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-14 12:34:08 +09:00
YAMAMOTO Takashi
83e3709a0d controller: fix send_q draining
when stopping the sender thread, ensure that no one is going to block
on send_q.  otherwise a ryu app who wants to do send_msg on the datapath
can block on the queue forever if the queue is full.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-14 08:08:39 +09:00
Isaku Yamahata
6b4a5f7470 ryu/controller/controller: add a helper method, is_reserved_port()
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-08 22:55:16 +09:00
FUJITA Tomonori
7578e7d602 replace dispatcher mechanism
This is purely internal change and no API for applications is
changed. At least, I confirmed that folsom OpenStack plugin works.

With the current dispatcher mechanism, multiple greenlets call
applications' handlers and might be blocked anywhere so we need
various locks to handle that concurrency. This makes things difficult
for application developers.

With this patch, each applications are connected with events. Each
application has the own greenlet(s) to handle events and might send
events to other applications.

If an application registers handlers for some OF events, it subscribes
to OF component and registers the OF events that it's interested. OF
application delivers such OF events to the application and the
application's greenlet executes the handlers.

With this, we can completely remove dispatcher.py and its friends.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-02-04 09:33:28 +09:00
FUJITA Tomonori
3dcb33bb1e enable OF1.3 support
Ryu sucessfully connects to CPqD OF1.3 switch.

https://github.com/CPqD/ofsoftswitch13

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-11-23 11:38:09 +09:00
OHMURA Kei
c1dfc53488 add TLS support
This patch supports TLS connection to encrypt OF channel.

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-11-16 08:30:00 +09:00
FUJITA Tomonori
c8cd4226d7 fix pep8 1.3.3 warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-22 06:27:12 +09:00
Isaku Yamahata
3579a3e37c controller: print backtrace when exception in addition to stacktrace
This is useful when debugging. it's difficult to debug without
backtrace.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-20 11:25:06 +09:00
FUJITA Tomonori
4c2de66d32 stop import ofproto_v1_0 as ofproto
'from . import ofproto_v1_0 as ofproto' in ryu/ofproto/__init__.py is
a wrong assumption. We need to remove it.

This introduces ryu/ofproto/ofproto_common.py including only constatns
that OF version independent code must use. Note that I don't move data
structures there that multiple OF versions can share (like OVS does).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-17 19:32:13 +09:00
Isaku Yamahata
10fcdec3b3 controller/controller: make send_flow_mod() allow default value for priority
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-05-01 08:48:33 +09:00
Isaku Yamahata
57bd1abe5c controller, ofproto_v1_0: avoid format for argument
format is defined in builtin, so it should be avoid for argument.
use flow_format instead.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Reviewed-by: Simon Horman <simon@horms.net>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-05-01 08:44:02 +09:00
FUJITA Tomonori
711301abb3 Switch to Apache 2.0 license
To make the further integration into IaaS OSS (OpenStack and
CloudStack) easier, we switch to Apache 2.0 license.

ryu/app/wsapi.py is still under GPL3 or later. We replace it later.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-04-06 08:38:45 +09:00
FUJITA Tomonori
8d2a263694 ignore GreenletExit exception
We get a pretty anonying message every time a datapath has gone since
we kill send_thr gleenlet in the normal termination. Let's ignore the
exception.

In the long term, we should improve error message delivering. Just
printing an error is pretty useless.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-16 02:39:44 +09:00
Simon Horman
c5a2dd55ed Allow send_flow_mod() to send NXTFlowMod messages
Allow send_flow_mod() to send NXTFlowMod messages in place of OFPFlowMod
messages if the match includes fields chat can't be encoded by OFPMatch

The flow format will be upgraded as necessary

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-13 21:41:42 -07:00
Simon Horman
85fe60abe0 Add support for NXT_SET_FLOW_FORMAT
This message may be used to request that the NXM
flow format may be used. NXM is used as the match
in NX vendor extension messages such as NXT_FLOW_MOD.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-13 21:41:25 -07:00
Isaku Yamahata
ba5ce1a72e controller: print stack trace when datapath main loop goes wrong and log it
log errors when serving datapath. And a comment to clarify the intention.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-08 05:54:19 +09:00
FUJITA Tomonori
d7ee5d2282 yield the CPU to other greenlets
We need to yield the CPU to other greenlets. Otherwise, ryu can't
accept new switches or handle the existing switches. The limit is
arbitrary. I guess that we need to think about the better approach in
the future (e.g. non greenlet framework).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:11:29 +09:00
FUJITA Tomonori
f6741e9c93 avoid reading too much data from socket
Currently, we try to read OFP_MSG_SIZE_MAX (65535) from sockets. This
hurts the performance badly. This patch changes ryu to read a single
request from socket.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:11:26 +09:00
FUJITA Tomonori
d0e3264a84 limit the queue size (send_q)
cbench in throughtput mode doesn't work with ryu. We need to limit
queue size to prevent the queue from eating memory up.

The size is arbitrary. It can be the startup parameter. But I think
that we should solve this in the better way. So let's not make it
global for now

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:11:01 +09:00
FUJITA Tomonori
e44c9d6089 kill recv_q
Using Queue hurts the performance badly. So let's kill recv_q. It's
not useufl.

Killing send_q is difficult because letting multiple greenlets to send
data to a switch is tricky.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:09:55 +09:00
Isaku Yamahata
68b1424ef3 controller: eliminate weakref of datapath.ev_q.aux
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:06:48 +09:00
Isaku Yamahata
0275604621 controller: make Controller::serve more robust
Even when exception occurred, kill other thread.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-03-01 09:06:21 +09:00
FUJITA Tomonori
92b58c2a41 enable OF1.2 support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-23 12:57:51 +09:00
Isaku Yamahata
2c018c6b99 controller/datapath: add a helper function to delete flow entries
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-10 16:45:14 +09:00
FUJITA Tomonori
567cb2c364 fix datapath disconnection cleanup
After the datapath connection is close, we call gevent.joinall for
ev_thr and send_thr greenlets to wait for the completion of them.
However, gevent.joinall will block forever since the greenlets sleep.
We can put some junk to the queues to wake them but looks like just
killing the greenlets is simpler.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-05 15:41:30 +09:00
FUJITA Tomonori
78e3eba75d remove unused members in Datapath class
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-03 12:21:14 +09:00
Isaku Yamahata
c22ef47a9c controller: factor out ofp message event from event.py
Move out ofp msg event from event.py into ofp_event.py

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-03 02:36:26 +09:00
Isaku Yamahata
b3002281e9 pylint: various fixes for pylint
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-03 02:35:38 +09:00
Isaku Yamahata
e66a04e80e controller/dpset: Introduce datapath enter/leave event
Introduce DPSet class to track datapath enter/leave and generate events.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-01 08:55:44 +09:00
Isaku Yamahata
39bc833bf3 controller: pass datapath to EventQueue for EventQueueCreate event
Later dpset is decoupled with EventQueueCreate.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-01 08:55:42 +09:00
Isaku Yamahata
4dd1118b7d dispatcher: pass name to EventQueue and track all instances
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-02-01 08:55:35 +09:00
FUJITA Tomonori
0be016c271 use 0 dl_{src, dst} for OFPMatch
Simplify the code a bit.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-01-31 04:02:21 +09:00
Isaku Yamahata
104436157a xid: improve xid handling
Generate xid for ofp message instead of always 0.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-01-30 18:32:47 +09:00
FUJITA Tomonori
cd0fbaffd9 Fix to send OFPT_HELLO with the highest OpenFlow protocol version
Preparation for 1.2 support.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-01-17 23:04:31 +09:00
FUJITA Tomonori
aa5051a162 initial commit
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2011-12-09 15:56:05 +09:00