diff options
author | Jason Kölker <jason@koelker.net> | 2016-06-28 18:18:56 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-01 11:37:09 +0900 |
commit | 8b038a492e6670a739664f8f04a45123279a33c0 (patch) | |
tree | 60fcad6e375476f7f33d4f4f227af8761381fd07 | |
parent | b0ab4f16028c452374c5a0f22bd970038194f142 (diff) |
lib/ofctl_utils: Log the datapath sent to
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 <jason@koelker.net>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ofctl_utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ryu/lib/ofctl_utils.py b/ryu/lib/ofctl_utils.py index a4097f87..89cd5c83 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) |