Beispiel #1
0
 def get_all_flows_from_dpid(self, dpid, timeout=10):
     """Return all flows from DPID."""
     int_dpid = faucet_mininet_test_util.str_int_dpid(dpid)
     return self.ofctl_get(
         int_dpid,
         '%s/stats/flow/%s' % (self.ofctl_rest_url(), int_dpid),
         timeout)
Beispiel #2
0
 def get_port_stats_from_dpid(self, dpid, port, timeout=2):
     """Return OFStats for a port."""
     int_dpid = faucet_mininet_test_util.str_int_dpid(dpid)
     port_stats = self.ofctl_get(
         int_dpid,
         '%s/stats/port/%s/%s' % (self.ofctl_rest_url(), int_dpid, port),
         timeout)
     if port_stats:
         return json.loads(port_stats[0])
     return None
 def get_all_groups_desc_from_dpid(self, dpid, timeout=2):
     int_dpid = faucet_mininet_test_util.str_int_dpid(dpid)
     for _ in range(timeout):
         try:
             ofctl_result = json.loads(
                 requests.get('%s/stats/groupdesc/%s' %
                              (self.ofctl_rest_url(), int_dpid)).text)
             flow_dump = ofctl_result[int_dpid]
             return [json.dumps(flow) for flow in flow_dump]
         except (ValueError, requests.exceptions.ConnectionError):
             # Didn't get valid JSON, try again
             time.sleep(1)
             continue
     return []
 def get_all_groups_desc_from_dpid(self, dpid, timeout=2):
     int_dpid = faucet_mininet_test_util.str_int_dpid(dpid)
     for _ in range(timeout):
         try:
             ofctl_result = json.loads(requests.get(
                 '%s/stats/groupdesc/%s' % (self.ofctl_rest_url(),
                                            int_dpid)).text)
             flow_dump = ofctl_result[int_dpid]
             return [json.dumps(flow) for flow in flow_dump]
         except (ValueError, requests.exceptions.ConnectionError):
             # Didn't get valid JSON, try again
             time.sleep(1)
             continue
     return []
Beispiel #5
0
 def get_all_groups_desc_from_dpid(self, dpid, timeout=2):
     int_dpid = faucet_mininet_test_util.str_int_dpid(dpid)
     return self.ofctl_get(
         int_dpid,
         '%s/stats/groupdesc/%s' % (self.ofctl_rest_url(), int_dpid),
         timeout)