[Ryu-devel] How to customize logging format in ryu apps?

2014-02-28 Thread Can Zhang
s with the logging system. Anyone could help? Best regards, Can Zhang -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Cust

[Ryu-devel] [PATCH] Register TCP_DST and UDP_DST headers in NXM

2013-10-08 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/ofproto/nx_match.py | 10 ++ 1 file changed, 10 insertions(+) diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index 40c98df..b575d9a 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -694,6 +694,16 @@ class MFTPSRC

[Ryu-devel] How to profile an app?

2013-05-21 Thread Can Zhang
Hello, Now I want to profile my ryu app and plan to use cProfile. So I'd like to know where should I put cProfile.run() calls? And how do you do that in ryu? Best regards, Can Zhang -- Try New Relic Now &a

Re: [Ryu-devel] [PATCH] Support bind IPv6 addresses in StreamServer

2013-05-09 Thread Can Zhang
That's apparently OK. 2013/5/10 FUJITA Tomonori > On Fri, 3 May 2013 17:39:02 +0800 > Can Zhang wrote: > > > Use a very loose condition to determine if the address is an IPv6 > address or not. > > > > Signed-off-by: Can Zhang > > --- > > ryu

Re: [Ryu-devel] ryu.lib.hub.StreamServer.serve_forever blocks other apps?

2013-05-08 Thread Can Zhang
erve_forever() Any problem with it? Best regards, Can Zhang -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This

[Ryu-devel] ryu.lib.hub.StreamServer.serve_forever blocks other apps?

2013-05-07 Thread Can Zhang
reamServer into another thread. Then in this scenario, would ryu's event mechanism work well? Thanks, Can Zhang -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the

[Ryu-devel] [PATCH] Support bind IPv6 addresses in StreamServer

2013-05-03 Thread Can Zhang
Use a very loose condition to determine if the address is an IPv6 address or not. Signed-off-by: Can Zhang --- ryu/lib/hub.py | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ryu/lib/hub.py b/ryu/lib/hub.py index 44e5fea..e74b74a 100644 --- a/ryu/lib/hub.py +++ b/ryu

[Ryu-devel] How to migrate from gevent to eventlet?

2013-05-02 Thread Can Zhang
Best regards, Can Zhang -- Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with <2% overhead. Down

