Signed-off-by: Shinpei Muraoka <shinpei.mura...@gmail.com>
---
 doc/source/nicira_ext_ref.rst |   42 +-
 ryu/ofproto/nx_actions.py     | 1242 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1280 insertions(+), 4 deletions(-)

diff --git a/doc/source/nicira_ext_ref.rst b/doc/source/nicira_ext_ref.rst
index 562e12a..2518536 100644
--- a/doc/source/nicira_ext_ref.rst
+++ b/doc/source/nicira_ext_ref.rst
@@ -7,17 +7,51 @@ Nicira Extension Structures
 Nicira Extension Actions Structures
 ===================================
 
-The followings shows the supported NXAction classes in OF1.3,
-but also available in OF1.2+.
+The followings shows the supported NXAction classes only in OpenFlow1.0
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-.. py:currentmodule:: ryu.ofproto.ofproto_v1_3_parser
+.. py:currentmodule:: ryu.ofproto.ofproto_v1_0_parser
+
+.. autoclass:: NXActionSetQueue
+.. autoclass:: NXActionDecTtl
+.. autoclass:: NXActionPushMpls
+.. autoclass:: NXActionPopMpls
+.. autoclass:: NXActionSetMplsTtl
+.. autoclass:: NXActionDecMplsTtl
+.. autoclass:: NXActionSetMplsLabel
+.. autoclass:: NXActionSetMplsTc
+
+The followings shows the supported NXAction classes in OpenFlow1.0 or later
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+.. py:currentmodule:: ryu.ofproto.ofproto_v1_3_parser
 
+.. autoclass:: NXActionPopQueue
+.. autoclass:: NXActionRegLoad
+.. autoclass:: NXActionRegLoad2
+.. autoclass:: NXActionNote
+.. autoclass:: NXActionSetTunnel
+.. autoclass:: NXActionSetTunnel64
 .. autoclass:: NXActionRegMove
+.. autoclass:: NXActionResubmit
+.. autoclass:: NXActionResubmitTable
+.. autoclass:: NXActionOutputReg
+.. autoclass:: NXActionOutputReg2
 .. autoclass:: NXActionLearn
+.. autoclass:: NXActionExit
+.. autoclass:: NXActionController
+.. autoclass:: NXActionController2
+.. autoclass:: NXActionDecTtlCntIds
+.. autoclass:: NXActionStackPush
+.. autoclass:: NXActionStackPop
+.. autoclass:: NXActionSample
+.. autoclass:: NXActionFinTimeout
 .. autoclass:: NXActionConjunction
-.. autoclass:: NXActionResubmitTable
+.. autoclass:: NXActionMultipath
+.. autoclass:: NXActionBundle
+.. autoclass:: NXActionBundleLoad
 .. autoclass:: NXActionCT
+.. autoclass:: NXActionNAT
 .. autoclass:: NXFlowSpecMatch
 .. autoclass:: NXFlowSpecLoad
 .. autoclass:: NXFlowSpecOutput
diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py
index cabbe3b..b55c285 100644
--- a/ryu/ofproto/nx_actions.py
+++ b/ryu/ofproto/nx_actions.py
@@ -126,18 +126,63 @@ def generate(ofp_name, ofpp_name):
             return buf
 
     class NXFlowSpecMatch(_NXFlowSpec):
+        """
+        Specification for adding match criterion
+
+        This class is used by ``NXActionLearn``.
+
+        For the usage of this class, please refer to ``NXActionLearn``.
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        src              OXM/NXM header and Start bit for source field
+        dst              OXM/NXM header and Start bit for destination field
+        n_bits           The number of bits from the start bit
+        ================ ======================================================
+        """
         # Add a match criteria
         # an example of the corresponding ovs-ofctl syntax:
         #    NXM_OF_VLAN_TCI[0..11]
         _dst_type = 0
 
     class NXFlowSpecLoad(_NXFlowSpec):
+        """
+        Add NXAST_REG_LOAD actions
+
+        This class is used by ``NXActionLearn``.
+
+        For the usage of this class, please refer to ``NXActionLearn``.
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        src              OXM/NXM header and Start bit for source field
+        dst              OXM/NXM header and Start bit for destination field
+        n_bits           The number of bits from the start bit
+        ================ ======================================================
+        """
         # Add NXAST_REG_LOAD actions
         # an example of the corresponding ovs-ofctl syntax:
         #    NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[]
         _dst_type = 1
 
     class NXFlowSpecOutput(_NXFlowSpec):
