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()