Esempio n. 1
0
 def send_req(self):
     if self.ryudp:
         match = parser.OFPMatch()
         self.req = parser.OFPFlowStatsRequest(self.ryudp, 0, ofp.OFPTT_ALL,
                                               ofp.OFPP_ANY, ofp.OFPG_ANY,
                                               0, 0, match)
         self.ryudp.send_msg(self.req)
Esempio n. 2
0
 def _flow_stats_requester(self):
     while True:
         for dp in self.switchports.keys():
             switch = self.switches[dp]  #Getting datapath from dpid
             cookie = cookie_mask = 0
             match = parser13.OFPMatch()
             msg = parser13.OFPFlowStatsRequest(switch, 0, of13.OFPTT_ALL,
                                                of13.OFPP_ANY,
                                                of13.OFPG_ANY, cookie,
                                                cookie_mask, match)
             switch.send_msg(msg)
         hub.sleep(3)  # Sleeping for three seconds
Esempio n. 3
0
 def _monitor(self):
     """
     This is the monitoring thread which periodically 
     """
     # This function is used for a periodical start of the get statistics request
     cookie = cookie_mask = 0
     table_id = 2
     req = ofparser.OFPFlowStatsRequest(self.datapath, 0, table_id,
                                        ofp.OFPP_ANY, ofp.OFPG_ANY, cookie,
                                        cookie_mask)
     while True:
         # Send request and wait for X seconds
         self.datapath.send_msg(req)
         hub.sleep(self.MONITORING_SLEEP_TIME)
Esempio n. 4
0
 def _monitor(self):
     """
     This is the monitoring thread which periodically 
     """
     # This function is used for a periodical start of the get statistics request
     cookie = cookie_mask = 0
     table_id = 1
     req = ofparser.OFPFlowStatsRequest(self.datapath, 0, table_id,
                                        ofp.OFPP_ANY, ofp.OFPG_ANY, cookie,
                                        cookie_mask)
     while True:
         # Send request and wait for X seconds
         self.datapath.send_msg(req)
         # Wait for a signal that the message was processed.
         # For safety reason, set a timeout (in case something goes wrong with the other thread
         self.learn_new_flows_event.wait(timeout=100 *
                                         self.MONITORING_SLEEP_TIME)
         # Wait for MONITORING_SLEEP_TIME before sending a new request
         hub.sleep(self.MONITORING_SLEEP_TIME)
         self.learn_new_flows_event.clear()
 def _request_stats(self, datapath):
 # Features request message
 # The controller sends a feature request to the switch upon session establishment.
     req = parser.OFPFlowStatsRequest(datapath)
     datapath.send_msg(req)
Esempio n. 6
0
    def request_stats(self, datapath, cookie):
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        req = parser.OFPFlowStatsRequest(datapath, cookie=cookie)
        datapath.send_msg(req)