+        """
+        Add an OFPAT_OUTPUT action
+
+        This class is used by ``NXActionLearn``.
+
+        For the usage of this class, please refer to ``NXActionLearn``.
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        src              OXM/NXM header and Start bit for source field
+        dst              Must be ''
+        n_bits           The number of bits from the start bit
+        ================ ======================================================
+        """
         # Add an OFPAT_OUTPUT action
         # an example of the corresponding ovs-ofctl syntax:
         #    output:NXM_OF_IN_PORT[]
@@ -203,6 +248,37 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetQueue(NXAction):
+        """
+        Set queue action
+
+        This action sets the queue that should be used to queue
+        when packets are output.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          set_queue:queue
+        ..
+
+        +-------------------------+
+        | **set_queue**\:\ *queue*|
+        +-------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        queue_id         Queue ID for the packets
+        ================ ======================================================
+
+        .. note::
+            This actions is supported by
+            ``OFPActionSetQueue``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionSetQueue(queue_id=10)]
+        """
         _subtype = nicira_ext.NXAST_SET_QUEUE
 
         # queue_id
@@ -224,6 +300,26 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionPopQueue(NXAction):
+        """
+        Pop queue action
+
+        This action restors the queue to the value it was before any
+        set_queue actions were applied.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          pop_queue
+        ..
+
+        +---------------+
+        | **pop_queue** |
+        +---------------+
+
+        Example::
+
+            actions += [parser.NXActionPopQueue()]
+        """
         _subtype = nicira_ext.NXAST_POP_QUEUE
 
         _fmt_str = '!6x'