Re: [Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-28 Thread can.
As I checked the specification, you're right. the in_port is just a placeholder if OFPFW_IN_PORT is set to 1. 2013/4/28 FUJITA Tomonori > On Sun, 28 Apr 2013 15:09:00 +0800 > Can Zhang wrote: > > > > +if in_port is None: > > > +self.in_port

Re: [Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-28 Thread Can Zhang
> +if in_port is None: > +self.in_port = 0 I think None should be OFPP_NONE here, not zero Other parts look fine, please update the repo. Best regards, Can Zhang -- Try New Relic Now &

Re: [Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-27 Thread can.
ping...just to remind you about this patch 2013/4/24 Can Zhang > Subject: [PATCH] OFPMatch: support keyword-style parameters > > Signed-off-by: Can Zhang > --- > ryu/ofproto/ofproto_v1_0_parser.py | 46 > -- > 1 file changed, 29 insert

Re: [Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-24 Thread Can Zhang
Subject: [PATCH] OFPMatch: support keyword-style parameters Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 46 -- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto

[Ryu-devel] [PATCH] support IPv4 mask in nx_match

2013-04-23 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/ofproto/nx_match.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index d986ac1..1ffbfda 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -614,6 +614,7 @@ class MFIPSrc(MFField

Re: [Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-23 Thread Can Zhang
add super().__init__() Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index a9520aa..5b47681 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu

[Ryu-devel] [PATCH] OFPMatch: support keyword-style parameters

2013-04-22 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 45 -- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index 7945888..a9520aa 100644 --- a/ryu/ofproto

[Ryu-devel] a bug in 1.0 version OFPMatch

2013-04-22 Thread Can Zhang
only allow positional parameter. I don't know if there're convenient ways to fix it, but a class definition like: class OFPMatch(object): def __init__(self, wildcards, in_port, etc.. …) should work. If there're convenient ways, please tell me. Otherwise I'll

Re: [Ryu-devel] [PATCH] ip address presentation convert helper methods

2013-04-15 Thread Can Zhang
Hi, Since I made 4 commits in the branch, I send them as attachments. Best regards, Can Zhang 0001-ip-address-presentation-convert-helper-methods.patch Description: Binary data 0002-ip-address-presentation-convert-helper-methods.patch Description: Binary data 0003-method-name-changes-to

Re: [Ryu-devel] [PATCH] ip address presentation convert helper methods

2013-04-12 Thread Can Zhang
e string +''' +args = struct.unpack_from(IPV6_PACK_STR, bin_addr) +return ':'.join('%x' % x for x in args) + +if __name__ == '__main__': +a = ipv4_to_bin('10.28.197.1') +print ipv4_to_str(a) +print bin_to_ipv6(ipv6_to_bin('3f:10::1:2')) +print bin_to_ipv6(ipv6_to

[Ryu-devel] [PATCH] ip address presentation convert helper methods

2013-04-11 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/lib/ip.py | 57 + 1 file changed, 57 insertions(+) create mode 100644 ryu/lib/ip.py diff --git a/ryu/lib/ip.py b/ryu/lib/ip.py new file mode 100644 index 000..9077634 --- /dev/null +++ b/ryu/lib/ip.py

Re: [Ryu-devel] [PATCH 1/2] ryu/lib/packet/lldp.py: remove __str__ method from class LLDPBasicTLV and class lldp

2013-04-09 Thread can.
Now the LLDP packets are printed as: and formerly the packets are shown as: I think the patch is OK to me. 2013/4/9 Isaku Yamahata > Those methods are legacy when lldp.py was written for dpkt. > They don't make sense. remove them. > > Cc: "can." >

Re: [Ryu-devel] [PATCH 2/2] Minor changes to support IPv6 src/dst in NXM.

2013-04-08 Thread can.
Hello, The patch seems to be missed since I don't receive any responses. So I send this mail as a reminder. 2013/4/2 can. > Then how about this: > > > From 3e29f270b921ed871d9cbc8b80d275c9fe19e96f Mon Sep 17 00:00:00 2001 > From: Can Zhang > Date: Tue, 2

Re: [Ryu-devel] [PATCH] Delete a non-exist method call in LLDP

2013-04-08 Thread can.
FYI, I initially found this bug when parse the packets: pkt = packet.Packet(data) for p in pkt.protocols: print p something_else() if remove __str__() entirely, would the print work correctly? 2013/4/8 Isaku Yamahata > On Sun, Apr 07, 2013 at 04:06:22PM +0800, Can Zh

[Ryu-devel] [PATCH] Delete a non-exist method call in LLDP

2013-04-07 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/lib/packet/lldp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py index f82e00a..e6d77ba 100644 --- a/ryu/lib/packet/lldp.py +++ b/ryu/lib/packet/lldp.py @@ -103,7 +103,6 @@ class LLDPBasicTLV(object

Re: [Ryu-devel] Questions about dpset and switch name

2013-04-05 Thread can.
> > > 2. how to get switch name? There's port name, switch dpid, but no switch > name. Something might be missing. > > What's 'switch name'? IOW, what a field of an OF message? > I think I get it now, the switch name is stored as the internal

[Ryu-devel] Questions about dpset and switch name

2013-04-02 Thread Can Zhang
Hello everyone, I got two questions when writing my controller, 1. is dpset is obsolete and I should use topology instead? 2. how to get switch name? There's port name, switch dpid, but no switch name. Something might be missing. Best regards, Can

Re: [Ryu-devel] [PATCH 2/2] Minor changes to support IPv6 src/dst in NXM.

2013-04-01 Thread can.
Then how about this: >From 3e29f270b921ed871d9cbc8b80d275c9fe19e96f Mon Sep 17 00:00:00 2001 From: Can Zhang Date: Tue, 2 Apr 2013 11:45:20 +0800 Subject: [PATCH] Changed pack string of IPv6 address in NXM from former '!4I' to '!8H'. Registered IPv6 src/dst field he

Re: [Ryu-devel] [PATCH 2/2] Minor changes to support IPv6 src/dst in NXM.

2013-04-01 Thread can.
oo many values to unpack > -- The error is raised from: (value,) = struct.unpack_from(cls.pack_str, buf, offset + 4) where cls.pack_str is '8H' as you suggested. -- Best regards, Can Zhang -

Re: [Ryu-devel] [PATCH] use utils.round_up

2013-03-31 Thread can.
do. > > > > > Thanks! > > > > > >> import logging > >> LOG = logging.getLogger('ryu.ofproto.ofproto_v1_0_parser') > >> @@ -1070,7 +1070,7 @@ class NXFlowStats(object): > >> actions = [] > >> total_len = original_offset +

Re: [Ryu-devel] [PATCH] use utils.round_up

2013-03-31 Thread can.
Oops, I'm sorry. >From 2e9358c4f8fa0de8b6f5c49b714248d1ff210a70 Mon Sep 17 00:00:00 2001 From: Can Zhang Date: Mon, 1 Apr 2013 09:11:20 +0800 Subject: [PATCH] use utils.round_up Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 3 ++- 1 file changed, 2 insertio

[Ryu-devel] [PATCH] use utils.round_up

2013-03-31 Thread Can Zhang
>From 8bc4236b1cee2619d9b4ce938f6901e2fcecd283 Mon Sep 17 00:00:00 2001 From: Can Zhang Date: Mon, 1 Apr 2013 08:49:27 +0800 Subject: [PATCH] use utils.round_up Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --gi

Re: [Ryu-devel] [PATCH 2/2] Minor changes to support IPv6 src/dst in NXM.

2013-03-31 Thread can.
2013/3/30 FUJITA Tomonori > On Fri, 29 Mar 2013 11:19:31 +0800 > Can Zhang wrote: > > > Changed pack string of IPv6 address from former '!4I' to '!16s'. > > I think that 8H would be better for consistency with of1.2 code. > > But format strings ot

[Ryu-devel] [PATCH 2/2] Minor changes to support IPv6 src/dst in NXM.

2013-03-28 Thread Can Zhang
Changed pack string of IPv6 address from former '!4I' to '!16s'. Might need an IPv6Addr class or something to convert between human readable address and binary representation. Signed-off-by: Can Zhang --- ryu/ofproto/nx_match.py | 23 --- 1 file changed,

[Ryu-devel] [PATCH 1/2] support parse OFPAction in NXFlowStats

2013-03-28 Thread Can Zhang
Signed-off-by: Can Zhang --- ryu/ofproto/ofproto_v1_0_parser.py | 11 +++ 1 file changed, 11 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index 180e161..a6d3977 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto

[Ryu-devel] patch about nx_flow_stats

2013-03-28 Thread Can Zhang
Hello, I modified OHMURA's patch and added actions parser, and NXM IPv6 support. diff file attached below. Best regards, Can Zhang nx_flow_stats.diff Description: Binary data -- Own the Future-Intel® Lev

[Ryu-devel] patch about a typo

2013-03-28 Thread Can Zhang
Hello, Attached a simple patch about a typo. Best regards, Can Zhang typo.diff Description: Binary data -- Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game

Re: [Ryu-devel] [PATCH 1/3] nx_match: add MFField parser

2013-03-27 Thread can.
Hi, I guess it's caused by this line: -@..., ofproto_v1_0.NXM_NX_TUN_ID_W]) this is a feature of git? 2013/3/26 OHMURA Kei > 2013/3/26 Can Zhang : > > Hello, > > > > Your patch 1/3 failed in nx_match.py. Below is the .rej file: > > Thanks for your trying. Ap

Re: [Ryu-devel] [PATCH 1/3] nx_match: add MFField parser

2013-03-26 Thread Can Zhang
self.putm(buf, offset, rule.flow.tun_id, rule.wc.tun_id_mask) Best regards, Can Zhang -- Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compet

Re: [Ryu-devel] [PATCH] ofproto_parser: dump packets if error is encountered during parse

2013-03-25 Thread can.
0xff 0xff 0x0 0x30 0x0 0x4 0x1 0x0 Encounter an error during parsing OpenFlow packet from switch.This implies switch sending a malfold OpenFlow packet.version 0x01 msg_type 10 msg_len 18 xid 0 buf 0x1 0xa 0x0 0x12 0x0 0x0 0x0 0x0 0xff 0xff 0xff 0xff 0x0 0x

Re: [Ryu-devel] [PATCH] ofproto_parser: dump packets if error is encountered during parse

2013-03-25 Thread can.
@ -42,7 +42,13 @@ def round_up(x, y): > > > def hex_array(data): > -return ' '.join(hex(ord(chr)) for chr in data) > +"""Convert string into array of hexes to be printed.""" > +r

Re: [Ryu-devel] Some random(?) errors

2013-03-21 Thread can.
found failed with TypeError 2013/3/21 Isaku Yamahata > Thank you for the packet capture. > It looks like the switch sends malfold OF packets. What switch are you > using? > I attached the patch which improve an error message. Can you please test > it? > > > OpenFlow Prot

Re: [Ryu-devel] Ryu OpenFlow Tutorial page

2013-03-19 Thread Can Zhang
nfirm/correct some of my understandings. So I want to know how to contribute to this project? Sending mail to the mail list or push to a repository? And what format should I use? Personally I prefer markdown. Best regards, Can

Re: [Ryu-devel] Some random(?) errors

2013-03-18 Thread can.
Hello Isaku, A capture file is attached to the mail. The IP 10.0.2.15 is a virtual machine running mininet, and IP 10.109.242.118 is the host running ryu. I suspect that it's the first packetIn packets cause ryu to crash as you can see the FIN packets are only a few milliseconds after

[Ryu-devel] Some random(?) errors

2013-03-17 Thread Can Zhang
ckets that ryu cannot handle properly, and then ryu crashes. Maybe this is a bug of ryu? FYI, I'm using ryu with mininet(open vSwitch 1.9.0) Best regards, Can Zhang -- Everyone hates slow websites. So do we.

[Ryu-devel] Fwd: How to match IPv6 packets through nx_match?

2013-03-13 Thread Can Zhang
line 1564, in parser msg.buf, ofproto_v1_0.OFP_HEADER_SIZE) error: unpack_from requires a buffer of at least 12 bytes failed with error Best regards, Can Zhang Begin forwarded message: > From: Can Zhang > Subject: How to match IPv6 packets through nx_match? > Date: March 13, 2

[Ryu-devel] How to match IPv6 packets through nx_match?

2013-03-13 Thread Can Zhang
, hard_timeout = 0, actions = actions) --- But I can only see the flow as below: cookie=0x0, duration=3.744s, table=0, n_packets=0, n_bytes=0, idle_age=3, ipv6 actions=CONTROLLER:0 Which means I fail to assign a IPv6 address in match section. Does this

Re: [Ryu-devel] ryu's event mechanism

2013-03-12 Thread Can Zhang
r(self, ev): print 'recv:', ev.msg --- Best regards, Can Zhang -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.ne

Re: [Ryu-devel] ryu's event mechanism

2013-03-01 Thread can.
But I still cannot see the 'recv: xxx' as expected, here are the outputs: - loading app ryu.controller.ofp_handler loading app event.py instantiating app ryu.controller.ofp_handler instantiating app event.py - and nothing more. 2013/3/1 OHMURA Kei > 2013/3/1 can. : > &g

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
Thanks Kei, You mean a normal app does not need to call that method explicitly? And what that method is supposed to do? 2013/3/1 OHMURA Kei > 2013/3/1 can. : > > I think I get it. I should add ` self.register_observer(EventTest, > > self.name) ` in TestEvent.__init__(). T

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
I think I get it. I should add ` self.register_observer(EventTest, self.name) ` in TestEvent.__init__(). Thanks very much! And I also see register_handler() in class RyuApp, when should I use it? 2013/3/1 can. > But I still cannot see the 'recv: xxx' as expected, here ar

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
sg - but after ping(), pong() is not triggered 2013/2/28 Isaku Yamahata > On Thu, Feb 28, 2013 at 04:13:36PM +0800, can. wrote: > > Hi there, > > > > I'm trying to figure out ryu's event mechanism by sending and receiving > an > > event. Below is th

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
What I want is a minimal example of handling event, including: 1) define an event 2) send an event 3) receive an event 2013/2/28 Isaku Yamahata > On Thu, Feb 28, 2013 at 04:13:36PM +0800, can. wrote: > > Hi there, > > > > I'm trying to figure out ryu's event mec

[Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
stating that "name 'Hehe' is not defined" in line "@handler.set_ev_cls(Hehe.Event_1)". What do I miss? I need some help about this minimal example of raising and handling an event(especially a self-defined event). Thank you in advance. -- Best regards, Can Zhang --

[Ryu-devel] About "OF1.3 doesn't have ports"

2013-02-27 Thread can.
nk I need to get the port information about switches in my applications(not now, though). -- Best regards, Can Zhang -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDy

Re: [Ryu-devel] How to use the topology discovery of ryu?

2013-01-21 Thread can.
match IPv6 packets using nx_match of ovs, but I can not figure it out by reading the examples, or by reading the documents, or by reading the source code of nx_match.py. I tried: rule = nx_match.ClsRule() rule.set_ipv6_src(123) but the IPv6 match condition seems to be ignored when I dump flo

Re: [Ryu-devel] How to use the topology discovery of ryu?

2013-01-18 Thread can.
code is pretty clean, I'm new to this project and need some help. 1. From my experience with ryu, the old version(version before May.31 2012) requires a class to contain a _CONTEXTS. I think there might be other differences in writing an app between the old and the latest version. So as you

Re: [Ryu-devel] How to use the topology discovery of ryu?

2013-01-17 Thread can.
Thanks Isaku. But your link is a summary of the component. Where can I get the code? -- Best regards, Can Zhang Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On 2013年1月18日Friday at 上午8:38, Isaku Yamahata wrote: > Hi. > > The latest patch is v4 and available

[Ryu-devel] How to use the topology discovery of ryu?

2013-01-16 Thread can.
Hi there, I downloaded and installed ryu from github, but I cannot find the topology discovery components I expected. So please tell me how to get the code and documents. -- Best regards, Can Zhang -- Master