antoninbas Treat OF groups and meters the same when initializing flows (#5613)
ec2f6f8 Nov 4, 2023
Treat OF groups and meters the same when initializing flows (#5613)
* Treat OF groups and meters the same when initializing flows

Both meter and group entries need to be deleted before initializing /
replaying flows, to avoid possible conflicts with existing objects.

Until now, meter entries were deleted by Antrea in the OFClient's
Initialize method, while group entries were deleted by the ofnet library
for every switch connection / re-connection.

We now treat both meter and group entries the same:
* ofnet is no longer in charge of deleting group entries
* all meter and group entries are deleted by Antrea before replaying
  flows (in the OFClient's initialize method)

We also remove a stale comment in the Agent initialization code.

Note that this deletion operation is mostly needed in the following
scenario: the antrea-agent container restarts while the antrea-ovs
container keeps running. In that case, all OF entries are replayed, but
previous entries (group & meter) can still be present because OVS
daemons were not restarted. The code takes a more general approach of
deleting entries every time flows are replayed, including in the
following situations:
* antrea-ovs container / OVS daemons are restarted: in this case group
  and meter tables are empty, so the deletion is a no-op.
* spurious re-connection without any process dying: not sure this can
  happen in practice.

* Replace max_len=128 with max_len=65535 in expected OF flows in tests

This is because of a change in the ofnet library.

65535 means that there is no buffering and that the full packet is sent
to the controller. This is actually the only value supported by OVS, and
the ofnet library now defaults to it (since v0.10).

Signed-off-by: Antonin Bas <abas@vmware.com>
ec2f6f8