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
@@ -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
