345 Commits

Author SHA1 Message Date
FUJITA Tomonori
d56ee9d19a Ryu 1.2
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
v1.2
2012-08-31 15:27:42 +09:00
FUJITA Tomonori
90021d43c1 remove OFPFlowRemoved and OFPPortStatus handlers in MAIN_DISPATCHER
I don't see any reason why we need to handle those two OFP messages as
differently as the rest.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-31 09:30:16 +09:00
FUJITA Tomonori
6e55bc8b98 remove unnecessary OFPFlowRemoved and OFPBarrierReply handlers in CONFIG_DISPATCHER
We don't send OFPC_DELETE OFPFlowMod or OFPBarrier during
CONFIG_DISPATCHER so we don't need OFPFlowRemoved and OFPBarrierReply.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-31 09:30:15 +09:00
FUJITA Tomonori
10fa798590 remove unnecessary OFPEchoReply handler in dispatchers
We don't send OFPEchoRequest so there is no point to have OFPEchoReply
handler.

I think that sending OFPEchoRequest is useful for some cases
(e.g. finding problems on the switch quickly). But that should be
another helper dispatcher since not all applications need such.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-31 09:29:57 +09:00
FUJITA Tomonori
05521398c1 packet lib: fix ipv4 option field handling
- fix the parser to set option data.
- add option argument to __init__.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-31 09:29:31 +09:00
FUJITA Tomonori
77df140ecf packet lib: set _MIN_LEN class variable
All protocols need to check if the data length is long enough so let's
set the minimum length in the same way.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-29 08:42:26 +09:00
FUJITA Tomonori
4d00bc8025 packet lib: add tcp support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
1241dafde4 packet lib: convert ip to use the checksum helper function
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
2814763bb8 packet lib: add udp data transmit and checksum support
- UDP supports sending data.
- UDP calculates the checksum if not given.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
0153f492ea packet lib: add packet_utils.py
Add a helper function to calculate the checksum.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
3fdb2dabec packet lib: add data serialize support to Packet class
This enables you to send data with Packet class.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
4e887d03c8 packet lib: calculate the udp length
If the length is not given, calculate it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
79ae375136 packet lib: calculate the ip total length
If the total length is not given, calculate it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
d0cc259e3b packet lib: serialize in reverse order
- we need to serialize in reverse order since some need to know
  payload.
- TCP and UDP need the previous protocol info (IP) to calculate the
  checksum.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-28 05:58:25 +09:00
FUJITA Tomonori
b3e491349a of1.2: fix OFPFlowRemoved parser
Fix the following:

ryu/ofproto/ofproto_v1_2_parser.py", line 1701, in parser
    type_, length = struct.unpack_from('!HH', buf, offset)
TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-27 17:01:29 +09:00
FUJITA Tomonori
3c339e77cc of1.2: fix ofp_port_stats pack format
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-27 11:43:23 +09:00
FUJITA Tomonori
cccd01f5ea test: fix pep8 1.3.3 warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-23 11:40:46 +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
FUJITA Tomonori
1dcf8f76d9 test: use the latest version of pep8
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-22 06:24:11 +09:00
FUJITA Tomonori
03b42e23d4 add packet library
As discussed on the mailing list, there is no good packet library
(parses and builds various protocol packets). dpkt isn't flexible
enough (can't nicely handle stacked protocols such as vlan, mpls,
gre). NOX's one is nice but released under GPL3.

So we need our own packet library.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-21 18:52:15 +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
c771dc8d6f test: add stats and config tests to integrated test suite
Run this in the following way:

$ ryu-manager ryu/ryu/tests/integrated/test_request_reply_v12.py

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-20 09:52:23 +09:00
FUJITA Tomonori
2a7f243425 of: Fix OFPEchoRequest serialize
The spec allows zero-length data.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-08-10 10:19:17 +09:00
FUJITA Tomonori
1eb52f7671 of1.2: pretty OFPGetConfigReply parser
Make OFPGetConfigReply parser consistent with the rest

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-08-06 14:29:49 +09:00
FUJITA Tomonori
b49ccfc11b clean up ETH_TYPE_ constants
Use ofproto/ether.py

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-07-31 13:26:53 +09:00
FUJITA Tomonori
7830a134de add ethernet type constants
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-07-31 13:26:36 +09:00
FUJITA Tomonori
254db170ec test: fix SET_NW_TOS action in test_add_flow_v10
The lowest two bits must be zero.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-07-31 13:26:17 +09:00
FUJITA Tomonori
89b5f3c5d0 clean up IPPROTO_ constants
Use ofproto/inet.py.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-31 13:25:49 +09:00
FUJITA Tomonori
6ba1075b6c add IPPROTO_SCTP constant
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-31 13:25:47 +09:00
FUJITA Tomonori
562515949d rename ryu/ofproto/in.py to ryu/ofproto/inet.py
Avoid a reserved word.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-31 13:25:45 +09:00
FUJITA Tomonori
a41029a2b9 test: specify OF version in integrated test suite
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-31 13:25:40 +09:00
FUJITA Tomonori
dbade0ca57 Add SubmittingPatches doc
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-30 21:44:54 +09:00
FUJITA Tomonori
be18e1b4b1 Ryu 1.1
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
v1.1
2012-07-30 20:05:59 +09:00
FUJITA Tomonori
6b99b1408b of1.2: handle unknown match field properly
Ryu crashes when it finds an unknown match field in OFPMatch. Instead,
Ryu should just ignore it and continue to parse.

