0

I’m modifying flows in flow_stats.py file and then sending a message to switch to enqueue them. but assert isinstance(data, of.ofp_header) in openflow.of_01.Connection.send()fails. I’ve read the post on pox-dev mailing list already and fixed my import names. Can someone guide me please.

here is my code

#flow_stats.py
def _handle_flowstats_received (event):
     stats = flow_stats_to_list(event.stats)
     log.debug("FlowStatsReceived from %s: %s", dpidToStr(event.connection.dpid), stats)

     msg = of.ofp_flow_mod()
     msg.command = of.OFPFC_MODIFY_STRICT
     connection = event.connection

     for f in event.stats:
        if f.match.nw_proto == 1:
           f.actions.append(of.ofp_action_enqueue(port = my_port, queue_id = 0))

     msg = f
     connection.send(msg)

This is the code where error occurs. This is pox file. I did not change anything in this file.

#of_01
#def send (self, data):
   if self.disconnected: return
   if type(data) is not bytes:
   # There's actually no reason the data has to be an instance of
   # ofp_header, but this check is likely to catch a lot of bugs,
   # so we check it anyway.
      assert isinstance(data, of.ofp_header)
      data = data.pack()
Areebah
  • 43
  • 8
  • Please include the code that involves the assertion, and fix the indentation below your `for` – Tim May 07 '14 at 05:57
  • I fixed the indentation below for , Still the same error occurs. – Areebah May 07 '14 at 06:20
  • I mean fix it in your question so we know what code is in the for and what code is not – Tim May 07 '14 at 06:21
  • Please don't post additional code in a comment, nobody can read that. Instead edit it into your original question – Tim May 07 '14 at 06:24
  • Are you sure this is the actual code that's running? It wouldn't compile as you have a missing `)` and are using smart quotes. – Burhan Khalid May 07 '14 at 06:40
  • I fixed the missing ) in the above code, And this is the code thats running. Only problem is on the line connection.send(). – Areebah May 07 '14 at 06:46

0 Answers0