本文整理汇总了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)