From 44cd14ac81382cb8ce0fcc91ad377f2dc99d4fb8 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Wed, 2 Aug 2017 14:45:09 +0900 Subject: ofp_event: Timestamp when OpenFlow event was generated This patch introduces "timestamp" attribute for OpenFlow event classes which shows when that event was generated by Datapath instance and nearly equivalent to when Ryu finished receiving the message contained in that event instance. Suggested-by: Matthew Hayes Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/controller/ofp_event.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ryu/controller/ofp_event.py b/ryu/controller/ofp_event.py index 6b1c8b3e..6eb8e5f8 100644 --- a/ryu/controller/ofp_event.py +++ b/ryu/controller/ofp_event.py @@ -19,10 +19,10 @@ OpenFlow event definitions. """ import inspect +import time from ryu.controller import handler from ryu import ofproto -from ryu import utils from . import event @@ -41,12 +41,14 @@ class EventOFPMsgBase(event.EventBase): msg.datapath A ryu.controller.controller.Datapath instance which describes an OpenFlow switch from which we received this OpenFlow message. + timestamp Timestamp when Datapath instance generated this event. ============ ============================================================== The msg object has some more additional members whose values are extracted from the original OpenFlow message. """ def __init__(self, msg): + self.timestamp = time.time() super(EventOFPMsgBase, self).__init__() self.msg = msg -- cgit v1.2.3