@@ -242,6 +338,37 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionRegLoad(NXAction):
+        """
+        Load literal value action
+
+        This action loads a literal value into a field or part of a field.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          load:value->dst[start..end]
+        ..
+
+        +-----------------------------------------------------------------+
+        | **load**\:\ *value*\->\ *dst*\ **[**\ *start*\..\ *end*\ **]**  |
+        +-----------------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        start            Start bit for destination field
+        end              End bit for destination field
+        dst              OXM/NXM header for destination field
+        value            OXM/NXM value to be loaded
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionRegLoad(start=4,
+                                               end=31,
+                                               dst="eth_dst",
+                                               value=0x112233)]
+        """
         _subtype = nicira_ext.NXAST_REG_LOAD
         _fmt_str = '!HIQ'  # ofs_nbits, dst, value
         _TYPE = {
@@ -281,6 +408,35 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionRegLoad2(NXAction):
+        """
+        Load literal value action
+
+        This action loads a literal value into a field or part of a field.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          set_field:value[/mask]->dst
+        ..
+
+        +------------------------------------------------------------+
+        | **set_field**\:\ *value*\ **[**\/\ *mask*\ **]**\->\ *dst* |
+        +------------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        value            OXM/NXM value to be loaded
+        mask             Mask for destination field
+        dst              OXM/NXM header for destination field
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionRegLoad2(dst="tun_ipv4_src",
+                                                value="192.168.10.0",
+                                                mask="255.255.255.0")]
+        """
         _subtype = nicira_ext.NXAST_REG_LOAD2
         _TYPE = {
             'ascii': [
@@ -321,6 +477,31 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionNote(NXAction):
+        """
+        Note action
+
+        This action does nothing at all.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          note:[hh]..
+        ..
+
+        +-----------------------------------+
+        | **note**\:\ **[**\ *hh*\ **]**\.. |
+        +-----------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        note             A list of integer type values
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionNote(note=[0xaa,0xbb,0xcc,0xdd])]
+        """
         _subtype = nicira_ext.NXAST_NOTE
 
         # note
@@ -375,18 +556,141 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionSetTunnel(_NXActionSetTunnelBase):
+        """
+        Set Tunnel action
+
+        This action sets the identifier (such as GRE) to the specified id.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        .. note::
+            ovs-ofctl command of the OpenFlow1.0 is different from that
+            of OpenFlow1.2 or later.
+
+        OpenFlow1.0
+
+        ..
+          set_tunnel:id
+        ..
+
+        +------------------------+
+        | **set_tunnel**\:\ *id* |
+        +------------------------+
+
+        OpenFlow1.2 or later
+
+        ..
+          set_field:value->tun_id
+        ..
+
+        +-----------------------------------+
+        | **set_field**\:\ *value*\->tun_id |
+        +-----------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        tun_id           Tunnel ID(32bits)
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionSetTunnel(tun_id=0xa)]
+        """
         _subtype = nicira_ext.NXAST_SET_TUNNEL
 
         # tun_id
         _fmt_str = '!2xI'
 
     class NXActionSetTunnel64(_NXActionSetTunnelBase):
+        """
+        Set Tunnel action
+
+        This action outputs to a port that encapsulates
+        the packet in a tunnel.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        .. note::
+            ovs-ofctl command of the OpenFlow1.0 is different from that
+            of OpenFlow1.2 or later.
+
+        OpenFlow1.0
+
+        ..
+          set_tunnel64:id
+        ..
+
+        +--------------------------+
+        | **set_tunnel64**\:\ *id* |
+        +--------------------------+
+
+        OpenFlow1.2 or later
+
+        ..
+          set_field:value->tun_id
+        ..
+
+        +-----------------------------------+
+        | **set_field**\:\ *value*\->tun_id |
+        +-----------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        tun_id           Tunnel ID(64bits)
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionSetTunnel64(tun_id=0xa)]
+        """
         _subtype = nicira_ext.NXAST_SET_TUNNEL64
 
         # tun_id
         _fmt_str = '!6xQ'
 
     class NXActionRegMove(NXAction):
+        """
+        Move register action
+
+        This action copies the src to dst.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          move:src[start..end]->dst[start..end]
+        ..
+
+        +--------------------------------------------------------+
+        | **move**\:\ *src*\ **[**\ *start*\..\ *end*\ **]**\->\ |
+        | *dst*\ **[**\ *start*\..\ *end* \ **]**                |
+        +--------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        src_field        OXM/NXM header for source field
+        src_start        Start bit for source field
+        src_end          End bit for source field
+        dst_field        OXM/NXM header for destination field
+        dst_start        Start bit for destination field
+        dst_end          End bit for destination field
+        ================ ======================================================
+
+        .. CAUTION::
+            **src_start**\  and \ **src_end**\  difference and \ **dst_start**\
+             and \ **dst_end**\  difference must be the same.
+
+        Example::
+
+            actions += [parser.NXActionRegMove(src_field="reg0",
+                                               src_start=0,
+                                               src_end=5,
+                                               dst_field="reg1",
+                                               dst_start=10,
+                                               dst_end=15)]
+        """
         _subtype = nicira_ext.NXAST_REG_MOVE
         _fmt_str = '!HHH'  # n_bits, src_ofs, dst_ofs
         # Followed by OXM fields (src, dst) and padding to 8 bytes boundary
@@ -448,6 +752,31 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionResubmit(NXAction):
+        """
+        Resubmit action
+
+        This action searches one of the switch's flow tables.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          resubmit:port
+        ..
+
+        +------------------------+
+        | **resubmit**\:\ *port* |
+        +------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        in_port          New in_port for checking flow table
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionResubmit(in_port=8080)]
+        """
         _subtype = nicira_ext.NXAST_RESUBMIT
 
         # in_port
@@ -472,6 +801,33 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionResubmitTable(NXAction):
+        """
+        Resubmit action
+
+        This action searches one of the switch's flow tables.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          resubmit([port],[table])
+        ..
+
+        +------------------------------------------------+
+        | **resubmit(**\[\ *port*\]\,[\ *table*\]\ **)** |
+        +------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        in_port          New in_port for checking flow table
+        table_id         Checking flow tables
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionResubmit(in_port=8080,
+                                                table_id=10)]
+        """
         _subtype = nicira_ext.NXAST_RESUBMIT_TABLE
 
         # in_port, table_id
@@ -499,6 +855,38 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionOutputReg(NXAction):
+        """
+        Add output action
+
+        This action outputs the packet to the OpenFlow port number read from
+        src.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          output:src[start...end]
+        ..
+
+        +-------------------------------------------------------+
+        | **output**\:\ *src*\ **[**\ *start*\...\ *end*\ **]** |
+        +-------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        start            Start bit for source field
+        end              End bit for source field
+        src              OXM/NXM header for source field
+        max_len          Max length to send to controller
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionOutputReg(start=8080,
+                                                 end=10,
+                                                 src="reg0",
+                                                 max_len=1024)]
+        """
         _subtype = nicira_ext.NXAST_OUTPUT_REG
 
         # ofs_nbits, src, max_len
@@ -547,6 +935,42 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionOutputReg2(NXAction):
+        """
+        Add output action
+
+        This action outputs the packet to the OpenFlow port number read from
+        src.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          output:src[start...end]
+        ..
+
+        +-------------------------------------------------------+
+        | **output**\:\ *src*\ **[**\ *start*\...\ *end*\ **]** |
+        +-------------------------------------------------------+
+
+        .. NOTE::
+             Like the ``NXActionOutputReg`` but organized so
+             that there is room for a 64-bit experimenter OXM as 'src'.
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        start            Start bit for source field
+        end              End bit for source field
+        src              OXM/NXM header for source field
+        max_len          Max length to send to controller
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionOutputReg(start=8080,
+                                                 end=10,
+                                                 src="reg0",
+                                                 max_len=1024)]
+        """
         _subtype = nicira_ext.NXAST_OUTPUT_REG2
 
         # start, end, src, max_len
@@ -599,6 +1023,113 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionLearn(NXAction):
+        """
+        Adds or modifies flow action
+
+        This action adds or modifies a flow in OpenFlow table.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          learn(argument[,argument]...)
+        ..
+
+        +---------------------------------------------------+
+        | **learn(**\ *argument*\[,\ *argument*\]...\ **)** |
+        +---------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        table_id         The table in which the new flow should be inserted
+        specs            Adds a match criterion to the new flow
+
+                         Please use the
+                         ``NXFlowSpecMatch``
+                         in order to set the following format
+
+                         ..
+                           field=value
+                           field[start..end]=src[start..end]
+                           field[start..end]
+                         ..
+
+                         | *field*\=\ *value*
+                         | *field*\ **[**\ *start*\..\ *end*\ **]**\  =\
+                         *src*\ **[**\ *start*\..\ *end*\ **]**
+                         | *field*\ **[**\ *start*\..\ *end*\ **]**
+                         |
+
+                         Please use the
+                         ``NXFlowSpecLoad``
+                         in order to set the following format
+
+                         ..
+                           load:value->dst[start..end]
+                           load:src[start..end]->dst[start..end]
+                         ..
+
+                         | **load**\:\ *value*\ **->**\ *dst*\
+                         **[**\ *start*\..\ *end*\ **]**
+                         | **load**\:\ *src*\ **[**\ *start*\..\ *end*\
+                         **] ->**\ *dst*\ **[**\ *start*\..\ *end*\ **]**
+                         |
+
+                         Please use the
+                         ``NXFlowSpecOutput``
+                         in order to set the following format
+
+                         ..
+                           output:field[start..end]
+                         ..
+
+                         | **output:**\ field\ **[**\ *start*\..\ *end*\ **]**
+
+        idle_timeout     Idle time before discarding(seconds)
+        hard_timeout     Max time before discarding(seconds)
+        priority         Priority level of flow entry
+        cookie           Cookie for new flow
+        flags            send_flow_rem
+        fin_idle_timeout Idle timeout after FIN(seconds)
+        fin_hard_timeout Hard timeout after FIN(seconds)
+        ================ ======================================================
+
+        .. CAUTION::
+            The arguments specify the flow's match fields, actions,
+            and other properties, as follows.
+            At least one match criterion and one action argument
+            should ordinarily be specified.
+
+        Example::
+
+            actions += [
+                parser.NXActionLearn(able_id=10,
+                     specs=[parser.NXFlowSpecMatch(src=0x800,
+                                                   dst=('eth_type_nxm', 0),
+                                                   n_bits=16),
+                            parser.NXFlowSpecMatch(src=('reg1', 1),
+                                                   dst=('reg2', 3),
+                                                   n_bits=5),
+                            parser.NXFlowSpecMatch(src=('reg3', 1),
+                                                   dst=('reg3', 1),
+                                                   n_bits=5),
+                            parser.NXFlowSpecLoad(src=0,
+                                                  dst=('reg4', 3),
+                                                  n_bits=5),
+                            parser.NXFlowSpecLoad(src=('reg5', 1),
+                                                  dst=('reg6', 3),
+                                                  n_bits=5),
+                            parser.NXFlowSpecOutput(src=('reg7', 1),
+                                                    dst="",
+                                                    n_bits=5)],
+                     idle_timeout=180,
+                     hard_timeout=300,
+                     priority=1,
+                     cookie=0x64,
+                     flags=ofproto.OFPFF_SEND_FLOW_REM,
+                     fin_idle_timeout=180,
+                     fin_hard_timeout=300)]
+        """
         _subtype = nicira_ext.NXAST_LEARN
 
         # idle_timeout, hard_timeout, priority, cookie, flags,
@@ -678,6 +1209,26 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionExit(NXAction):
+        """
+        Halt action
+
+        This action causes OpenvSwitch to immediately halt
+        execution of further actions.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          exit
+        ..
+
+        +----------+
+        | **exit** |
+        +----------+
+
+        Example::
+
+            actions += [parser.NXActionExit()]
+        """
         _subtype = nicira_ext.NXAST_EXIT
 
         _fmt_str = '!6x'
@@ -697,6 +1248,31 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionDecTtl(NXAction):
+        """
+        Decrement IP TTL action
+
+        This action decrements TTL of IPv4 packet or
+        hop limit of IPv6 packet.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          dec_ttl
+        ..
+
+        +-------------+
+        | **dec_ttl** |
+        +-------------+
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionDecNwTtl``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionDecTtl()]
+        """
         _subtype = nicira_ext.NXAST_DEC_TTL
 
         _fmt_str = '!6x'
@@ -715,6 +1291,37 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionController(NXAction):
+        """
+        Send packet in message action
+
+        This action sends the packet to the OpenFlow controller as
+        a packet in message.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          controller(key=value...)
+        ..
+
+        +----------------------------------------------+
+        | **controller(**\ *key*\=\ *value*\...\ **)** |
+        +----------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        max_len          Max length to send to controller
+        controller_id    Controller ID to send packet-in
+        reason           Reason for sending the message
+        ================ ======================================================
+
+        Example::
+
+            actions += [
+                parser.NXActionController(max_len=1024,
+                                          controller_id=1,
+                                          reason=ofproto.OFPR_INVALID_TTL)]
+        """
         _subtype = nicira_ext.NXAST_CONTROLLER
 
         # max_len, controller_id, reason
@@ -749,6 +1356,42 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionController2(NXAction):
+        """
+        Send packet in message action
+
+        This action sends the packet to the OpenFlow controller as
+        a packet in message.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          controller(key=value...)
+        ..
+
+        +----------------------------------------------+
+        | **controller(**\ *key*\=\ *value*\...\ **)** |
+        +----------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        max_len          Max length to send to controller
+        controller_id    Controller ID to send packet-in
+        reason           Reason for sending the message
+        userdata         Additional data to the controller in the packet-in
+                         message
+        pause            Flag to pause pipeline to resume later
+        ================ ======================================================
+
+        Example::
+
+            actions += [
+                parser.NXActionController(max_len=1024,
+                                          controller_id=1,
+                                          reason=ofproto.OFPR_INVALID_TTL,
+                                          userdata=[0xa,0xb,0xc],
+                                          pause=True)]
+        """
         _subtype = nicira_ext.NXAST_CONTROLLER2
         _fmt_str = '!6x'
         _PACK_STR = '!HH'
@@ -959,6 +1602,40 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionDecTtlCntIds(NXAction):
+        """
+        Decrement TTL action
+
+        This action decrements TTL of IPv4 packet or
+        hop limits of IPv6 packet.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          dec_ttl(id1[,id2]...)
+        ..
+
+        +-------------------------------------------+
+        | **dec_ttl(**\ *id1*\[,\ *id2*\]...\ **)** |
+        +-------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        cnt_ids          Controller ids
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionDecTtlCntIds(cnt_ids=[1,2,3])]
+
+        .. NOTE::
+            If you want to set the following ovs-ofctl command.
+            Please use ``OFPActionDecNwTtl``.
+
+        +-------------+
+        | **dec_ttl** |
+        +-------------+
+        """
         _subtype = nicira_ext.NXAST_DEC_TTL_CNT_IDS
 
         # controllers
@@ -1036,14 +1713,106 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionPushMpls(NXActionMplsBase):
+        """
+        Push MPLS action
+
+        This action pushes a new MPLS header to the packet.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          push_mpls:ethertype
+        ..
+
+        +-------------------------------+
+        | **push_mpls**\:\ *ethertype*  |
+        +-------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        ethertype        Ether type(The value must be either 0x8847 or 0x8848)
+        ================ ======================================================
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionPushMpls``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            match = parser.OFPMatch(dl_type=0x0800)
+            actions += [parser.NXActionPushMpls(ethertype=0x8847)]
+        """
         _subtype = nicira_ext.NXAST_PUSH_MPLS
 
     # For OpenFlow1.0 only
     class NXActionPopMpls(NXActionMplsBase):
+        """
+        Pop MPLS action
+
+        This action pops the MPLS header from the packet.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          pop_mpls:ethertype
+        ..
+
+        +------------------------------+
+        | **pop_mpls**\:\ *ethertype*  |
+        +------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        ethertype        Ether type
+        ================ ======================================================
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionPopMpls``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            match = parser.OFPMatch(dl_type=0x8847)
+            actions += [parser.NXActionPushMpls(ethertype=0x0800)]
+        """
         _subtype = nicira_ext.NXAST_POP_MPLS
 
     # For OpenFlow1.0 only
     class NXActionSetMplsTtl(NXAction):
+        """
+        Set MPLS TTL action
+
+        This action sets the MPLS TTL.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          set_mpls_ttl:ttl
+        ..
+
+        +---------------------------+
+        | **set_mpls_ttl**\:\ *ttl* |
+        +---------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        ttl              MPLS TTL
+        ================ ======================================================
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionSetMplsTtl``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionSetMplsTil(ttl=128)]
+        """
         _subtype = nicira_ext.NXAST_SET_MPLS_TTL
 
         # ethertype
@@ -1069,6 +1838,30 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionDecMplsTtl(NXAction):
+        """
+        Decrement MPLS TTL action
+
+        This action decrements the MPLS TTL.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          dec_mpls_ttl
+        ..
+
+        +------------------+
+        | **dec_mpls_ttl** |
+        +------------------+
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionDecMplsTtl``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionDecMplsTil()]
+        """
         _subtype = nicira_ext.NXAST_DEC_MPLS_TTL
 
         # ethertype
@@ -1089,6 +1882,36 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetMplsLabel(NXAction):
+        """
+        Set MPLS Lavel action
+
+        This action sets the MPLS Label.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          set_mpls_label:label
+        ..
+
+        +-------------------------------+
+        | **set_mpls_label**\:\ *label* |
+        +-------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        label            MPLS Label
+        ================ ======================================================
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionSetField(mpls_label=label)``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionSetMplsLabel(label=0x10)]
+        """
         _subtype = nicira_ext.NXAST_SET_MPLS_LABEL
 
         # ethertype
@@ -1114,6 +1937,36 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetMplsTc(NXAction):
+        """
+        Set MPLS Tc action
+
+        This action sets the MPLS Tc.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          set_mpls_tc:tc
+        ..
+
+        +-------------------------+
+        | **set_mpls_tc**\:\ *tc* |
+        +-------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        tc               MPLS Tc
+        ================ ======================================================
+
+        .. NOTE::
+            This actions is supported by
+            ``OFPActionSetField(mpls_label=tc)``
+            in OpenFlow1.2 or later.
+
+        Example::
+
+            actions += [parser.NXActionSetMplsLabel(tc=0x10)]
+        """
         _subtype = nicira_ext.NXAST_SET_MPLS_TC
 
         # ethertype
@@ -1178,12 +2031,104 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionStackPush(NXActionStackBase):
+        """
+        Push field action
+
+        This action pushes field to top of the stack.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          pop:dst[start...end]
+        ..
+
+        +----------------------------------------------------+
+        | **pop**\:\ *dst*\ **[**\ *start*\...\ *end*\ **]** |
+        +----------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        field            OXM/NXM header for source field
+        start            Start bit for source field
+        end              End bit for source field
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionStackPush(field="reg2",
+                                                 start=0,
+                                                 end=5)]
+        """
         _subtype = nicira_ext.NXAST_STACK_PUSH
 
     class NXActionStackPop(NXActionStackBase):
+        """
+        Pop field action
+
+        This action pops field from top of the stack.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          pop:src[start...end]
+        ..
+
+        +----------------------------------------------------+
+        | **pop**\:\ *src*\ **[**\ *start*\...\ *end*\ **]** |
+        +----------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        field            OXM/NXM header for destination field
+        start            Start bit for destination field
+        end              End bit for destination field
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionStackPop(field="reg2",
+                                                start=0,
+                                                end=5)]
+        """
         _subtype = nicira_ext.NXAST_STACK_POP
 
     class NXActionSample(NXAction):
+        """
+        Sample packets action
+
+        This action samples packets and sends one sample for
+        every sampled packet.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          sample(argument[,argument]...)
+        ..
+
+        +----------------------------------------------------+
+        | **sample(**\ *argument*\[,\ *argument*\]...\ **)** |
+        +----------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        probability      The number of sampled packets
+        collector_set_id The unsigned 32-bit integer identifier of
+                         the set of sample collectors to send sampled packets
+                         to
+        obs_domain_id    The Unsigned 32-bit integer Observation Domain ID
+        obs_point_id     The unsigned 32-bit integer Observation Point ID
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionSample(probability=3,
+                                              collector_set_id=1,
+                                              obs_domain_id=2,
+                                              obs_point_id=3,)]
+        """
         _subtype = nicira_ext.NXAST_SAMPLE
 
         # probability, collector_set_id, obs_domain_id, obs_point_id
@@ -1223,6 +2168,38 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionFinTimeout(NXAction):
+        """
+        Change TCP timeout action
+
+        This action changes the idle timeout or hard timeout or
+        both, of this OpenFlow rule when the rule matches a TCP
+        packet with the FIN or RST flag.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          fin_timeout(argument[,argument]...)
+        ..
+
+        +---------------------------------------------------------+
+        | **fin_timeout(**\ *argument*\[,\ *argument*\]...\ **)** |
+        +---------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        fin_idle_timeout Causes the flow to expire after the given number
+                         of seconds of inactivity
+        fin_idle_timeout Causes the flow to expire after the given number
+                         of second, regardless of activity
+        ================ ======================================================
+
+        Example::
+
+            match = parser.OFPMatch(ip_proto=6, eth_type=0x0800)
+            actions += [parser.NXActionFinTimeout(fin_idle_timeout=30,
+                                                  fin_hard_timeout=60)]
+        """
         _subtype = nicira_ext.NXAST_FIN_TIMEOUT
 
         # fin_idle_timeout, fin_hard_timeout
@@ -1252,6 +2229,37 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionConjunction(NXAction):
+        """
+        Conjunctive matches action
+
+        This action ties groups of individual OpenFlow flows into
+        higher-level conjunctive flows.
+        Please refer to the ovs-ofctl command manual for details.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          conjunction(id,k/n)
+        ..
+
+        +--------------------------------------------------+
+        | **conjunction(**\ *id*\,\ *k*\ **/**\ *n*\ **)** |
+        +--------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        clause           Number assigned to the flow's dimension
+        n_clauses        Specify the conjunctive flow's match condition
+        id\_             Conjunction ID
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionConjunction(clause=1,
+                                                   n_clauses=2,
+                                                   id_=10)]
+        """
         _subtype = nicira_ext.NXAST_CONJUNCTION
 
         # clause, n_clauses, id
@@ -1284,6 +2292,48 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionMultipath(NXAction):
+        """
+        Select multipath link action
+
+        This action selects multipath link based on the specified parameters.
+        Please refer to the ovs-ofctl command manual for details.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          multipath(fields, basis, algorithm, n_links, arg, dst[start..end])
+        ..
+
+        +-------------------------------------------------------------+
+        | **multipath(**\ *fields*\, \ *basis*\, \ *algorithm*\,      |
+        | *n_links*\, \ *arg*\, \ *dst*\[\ *start*\..\ *end*\]\ **)** |
+        +-------------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        fields           One of NX_HASH_FIELDS_*
+        basis            Universal hash parameter
+        algorithm        One of NX_MP_ALG_*.
+        max_link         Number of output links
+        arg              Algorithm-specific argument
+        start            Start bit for source field
+        end              End bit for source field
+        dst              OXM/NXM header for source field
+        ================ ======================================================
+
+        Example::
+
+            actions += [parser.NXActionMultipath(
+                            fields=nicira_ext.NX_HASH_FIELDS_SYMMETRIC_L4,
+                            basis=1024,
+                            algorithm=nicira_ext.NX_MP_ALG_HRW,
+                            max_link=5,
+                            arg=0,
+                            start=4,
+                            end=31,
+                            dst="reg2")]
+        """
         _subtype = nicira_ext.NXAST_MULTIPATH
 
         # fields, basis, algorithm, max_link,
@@ -1439,6 +2489,51 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionBundle(_NXActionBundleBase):
+        """
+        Select bundle link action
+
+        This action selects bundle link based on the specified parameters.
+        Please refer to the ovs-ofctl command manual for details.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          bundle(fields, basis, algorithm, slave_type, slaves:[ s1, s2,...])
+        ..
+
+        +-----------------------------------------------------------+
+        | **bundle(**\ *fields*\, \ *basis*\, \ *algorithm*\,       |
+        | *slave_type*\, \ *slaves*\:[ \ *s1*\, \ *s2*\,...]\ **)** |
+        +-----------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        algorithm        One of NX_MP_ALG_*.
+        fields           One of NX_HASH_FIELDS_*
+        basis            Universal hash parameter
+        slave_type       Type of slaves(must be NXM_OF_IN_PORT)
+        n_slaves         Number of slaves
+        start            Start bit for source field(must be zero)
+        end              End bit for source field(must be zero)
+        dst              OXM/NXM header for source field(must be zero)
+        slaves           List of slaves
+        ================ ======================================================
+
+
+        Example::
+
+            actions += [parser.NXActionBundle(
+                            algorithm=nicira_ext.NX_MP_ALG_HRW,
+                            fields=nicira_ext.NX_HASH_FIELDS_ETH_SRC,
+                            basis=0,
+                            slave_type=nicira_ext.NXM_OF_IN_PORT,
+                            n_slaves=2,
+                            start=0,
+                            end=0,
+                            dst=0,
+                            slaves=[2, 3])]
+        """
         _subtype = nicira_ext.NXAST_BUNDLE
 
         def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
@@ -1449,6 +2544,53 @@ def generate(ofp_name, ofpp_name):
                 start=0, end=0, dst=0, slaves=slaves)
 
     class NXActionBundleLoad(_NXActionBundleBase):
+        """
+        Select bundle link action
+
+        This action has the same behavior as the bundle action,
+        with one exception.
+        Please refer to the ovs-ofctl command manual for details.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          bundle_load(fields, basis, algorithm, slave_type,
+                      slaves:[ s1, s2,...])
+        ..
+
+        +-----------------------------------------------------------+
+        | **bundle_load(**\ *fields*\, \ *basis*\, \ *algorithm*\,  |
+        | *slave_type*\, \ *slaves*\:[ \ *s1*\, \ *s2*\,...]\ **)** |
+        +-----------------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        algorithm        One of NX_MP_ALG_*.
+        fields           One of NX_HASH_FIELDS_*
+        basis            Universal hash parameter
+        slave_type       Type of slaves(must be NXM_OF_IN_PORT)
+        n_slaves         Number of slaves
+        start            Start bit for source field
+        end              End bit for source field
+        dst              OXM/NXM header for source field
+        slaves           List of slaves
+        ================ ======================================================
+
+
+        Example::
+
+            actions += [parser.NXActionBundleLoad(
+                            algorithm=nicira_ext.NX_MP_ALG_HRW,
+                            fields=nicira_ext.NX_HASH_FIELDS_ETH_SRC,
+                            basis=0,
+                            slave_type=nicira_ext.NXM_OF_IN_PORT,
+                            n_slaves=2,
+                            start=4,
+                            end=31,
+                            dst="reg0",
+                            slaves=[2, 3])]
+        """
         _subtype = nicira_ext.NXAST_BUNDLE_LOAD
         _TYPE = {
             'ascii': [
@@ -1463,6 +2605,45 @@ def generate(ofp_name, ofpp_name):
                 start, end, dst, slaves)
 
     class NXActionCT(NXAction):
+        """
+        Pass traffic to the connection tracker action
+
+        This action sends the packet through the connection tracker.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          ct(argument[,argument]...)
+        ..
+
+        +------------------------------------------------+
+        | **ct(**\ *argument*\[,\ *argument*\]...\ **)** |
+        +------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        flags            Zero or more(Unspecified flag bits must be zero.)
+        zone_src         OXM/NXM header for source field
+        zone_start       Start bit for source field
+        zone_end         End bit for source field
+        recirc_table     Recirculate to a specific table
+        alg              Well-known port number for the protocol
+        actions          Zero or more actions may immediately follow this
+                         action
+        ================ ======================================================
+
+        Example::
+
+            match = parser.OFPMatch(eth_type=0x0800, ct_state=(0,32))
+            actions += [parser.NXActionCT(flags = 1,
+                                          zone_src = 0,
+                                          zone_start = 0,
+                                          zone_end = 0,
+                                          recirc_table = 4,
+                                          alg = 0,
+                                          actions = [])]
+        """
         _subtype = nicira_ext.NXAST_CT
 
         # flags, zone_src, zone_ofs_nbits, recirc_table,
@@ -1524,6 +2705,67 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionNAT(NXAction):
+        """
+        Network address translation action
+
+        This action sends the packet through the connection tracker.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        .. NOTE::
+            The following command image does not exist in ovs-ofctl command
+            manual and has been created from the command response.
+
+        ..
+          nat(src=ip_min-ip_max : proto_min-proto-max)
+        ..
+
+        +--------------------------------------------------+
+        | **nat(src**\=\ *ip_min*\ **-**\ *ip_max*\  **:** |
+        | *proto_min*\ **-**\ *proto-max*\ **)**           |
+        +--------------------------------------------------+
+
+        ================ ======================================================
+        Attribute        Description
+        ================ ======================================================
+        flags            Zero or more(Unspecified flag bits must be zero.)
+        range_ipv4_min   Range ipv4 address minimun
+        range_ipv4_max   Range ipv4 address maximun
+        range_ipv6_min   Range ipv6 address minimun
+        range_ipv6_max   Range ipv6 address maximun
+        range_proto_min  Range protocol minimum
+        range_proto_max  Range protocol maximun
+        ================ ======================================================
+
+        .. CAUTION::
+            ``NXActionNAT`` must be defined in the actions in the
+            ``NXActionCT``.
+
+        Example::
+
+            match = parser.OFPMatch(eth_type=0x0800)
+            actions += [
+                parser.NXActionCT(
+                    flags = 1,
+                    zone_src = 0,
+                    zone_start = 0,
+                    zone_end = 0,
+                    recirc_table = 255,
+                    alg = 0,
+                    actions = [
+                        parser.NXActionNAT(
+                            flags = 1,
+                            range_ipv4_min = "10.1.12.0",
+                            range_ipv4_max = "10.1.13.255",
+                            range_ipv6_min = "",
+                            range_ipv6_max = "",
+                            range_proto_min = 1,
+                            range_proto_max = 1023
+                        )
+                    ]
+                )
+            ]
+        """
         _subtype = nicira_ext.NXAST_NAT
 
         # pad, flags, range_present
-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to