[ovs-discuss] Flow comparison with OFPFlowMod message
Nick Yurchenko
urchennko at gmail.com
Tue Aug 27 19:08:08 UTC 2019
Hi,
In my project I need to compare an active flow in the table(obtained from
`EventOFPFlowStatsReply`) with a OFPFlowMod message that is sent to the
controller.
I've thrown together a method to compare the two but it doesn't look good.
Is there a better way to do this?
```
def compare_flow_and_flowmsg(flow, msg):
# TODO: this is v hacky, there must be a better way to compare this
return sorted(flow.match.items()) == sorted(msg.match.items()) and\
flow.cookie == msg.cookie and \
all(action1.serialize_body() == action2.serialize_body() for
action1, action2 in
zip(flow.instructions[0].actions, msg.instructions[0].actions))
```
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20190827/5650c067/attachment.html>
More information about the discuss
mailing list