On Tue, 2 Sep 2014 22:35:15 +0800
Peng Xiao <[email protected]> wrote:

> Differentiate BMP messages from different BMP clients, and modify the debug
> logging message for client connected and disconnected.
> ---
>  ryu/app/bmpstation.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good, thanks.

I got the following pep8 warning:

ryu/app/bmpstation.py:87:80: E501 line too long (80 > 79 characters)
                    self.output_fd.write("%s | %s | %s\n\n" % (t,
                    addr[0], msg))
                                 
I fixed and also added your signed-off-by. Is the following patch ok
for you?

If you are not familiar with signed-off-by stuff, please have look at
'12) Sign your work' section at:

https://www.kernel.org/doc/Documentation/SubmittingPatches


=
>From 41d95ac699160f585cc791280eacab4f255f510f Mon Sep 17 00:00:00 2001
From: Peng Xiao <[email protected]>
Date: Wed, 3 Sep 2014 10:02:41 +0900
Subject: [PATCH] bmp: add client information to each bmp message

Differentiate BMP messages from different BMP clients, and modify the
debug logg ing message for client connected and disconnected.

Signed-off-by: Peng Xiao <[email protected]>
Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/app/bmpstation.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ryu/app/bmpstation.py b/ryu/app/bmpstation.py
index f8d22de..a96500f 100644
--- a/ryu/app/bmpstation.py
+++ b/ryu/app/bmpstation.py
@@ -48,7 +48,7 @@ class BMPStation(app_manager.RyuApp):
                                       self.loop).serve_forever)
 
     def loop(self, sock, addr):
-        self.logger.debug("start bmp loop: client %s" % str(addr))
+        self.logger.debug("BMP client connected, ip=%s, port=%s" % addr)
         is_active = True
         buf = bytearray()
         required_len = bmp.BMPMessage._HDR_LEN
@@ -83,14 +83,15 @@ class BMPStation(app_manager.RyuApp):
                                       (e, self.failed_pkt_count))
                 else:
                     t = time.strftime("%Y %b %d %H:%M:%S", time.localtime())
-                    self.logger.debug("%s | %s\n" % (t, msg))
-                    self.output_fd.write("%s | %s\n\n" % (t, msg))
+                    self.logger.debug("%s | %s | %s\n" % (t, addr[0], msg))
+                    self.output_fd.write("%s | %s | %s\n\n" % (t, addr[0],
+                                                               msg))
                     self.output_fd.flush()
                     buf = rest
 
                 required_len = bmp.BMPMessage._HDR_LEN
 
-        self.logger.debug("end bmp loop.")
+        self.logger.debug("BMP client disconnected, ip=%s, port=%s" % addr)
         sock.close()
         self.output_fd.close()
         self.failed_dump_fd.close()
-- 
1.8.5.2 (Apple Git-48)


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to