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 <matthew_john_hayes@hotmail.com>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
IWASE Yusuke 2017-08-02 14:45:09 +09:00 committed by FUJITA Tomonori
parent 6d950481f6
commit 44cd14ac81

View File

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