With this patch, Ryu uses OFPmatchField class for an unknown match
field and continue to parse.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: Simon Horman <horms@verge.net.au>
2012-07-30 11:58:23 +09:00
FUJITA Tomonori
8c1978942d test: simplify integrated OVS test suite
This patch simplifies integrated OVS test suite. Currently, we wait
for a barrier response before moving to the next test. However, we
don't need. The logic works like the following:

sending a flow mod (deleting all the flows)
sending a barrier
sending a flow mod (set up a flow to test)
sending a barrier
sending a flow stats

Then the reply handler for flow stats verifies the result and move to
the next.

You can run a test suite like:

$ ryu-manager ~/git/ryu/ryu/tests/integrated/test_add_flow_v12_actions.py

We can try two more suites:

ryu/tests/integrated/test_add_flow_v10.py
ryu/tests/integrated/test_add_flow_v12_matches.py

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-28 10:24:46 +09:00
FUJITA Tomonori
dfa4ab185a test: add more of1.2 unittests
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-26 19:44:40 +09:00
FUJITA Tomonori
696639de4e of1.2: fix IPv6 match parsers
Fix the folloing problem in MTIPv6Src, MTIPv6Src, MTIPv6Dst, and
MTIPv6NdTarget's parsers:

File "/home/openflow/ryu/ryu/ofproto/ofproto_v1_2_parser.py", line 1705, in parser
  field = OFPMatchField.parser(buf, offset)
File "/home/openflow/ryu/ryu/ofproto/ofproto_v1_2_parser.py", line 1934, in parser
  field = cls_.field_parser(header, buf, offset)
File "/home/openflow/ryu/ryu/ofproto/ofproto_v1_2_parser.py", line 1949, in field_parser
  (value,) = struct.unpack_from(cls.pack_str, buf, offset + 4)
ValueError: too many values to unpack

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-26 19:41:08 +09:00
FUJITA Tomonori
2bf07c065a of1.2: make set_metadata implementation consistent with the rest
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-25 11:48:43 +09:00
FUJITA Tomonori
f2ac2b5e15 of1.2: fix OFPExperimenter parser
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-25 11:46:36 +09:00
FUJITA Tomonori
ef5c5e45d3 of1.2: fix Instruction parser
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-24 15:19:47 +09:00
Simon Horman
a7eb8c4254 of1.2: add OXM_OF_METADATA support
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-24 07:55:40 +09:00
FUJITA Tomonori
68bfa1f84d fix 475ca44ef4f87b00945ccd5be8ee4ab196c4e86f regression
Needs __init__.py

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-20 07:48:30 +09:00
FUJITA Tomonori
475ca44ef4 test: add integrated OVS test suite
This patch adds a test framework with OVS to test various matches and
actions; adding various matches and actions and check `ovs-ofctl
dump-flows' output.

First, create 'br-tester' bridge:

fujita@rose:~$ sudo ovs-vsctl add-br br-tester

Secondly, configure the bridge to use the local controller:

fujita@rose:~$ sudo ovs-vsctl set-controller br-tester tcp:127.0.0.1

Thirdly, run what you want to test. If you want to try adding flows on
OF1.0:

fujita@rose:~$ ryu-manager --verbose --run_test_mod ryu.tests.integrated.test_add_flow_v10 ryu.tests.integrated.tester

This patch adds three test sets:

ryu.tests.integrated.test_add_flow_v10
ryu.tests.integrated.test_add_flow_v12_actions
ryu.tests.integrated.test_add_flow_v12_matches

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-20 06:27:16 +09:00
FUJITA Tomonori
bdaafadc3f of1.2: fix OFPPortStatsRequest typo
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-19 21:07:54 +09:00
FUJITA Tomonori
b281cc72bc of1.2: OFPGroupMod and OFPGroupFeaturesStats
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-19 21:07:31 +09:00
FUJITA Tomonori
b5d462f615 simple_switch: remove outside module dependence
simple_switch is a a learing material (who uses this in
production?). It should be the simple learning switch code like one in
OpenFlow tutorial. It's easier for learniners if simple_switch doesn't
use the outside modules.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-19 14:59:58 +09:00
FUJITA Tomonori
e3e703970d cbench: specify OF1.0
cbench works with only OF1.0 and OF1.0 provides all cbench needs. So
specify OF1.0.

Also it doesn't need nxm so use OFPMatch and OFPFlowMod.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
2012-07-18 16:54:43 +09:00
FUJITA Tomonori
112c7e5496 simple_switch: specify OF1.0
simple_switch works with only OF1.0 and OF1.0 provides all
simple_switch needs. So specify OF1.0.

simple_switch doesn't need nxm so use OFPMatch and OFPFlowMod (and
avoid the helper functions).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-18 16:54:18 +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
FUJITA Tomonori
ad184686a8 nxm: remove import ofproto
Use ofproto_v1_0 explicitly instead.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2012-07-17 19:31:58 +09:00