Beispiel #1
0
 def _handle_BarrierIn(self, barrier):
     # yeah. barrier in. time to sync some of these flows
     if barrier.xid in self._pending_barrier_to_ops:
         added = []
         removed = []
         #print "barrier in: pending for barrier: %d: %s" % (barrier.xid,
         #    self._pending_barrier_to_ops[barrier.xid])
         for op in self._pending_barrier_to_ops[barrier.xid]:
             (command, entry) = op
             if (command == OFSyncFlowTable.ADD):
                 self.flow_table.add_entry(entry)
                 added.append(entry)
             else:
                 removed.extend(
                     self.flow_table.remove_matching_entries(
                         entry.match,
                         entry.priority,
                         strict=command == OFSyncFlowTable.REMOVE_STRICT))
             #print "op: %s, pending: %s" % (op, self._pending)
             if op in self._pending: self._pending.remove(op)
             self._pending_op_to_barrier.pop(op, None)
         del self._pending_barrier_to_ops[barrier.xid]
         self.raiseEvent(FlowTableModification(added=added,
                                               removed=removed))
         return EventHalt
     else:
         return EventContinue
Beispiel #2
0
 def _handle_FlowRemoved (self, event):
   """
   process a flow removed event -- remove the matching flow from the table.
   """
   flow_removed = event.ofp
   for entry in self.flow_table.entries:
     if (flow_removed.match == entry.match
         and flow_removed.priority == entry.priority):
       self.flow_table.remove_entry(entry)
       self.raiseEvent(FlowTableModification(removed=[entry]))
       return EventHalt
   return EventContinue