Match (de)serialization fixed + tests added
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-types.yang
index c9e6990e1f4b00ab49cc084c17bf5986410c5e69..d17f69a807b7290e886a52a7e7dbb40361ed7090 100644 (file)
@@ -7,8 +7,38 @@ module openflow-types {
     }
 
     typedef port-number {
-        type uint32 {
-            range "0..4294967040"; // 0xffffff00 See for actual value
+        type uint32;
+    }
+    
+    typedef port-number-values {
+        type enumeration {
+            enum MAX {
+                value -256; // 0xffffff00 
+            }
+            enum IN_PORT {
+                value -8; // 0xfffffff8
+            }
+            enum TABLE {
+                value -7; // 0xfffffff9 
+            }
+            enum NORMAL {
+                value -6; // 0xfffffffa 
+            }
+            enum FLOOD {
+                value -5; // 0xfffffffb 
+            }
+            enum ALL {
+                value -4; // 0xfffffffc 
+            }
+            enum CONTROLLER {
+                value -3; // 0xfffffffd
+            }
+            enum LOCAL {
+                value -2; // 0xfffffffe
+            }
+            enum ANY {
+                value -1; // 0xffffffff
+            }
         }
     }
 
@@ -16,43 +46,43 @@ module openflow-types {
         ////description "Features of ports available in datapath.";
         //reference "ofp_port_features";
         type bits {
-            bit 10mb_hd { 
+            bit _10mb_hd { 
                 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.";
             }
@@ -137,16 +167,9 @@ module openflow-types {
     }
 
     identity standard-match-type {
-        deprecated true;
         base oft:match-type-base;
     }
 
-    typedef oxm-match-type {
-        type identityref {
-            base oft:match-type-base;
-        }
-    }
-
     identity instruction {
     }
 
@@ -238,7 +261,412 @@ module openflow-types {
             }
         }
     }
+    
+    typedef hello-failed-code {
+        type enumeration {
+            enum INCOMPATIBLE {
+                value 0; 
+                description "Hello Protocol failed.";
+            }
+            enum EPERM {
+                value 1; 
+                description "Request was not understood.";
+            }
+        }
+    }
+    
+    typedef bad-request-code {
+        type enumeration {
+            enum BAD_VERSION {
+                value 0; 
+            }
+            enum BAD_TYPE {
+                value 1; 
+            }
+            enum BAD_MULTIPART {
+                value 2; 
+            }
+            enum BAD_EXPERIMENTER {
+                value 3; 
+            }
+            enum BAD_EXP_TYPE {
+                value 4; 
+            }
+            enum EPERM {
+                value 5; 
+            }
+            enum BAD_LEN {
+                value 6; 
+            }
+            enum BUFFER_EMPTY {
+                value 7; 
+            }
+            enum BUFFER_UNKNOWN {
+                value 8; 
+            }
+            enum BAD_TABLE_ID {
+                value 9; 
+            }
+            enum IS_SLAVE {
+                value 10; 
+            }
+            enum BAD_PORT {
+                value 11; 
+            }
+            enum BAD_PACKET {
+                value 12; 
+            }
+            enum MULTIPART_BUFFER_OVERFLOW {
+                value 13; 
+            }
+        }
+    }
+    
+    typedef bad-action-code {
+        type enumeration {
+            enum BAD_TYPE {
+                value 0; 
+            }
+            enum BAD_LEN {
+                value 1; 
+            }
+            enum BAD_EXPERIMENTER {
+                value 2; 
+            }
+            enum BAD_EXP_TYPE {
+                value 3; 
+            }
+            enum BAD_OUT_PORT {
+                value 4; 
+            }
+            enum BAD_ARGUMENT {
+                value 5; 
+            }
+            enum EPERM {
+                value 6; 
+            }
+            enum TOO_MANY {
+                value 7; 
+            }
+            enum BAD_QUEUE {
+                value 8; 
+            }
+            enum BAD_OUT_GROUP {
+                value 9; 
+            }
+            enum MATCH_INCONSISTENT {
+                value 10; 
+            }
+            enum UNSUPPORTED_ORDER {
+                value 11; 
+            }
+            enum BAD_TAG {
+                value 12; 
+            }
+            enum BAD_SET_TYPE {
+                value 13; 
+            }
+            enum BAD_SET_LEN {
+                value 14; 
+            }
+            enum BAD_SET_ARGUMENT {
+                value 15; 
+            }
+        }
+    }
+    
+    typedef bad-instruction-code {
+        type enumeration {
+            enum UNKNOWN_INST {
+                value 0; 
+            }
+            enum UNSUP_INST {
+                value 1; 
+            }
+            enum BAD_TABLE_ID {
+                value 2; 
+            }
+            enum UNSUP_METADATA {
+                value 3; 
+            }
+            enum UNSUP_METADATA_MASK {
+                value 4; 
+            }
+            enum BAD_EXPERIMENTER {
+                value 5; 
+            }
+            enum BAD_EXP_TYPE {
+                value 6; 
+            }
+            enum BAD_LEN {
+                value 7; 
+            }
+            enum EPERM {
+                value 8; 
+            }
+        }
+    }
+    
+    typedef bad-match-code {
+        type enumeration {
+            enum BAD_TYPE {
+                value 0; 
+            }
+            enum BAD_LEN {
+                value 1; 
+            }
+            enum BAD_TAG {
+                value 2; 
+            }
+            enum BAD_DL_ADDR_MASK {
+                value 3; 
+            }
+            enum BAD_NW_ADDR_MASK {
+                value 4; 
+            }
+            enum BAD_WILDCARDS {
+                value 5; 
+            }
+            enum BAD_FIELD {
+                value 6; 
+            }
+            enum BAD_VALUE {
+                value 7; 
+            }
+            enum BAD_MASK {
+                value 8; 
+            }
+            enum BAD_PREREQ {
+                value 9; 
+            }
+            enum DUP_FIELD {
+                value 10; 
+            }
+            enum EPERM {
+                value 11; 
+            }
+        }
+    }
+    
+    typedef flow-mod-failed-code {
+        type enumeration {
+            enum UNKNOWN {
+                value 0; 
+            }
+            enum TABLE_FULL {
+                value 1; 
+            }
+            enum BAD_TABLE_ID {
+                value 2; 
+            }
+            enum OVERLAP {
+                value 3; 
+            }
+            enum EPERM {
+                value 4; 
+            }
+            enum BAD_TIMEOUT {
+                value 5; 
+            }
+            enum BAD_COMMAND {
+                value 6; 
+            }
+            enum BAD_FLAGS {
+                value 7; 
+            }
+        }
+    }
+    
+    typedef group-mod-failed-code {
+        type enumeration {
+            enum GROUP_EXISTS {
+                value 0; 
+            }
+            enum INVALID_GROUP {
+                value 1; 
+            }
+            enum WEIGHT_UNSUPPORTED {
+                value 2; 
+            }
+            enum OUT_OF_GROUPS {
+                value 3; 
+            }
+            enum OUT_OF_BUCKETS {
+                value 4; 
+            }
+            enum CHAINING_UNSUPPORTED {
+                value 5; 
+            }
+            enum WATCH_UNSUPPORTED {
+                value 6; 
+            }
+            enum LOOP {
+                value 7; 
+            }
+            enum UNKNOWN_GROUP {
+                value 8; 
+            }
+            enum CHAINED_GROUP {
+                value 9; 
+            }
+            enum BAD_TYPE {
+                value 10; 
+            }
+            enum BAD_COMMAND {
+                value 11; 
+            }
+            enum BAD_BUCKET {
+                value 12; 
+            }
+            enum BAD_WATCH {
+                value 13; 
+            }
+            enum EPERM {
+                value 14; 
+            }
+        }
+    }
+    
+    typedef port-mod-failed-code {
+        type enumeration {
+            enum BAD_PORT {
+                value 0; 
+            }
+            enum BAD_HW_ADDR {
+                value 1; 
+            }
+            enum BAD_CONFIG {
+                value 2; 
+            }
+            enum BAD_ADVERTISE {
+                value 3; 
+            }
+            enum EPERM {
+                value 4; 
+            }
+        }
+    }
+    
+    typedef table-mod-failed-code {
+        type enumeration {
+            enum BAD_TABLE {
+                value 0; 
+            }
+            enum BAD_CONFIG {
+                value 1; 
+            }
+            enum EPERM {
+                value 2; 
+            }
+        }
+    }
 
+    typedef queue-op-failed-code {
+        type enumeration {
+            enum BAD_PORT {
+                value 0; 
+            }
+            enum BAD_QUEUE {
+                value 1; 
+            }
+            enum EPERM {
+                value 2; 
+            }
+        }
+    }
+    
+    typedef switch-config-failed-code {
+        type enumeration {
+            enum BAD_FLAGS {
+                value 0; 
+            }
+            enum BAD_LEN {
+                value 1; 
+            }
+            enum EPERM {
+                value 2; 
+            }
+        }
+    }
+    
+    typedef role-request-failed-code {
+        type enumeration {
+            enum STALE {
+                value 0; 
+            }
+            enum UNSUP {
+                value 1; 
+            }
+            enum BAD_ROLE {
+                value 2; 
+            }
+        }
+    }
+    
+    typedef meter-mod-failed-code {
+        type enumeration {
+            enum UNKNOWN {
+                value 0; 
+            }
+            enum METER_EXISTS {
+                value 1; 
+            }
+            enum INVALID_METER {
+                value 2; 
+            }
+            enum UNKNOWN_METER {
+                value 3; 
+            }
+            enum BAD_COMMAND {
+                value 4; 
+            }
+            enum BAD_FLAGS {
+                value 5; 
+            }
+            enum BAD_RATE {
+                value 6; 
+            }
+            enum BAD_BURST {
+                value 7; 
+            }
+            enum BAD_BAND {
+                value 8; 
+            }
+            enum BAD_BAND_VALUE {
+                value 9; 
+            }
+            enum OUT_OF_METERS {
+                value 10; 
+            }
+            enum OUT_OF_BANDS {
+                value 11; 
+            }
+        }
+    }
+    
+    typedef table-features-failed-code {
+        type enumeration {
+            enum BAD_TABLE {
+                value 0; 
+            }
+            enum BAD_METADATA {
+                value 1; 
+            }
+            enum BAD_TYPE {
+                value 2; 
+            }
+            enum BAD_LEN {
+                value 3; 
+            }
+            enum BAD_ARGUMENT {
+                value 4; 
+            }
+            enum EPERM {
+                value 5; 
+            }
+        }
+    }
+    
     typedef hello-element-type {
         type enumeration {
             enum VERSIONBITMAP {
@@ -434,6 +862,21 @@ module openflow-types {
             }
         }
     }
+    
+    typedef table-values {
+        /* ofp_table */
+        type enumeration {
+            enum OFPTT_MAX {            
+              value 254; // 0xfe             
+              description "Last usable table number.";            
+            }
+            enum OFPTT_ALL {
+              value 255; // 0xff
+              description "Wildcard table used for table config, 
+                           flow stats and flow deletes.";
+            }
+        }
+    }
 
        typedef group {
                /* ofp_group - Group numbering. Groups can use any number up to OFPG_MAX.*/
@@ -758,6 +1201,20 @@ module openflow-types {
             }
         }
     }
+    
+    typedef meter-band-type-bitmap {
+        /* ofp_meter_band_type */
+        type bits {
+            bit OFPMBT_DROP {
+              position 1;
+              description "Drop packet. ";
+            }
+            bit OFPMBT_DSCP_REMARK {
+              position 2;
+              description "Remark DSCP in the IP header. ";
+            }
+        }
+    }
 
        typedef meter {
                /* ofp_meter - Meter numbering. Flow meters can use any number up to OFPM_MAX*/
@@ -907,9 +1364,236 @@ module openflow-types {
         }
     }
     
+    typedef ipv6-exthdr-flags {
+        type bits {
+            bit nonext {
+                description "<No next header> encountered.";
+                position 0;
+            }
+            bit esp {
+                description "Encrypted Sec Payload header present.";
+                position 1;
+            }
+            bit auth {
+                description "Authentication header present.";
+                position 2;
+            }
+            bit dest {
+                description "1 or 2 dest headers present.";
+                position 3;
+            }
+            bit frag {
+                description "Fragment header present.";
+                position 4;
+            }
+            bit router {
+                description "Router header present.";
+                position 5;
+            }
+            bit hop {
+                description "Hop-by-hop header present.";
+                position 6;
+            }
+            bit unrep {
+                description "Unexpected repeats encountered.";
+                position 7;
+            }
+            bit unseq {
+                description "Unexpected sequencing encountered.";
+                position 8;
+            }
+        }
+    }
+    
 // OPENFLOW v1.0 STRUCTURES
     // Structures under this line are needed to support OpenFlow version 1.0 
-    // wire protocol 0x01; 
+    // wire protocol 0x01;
+    
+    typedef error-type-v10 {
+        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 FLOW_MOD_FAILED {
+                value 3; 
+                description "Problem modifying flow entry.";
+            }
+            enum PORT_MOD_FAILED {
+                value 4; 
+                description "Port mod request failed.";
+            }
+            enum QUEUE_OP_FAILED {
+                value 5; 
+                description "Queue operation failed.";
+            }
+        }
+    }
+    
+    typedef hello-failed-code-v10 {
+        type enumeration {
+            enum INCOMPATIBLE {
+                value 0; 
+                description "Hello Protocol failed.";
+            }
+            enum EPERM {
+                value 1; 
+                description "Request was not understood.";
+            }
+        }
+    }
+    
+    typedef bad-request-code-v10 {
+        type enumeration {
+            enum BAD_VERSION {
+                value 0; 
+            }
+            enum BAD_TYPE {
+                value 1; 
+            }
+            enum BAD_STAT {
+                value 2; 
+            }
+            enum BAD_VENDOR {
+                value 3; 
+            }
+            enum BAD_SUBTYPE {
+                value 4; 
+            }
+            enum EPERM {
+                value 5; 
+            }
+            enum BAD_LEN {
+                value 6; 
+            }
+            enum BUFFER_EMPTY {
+                value 7; 
+            }
+            enum BUFFER_UNKNOWN {
+                value 8; 
+            }
+        }
+    }
+    
+    typedef bad-action-code-v10 {
+        type enumeration {
+            enum BAD_TYPE {
+                value 0; 
+            }
+            enum BAD_LEN {
+                value 1; 
+            }
+            enum VENDOR {
+                value 2; 
+            }
+            enum BAD_VENDOR_TYPE {
+                value 3; 
+            }
+            enum BAD_OUT_PORT {
+                value 4; 
+            }
+            enum BAD_ARGUMENT {
+                value 5; 
+            }
+            enum EPERM {
+                value 6; 
+            }
+            enum TOO_MANY {
+                value 7; 
+            }
+            enum BAD_QUEUE {
+                value 8; 
+            }
+        }
+    }
+    
+    typedef flow-mod-failed-code-v10 {
+        type enumeration {
+            enum ALL_TABLES_FULL {
+                value 0; 
+            }
+            enum OVERLAP {
+                value 1; 
+            }
+            enum EPERM {
+                value 2; 
+            }
+            enum BAD_EMERG_TIMEOUT {
+                value 3; 
+            }
+            enum BAD_COMMAND {
+                value 4; 
+            }
+            enum UNSUPPORTED {
+                value 5; 
+            }
+        }
+    }
+    
+    typedef port-mod-failed-code-v10 {
+        type enumeration {
+            enum BAD_PORT {
+                value 0; 
+            }
+            enum BAD_HW_ADDR {
+                value 1; 
+            }
+        }
+    }
+    
+    typedef queue-op-failed-code-v10 {
+        type enumeration {
+            enum BAD_PORT {
+                value 0; 
+            }
+            enum BAD_QUEUE {
+                value 1; 
+            }
+            enum EPERM {
+                value 2; 
+            }
+        }
+    }
+    
+    typedef port-number-values-v10 {
+        type enumeration {
+            enum MAX {
+                value 65280; // 0xff00 
+            }
+            enum IN_PORT {
+                value 65528; // 0xfff8
+            }
+            enum TABLE {
+                value 65529; // 0xfff9 
+            }
+            enum NORMAL {
+                value 65530; // 0xfffa 
+            }
+            enum FLOOD {
+                value 65531; // 0xfffb 
+            }
+            enum ALL {
+                value 65532; // 0xfffc 
+            }
+            enum CONTROLLER {
+                value 65533; // 0xfffd
+            }
+            enum LOCAL {
+                value 65534; // 0xfffe
+            }
+            enum NONE {
+                value 65535; // 0xffff
+            }
+        }
+    }
     
     typedef port-config-v10 {
         description 
@@ -966,24 +1650,19 @@ module openflow-types {
                 position 2;
             }
             bit stp_listen {
-                //description "Live for Fast Failover Group.";
-                position 8;
+                //description "Not learning or relaying frames.";
             }
             bit stp_learn {
-                //description "Live for Fast Failover Group.";
-                position 8;
+                //description "Learning but not relaying frames.";
             }
             bit stp_forward {
-                //description "Live for Fast Failover Group.";
-                position 8;
+                //description "Learning and relaying frames.";
             }
             bit stp_block {
-                //description "Live for Fast Failover Group.";
-                position 8;
+                //description "Not part of spanning tree.";
             }
             bit stp_mask {
-                //description "Live for Fast Failover Group.";
-                position 8;
+                //description "Bit mask for OFPPS_STP_* values.";
             }
         }
     }
