Python ryu.controller.ofp_event.EventOFPPortStatsReply() Examples

The following are 1 code examples of ryu.controller.ofp_event.EventOFPPortStatsReply(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module ryu.controller.ofp_event , or try the search function .
Example #1
Source File: tester.py    From ryu with Apache License 2.0 5 votes vote down vote up
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)