Added Yang models for ofp_match
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-types.yang
index 3791f565ef49ca4f9827705b4b5da90b110895ae..b771f69230c2cfa4a9b6920161481364ba85f9c3 100644 (file)
@@ -14,7 +14,7 @@ module openflow-types {
 
     typedef special-port-number {
         type enumeration {
-            enum in_port { 
+            enum in-port { 
                 //value "4294967288";
                 //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
             }
@@ -65,39 +65,39 @@ module openflow-types {
                 position 0;
                 //description "10 Mb half-duplex rate support.";
             }
-            bit 10mb_fd { 
+            bit 10mb-fd { 
                 position 1;
                 //description "10 Mb full-duplex rate support.";
             }
-            bit 100mb_hd { 
+            bit 100mb-hd { 
                 position 2;
                 //description "100 Mb half-duplex rate support.";
             }
-            bit 100mb_fd { 
+            bit 100mb-fd { 
                 position 3;
                 //description "100 Mb full-duplex rate support.";
             }
-            bit 1gb_hd { 
+            bit 1gb-hd { 
                 position 4;
                 //description "1 Gb half-duplex rate support.";
             }
-            bit 1gb_fd { 
+            bit 1gb-fd { 
                 position 5;
                 //description "1 Gb full-duplex rate support.";
             }
-            bit 10gb_fd { 
+            bit 10gb-fd { 
                 position 6;
                 //description "10 Gb full-duplex rate support.";
             }
-            bit 40gb_fd { 
+            bit 40gb-fd { 
                 position 7;
                 //description "40 Gb full-duplex rate support.";
             }
-            bit 100gb_fd { 
+            bit 100gb-fd { 
                 position 8;
                 //description "100 Gb full-duplex rate support.";
             }
-            bit 1tb_fd { 
+            bit 1tb-fd { 
                 position 9;
                 //description "1 Tb full-duplex rate support.";
             }
@@ -121,39 +121,39 @@ module openflow-types {
                 position 14;
                 //description "Pause.";
             }
-            bit pause_asym { 
+            bit pause-asym { 
                 position 15;
                 //description "Asymmetric pause.";
             }
         }
     }
 
-    typedef port_config {
+    typedef port-config {
         description 
            "Flags to indicate behavior of the physical port. These flags are
             describe the current configuration and used port_mod message 
             to configure the port's behavior.";
         type bits {
-            bit port_down { 
+            bit port-down { 
                 //description " Port is administratively down.";
                 position 0;
             }
-            bit no_recv { 
+            bit no-recv { 
                 //description " Drop all packets received by port.";
                 position 2;
             }
-            bit no_fwd { 
+            bit no-fwd { 
                 //description " Drop packets forwarded to port.";
                 position 5;
             }
-            bit no_packet_in { 
+            bit no-packet-in { 
                 //description "Do not send packet-in msgs for port.";
                 position 6;
             }
         }
     }
 
-    typedef ofp_port_state {
+    typedef port-state {
         description 
             "Current state of the physical port. These are not configurable from
             the controller.";
@@ -173,7 +173,7 @@ module openflow-types {
         }
     }
 
-    identity match-type {
+    identity match-type-base {
         description 
            "The match type indicates the match structure (set of fields that compose the
             match) in use. The match type is placed in the type field at the beginning
@@ -183,13 +183,16 @@ module openflow-types {
 
     identity standard-match-type {
         deprecated true;
-        base oft:match-type;
+        base oft:match-type-base;
     }
 
     typedef match-type {
-        type identityref {
-            base oft:match-type;
-        }
+        //type identityref {
+        //    base oft:match-type-base;
+        //}
+        
+        //TODO: use identityref, when generating available
+        type string;
     }
 
     identity instruction {
@@ -204,6 +207,540 @@ module openflow-types {
     typedef metadata {
         type binary;
     }
+    
+    typedef table-id {
+        type uint32;
+    }
+    typedef meter-id {
+        type uint32;
+    }
+    typedef queue-id {
+        type uint32;
+    }
+    typedef group-id {
+        type uint32;
+    }
+    
+    typedef ether-type {
+        type uint16;
+    }
+    
+    typedef error-type {
+        type enumeration {
+            enum HELLO_FAILED {
+                value 0; 
+                description "Hello Protocol failed.";
+            }
+            enum BAD_REQUEST {
+                value 1; 
+                description "Request was not understood.";
+            }
+            enum BAD_ACTION {
+                value 2; 
+                description "Error in action description.";
+            }
+            enum BAD_INSTRUCTION {
+                value 3; 
+                description "Error in instruction list.";
+            }
+            enum BAD_MATCH {
+                value 4; 
+                description "Error in match.";
+            }
+            enum FLOW_MOD_FAILED {
+                value 5; 
+                description "Problem modifying flow entry.";
+            }
+            enum GROUP_MOD_FAILED {
+                value 6; 
+                description "Problem modifying group entry.";
+            }
+            enum PORT_MOD_FAILED {
+                value 7; 
+                description "Port mod request failed.";
+            }
+            enum TABLE_MOD_FAILED {
+                value 8; 
+                description "Table mod request failed.";
+            }
+            enum QUEUE_OP_FAILED {
+                value 9; 
+                description "Queue operation failed.";
+            }
+            enum SWITCH_CONFIG_FAILED {
+                value 10; 
+                description "Switch config request failed.";
+            }
+            enum ROLE_REQUEST_FAILED {
+                value 11; 
+                description "Controller Role request failed.";
+            }
+            enum METER_MOD_FAILED {
+                value 12; 
+                description "Error in meter.";
+            }
+            enum TABLE_FEATURES_FAILED {
+                value 13; 
+                description "Setting table features failed.";
+            }
+            enum EXPERIMENTER {
+                value 65535; //0xffff 
+                description "Experimenter error messages.";
+            }
+        }
+    }
+    
+    typedef hello-element-type {
+        type enumeration {
+            enum VERSIONBITMAP {
+                value 1; 
+                description "Bitmap of version supported.";
+            }
+        }
+    }
+    
+    typedef switch-config-flag {
+        /* Handling of IP fragments. */
+        type enumeration {
+            enum FRAG_NORMAL {
+                value 0; 
+                description "No special handling for fragments.";
+            }
+            enum OFPC_FRAG_DROP {
+                value 1; 
+                description "Drop fragments.";
+            }
+            enum OFPC_FRAG_REASM {
+                value 2; 
+                description "Reassemble (only if OFPC_IP_REASM set).";
+            }
+            enum OFPC_FRAG_MASK {
+                value 3; 
+            }
+        }
+    }
+    
+    typedef flow-removed-reason {
+        /* flow removed */
+        type enumeration {
+            enum OFPRR_IDLE_TIMEOUT {
+                value 0;
+                description "Flow idle time exceeded idle_timeout.";
+            }
+            enum OFPRR_HARD_TIMEOUT {
+                value 1;
+                description "Time exceeded hard_timeout.";
+            }
+            enum OFPRR_DELETE {
+                value 2;
+                description "Evicted by a DELETE flow mod.";
+            }
+            enum OFPRR_GROUP_DELETE {
+                value 3;
+                description "Group was removed.";
+            }
+        }
+    }
+    
+    typedef port-reason {
+        /* port status */
+        type enumeration {
+            enum OFPPR_ADD {
+                value 0;
+                description "The port was added.";
+            }
+            enum OFPPR_DELETE {
+                value 1;
+                description "he port was removed.";
+            }
+            enum OFPPR_MODIFY {
+                value 2;
+                description "Some attribute of the port has changed.";
+            }
+        }
+    }
+    
+    typedef flow-mod-command {
+        /* ofp_flow_mod_command */
+        type enumeration {
+            enum OFPFC_ADD {      
+                value 0;      
+                description "New flow.";    
+            }
+            enum OFPFC_MODIFY {
+                value 1;
+                description "Modify all matching flows.";
+            }
+            enum OFPFC_MODIFY_STRICT {
+                value 2;
+                description "Modify entry strictly matching wildcards and priority.";
+            }
+            enum OFPFC_DELETE {
+                value 3;
+                description "Delete all matching flows.";
+            }
+            enum OFPFC_DELETE_STRICT {
+                value 4;
+                description "Delete entry strictly matching wildcards and priority.";
+            }
+        }
+    }
+    
+    typedef flow-mod-flags {
+        /* ofp_flow_mod_flags */
+        type bits {
+            bit OFPFF_SEND_FLOW_REM {
+                position 0;
+                /* Send flow removed message when flow expires or is deleted. */
+            }
+            bit OFPFF_CHECK_OVERLAP {
+                position 1;
+                /* Check for overlapping entries first. */
+            }
+            bit OFPFF_RESET_COUNTS {
+                position 2;
+                /* Reset flow packet and byte counts. */
+            }
+            bit OFPFF_NO_PKT_COUNTS {
+                position 3;
+                /* Don't keep track of packet count. */
+            }
+            bit OFPFF_NO_BYT_COUNTS {
+                position 4;
+                /* Don't keep track of byte count. */
+            }
+        }
+    }
+    
+    typedef group-mod-command {
+        /* ofp_group_mod_command */
+        type enumeration {
+            enum OFPGC_ADD {            
+              value 0;            
+              description "New group.";            
+            }
+            enum OFPGC_MODIFY {
+              value 1;
+              description "Modify all matching groups.";
+            }
+            enum OFPGC_DELETE {
+              value 2;
+              description "Delete all matching groups.";
+            }
+            
+        }
+    }
+    
+    
+    typedef group-type {
+        /* ofp_group_type */
+        type enumeration {
+            enum OFPGT_ALL {            
+              value 0;            
+              description "All (multicast/broadcast) group.";            
+            }
+            enum OFPGT_SELECT {
+              value 1;
+              description "Select group.";
+            }
+            enum OFPGT_INDIRECT {
+              value 2;
+              description "Indirect group.";
+            }
+            enum OFPGT_FF {
+              value 3;
+              description "Fast failover group.";
+            }
+        }
+    }
+    
+    typedef multipart-request-flags {
+        description
+            "enum ofp_multipart_request_flags ";
+        type bits {
+            bit OFPMPF_REQ_MORE {
+                //description "More requests to follow.";
+                position 0;
+            }
+        }
+    }
+    
+    typedef multipart-type {
+        /* ofp_multipart_type */
+        type enumeration {
+            enum OFPGT_ALL {
+              value 0;
+              description "All (multicast/broadcast) group.";
+            }
+            
+            enum OFPMP_DESC {
+              value 0;
+              description "Description of this OpenFlow switch.
+                 The request body is empty.
+                 The reply body is struct ofp_desc.";
+            }
+            enum OFPMP_FLOW {
+              value 1;
+              description "Individual flow statistics.
+                 The request body is struct ofp_flow_stats_request.
+                 The reply body is an array of struct ofp_flow_stats.";
+            }
+            enum OFPMP_AGGREGATE {
+              value 2;
+              description "Aggregate flow statistics.
+                 The request body is struct ofp_aggregate_stats_request.
+                 The reply body is struct ofp_aggregate_stats_reply.";
+            }
+            enum OFPMP_TABLE {
+              value 3;
+              description "Flow table statistics.
+                 The request body is empty.
+                 The reply body is an array of struct ofp_table_stats.";
+            }
+            enum OFPMP_PORT_STATS {
+              value 4;
+              description "Port statistics.
+                 The request body is struct ofp_port_stats_request.
+                 The reply body is an array of struct ofp_port_stats.";
+            }
+            enum OFPMP_QUEUE {
+              value 5;
+              description "Queue statistics for a port
+                 The request body is struct ofp_queue_stats_request.
+                 The reply body is an array of struct ofp_queue_stats";
+            }
+            enum OFPMP_GROUP {
+              value 6;
+              description "Group counter statistics.
+                 The request body is struct ofp_group_stats_request.
+                 The reply is an array of struct ofp_group_stats.";
+            }
+            enum OFPMP_GROUP_DESC {
+              value 7;
+              description "Group description.
+                 The request body is empty.
+                 The reply body is an array of struct ofp_group_desc.";
+            }
+            enum OFPMP_GROUP_FEATURES {
+              value 8;
+              description "Group features.
+                 The request body is empty.
+                 The reply body is struct ofp_group_features.";
+            }
+            enum OFPMP_METER {
+              value 9;
+              description "Meter statistics.
+                 The request body is struct ofp_meter_multipart_requests.
+                 The reply body is an array of struct ofp_meter_stats.";
+            }
+            enum OFPMP_METER_CONFIG {
+              value 10;
+              description "Meter configuration.
+                 The request body is struct ofp_meter_multipart_requests.
+                 The reply body is an array of struct ofp_meter_config.";
+            }
+            enum OFPMP_METER_FEATURES {
+              value 11;
+              description "Meter features.
+                 The request body is empty.
+                 The reply body is struct ofp_meter_features.";
+            }
+            enum OFPMP_TABLE_FEATURES {
+              value 12;
+              description "Table features.
+                 The request body is either empty or contains an array of
+                 struct ofp_table_features containing the controller’s
+                 desired view of the switch. If the switch is unable to
+                 set the specified view an error is returned.
+                 The reply body is an array of struct ofp_table_features.";
+            }
+            enum OFPMP_PORT_DESC {
+              value 13;
+              description "Port description.
+                 The request body is empty.
+                 The reply body is an array of struct ofp_port.";
+            }
+            enum OFPMP_EXPERIMENTER {
+              value 65535; //0xffff
+              description "Experimenter extension.
+                 The request and reply bodies begin with
+                 struct ofp_experimenter_multipart_header.
+                 The request and reply bodies are otherwise experimenter-defined.";
+            }
+        }
+    }
+    
+    typedef queue-property {
+        /* ofp_queue_properties */
+        type enumeration {
+            enum OFPGT_ALL {
+              value 0;
+              description "All (multicast/broadcast) group.";
+            }
+            enum OFPQT_MIN_RATE {
+                value 1;
+                description "Minimum datarate guaranteed.";
+            }
+            enum OFPQT_MAX_RATE {
+                value 2;
+                description "Maximum datarate.";
+            }
+            enum OFPQT_EXPERIMENTER {
+                value 65535; // 0xffff 
+                description "Experimenter defined property.";
+            }
+        }
+    }
+    
+    typedef controller-role {
+        /* ofp_controller_role */
+        type enumeration {
+            enum OFPCR_ROLE_NOCHANGE {
+              value 0;
+              description "Don’t change current role.";
+            }
+            enum OFPCR_ROLE_EQUAL {
+              value 1;
+              description "Default role, full access.";
+            }
+            enum OFPCR_ROLE_MASTER {
+              value 2;
+              description "Full access, at most one master.";
+            }
+            enum OFPCR_ROLE_SLAVE {
+              value 3;
+              description "Read-only access.";
+            }
+        }
+    }
+    
+    typedef packet-in-reason {
+        /* ofp_packet_in_reason */
+        type enumeration {
+            enum OFPR_NO_MATCH {
+              value 0;
+              description "No matching flow (table-miss flow entry). ";
+            }
+            enum OFPR_ACTION {
+              value 1;
+              description "Action explicitly output to controller. ";
+            }
+            enum OFPR_INVALID_TTL {
+              value 2;
+              description "Packet has invalid TTL ";
+            }
+        }
+    }
+    
+    typedef meter-mod-command {
+        /* ofp_meter_mod_command */
+        type enumeration {
+            enum OFPMC_ADD {
+              description "New meter. ";
+            }
+            enum OFPMC_MODIFY {
+              description "Modify specified meter. ";
+            }
+            enum OFPMC_DELETE {
+              description "Delete specified meter. ";
+            }
 
+        }
+    }
+    typedef meter-flags {
+        /* ofp_meter_flags */
+        type bits {
+            bit OFPMF_KBPS {
+                position 0;
+                /* Rate value in kb/s (kilo-bit per second). */
+            }
+            bit OFPMF_PKTPS {
+                position 1;
+                /* Rate value in packet/sec. */
+            }
+            bit OFPMF_BURST {
+                position 2;
+                /* Do burst size. */
+            }
+            bit OFPMF_STATS {
+                position 3;
+                /* Collect statistics. */
+            }
+        }
+    }
+    
+    typedef meter-band-type {
+        /* ofp_meter_band_type */
+        type enumeration {
+            enum OFPMBT_DROP {
+              value 1;
+              description "Drop packet. ";
+            }
+            enum OFPMBT_DSCP_REMARK {
+              value 2;
+              description "Remark DSCP in the IP header. ";
+            }
+            enum OFPMBT_EXPERIMENTER {
+              value 65535; //0xFFFF
+              description "Experimenter meter band. ";
+            }
 
-}
\ No newline at end of file
+        }
+    }
+    
+    typedef table-config {
+        /* ofp_table_config */
+        type bits {
+            bit OFPTC_DEPRECATED_MASK {
+                /* Deprecated bits */
+                position 3;
+            }
+        }
+    }
+    
+    typedef group-types {
+        /* ofp_group_type */
+        type bits {
+            bit OFPGT_ALL {
+                /* All (multicast/broadcast) group. */
+                position 0;
+            }
+            bit OFPGT_SELECT {
+                /* Select group. */
+                position 1;
+            }
+            bit OFPGT_INDIRECT {
+                /* Indirect group. */
+                position 2;
+            }
+            bit OFPGT_FF {
+                /* Fast failover group. */
+                position 3;
+            }
+        }
+    }
+    
+    typedef group-capabilities {
+        /* ofp_group_capabilities */
+        type bits {
+            bit OFPGFC_SELECT_WEIGHT {
+                /* Support weight for select groups */
+                position 0;
+            }
+            bit OFPGFC_SELECT_LIVENESS {
+                /* Support liveness for select groups */
+                position 1;
+            }
+            bit OFPGFC_CHAINING {
+                /* Support chaining groups */
+                position 2;
+            }
+            bit OFPGFC_CHAINING_CHECKS {
+                /* Check chaining for loops and delete */
+                position 3;
+            }
+        }
+    }
+    
+}