Beispiel #1
0
 def _handle_multipart_flow_stats(self, reply, switch):
     """Update switch flows after all replies are received."""
     if self._is_multipart_reply_ours(reply, switch):
         # Get all flows from the reply
         flows = [Flow04.from_of_flow_stats(of_flow_stats, switch)
                  for of_flow_stats in reply.body]
         # Get existent flows from the same xid (or create an empty list)
         all_flows = self._multipart_replies_flows.setdefault(switch.id, [])
         all_flows.extend(flows)
         if reply.flags.value % 2 == 0:  # Last bit means more replies
             self._update_switch_flows(switch)
Beispiel #2
0
 def _handle_multipart_flow_stats(self, reply, switch):
     """Update switch flows after all replies are received."""
     if self._is_multipart_reply_ours(reply, switch, 'flows'):
         # Get all flows from the reply
         flows = [
             Flow04.from_of_flow_stats(of_flow_stats, switch)
             for of_flow_stats in reply.body
         ]
         # Get existent flows from the same xid (or create an empty list)
         all_flows = self._multipart_replies_flows.setdefault(switch.id, [])
         all_flows.extend(flows)
         if reply.flags.value % 2 == 0:  # Last bit means more replies
             self._update_switch_flows(switch)
             event_raw = KytosEvent(
                 name='kytos/of_core.flow_stats.received',
                 content={'switch': switch})
             self.controller.buffers.app.put(event_raw)