Add support for encap/decap nicira actions 91/72091/9
authorJaime Caamaño Ruiz <jcaamano@suse.com>
Fri, 18 May 2018 12:26:44 +0000 (14:26 +0200)
committerJaime Caamaño Ruiz <jcaamano@suse.com>
Mon, 9 Jul 2018 16:43:19 +0000 (18:43 +0200)
commitaa3a27d92a01fc4bf286ac92410d3eb0b92bc75c
tree41225cf56ab500e5a6aefb840a3895926a6507be
parenta2f8c40682d0b9c0804cf8f0407a6bde88d93d06
Add support for encap/decap nicira actions

Encap action is used to encapsulate the packet with a new packet header,
while decap action is used to decapsulate the outer packet header. Both
actions are particularly useful for application using nsh encapsulation.

From [1], the structure of encap action is:

struct nx_action_encap {
    ovs_be16 type;         // OFPAT_VENDOR = EXPERIMENTER = 0xFFFF
    ovs_be16 len;
    ovs_be32 vendor;       // NX_VENDOR_ID = NXOXM_ET = 0x00002320
    ovs_be16 subtype;      // NXAST_ENCAP = 46
    ovs_be16 hdr_size;     // Header size in bytes, 0 = 'not specified'
    ovs_be32 new_pkt_type; // Header type to add
    struct ofp_ed_prop_header props[];  // Encap TLV properties
};

Properties are specific to the new packet type, such as the md type or
type 2 metadata in case of nsh. This patch does not include support for
properties. In case of nsh, when no properties are present,
md type defaults to 1.

From [1], the structure of decap action is:

struct nx_action_encap {
    ovs_be16 type;         // OFPAT_VENDOR = EXPERIMENTER = 0xFFFF
    ovs_be16 len;
    ovs_be32 vendor;       // NX_VENDOR_ID = NXOXM_ET = 0x00002320
    ovs_be16 subtype;      // NXAST_ENCAP = 47
    uint8_t pad[2];        // 2 bytes padding
    ovs_be32 new_pkt_type; // new packet type, 0xFFFE = USE NEXT PROTO
};

new_pkt_type is the desired packet type required after decapsulation.
The special value 0xFFFE sets the packet type automatically based on the
outermost header type of the remaining packet.

See [1] and [2] for reference.

[1] https://github.com/openvswitch/ovs/blob/master/lib/ofp-actions.c
[2] http://www.openvswitch.org/support/dist-docs/ovs-ofctl.8.txt

Change-Id: Ia313c68ac17618f89c5e64c9351a0033facf9066
JIRA: OPNFLWPLUG-1017
Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
14 files changed:
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistrator.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/DecapCodec.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/EncapCodec.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java
extension/openflowjava-extension-nicira/src/main/yang/nicira-action.yang
extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistratorTest.java
extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/DecapCodecTest.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/EncapCodecTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/NiciraExtensionProvider.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecapConvertor.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/EncapConvertor.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecapConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/EncapConvertorTest.java [new file with mode: 0644]