flow_stats.py ファイルのフローを変更してから、それらをエンキューするように切り替えるメッセージを送信しています。しかし、openflow.of_01.Connection.send() で isinstance(data, of.ofp_header) をアサートすると失敗します。pox-dev メーリング リストの投稿を読み、インポート名を修正しました。誰かが私を案内してくれませんか。
ここに私のコードがあります
#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)
これはエラーが発生するコードです。これが pox ファイルです。このファイルでは何も変更していません。
#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()