If a controller has multiple switches connected it is useful to be able
to distinguish which datapath the msg is being sent to.

Signed-off-by: Jason Kölker <ja...@koelker.net>
---
 ryu/lib/ofctl_utils.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ryu/lib/ofctl_utils.py b/ryu/lib/ofctl_utils.py
index a4097f8..89cd5c8 100644
--- a/ryu/lib/ofctl_utils.py
+++ b/ryu/lib/ofctl_utils.py
@@ -19,6 +19,7 @@ import logging
 import netaddr
 import six
 
+from ryu.lib import dpid
 from ryu.lib import hub
 
 
@@ -229,7 +230,12 @@ def send_msg(dp, msg, logger=None):
     if msg.xid is None:
         dp.set_xid(msg)
 
-    get_logger(logger).debug('Sending message with xid(%x): %s', msg.xid, msg)
+    log = get_logger(logger)
+    # NOTE(jkoelker) Prevent unnecessary string formating by including the
+    #                format rules in the log_msg
+    log_msg = ('Sending message with xid(%x) to '
+               'datapath(' + dpid._DPID_FMT + '): %s')
+    log.debug(log_msg, msg.xid, dp.id, msg)
     dp.send_msg(msg)
 
 
-- 
2.7.4


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to