Fix BUG 4281
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-action.yang
index a5dfcbfdd084949a92f802bf491c3c7154b4fc33..d2ae42f68197778a99d4c181a2a69ee1a796c2d3 100644 (file)
-module openflow-action {
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+ module openflow-action {
     namespace "urn:opendaylight:openflow:common:action";
     prefix "ofaction";
 
-    import openflow-types { prefix oft; }
-
-    revision "2013-07-31" {
-        description "Initial model";
-    }
-
-    /*
-    identity output {
-        description " Output to switch port. ";
-        base oft:action;
-    }
-    identity copy_ttl_out {
-        description " Copy TTL "outwards" -- from next-to-outermost to outermost ";
-        base oft:action;
-    }
-    identity copy_ttl_in {
-        description " Copy TTL "inwards" -- from outermost to next-to-outermost ";
-        base oft:action;
-    }
-    identity set_mpls_ttl {
-        description " MPLS TTL ";
-        base oft:action;
-    }
-    identity dec_mpls_ttl {
-        description " Decrement MPLS TTL ";
-        base oft:action;
-    }
-    identity push_vlan {
-        description " Push a new VLAN tag ";
-        base oft:action;
-    }
-    identity pop_vlan {
-        description " Pop the outer VLAN tag ";
-        base oft:action;
-    }
-    identity push_mpls {
-        description " Push a new MPLS tag ";
-        base oft:action;
-    }
-    identity pop_mpls {
-        description " Pop the outer MPLS tag ";
-        base oft:action;
-    }
-    identity set_queue {
-        description " Set queue id when outputting to a port ";
-        base oft:action;
-    }
-    identity group {
-        description " Apply group. ";
-        base oft:action;
-    }
-    identity set_nw_ttl {
-        description " IP TTL. ";
-        base oft:action;
-    }
-    identity dec_nw_ttl {
-        description " Decrement IP TTL. ";
-        base oft:action;
-    }
-    identity set_field {
-        description " Set a header field using OXM TLV format. ";
-        base oft:action;
-    }
-    identity push_pbb {
-        description " Push a new PBB service tag (I-TAG) ";
-        base oft:action;
-    }
-    identity pop_pbb {
-        description " Pop the outer PBB service tag (I-TAG) ";
-        base oft:action;
-    }
-    identity experimenter {
-        description "";
-        base oft:action;
-    }
-    */
-    grouping output {
-        description 
-            "Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
-            When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
-            number of bytes to send. A 'max_len' of zero means no bytes of the
-            packet should be sent. A 'max_len' of OFPCML_NO_BUFFER means that
-            the packet is not buffered and the complete packet is to be sent to
-            the controller.";
-        leaf port {
-            type oft:any-port-number;
-        }
-        leaf max-length {
-            description "Maximum packet length to be send to controller.";
-            type union {
-                type uint16 {
-                    range "0..65294"; // 0..0xff0e
-                }
-                type enumeration {
-                    enum no-buffer {
-                        description 
-                            "indicates that no buffering should be
-                             applied and the whole packet is to be
-                             sent to the controller";
-                        value 65535; //0xffff
-                    }
-                }
-            }
-        }
-    }
-
-    grouping group {
-        leaf group {
-            type oft:group-id; // define action group-id type;
-        }
-    }
-
-    grouping set-queue {
-        leaf queue {
-            type oft:queue-id;
-        }
-    }
-
-    grouping set-mpls-ttl {
-        leaf mpls_ttl {
-            type uint8;
-        }
-    }
-
-    grouping set-nw-ttl {
-        leaf nw_ttl {
-            type uint8;
-        }
-    }
+    import ietf-inet-types {prefix inet;}
+    import ietf-yang-types {prefix yang;}
 
-    grouping push-pbb {
+    import openflow-types { prefix oft; }
+    import openflow-extensible-match { prefix oxm;}
 
+    revision "2015-02-03" {
+        description "#NOT_PUBLISHED# OpenFlow 1.3 - action model";
     }
 
-    grouping push-mpls {
-
+    identity experimenter-action-sub-type {
+        description "The base identity for vendor's actions.";
     }
 
-    grouping push-vlan {
-
+    container action-container {
+        uses action-grouping;
     }
 
-    grouping pop-mpls {
-        leaf ethertype {
-            type uint16; // TODO: define ethertype type
+    grouping actions-grouping {
+        list action {
+            uses action-grouping;
+            leaf experimenter-id {
+                type oft:experimenter-id;
+            }
         }
     }
 
-    grouping set-field {
-        container field {
-            // TODO: figure definition
-        }
-    }
-    
-    
-    grouping action-header {
-        leaf type {
-            type action-type;
-        }
-    }
-    
-    typedef action-type {
-        /* ofp_action_type */
-        type enumeration {
-            enum OUTPUT {
-                description "Output to switch port.";
+    grouping action-grouping {
+        choice action-choice {
+            case output-action-case {
+                container output-action {
+                    leaf port {
+                        type oft:port-number;
+                    }
+                    leaf max-length {
+                        type uint16;
+                    }
+                }
             }
-            enum SET_VLAN_VID {
-                description "Set the 802.1q VLAN id.";
+            case copy-ttl-out-case {
+                // empty action
             }
-            enum SET_VLAN_PCP {
-                description "Set the 802.1q priority.";
+            case copy-ttl-in-case {
+                // empty action
             }
-            enum STRIP_VLAN {
-                description "Strip the 802.1q header.";
+            case set-mpls-ttl-case {
+                container set-mpls-ttl-action {
+                    leaf mpls-ttl {
+                        type uint8;
+                    }
+                }
             }
-            enum SET_DL_SRC {
-                description "Ethernet source address.";
+            case dec-mpls-ttl-case {
+                // empty action
             }
-            enum SET_DL_DST {
-                description "Ethernet destination address.";
+            case push-vlan-case {
+                container push-vlan-action {
+                    leaf ethertype {
+                        type oft:ether-type;
+                    }
+                }
             }
-            enum SET_NW_SRC {
-                description "IP source address.";
+            case pop-vlan-case {
+                // empty action
+            }
+            case push-mpls-case {
+                container push-mpls-action {
+                    leaf ethertype {
+                        type oft:ether-type;
+                    }
+                }
+            }
+            case pop-mpls-case {
+                container pop-mpls-action {
+                    leaf ethertype {
+                        type oft:ether-type;
+                    }
+                }
             }
-            enum SET_NW_DST {
-                description "IP destination address.";
+            case set-queue-case {
+                container set-queue-action {
+                    leaf queue-id {
+                        type uint32;
+                    }
+                }
             }
-            enum SET_TP_SRC {
-                description "TCP/UDP source port.";
+            case group-case {
+                container group-action {
+                    leaf group-id {
+                        type uint32;
+                    }
+                }
             }
-            enum SET_TP_DST {
-                description "TCP/UDP destination port.";
+            case set-nw-ttl-case {
+                container set-nw-ttl-action {
+                    leaf nw-ttl {
+                        type uint8;
+                    }
+                }
+            }
+            case dec-nw-ttl-case {
+                // empty action
+            }
+            case set-field-case {
+                container set-field-action {
+                    uses oxm:match-entries-grouping;
+                }
+            }
+            case push-pbb-case {
+                container push-pbb-action {
+                    leaf ethertype {
+                        type oft:ether-type;
+                    }
+                }
+            }
+            case pop-pbb-case {
+                // empty action
+            }
+        // OF1.0 structures
+            case set-vlan-vid-case {
+                container set-vlan-vid-action {
+                    leaf vlan-vid {
+                        type uint16;
+                    }
+                }
+            }
+            case set-vlan-pcp-case {
+                container set-vlan-pcp-action {
+                    leaf vlan-pcp {
+                        type uint8;
+                    }
+                }
             }
-            enum OFPAT_VENDOR {
-                value 65535; // 0xffff
+            case strip-vlan-case {
+                // empty action
+            }
+            case set-dl-src-case {
+                container set-dl-src-action {
+                    leaf dl-src-address {
+                        type yang:mac-address;
+                    }
+                }
+            }
+            case set-dl-dst-case {
+                container set-dl-dst-action {
+                    leaf dl-dst-address {
+                        type yang:mac-address;
+                    }
+                }
+            }
+            case set-nw-src-case {
+                container set-nw-src-action {
+                    leaf ip-address {
+                        type inet:ipv4-address;
+                    }
+                }
+            }
+            case set-nw-dst-case {
+                container set-nw-dst-action {
+                    leaf ip-address {
+                        type inet:ipv4-address;
+                    }
+                }
+            }
+            case set-nw-tos-case {
+                container set-nw-tos-action {
+                    leaf nw-tos {
+                        type uint8;
+                    }
+                }
+            }
+            case set-tp-src-case {
+                container set-tp-src-action {
+                    leaf port {
+                        type oft:port-number;
+                    }
+                }
+            }
+            case set-tp-dst-case {
+                container set-tp-dst-action {
+                    leaf port {
+                        type oft:port-number;
+                    }
+                }
+            }
+            case enqueue-case {
+                container enqueue-action {
+                    leaf port {
+                        type oft:port-number;
+                    }
+                    leaf queue-id {
+                        type oft:queue-id;
+                    }
+                }
             }
         }
     }
-}
\ No newline at end of file
+
+}