Add method to register listener for unknown msg
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-extensible-match.yang
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9  module openflow-extensible-match {
10     namespace "urn:opendaylight:openflow:oxm";
11     prefix "oxm";
12
13     import ietf-yang-types {prefix yang;}
14     import ietf-inet-types {prefix inet;}
15     import openflow-types {prefix oft;}
16
17     revision "2015-02-25" {
18         description "#NOT_PUBLISHED# OpenFlow 1.3 - match model";
19     }
20
21     identity oxm-match-type {
22         description
23            "The OpenFlow Extensible Match type must be supported by all OpenFlow
24             switches.";
25         base oft:match-type-base;
26     }
27
28     // oxm classes
29     identity oxm-class-base {
30         description "Base identity for OXM classes";
31     }
32
33     identity nxm-0-class {
34         description "Match class for backward compatibility with NXM";
35         base oxm-class-base;
36     }
37     identity nxm-1-class {
38         description "Match class for backward compatibility with NXM";
39         base oxm-class-base;
40     }
41     identity openflow-basic-class {
42         description "Basic class for OpenFlow";
43         base oxm-class-base;
44     }
45     identity experimenter-class {
46         description
47             "Marks Experimenter match type class.
48             All experimenter match classes MUST use this class as a base.";
49         base oxm-class-base;
50     }
51
52     // match-field types
53     identity match-field {
54         description "Base identity for OXM Fields";
55     }
56
57     identity in_port {
58         base match-field;
59         description "OXM field for Switch input port.";
60     }
61     identity in_phy_port {
62         base match-field;
63         description "OXM field for Switch physical input port.";
64     }
65     identity metadata {
66         base match-field;
67         description "OXM field for Metadata passed between tables.";
68     }
69     identity eth_dst {
70         base match-field;
71         description "OXM field for Ethernet destination address.";
72     }
73     identity eth_src {
74         base match-field;
75         description "OXM field for Ethernet source address.";
76     }
77     identity eth_type {
78         base match-field;
79         description "OXM field for Ethernet frame type.";
80     }
81     identity vlan_vid {
82         base match-field;
83         description "OXM field for VLAN id.";
84     }
85     identity vlan_pcp {
86         base match-field;
87         description "OXM field for VLAN priority.";
88     }
89     identity ip_dscp {
90         base match-field;
91         description "OXM field for IP DSCP (6 bits in ToS field).";
92     }
93     identity ip_ecn {
94         base match-field;
95         description "OXM field for IP ECN (2 bits in ToS field).";
96     }
97     identity ip_proto {
98         base match-field;
99         description "OXM field for IP protocol.";
100     }
101     identity ipv4_src {
102         base match-field;
103         description "OXM field for IPv4 source address.";
104     }
105     identity ipv4_dst {
106         base match-field;
107         description "OXM field for IPv4 destination address.";
108     }
109     identity tcp_src {
110         base match-field;
111         description "OXM field for TCP source port.";
112     }
113     identity tcp_dst {
114         base match-field;
115         description "OXM field for TCP destination port.";
116     }
117     identity udp_src {
118         base match-field;
119         description "OXM field for UDP source port.";
120     }
121     identity udp_dst {
122         base match-field;
123         description "OXM field for UDP destination port.";
124     }
125     identity sctp_src {
126         base match-field;
127         description "OXM field for SCTP source port.";
128     }
129     identity sctp_dst {
130         base match-field;
131         description "OXM field for SCTP destination port.";
132     }
133     identity icmpv4_type {
134         base match-field;
135         description "OXM field for ICMP type.";
136     }
137     identity icmpv4_code {
138         base match-field;
139         description "OXM field for ICMP code.";
140     }
141     identity arp_op {
142         base match-field;
143         description "OXM field for ARP opcode.";
144     }
145     identity arp_spa {
146         base match-field;
147         description "OXM field for ARP source IPv4 address.";
148     }
149     identity arp_tpa {
150         base match-field;
151         description "OXM field for ARP target IPv4 address.";
152     }
153     identity arp_sha {
154         base match-field;
155         description "OXM field for ARP source hardware address.";
156     }
157     identity arp_tha {
158         base match-field;
159         description "OXM field for ARP target hardware address.";
160     }
161     identity ipv6_src {
162         base match-field;
163         description "OXM field for IPv6 source address.";
164     }
165     identity ipv6_dst {
166         base match-field;
167         description "OXM field for IPv6 destination address.";
168     }
169     identity ipv6_flabel {
170         base match-field;
171         description "OXM field for IPv6 Flow Label";
172     }
173     identity icmpv6_type {
174         base match-field;
175         description "OXM field for ICMPv6 type.";
176     }
177     identity icmpv6_code {
178         base match-field;
179         description "OXM field for ICMPv6 code.";
180     }
181     identity ipv6_nd_target {
182         base match-field;
183         description "OXM field for Target address for ND.";
184     }
185     identity ipv6_nd_sll {
186         base match-field;
187         description "OXM field for Source link-layer for ND.";
188     }
189     identity ipv6_nd_tll {
190         base match-field;
191         description "OXM field for Target link-layer for ND.";
192     }
193     identity mpls_label {
194         base match-field;
195         description "OXM field for MPLS label.";
196     }
197     identity mpls_tc {
198         base match-field;
199         description "OXM field for MPLS TC.";
200     }
201     identity mpls_bos {
202         base match-field;
203         description "OXM field for MPLS BoS bit.";
204     }
205     identity pbb_isid {
206         base match-field;
207         description "OXM field for PBB I-SID.";
208     }
209     identity tunnel_id {
210         base match-field;
211         description "OXM field for Logical Port Metadata";
212     }
213     identity ipv6_exthdr {
214         base match-field;
215         description "OXM field for IPv6 Extension Header pseudo-field";
216     }
217
218     grouping match-grouping {
219         container match {
220             description "Match structure (OF v1.3)";
221             leaf type {
222                 type identityref {
223                     base oft:match-type-base;
224                 }
225             }
226             uses match-entries-grouping;
227         }
228     }
229
230     grouping match-entries-grouping {
231         list match-entry {
232             config false;
233             uses match-entry-fields-grouping;
234             uses match-entry-value-grouping;
235         }
236     }
237
238     grouping match-entry-fields-grouping {
239         leaf oxm-class {
240             type identityref {
241                 base oxm-class-base;
242             }
243         }
244         leaf oxm-match-field {
245             type identityref {
246                 base match-field;
247             }
248         }
249         leaf has-mask {
250             type boolean;
251         }
252     }
253
254     container oxm-container {
255         uses match-entry-value-grouping;
256     }
257
258     grouping match-entry-value-grouping {
259         choice match-entry-value {
260             case in-port-case {
261                 container in-port {
262                     leaf port-number {
263                         type oft:port-number;
264                     }
265                 }
266             }
267             case in-phy-port-case {
268                 container in-phy-port {
269                     leaf port-number {
270                         type oft:port-number;
271                     }
272                 }
273             }
274             case metadata-case {
275                 container metadata {
276                     leaf metadata {
277                         type binary;
278                     }
279                     leaf mask {
280                         type binary;
281                     }
282                 }
283             }
284             case eth-src-case {
285                 container eth-src {
286                     leaf mac-address {
287                         type yang:mac-address;
288                     }
289                     leaf mask {
290                         type binary;
291                     }
292                 }
293             }
294             case eth-dst-case {
295                 container eth-dst {
296                     leaf mac-address {
297                         type yang:mac-address;
298                     }
299                     leaf mask {
300                         type binary;
301                     }
302                 }
303             }
304             case eth-type-case {
305                 container eth-type {
306                     leaf eth-type {
307                         type oft:ether-type;
308                     }
309                 }
310             }
311             case vlan-vid-case {
312                 container vlan-vid {
313                     leaf vlan-vid {
314                         type uint16;
315                     }
316                     leaf cfi-bit {
317                         type boolean;
318                     }
319                     leaf mask {
320                         type binary;
321                     }
322                 }
323             }
324             case vlan-pcp-case {
325                 container vlan-pcp {
326                     leaf vlan-pcp {
327                         type uint8;
328                     }
329                 }
330             }
331             case ip-dscp-case {
332                 container ip-dscp {
333                     leaf dscp {
334                         type inet:dscp;
335                     }
336                 }
337             }
338             case ip-ecn-case {
339                 container ip-ecn {
340                     leaf ecn {
341                         type uint8;
342                     }
343                 }
344             }
345             case ip-proto-case {
346                 container ip-proto {
347                     leaf protocol-number {
348                         type uint8;
349                     }
350                 }
351             }
352             case ipv4-src-case {
353                 container ipv4-src {
354                     leaf ipv4-address {
355                         type inet:ipv4-address;
356                     }
357                     leaf mask {
358                         type binary;
359                     }
360                 }
361             }
362             case ipv4-dst-case {
363                 container ipv4-dst {
364                     leaf ipv4-address {
365                         type inet:ipv4-address;
366                     }
367                     leaf mask {
368                         type binary;
369                     }
370                 }
371             }
372             case tcp-src-case {
373                 container tcp-src {
374                     leaf port {
375                         type inet:port-number;
376                     }
377                 }
378             }
379             case tcp-dst-case {
380                 container tcp-dst {
381                     leaf port {
382                         type inet:port-number;
383                     }
384                 }
385             }
386             case udp-src-case {
387                 container udp-src {
388                     leaf port {
389                         type inet:port-number;
390                     }
391                 }
392             }
393             case udp-dst-case {
394                 container udp-dst {
395                     leaf port {
396                         type inet:port-number;
397                     }
398                 }
399             }
400             case sctp-src-case {
401                 container sctp-src {
402                     leaf port {
403                         type inet:port-number;
404                     }
405                 }
406             }
407             case sctp-dst-case {
408                 container sctp-dst {
409                     leaf port {
410                         type inet:port-number;
411                     }
412                 }
413             }
414             case icmpv4-type-case {
415                 container icmpv4-type {
416                     leaf icmpv4-type {
417                         type uint8;
418                     }
419                 }
420             }
421             case icmpv4-code-case {
422                 container icmpv4-code {
423                     leaf icmpv4-code {
424                         type uint8;
425                     }
426                 }
427             }
428             case arp-op-case {
429                 container arp-op {
430                     leaf op-code {
431                         type uint16;
432                     }
433                 }
434             }
435             case arp-spa-case {
436                 container arp-spa {
437                     leaf ipv4-address {
438                         type inet:ipv4-address;
439                     }
440                     leaf mask {
441                         type binary;
442                     }
443                 }
444             }
445             case arp-tpa-case {
446                 container arp-tpa {
447                     leaf ipv4-address {
448                         type inet:ipv4-address;
449                     }
450                     leaf mask {
451                         type binary;
452                     }
453                 }
454             }
455             case arp-sha-case {
456                 container arp-sha {
457                     leaf mac-address {
458                         type yang:mac-address;
459                     }
460                     leaf mask {
461                         type binary;
462                     }
463                 }
464             }
465             case arp-tha-case {
466                 container arp-tha {
467                     leaf mac-address {
468                         type yang:mac-address;
469                     }
470                     leaf mask {
471                         type binary;
472                     }
473                 }
474             }
475             case ipv6-src-case {
476                 container ipv6-src {
477                     leaf ipv6-address {
478                         type inet:ipv6-address;
479                     }
480                     leaf mask {
481                         type binary;
482                     }
483                 }
484             }
485             case ipv6-dst-case {
486                 container ipv6-dst {
487                     leaf ipv6-address {
488                         type inet:ipv6-address;
489                     }
490                     leaf mask {
491                         type binary;
492                     }
493                 }
494             }
495             case ipv6-flabel-case {
496                 container ipv6-flabel {
497                     leaf ipv6-flabel {
498                         type inet:ipv6-flow-label;
499                     }
500                     leaf mask {
501                         type binary;
502                     }
503                 }
504             }
505             case icmpv6-type-case {
506                 container icmpv6-type {
507                     leaf icmpv6-type {
508                         type uint8;
509                     }
510                 }
511             }
512             case icmpv6-code-case {
513                 container icmpv6-code {
514                     leaf icmpv6-code {
515                          type uint8;
516                      }
517                 }
518             }
519             case ipv6-nd-target-case {
520                 container ipv6-nd-target {
521                     leaf ipv6-address {
522                         type inet:ipv6-address;
523                     }
524                 }
525             }
526             case ipv6-nd-sll-case {
527                 container ipv6-nd-sll {
528                     leaf mac-address {
529                         type yang:mac-address;
530                     }
531                 }
532             }
533             case ipv6-nd-tll-case {
534                 container ipv6-nd-tll {
535                     leaf mac-address {
536                         type yang:mac-address;
537                     }
538                 }
539             }
540             case mpls-label-case {
541                 container mpls-label {
542                     leaf mpls-label {
543                         type uint32;
544                     }
545                 }
546             }
547             case mpls-tc-case {
548                 container mpls-tc {
549                     leaf tc {
550                         type uint8;
551                     }
552                 }
553             }
554             case mpls-bos-case {
555                 container mpls-bos {
556                     leaf bos {
557                         type boolean;
558                     }
559                 }
560             }
561             case pbb-isid-case {
562                 container pbb-isid {
563                     leaf isid {
564                         type uint32;
565                     }
566                     leaf mask {
567                         type binary;
568                     }
569                 }
570             }
571             case tunnel-id-case {
572                 container tunnel-id {
573                     leaf tunnel-id {
574                         type binary;
575                     }
576                     leaf mask {
577                         type binary;
578                     }
579                 }
580             }
581             case ipv6-exthdr-case {
582                 container ipv6-exthdr {
583                     leaf pseudo-field {
584                         type oft:ipv6-exthdr-flags;
585                     }
586                     leaf mask {
587                         type binary;
588                     }
589                 }
590             }
591         }
592     }
593
594     // OF1.0 structures
595     grouping match-v10-grouping {
596         container match-v10 {
597             description "OF v1.0 match structure";
598             leaf wildcards {
599                 description "Wildcard fields (only flags).";
600                 type oft:flow-wildcards-v10;
601             }
602             leaf nw-src-mask {
603                 description "IP source address mask (definition differs from OF v1.0.0 spec to ease
604                  understanding, library does the transformation into OF v1.0 spec correct data)";
605                 type uint8;
606             }
607             leaf nw-dst-mask {
608                 description "IP destination address mask (definition differs from OF v1.0.0 spec to ease
609                  understanding, library does the transformation into OF v1.0 spec correct data)";
610                 type uint8;
611             }
612             leaf in-port {
613             description "Input switch port.";
614                 type uint16;
615             }
616             leaf dl-src {
617                 description "Ethernet source address.";
618                 type yang:mac-address;
619             }
620             leaf dl-dst {
621                 description "Ethernet destination address.";
622                 type yang:mac-address;
623             }
624             leaf dl-vlan {
625                 description "Input VLAN id.";
626                 type uint16;
627             }
628             leaf dl-vlan-pcp {
629                 description "Input VLAN priority.";
630                 type uint8;
631             }
632             leaf dl-type {
633                 description "Ethernet frame type.";
634                 type uint16;
635             }
636             leaf nw-tos {
637                 description "IP ToS (actually DSCP field, 6 bits).";
638                 type uint8;
639             }
640             leaf nw-proto {
641                 description "IP protocol or lower 8 bits of ARP opcode.";
642                 type uint8;
643             }
644             leaf nw-src {
645                 description "IP source address.";
646                 type inet:ipv4-address;
647             }
648             leaf nw-dst {
649                 description "IP destination address.";
650                 type inet:ipv4-address;
651             }
652             leaf tp-src {
653                 description "TCP/UDP source port.";
654                 type uint16;
655             }
656             leaf tp-dst {
657                 description "TCP/UDP destination port.";
658                 type uint16;
659             }
660         }
661     }
662 }