Q: How do I implement a new OpenFlow message?
A: Add your new message to
enum ofpraw
andenum ofptype
ininclude/openvswitch/ofp-msgs.h
, following the existing pattern. Then recompile and fix all of the new warnings, implementing new functionality for the new message as needed. (If you configure with--enable-Werror
, as described in :doc:`/intro/install/general`, then it is impossible to miss any warnings.)To add an OpenFlow vendor extension message (aka experimenter message) for a vendor that doesn't yet have any extension messages, you will also need to edit
build-aux/extract-ofp-msgs
and at leastofphdrs_decode()
andofpraw_put__()
inlib/ofp-msgs.c
. OpenFlow doesn't standardize vendor extensions very well, so it's hard to make the process simpler than that. (If you have a choice of how to design your vendor extension messages, it will be easier if you make them resemble the ONF and OVS extension messages.)
Q: How do I add support for a new field or header?
A: Add new members for your field to
struct flow
ininclude/openvswitch/flow.h
, and add new enumerations for your new field toenum mf_field_id
ininclude/openvswitch/meta-flow.h
, following the existing pattern. If the field uses a new OXM class, add it to OXM_CLASSES inbuild-aux/extract-ofp-fields
. Also, add support tominiflow_extract()
inlib/flow.c
for extracting your new field from a packet into struct miniflow, and tonx_put_raw()
inlib/nx-match.c
to output your new field in OXM matches. Then recompile and fix all of the new warnings, implementing new functionality for the new field or header as needed. (If you configure with--enable-Werror
, as described in :doc:`/intro/install/general`, then it is impossible to miss any warnings.)If you want kernel datapath support for your new field, you also need to modify the kernel module for the operating systems you are interested in. This isn't mandatory, since fields understood only by userspace work too (with a performance penalty), so it's reasonable to start development without it. If you implement kernel module support for Linux, then the Linux kernel "netdev" mailing list is the place to submit that support first; please read up on the Linux kernel development process separately. The Windows datapath kernel module support, on the other hand, is maintained within the OVS tree, so patches for that can go directly to ovs-dev.
Q: How do I add support for a new OpenFlow action?
A: Add your new action to
enum ofp_raw_action_type
inlib/ofp-actions.c
, following the existing pattern. Then recompile and fix all of the new warnings, implementing new functionality for the new action as needed. (If you configure with--enable-Werror
, as described in the :doc:`/intro/install/general`, then it is impossible to miss any warnings.)If you need to add an OpenFlow vendor extension action for a vendor that doesn't yet have any extension actions, then you will also need to add the vendor to
vendor_map
inbuild-aux/extract-ofp-actions
. Also, you will need to add support for the vendor toofpact_decode_raw()
andofpact_put_raw()
inlib/ofp-actions.c
. (If you have a choice of how to design your vendor extension actions, it will be easier if you make them resemble the ONF and OVS extension actions.)
Q: How do I add support for a new OpenFlow error message?
A: Add your new error toenum ofperr
ininclude/openvswitch/ofp-errors.h
. Read the large comment at the top of the file for details. If you need to add an OpenFlow vendor extension error for a vendor that doesn't yet have any, first add the vendor ID to the<name>_VENDOR_ID
list ininclude/openflow/openflow-common.h
.