本文整理匯總了Python中ryu.controller.ofp_event.EventOFPPortStatsReply方法的典型用法代碼示例。如果您正苦於以下問題:Python ofp_event.EventOFPPortStatsReply方法的具體用法?Python ofp_event.EventOFPPortStatsReply怎麽用?Python ofp_event.EventOFPPortStatsReply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ryu.controller.ofp_event
的用法示例。
在下文中一共展示了ofp_event.EventOFPPortStatsReply方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: stats_reply_handler
# 需要導入模塊: from ryu.controller import ofp_event [as 別名]
# 或者: from ryu.controller.ofp_event import EventOFPPortStatsReply [as 別名]
def stats_reply_handler(self, ev):
# keys: stats reply event classes
# values: states in which the events should be processed
ofp = ev.msg.datapath.ofproto
event_states = {
ofp_event.EventOFPFlowStatsReply:
[STATE_FLOW_EXIST_CHK,
STATE_THROUGHPUT_FLOW_EXIST_CHK,
STATE_GET_THROUGHPUT],
ofp_event.EventOFPTableStatsReply:
[STATE_GET_MATCH_COUNT,
STATE_FLOW_UNMATCH_CHK],
ofp_event.EventOFPPortStatsReply:
[STATE_TARGET_PKT_COUNT,
STATE_TESTER_PKT_COUNT],
}
if ofp.OFP_VERSION >= ofproto_v1_2.OFP_VERSION:
event_states[ofp_event.EventOFPGroupDescStatsReply] = [
STATE_GROUP_EXIST_CHK
]
if ofp.OFP_VERSION >= ofproto_v1_3.OFP_VERSION:
event_states[ofp_event.EventOFPMeterConfigStatsReply] = [
STATE_METER_EXIST_CHK
]
if self.state in event_states[ev.__class__]:
if self.waiter and ev.msg.xid in self.send_msg_xids:
self.rcv_msgs.append(ev.msg)
if not ev.msg.flags:
self.waiter.set()
hub.sleep(0)