Exemplo n.º 1
0
    def next_step(self):
        time.sleep(0.05)
        self.logical_time += 1
        self._forwarded_this_step = 0

        if len(self.event_list) == 0:
            msg.fail("No more events to inject")
            return

        next_event = self.event_list.pop(0)
        if type(next_event) in InteractiveReplayer.supported_input_events:
            msg.replay_event_success("Injecting %r" % next_event)
            next_event.proceed(self.simulation)
        else:  # type(next_event) in InteractiveReplayer.supported_internal_events
            if type(next_event) == ControlMessageReceive and is_flow_mod(
                    next_event):
                msg.mcs_event("Injecting %r" % next_event)
            else:
                msg.replay_event_success("Injecting %r" % next_event)
            next_event.manually_inject(self.simulation)
            if self.show_flow_tables_each_step:
                for switch in self.simulation.topology.switches:
                    print "Switch %s" % switch.dpid
                    switch.show_flow_table()

        print "\nAdvanced to step %d\n" % self.logical_time
Exemplo n.º 2
0
  def next_step(self):
    time.sleep(0.05)
    self.logical_time += 1
    self._forwarded_this_step = 0

    if len(self.event_list) == 0:
      msg.fail("No more events to inject")
    else:
      next_event = self.event_list.pop(0)
      if type(next_event) in InteractiveReplayer.supported_input_events:
        msg.replay_event_success("Injecting %r" % next_event)
        next_event.proceed(self.simulation)
      else: # type(next_event) in InteractiveReplayer.supported_internal_events
	if type(next_event) == ControlMessageReceive and is_flow_mod(next_event):
          msg.mcs_event("Injecting %r" % next_event)
	else:
          msg.replay_event_success("Injecting %r" % next_event)
        next_event.manually_inject(self.simulation)
      if self.show_flow_tables_each_step:
	for switch in self.simulation.topology.switches:
	  print "Switch %s" % switch.dpid
	  switch.show_flow_table()

    print "\nAdvanced to step %d\n" % self.logical_time
Exemplo n.º 3
0
 def log_no_violation(self, s):
     ''' Output a message to both self._log and self._extra_log '''
     msg.mcs_event(color.GREEN + s)
     if self._extra_log is not None:
         self._extra_log.write(s + '\n')
         self._extra_log.flush()
Exemplo n.º 4
0
 def log(self, s):
     ''' Output a message to both self._log and self._extra_log '''
     msg.mcs_event(s)
     if self._extra_log is not None:
         self._extra_log.write(s + '\n')
         self._extra_log.flush()
Exemplo n.º 5
0
 def log_no_violation(self, s):
   ''' Output a message to both self._log and self._extra_log '''
   msg.mcs_event(color.GREEN + s)
   if self._extra_log is not None:
     self._extra_log.write(s + '\n')
     self._extra_log.flush()
Exemplo n.º 6
0
 def log(self, s):
   ''' Output a message to both self._log and self._extra_log '''
   msg.mcs_event(s)
   if self._extra_log is not None:
     self._extra_log.write(s + '\n')
     self._extra_log.flush()