Yang model fixed
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-extensible-match.yang
index 54decb1a9fe6928fc5e6bfb975331c73c5da81d3..349f3770863d6435b89e56a978ca0ed4fd097db2 100644 (file)
@@ -2,15 +2,12 @@ module openflow-extensible-match {
     namespace "urn:opendaylight:openflow:oxm";
     prefix "oxm";
 
-
-    
     import ietf-yang-types {prefix yang;}
     import ietf-inet-types {prefix inet;}
     import openflow-types {prefix oft;}
 
-
     revision "2013-07-31" {
-        description "Initial model";
+        description "OpenFlow 1.3 - match model";
     }
 
     identity oxm-match-type {
@@ -25,7 +22,6 @@ module openflow-extensible-match {
             description "Base identity for OXM classes";
         }
 
-
         identity nxm-0-class {
             description "Backward compatibility with NXM";
             base clazz;
@@ -45,10 +41,7 @@ module openflow-extensible-match {
             base clazz;
         }
 
-
-
     // field types
-        
         identity match-field {
             description "Base identity for OXM Fields";
         }
@@ -213,538 +206,14 @@ module openflow-extensible-match {
             base match-field;
             description "Match for IPv6 Extension Header pseudo-field";
         }
-        
-    // Abstract definitions of fields structure
 
-        grouping in-port {
-            description 
-                "Ingress port. Numerical representation of incoming port, starting at 1. This may be a physical or switch-defined logical port.";
-            leaf port-number {
-                type oft:port-number;
-            }
-        }
-        grouping in-phy-port {
-            description "Physical port. In ofp_packet_in messages, underlying physical port when packet received on a logical port.";
-            leaf port-number {
-                type oft:port-number;
-            }
-        }
-        grouping metadata {
-            description "Metadata passed between tables.";
-            leaf value {
-                type oft:metadata;
-            }
-            leaf mask {
-                type oft:metadata;
-            }
-        }
-        grouping eth-dst {
-            description "Ethernet destination address.";
-            leaf address {
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping eth-src {
-            description "Ethernet source address.";
-            leaf address {
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping eth-type {
-            description "Ethernet frame type.";
-            leaf type {
-                type oft:ether-type; // Needs to define that as general model
-            }
-        }
-        grouping vlan-vid {
-            description "VLAN id.";
-            leaf vlan-id {
-                type uint16; // TODO: Define proper vlan id type.
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping vlan-pcp {
-            description "VLAN priority.";
-            leaf vlan-pcp {
-                type uint8; // TODO: Define PCP type
-            }
-        }
-        grouping ip-dscp {
-            description "IP DSCP (6 bits in ToS field).";
-
-            leaf dscp {
-                type inet:dscp; // TODO: Define DSCP type
-            }
-        }
-        grouping ip-ecn {
-            description "IP ECN (2 bits in ToS field).";
-            leaf ecn {
-                type uint8; // TODO define ECN
-            }
-        }
-        grouping ip-proto {
-            description "IP protocol.";
-            leaf protocol-number {
-                type uint8; // TODO define IP protocol number
-            }
-        }
-        grouping ipv4-src {
-            description "IPv4 source address.";
-            leaf prefix {
-                type inet:ipv4-prefix;
-            }
-        }
-        grouping ipv4-dst {
-            description "IPv4 destination address.";
-            leaf prefix {
-                type inet:ipv4-prefix;
-            }
-        }
-        grouping tcp-src {
-            description "TCP source port.";
-            leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping tcp-dst {
-            description "TCP destination port.";
-                    leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping udp-src {
-            description "UDP source port.";
-            leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping udp-dst {
-            description "UDP destination port.";
-            leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping sctp-src {
-            description "SCTP source port.";
-            leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping sctp-dst {
-            description "SCTP destination port.";
-            leaf port {
-                type inet:port-number;
-            }
-        }
-        grouping icmpv4-type {
-            description "ICMP type.";
-            leaf type {
-                type uint8; // Define ICMP Type
-            }
-        }
-        grouping icmpv4-code {
-            description "ICMP code.";
-            leaf code {
-                type uint8; // Define ICMP Code
-            }
-        }
-        grouping arp-op {
-            description "ARP opcode.";
-            leaf op-code {
-                type uint16;
-            }
-        }
-        grouping arp-spa {
-            description "ARP source IPv4 address.";
-            leaf prefix {
-                type inet:ipv4-prefix;
-            }
-        }
-        grouping arp-tpa {
-            description "ARP target IPv4 address.";
-            leaf prefix {
-                type inet:ipv4-prefix;
-            }
-        }
-        grouping arp-sha {
-            description "ARP source hardware address.";
-            leaf address {
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping arp-tha {
-            description "ARP target hardware address.";
-            leaf address {
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping ipv6-src {
-            description "IPv6 source address.";
-            leaf prefix {
-                type inet:ipv6-prefix;
-            }
-        }
-        grouping ipv6-dst {
-            description "IPv6 destination address.";
-            leaf prefix {
-                type inet:ipv6-prefix;
-            }
-        }
-        grouping ipv6-flabel {
-            description "IPv6 Flow Label";
-            leaf label {
-                type inet:ipv6-flow-label;
-            }
-        }
-        grouping icmpv6-type {
-            description "ICMPv6 type.";
-            leaf type {
-                type uint8;
-            }
-        }
-        grouping icmpv6-code {
-            description "ICMPv6 code.";
-            leaf code {
-                type uint8;
-            }
-        }
-        grouping ipv6-nd-target {
-            description "Target address for ND.";
-            leaf address {
-                type inet:ipv6-address;
-            }
-        }
-        grouping ipv6-nd-sll {
-            description "Source link-layer for ND.";
-            leaf address {
-                type yang:mac-address;
-            }
-        }
-        grouping ipv6-nd-tll {
-            description "Target link-layer for ND.";
-            leaf address {
-                type yang:mac-address;
-            }
-        }
-        grouping mpls-label {
-            description "MPLS label.";
-            leaf label {
-                type uint32; // TODO define type
-            }
-        }
-        grouping mpls-tc {
-            description "MPLS TC.";
-            leaf tc {
-                type uint8;
-            }
-        }
-        grouping mpls-bos {
-            description "MPLS BoS bit.";
-            leaf bos {
-                type boolean;
-            }
-        }
-        grouping pbb-isid {
-            description "PBB I-SID.";
-            leaf isid {
-                type uint32;
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-        grouping tunnel-id {
-            description "Logical Port Metadata.";
-            leaf value {
-                type oft:metadata; 
-            }
-            leaf mask {
-                type oft:metadata;
-            }
-        }
-        grouping ipv6-exthdr {
-            description "IPv6 Extension Header pseudo-field";
-            leaf pseudo-field {
-                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;
-                        }                    
-                }
-            }
-            leaf mask {
-                type binary;
-            }
-        }
-
-    /* Basic Match Fields : 
-       - Maybe it will be better to split into several groupings
-         based on protocol types:
-             - L2 match
-             - L3 match
-                - IPv4 match
-                - IPv6 match
-             - L4 match
-             - ARP match
-             etc...
-        Maybe this works belongs to other module.
-    */
-
-        grouping basic-match-fields {
-            container in-port {
-                presence "";
-                uses in-port; 
-        
-            }
-            container in-phy-port {
-                presence "";
-                uses in-phy-port; 
-                
-            }
-            container metadata {
-                presence "";
-                uses metadata; 
-                
-            }
-            container eth-dst {
-                presence "";
-                uses eth-dst; 
-                
-            }
-            container eth-src {
-                presence "";
-                uses eth-src; 
-                
-            }
-            container eth-type {
-                presence "";
-                uses eth-type; 
-                
-            }
-            container vlan-vid {
-                presence "";
-                uses vlan-vid; 
-                
-            }
-            container vlan-pcp {
-                presence "";
-                uses vlan-pcp; 
-                
-            }
-            container ip-dscp {
-                presence "";
-                uses ip-dscp; 
-                
-            }
-            container ip-ecn {
-                presence "";
-                uses ip-ecn; 
-                
-            }
-            container ip-proto {
-                presence "";
-                uses ip-proto; 
-                
-            }
-            container ipv4-src {
-                presence "";
-                uses ipv4-src; 
-                
-            }
-            container ipv4-dst {
-                presence "";
-                uses ipv4-dst; 
-                
-            }
-            container tcp-src {
-                presence "";
-                uses tcp-src; 
-                
-            }
-            container tcp-dst {
-                presence "";
-                uses tcp-dst; 
-                
-            }
-            container udp-src {
-                presence "";
-                uses udp-src; 
-                
-            }
-            container udp-dst {
-                presence "";
-                uses udp-dst; 
-                
-            }
-            container sctp-src {
-                presence "";
-                uses sctp-src; 
-                
-            }
-            container sctp-dst {
-                presence "";
-                uses sctp-dst; 
-                
-            }
-            container icmpv4-type {
-                presence "";
-                uses icmpv4-type; 
-                
-            }
-            container icmpv4-code {
-                presence "";
-                uses icmpv4-code; 
-                
-            }
-            container arp-op {
-                presence "";
-                uses arp-op; 
-                
-            }
-            container arp-spa {
-                presence "";
-                uses arp-spa; 
-                
-            }
-            container arp-tpa {
-                presence "";
-                uses arp-tpa; 
-                
-            }
-            container arp-sha {
-                presence "";
-                uses arp-sha; 
-                
-            }
-            container arp-tha {
-                presence "";
-                uses arp-tha; 
-                
-            }
-            container ipv6-src {
-                presence "";
-                uses ipv6-src; 
-                
-            }
-            container ipv6-dst {
-                presence "";
-                uses ipv6-dst; 
-                
-            }
-            container ipv6-flabel {
-                presence "";
-                uses ipv6-flabel; 
-                
-            }
-            container icmpv6-type {
-                presence "";
-                uses icmpv6-type; 
-                
-            }
-            container icmpv6-code {
-                presence "";
-                uses icmpv6-code; 
-                
-            }
-            container ipv6-nd-target {
-                presence "";
-                uses ipv6-nd-target; 
-                
-            }
-            container ipv6-nd-sll {
-                presence "";
-                uses ipv6-nd-sll; 
-                
-            }
-            container ipv6-nd-tll {
-                presence "";
-                uses ipv6-nd-tll; 
-                
-            }
-            container mpls-label {
-                presence "";
-                uses mpls-label; 
-                
-            }
-            container mpls-tc {
-                presence "";
-                uses mpls-tc; 
-                
-            }
-            container mpls-bos {
-                presence "";
-                uses mpls-bos; 
-                
-            }
-            container pbb-isid {
-                presence "";
-                uses pbb-isid; 
-                
-            }
-            container tunnel-id {
-                presence "";
-                uses tunnel-id; 
-                
-            }
-            container ipv6-exthdr {
-                presence "";
-                uses ipv6-exthdr; 
-                
-            }
-        }
-        
         container oxm-container {
             uses oxm-fields;
         }
         
         grouping oxm-fields {
             list match-entries {
+                key "oxm-class oxm-match-field has-mask";
                 leaf oxm-class {
                     type identityref {
                         base clazz;
@@ -755,6 +224,60 @@ module openflow-extensible-match {
                         base match-field;
                     }
                 }
+                leaf has-mask {
+                    type boolean;
+                } 
+            }
+        }
+        
+        // OF1.0 structures
+        grouping match-v10-grouping {
+            container match-v10 {
+                leaf wildcards {
+                    type oft:flow-wildcards-v10;
+                }
+                leaf nw-src-mask {
+                    type uint8;
+                }
+                leaf nw-dst-mask {
+                    type uint8;
+                }
+                leaf in-port {
+                    type uint16;
+                }
+                leaf dl-src {
+                    type yang:mac-address;
+                }
+                leaf dl-dst {
+                    type yang:mac-address;
+                }
+                leaf dl-vlan {
+                    type uint16;
+                }
+                leaf dl-vlan-pcp {
+                    type uint8;
+                }
+                leaf dl-type {
+                    type uint16;
+                }
+                leaf nw-tos {
+                    type uint8;
+                }
+                leaf nw-proto {
+                    type uint8;
+                }
+                leaf nw-src {
+                    type inet:ipv4-address;
+                }
+                leaf nw-dst {
+                    type inet:ipv4-address;
+                }
+                leaf tp-src {
+                    type uint16;
+                }
+                leaf tp-dst {
+                    type uint16;
+                }
             }
         }