Example #1
0
 def handle_DpPacketOut(event):
   fingerprint = (DPFingerprint.from_pkt(event.packet),
                  event.node.dpid, event.port.port_no)
   # Monkey patch on a fingerprint for this event
   event.fingerprint = fingerprint
   self.fingerprint2dp_outs[fingerprint].append(event)
   self.raiseEvent(event)
Example #2
0
 def handle_DpPacketOut(event):
     fingerprint = (DPFingerprint.from_pkt(event.packet),
                    event.node.dpid, event.port.port_no)
     # Monkey patch on a fingerprint for this event
     event.fingerprint = fingerprint
     self.fingerprint2dp_outs[fingerprint].append(event)
     self.raiseEvent(event)
def control_message_filter(e, pkt_fingerprint):
  of_pkt = e.get_packet()

  # TODO(cs): also handle ofp_flow_mod.buffer_id, which applies the rule to a
  # particular buffered packet.
  if type(of_pkt) not in dp_ofp_packets:
    return False

  # TODO(cs): problem: controllers often truncate the packet in
  # ofp_packet_out.data. ofp_packet_in's are fine though, since POX's
  # software_switch always includes the entire dataplane packet in the
  # packet_in. To really solve this issue we would need to replay the
  # flow_mods to cloned topology, and verify that buffer_id's are chosen
  # deterministically.
  return DPFingerprint.from_pkt(ethernet(raw=of_pkt.data)) == pkt_fingerprint
Example #4
0
def control_message_filter(e, pkt_fingerprint):
    of_pkt = e.get_packet()

    # TODO(cs): also handle ofp_flow_mod.buffer_id, which applies the rule to a
    # particular buffered packet.
    if type(of_pkt) not in dp_ofp_packets:
        return False

    # TODO(cs): problem: controllers often truncate the packet in
    # ofp_packet_out.data. ofp_packet_in's are fine though, since POX's
    # software_switch always includes the entire dataplane packet in the
    # packet_in. To really solve this issue we would need to replay the
    # flow_mods to cloned topology, and verify that buffer_id's are chosen
    # deterministically.
    return DPFingerprint.from_pkt(ethernet(raw=of_pkt.data)) == pkt_fingerprint
def main(args):
  with open(args.input) as input_file:
    trace = parse(input_file)
    # TODO(cs): binary search instead of linear?
    while len(trace) > 0 and trace[0].label_id < args.ti_id:
      trace.pop(0)

    ti_event = trace[0]
    if type(ti_event) != replay_events.TrafficInjection:
      raise ValueError("Event %s with is not a TrafficInjection" % str(ti_event))

    pkt_fingerprint = DPFingerprint.from_pkt(ti_event.dp_event.packet)

    for event in trace:
      t = type(event)
      if t in dp_class_to_filter and dp_class_to_filter[t](event, pkt_fingerprint):
        for field in default_fields:
          field_formatters[field](event)
Example #6
0
def main(args):
    with open(args.input) as input_file:
        trace = parse(input_file)
        # TODO(cs): binary search instead of linear?
        while len(trace) > 0 and trace[0].label_id < args.ti_id:
            trace.pop(0)

        ti_event = trace[0]
        if type(ti_event) != replay_events.TrafficInjection:
            raise ValueError("Event %s with is not a TrafficInjection" %
                             str(ti_event))

        pkt_fingerprint = DPFingerprint.from_pkt(ti_event.dp_event.packet)

        for event in trace:
            t = type(event)
            if t in dp_class_to_filter and dp_class_to_filter[t](
                    event, pkt_fingerprint):
                for field in default_fields:
                    field_formatters[field](event)
def ti_filter(e, pkt_fingerprint):
  return DPFingerprint.from_pkt(e.dp_event.packet) == pkt_fingerprint
Example #8
0
def ti_filter(e, pkt_fingerprint):
    return DPFingerprint.from_pkt(e.dp_event.packet) == pkt_fingerprint