@@ -992,31 +1671,31 @@ module openflow-types {
         ////description "Features of ports available in datapath.";
         //reference "ofp_port_features";
         type bits {
-            bit 10mb-hd { 
+            bit _10mb-hd { 
                 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.";
             }
@@ -1156,32 +1835,40 @@ module openflow-types {
         }
     }
     
-    typedef error-type-v10 {
-        type enumeration {
-            enum HELLO_FAILED {
-                value 0; 
-                description "Hello Protocol failed.";
+    typedef flow-wildcards-v10 {
+        /* ofp_flow_wildcards */
+        type bits {
+            bit IN_PORT {
+                position 0;
             }
-            enum BAD_REQUEST {
-                value 1; 
-                description "Request was not understood.";
+            bit DL_VLAN {
+                position 1;
             }
-            enum BAD_ACTION {
-                value 2; 
-                description "Error in action description.";
+            bit DL_SRC {
+                position 2;
             }
-            enum FLOW_MOD_FAILED {
-                value 3; 
-                description "Problem modifying flow entry.";
+            bit DL_DST {
+                position 3;
             }
-            enum PORT_MOD_FAILED {
-                value 4; 
-                description "Port mod request failed.";
+            bit DL_TYPE {
+                position 4;
             }
-            enum QUEUE_OP_FAILED {
-                value 5; 
-                description "Queue operation failed.";
+            bit NW_PROTO {
+                position 5;
+            }
+            bit TP_SRC {
+                position 6;
+            }
+            bit TP_DST {
+                position 7;
+            }
+            bit DL_VLAN_PCP {
+                position 20;
+            }
+            bit NW_TOS {
+                position 21;
             }
         }
     }
+    
 }