Augmented nodes wrapped
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-extensible-match.yang
1 module openflow-extensible-match {
2     namespace "urn:opendaylight:openflow:oxm";
3     prefix "oxm";
4
5
6     
7     import ietf-yang-types {prefix yang;}
8     import ietf-inet-types {prefix inet;}
9     import openflow-types {prefix oft;}
10
11
12     revision "2013-07-31" {
13         description "Initial model";
14     }
15
16     identity oxm-match-type {
17         description 
18            "The OpenFlow Extensible Match type must be supported by all OpenFlow
19             switches.";
20         base oft:match-type-base;
21     }
22     
23     // oxm classes
24         identity clazz {
25             description "Base identity for OXM classes";
26         }
27
28
29         identity nxm-0-class {
30             description "Backward compatibility with NXM";
31             base clazz;
32         }
33         identity nxm-1-class {
34             description "Backward compatibility with NXM";
35             base clazz;
36         }
37         identity openflow-basic-class {
38             description "Basic class for OpenFlow";
39             base clazz;
40         }
41         identity experimenter-class {
42             description 
43                 "Marks Experimenter match type class.
44                 All experimenter match classes MUST use this class as a base.";
45             base clazz;
46         }
47
48
49
50     // field types
51         
52         identity match-field {
53             description "Base identity for OXM Fields";
54         }
55
56         identity in_port {
57             base match-field;
58             description "Match for Switch input port.";
59         }
60         identity in_phy_port {
61             base match-field;
62             description "Match for Switch physical input port.";
63         }
64         identity metadata {
65             base match-field;
66             description "Match for Metadata passed between tables.";
67         }
68         identity eth_dst {
69             base match-field;
70             description "Match for Ethernet destination address.";
71         }
72         identity eth_src {
73             base match-field;
74             description "Match for Ethernet source address.";
75         }
76         identity eth_type {
77             base match-field;
78             description "Match for Ethernet frame type.";
79         }
80         identity vlan_vid {
81             base match-field;
82             description "Match for VLAN id.";
83         }
84         identity vlan_pcp {
85             base match-field;
86             description "Match for VLAN priority.";
87         }
88         identity ip_dscp {
89             base match-field;
90             description "Match for IP DSCP (6 bits in ToS field).";
91         }
92         identity ip_ecn {
93             base match-field;
94             description "Match for IP ECN (2 bits in ToS field).";
95         }
96         identity ip_proto {
97             base match-field;
98             description "Match for IP protocol.";
99         }
100         identity ipv4_src {
101             base match-field;
102             description "Match for IPv4 source address.";
103         }
104         identity ipv4_dst {
105             base match-field;
106             description "Match for IPv4 destination address.";
107         }
108         identity tcp_src {
109             base match-field;
110             description "Match for TCP source port.";
111         }
112         identity tcp_dst {
113             base match-field;
114             description "Match for TCP destination port.";
115         }
116         identity udp_src {
117             base match-field;
118             description "Match for UDP source port.";
119         }
120         identity udp_dst {
121             base match-field;
122             description "Match for UDP destination port.";
123         }
124         identity sctp_src {
125             base match-field;
126             description "Match for SCTP source port.";
127         }
128         identity sctp_dst {
129             base match-field;
130             description "Match for SCTP destination port.";
131         }
132         identity icmpv4_type {
133             base match-field;
134             description "Match for ICMP type.";
135         }
136         identity icmpv4_code {
137             base match-field;
138             description "Match for ICMP code.";
139         }
140         identity arp_op {
141             base match-field;
142             description "Match for ARP opcode.";
143         }
144         identity arp_spa {
145             base match-field;
146             description "Match for ARP source IPv4 address.";
147         }
148         identity arp_tpa {
149             base match-field;
150             description "Match for ARP target IPv4 address.";
151         }
152         identity arp_sha {
153             base match-field;
154             description "Match for ARP source hardware address.";
155         }
156         identity arp_tha {
157             base match-field;
158             description "Match for ARP target hardware address.";
159         }
160         identity ipv6_src {
161             base match-field;
162             description "Match for IPv6 source address.";
163         }
164         identity ipv6_dst {
165             base match-field;
166             description "Match for IPv6 destination address.";
167         }
168         identity ipv6_flabel {
169             base match-field;
170             description "Match for IPv6 Flow Label";
171         }
172         identity icmpv6_type {
173             base match-field;
174             description "Match for ICMPv6 type.";
175         }
176         identity icmpv6_code {
177             base match-field;
178             description "Match for ICMPv6 code.";
179         }
180         identity ipv6_nd_target {
181             base match-field;
182             description "Match for Target address for ND.";
183         }
184         identity ipv6_nd_sll {
185             base match-field;
186             description "Match for Source link-layer for ND.";
187         }
188         identity ipv6_nd_tll {
189             base match-field;
190             description "Match for Target link-layer for ND.";
191         }
192         identity mpls_label {
193             base match-field;
194             description "Match for MPLS label.";
195         }
196         identity mpls_tc {
197             base match-field;
198             description "Match for MPLS TC.";
199         }
200         identity mpls_bos {
201             base match-field;
202             description "Match for MPLS BoS bit.";
203         }
204         identity pbb_isid {
205             base match-field;
206             description "Match for PBB I-SID.";
207         }
208         identity tunnel_id {
209             base match-field;
210             description "Match for Logical Port Metadata";
211         }
212         identity ipv6_exthdr {
213             base match-field;
214             description "Match for IPv6 Extension Header pseudo-field";
215         }
216         
217     // Abstract definitions of fields structure
218
219         grouping in-port {
220             description 
221                 "Ingress port. Numerical representation of incoming port, starting at 1. This may be a physical or switch-defined logical port.";
222             leaf port-number {
223                 type oft:port-number;
224             }
225         }
226         grouping in-phy-port {
227             description "Physical port. In ofp_packet_in messages, underlying physical port when packet received on a logical port.";
228             leaf port-number {
229                 type oft:port-number;
230             }
231         }
232         grouping metadata {
233             description "Metadata passed between tables.";
234             leaf value {
235                 type oft:metadata;
236             }
237             leaf mask {
238                 type oft:metadata;
239             }
240         }
241         grouping eth-dst {
242             description "Ethernet destination address.";
243             leaf address {
244                 type yang:mac-address;
245             }
246             leaf mask {
247                 type binary;
248             }
249         }
250         grouping eth-src {
251             description "Ethernet source address.";
252             leaf address {
253                 type yang:mac-address;
254             }
255             leaf mask {
256                 type binary;
257             }
258         }
259         grouping eth-type {
260             description "Ethernet frame type.";
261             leaf type {
262                 type oft:ether-type; // Needs to define that as general model
263             }
264         }
265         grouping vlan-vid {
266             description "VLAN id.";
267             leaf vlan-id {
268                 type uint16; // TODO: Define proper vlan id type.
269             }
270             leaf mask {
271                 type binary;
272             }
273         }
274         grouping vlan-pcp {
275             description "VLAN priority.";
276             leaf vlan-pcp {
277                 type uint8; // TODO: Define PCP type
278             }
279         }
280         grouping ip-dscp {
281             description "IP DSCP (6 bits in ToS field).";
282
283             leaf dscp {
284                 type inet:dscp; // TODO: Define DSCP type
285             }
286         }
287         grouping ip-ecn {
288             description "IP ECN (2 bits in ToS field).";
289             leaf ecn {
290                 type uint8; // TODO define ECN
291             }
292         }
293         grouping ip-proto {
294             description "IP protocol.";
295             leaf protocol-number {
296                 type uint8; // TODO define IP protocol number
297             }
298         }
299         grouping ipv4-src {
300             description "IPv4 source address.";
301             leaf prefix {
302                 type inet:ipv4-prefix;
303             }
304         }
305         grouping ipv4-dst {
306             description "IPv4 destination address.";
307             leaf prefix {
308                 type inet:ipv4-prefix;
309             }
310         }
311         grouping tcp-src {
312             description "TCP source port.";
313             leaf port {
314                 type inet:port-number;
315             }
316         }
317         grouping tcp-dst {
318             description "TCP destination port.";
319                     leaf port {
320                 type inet:port-number;
321             }
322         }
323         grouping udp-src {
324             description "UDP source port.";
325             leaf port {
326                 type inet:port-number;
327             }
328         }
329         grouping udp-dst {
330             description "UDP destination port.";
331             leaf port {
332                 type inet:port-number;
333             }
334         }
335         grouping sctp-src {
336             description "SCTP source port.";
337             leaf port {
338                 type inet:port-number;
339             }
340         }
341         grouping sctp-dst {
342             description "SCTP destination port.";
343             leaf port {
344                 type inet:port-number;
345             }
346         }
347         grouping icmpv4-type {
348             description "ICMP type.";
349             leaf type {
350                 type uint8; // Define ICMP Type
351             }
352         }
353         grouping icmpv4-code {
354             description "ICMP code.";
355             leaf code {
356                 type uint8; // Define ICMP Code
357             }
358         }
359         grouping arp-op {
360             description "ARP opcode.";
361             leaf op-code {
362                 type uint16;
363             }
364         }
365         grouping arp-spa {
366             description "ARP source IPv4 address.";
367             leaf prefix {
368                 type inet:ipv4-prefix;
369             }
370         }
371         grouping arp-tpa {
372             description "ARP target IPv4 address.";
373             leaf prefix {
374                 type inet:ipv4-prefix;
375             }
376         }
377         grouping arp-sha {
378             description "ARP source hardware address.";
379             leaf address {
380                 type yang:mac-address;
381             }
382             leaf mask {
383                 type binary;
384             }
385         }
386         grouping arp-tha {
387             description "ARP target hardware address.";
388             leaf address {
389                 type yang:mac-address;
390             }
391             leaf mask {
392                 type binary;
393             }
394         }
395         grouping ipv6-src {
396             description "IPv6 source address.";
397             leaf prefix {
398                 type inet:ipv6-prefix;
399             }
400         }
401         grouping ipv6-dst {
402             description "IPv6 destination address.";
403             leaf prefix {
404                 type inet:ipv6-prefix;
405             }
406         }
407         grouping ipv6-flabel {
408             description "IPv6 Flow Label";
409             leaf label {
410                 type inet:ipv6-flow-label;
411             }
412         }
413         grouping icmpv6-type {
414             description "ICMPv6 type.";
415             leaf type {
416                 type uint8;
417             }
418         }
419         grouping icmpv6-code {
420             description "ICMPv6 code.";
421             leaf code {
422                 type uint8;
423             }
424         }
425         grouping ipv6-nd-target {
426             description "Target address for ND.";
427             leaf address {
428                 type inet:ipv6-address;
429             }
430         }
431         grouping ipv6-nd-sll {
432             description "Source link-layer for ND.";
433             leaf address {
434                 type yang:mac-address;
435             }
436         }
437         grouping ipv6-nd-tll {
438             description "Target link-layer for ND.";
439             leaf address {
440                 type yang:mac-address;
441             }
442         }
443         grouping mpls-label {
444             description "MPLS label.";
445             leaf label {
446                 type uint32; // TODO define type
447             }
448         }
449         grouping mpls-tc {
450             description "MPLS TC.";
451             leaf tc {
452                 type uint8;
453             }
454         }
455         grouping mpls-bos {
456             description "MPLS BoS bit.";
457             leaf bos {
458                 type boolean;
459             }
460         }
461         grouping pbb-isid {
462             description "PBB I-SID.";
463             leaf isid {
464                 type uint32;
465             }
466             leaf mask {
467                 type binary;
468             }
469         }
470         grouping tunnel-id {
471             description "Logical Port Metadata.";
472             leaf value {
473                 type oft:metadata; 
474             }
475             leaf mask {
476                 type oft:metadata;
477             }
478         }
479         grouping ipv6-exthdr {
480             description "IPv6 Extension Header pseudo-field";
481             leaf pseudo-field {
482                 type bits {
483                     bit nonext {
484                         description "<No next header> encountered.";
485                         position 0;
486                     }
487                     bit esp {
488                         description "Encrypted Sec Payload header present.";
489                         position 1;
490                     }
491                     bit auth {
492                         description "Authentication header present.";
493                         position 2;
494                     }
495                     bit dest {
496                         description "1 or 2 dest headers present.";
497                         position 3;
498                     }
499                     bit frag {
500                         description "Fragment header present.";
501                         position 4;
502                     }
503                     bit router {
504                         description "Router header present.";
505                         position 5;
506                     }
507                     bit hop {
508                         description "Hop-by-hop header present.";
509                         position 6;
510                     }
511                     bit unrep {
512                         description "Unexpected repeats encountered.";
513                         position 7;
514                     }
515                     bit unseq {
516                         description "Unexpected sequencing encountered.";
517                         position 8;
518                         }                    
519                 }
520             }
521             leaf mask {
522                 type binary;
523             }
524         }
525
526     /* Basic Match Fields : 
527        - Maybe it will be better to split into several groupings
528          based on protocol types:
529              - L2 match
530              - L3 match
531                 - IPv4 match
532                 - IPv6 match
533              - L4 match
534              - ARP match
535              etc...
536         Maybe this works belongs to other module.
537     */
538
539         grouping basic-match-fields {
540             container in-port {
541                 presence "";
542                 uses in-port; 
543
544             }
545             container in-phy-port {
546                 presence "";
547                 uses in-phy-port; 
548                 
549             }
550             container metadata {
551                 presence "";
552                 uses metadata; 
553                 
554             }
555             container eth-dst {
556                 presence "";
557                 uses eth-dst; 
558                 
559             }
560             container eth-src {
561                 presence "";
562                 uses eth-src; 
563                 
564             }
565             container eth-type {
566                 presence "";
567                 uses eth-type; 
568                 
569             }
570             container vlan-vid {
571                 presence "";
572                 uses vlan-vid; 
573                 
574             }
575             container vlan-pcp {
576                 presence "";
577                 uses vlan-pcp; 
578                 
579             }
580             container ip-dscp {
581                 presence "";
582                 uses ip-dscp; 
583                 
584             }
585             container ip-ecn {
586                 presence "";
587                 uses ip-ecn; 
588                 
589             }
590             container ip-proto {
591                 presence "";
592                 uses ip-proto; 
593                 
594             }
595             container ipv4-src {
596                 presence "";
597                 uses ipv4-src; 
598                 
599             }
600             container ipv4-dst {
601                 presence "";
602                 uses ipv4-dst; 
603                 
604             }
605             container tcp-src {
606                 presence "";
607                 uses tcp-src; 
608                 
609             }
610             container tcp-dst {
611                 presence "";
612                 uses tcp-dst; 
613                 
614             }
615             container udp-src {
616                 presence "";
617                 uses udp-src; 
618                 
619             }
620             container udp-dst {
621                 presence "";
622                 uses udp-dst; 
623                 
624             }
625             container sctp-src {
626                 presence "";
627                 uses sctp-src; 
628                 
629             }
630             container sctp-dst {
631                 presence "";
632                 uses sctp-dst; 
633                 
634             }
635             container icmpv4-type {
636                 presence "";
637                 uses icmpv4-type; 
638                 
639             }
640             container icmpv4-code {
641                 presence "";
642                 uses icmpv4-code; 
643                 
644             }
645             container arp-op {
646                 presence "";
647                 uses arp-op; 
648                 
649             }
650             container arp-spa {
651                 presence "";
652                 uses arp-spa; 
653                 
654             }
655             container arp-tpa {
656                 presence "";
657                 uses arp-tpa; 
658                 
659             }
660             container arp-sha {
661                 presence "";
662                 uses arp-sha; 
663                 
664             }
665             container arp-tha {
666                 presence "";
667                 uses arp-tha; 
668                 
669             }
670             container ipv6-src {
671                 presence "";
672                 uses ipv6-src; 
673                 
674             }
675             container ipv6-dst {
676                 presence "";
677                 uses ipv6-dst; 
678                 
679             }
680             container ipv6-flabel {
681                 presence "";
682                 uses ipv6-flabel; 
683                 
684             }
685             container icmpv6-type {
686                 presence "";
687                 uses icmpv6-type; 
688                 
689             }
690             container icmpv6-code {
691                 presence "";
692                 uses icmpv6-code; 
693                 
694             }
695             container ipv6-nd-target {
696                 presence "";
697                 uses ipv6-nd-target; 
698                 
699             }
700             container ipv6-nd-sll {
701                 presence "";
702                 uses ipv6-nd-sll; 
703                 
704             }
705             container ipv6-nd-tll {
706                 presence "";
707                 uses ipv6-nd-tll; 
708                 
709             }
710             container mpls-label {
711                 presence "";
712                 uses mpls-label; 
713                 
714             }
715             container mpls-tc {
716                 presence "";
717                 uses mpls-tc; 
718                 
719             }
720             container mpls-bos {
721                 presence "";
722                 uses mpls-bos; 
723                 
724             }
725             container pbb-isid {
726                 presence "";
727                 uses pbb-isid; 
728                 
729             }
730             container tunnel-id {
731                 presence "";
732                 uses tunnel-id; 
733                 
734             }
735             container ipv6-exthdr {
736                 presence "";
737                 uses ipv6-exthdr; 
738                 
739             }
740         }
741         
742         container oxm-container {
743             uses oxm-fields;
744         }
745         
746         grouping oxm-fields {
747             list match-entries {
748                 leaf oxm-class {
749                     type identityref {
750                         base clazz;
751                     }
752                 }
753                 leaf oxm-match-field {
754                     type identityref {
755                         base match-field;
756                     }
757                 }
758             }
759         }
760         
761 }