The watch_port should be set to OFPP_ANY ('any' atom), and watch_group should be set to OFPG_ANY ('any' atom) when the field is to be ignored. However the current #ofp_bucket{} record definition default these fields to zero (which btw. is an invalid value for ports).
Also these fields are not handled by the enums, so upon decoding the fields will not be converted to atoms for constants, and on encoding the use of constants result in an error:
ofp_v4_encode:do(#ofp_message{version=4, type=group_mod, body=#ofp_group_mod{command=add, type=ff, group_id=1, buckets=[#ofp_bucket{watch_port=any}]}}).
\ exception error: bad argument
in function ofp_v4_encode:encode_struct/1 (src/ofp_v4_encode.erl, line 317)
in call from ofp_utils:encode_list/3 (src/ofp_utils.erl, line 139)
in call from ofp_v4_encode:encode_body/1 (src/ofp_v4_encode.erl, line 544)
in call from ofp_v4_encode:do/1 (src/ofp_v4_encode.erl, line 37)
The watch_port should be set to OFPP_ANY ('any' atom), and watch_group should be set to OFPG_ANY ('any' atom) when the field is to be ignored. However the current #ofp_bucket{} record definition default these fields to zero (which btw. is an invalid value for ports).
Also these fields are not handled by the enums, so upon decoding the fields will not be converted to atoms for constants, and on encoding the use of constants result in an error: