Merge "Strong password check to consider underscore as a special character"
[controller.git] / opendaylight / md-sal / model / model-flow-base / src / main / yang / match-types.yang
1 module opendaylight-match-types {
2     namespace "urn:opendaylight:model:match:types";
3     prefix "match";
4
5     import ietf-inet-types {prefix inet;}
6     import ietf-yang-types {prefix yang;}
7     import opendaylight-l2-types {prefix l2t;}
8
9     revision "2013-08-19" {
10         description "Initial revision of flow service";
11     }
12
13     grouping "mac-address-filter" {
14         leaf address {
15             mandatory true;
16             type yang:mac-address;
17         }
18         leaf mask {
19             type binary;
20         }
21     }
22
23      /** Match Groupings **/
24     grouping "ethernet-match-fields" {
25         container ethernet-source {
26             description "Ethernet source address.";
27             presence "Match field is active and set";
28             uses mac-address-filter;
29         }
30         container ethernet-destination {
31             description "Ethernet destination address.";
32             presence "Match field is active and set";
33             uses mac-address-filter;
34         }
35         container ethernet-type {
36             description "Ethernet frame type.";
37             presence "Match field is active and set";
38             
39             leaf type {
40                 mandatory true;
41                 type l2t:ether-type; // Needs to define that as general model
42             }
43             leaf mask {
44                 type binary;
45             }
46         }
47     }
48
49     grouping "vlan-match-fields" {
50         container vlan-id {
51             description "VLAN id.";
52             presence "Match field is active and set";
53             
54             leaf vlan-id {
55                 mandatory true;
56                 type l2t:vlan-id; 
57             }
58             leaf mask {
59                 type binary;
60             }
61         }
62         leaf vlan-pcp {
63             description "VLAN priority.";
64             type l2t:vlan-pcp;
65         }
66     }
67
68     grouping "ip-match-fields" {
69         leaf ip-protocol {
70                 description "IP protocol.";
71                 type uint8; 
72         }
73
74         leaf ip-dscp {
75             description "IP DSCP (6 bits in ToS field).";
76             type inet:dscp; 
77         }
78         leaf ip-ecn {
79             description "IP ECN (2 bits in ToS field).";
80             type uint8; 
81         }
82     }
83
84     grouping "ipv4-match-fields" {
85         leaf ipv4-source {
86             description "IPv4 source address.";
87             type inet:ipv4-prefix;
88         }
89         leaf ipv4-destination {
90             description "IPv4 destination address.";
91             type inet:ipv4-prefix;
92         }
93     }
94
95     grouping "ipv6-match-fields" {
96         leaf ipv6-source {
97             description "IPv6 source address.";
98             type inet:ipv6-prefix;
99         }
100         leaf ipv6-destination {
101             description "IPv6 destination address.";
102             type inet:ipv6-prefix;
103         }
104     }
105
106     grouping "udp-match-fields" {
107         leaf udp-source-port {
108             description "UDP source port.";
109             type inet:port-number;
110         }
111         leaf udp-destination-port {
112             description "UDP destination port.";
113                 type inet:port-number;
114         }
115     }
116
117     grouping "tcp-match-fields" {
118         leaf tcp-source-port {
119             description "TCP source port.";
120             type inet:port-number;
121         }
122         leaf tcp-destination-port {
123             description "TCP destination port.";
124             type inet:port-number;
125         }
126     }
127
128     grouping "sctp-match-fields" {
129         leaf sctp-source-port {
130             description "SCTP source port.";
131             type inet:port-number;
132         }
133         leaf sctp-destination-port {
134             description "SCTP destination port.";
135             type inet:port-number;
136         }
137     }
138
139     grouping "icmpv4-match-fields" {
140         leaf icmpv4-type {
141         description "ICMP type.";
142             type uint8; // Define ICMP Type
143         }
144         description "ICMP code.";
145         leaf icmpv4-code {
146             type uint8; // Define ICMP Code
147         }
148     }
149
150     grouping "arp-match-fields" {
151         leaf arp-source-transport-address {
152             description "ARP source IPv4 address.";
153             type inet:ipv4-prefix;
154         }
155     
156         leaf arp-target-transport-address {
157             description "ARP target IPv4 address.";
158             type inet:ipv4-prefix;
159         }
160         container arp-source-hardware-address {
161             description "ARP source hardware address.";
162             presence "Match field is active and set";
163         uses mac-address-filter;
164         }
165         container arp-target-hardware-address {
166             description "ARP target hardware address.";
167             presence "Match field is active and set";
168         uses mac-address-filter;
169         }
170     }
171
172     grouping action {
173         choice action {
174             case output-action {
175                 leaf-list output-node-connector {
176                     type string;
177                 }
178             }
179
180             case controller-action {
181                 leaf max-length {
182                     type uint16 {
183                         range "0..65294";
184                     }
185                 }
186             }
187
188             case set-queue-action {
189                 leaf queue {
190                     type string; // TODO: define queues
191                 }
192             }
193
194             case pop-mpls-action {
195                 container pop-mpls {
196                     leaf ethernet-type {
197                         type uint16; // TODO: define ethertype type
198                     }
199                 }
200             }
201
202             case set-mpls-ttl-action {
203                 leaf mpls-ttl {
204                     type uint8;
205                 }
206             }
207
208             case set-nw-ttl-action {
209                 leaf nw-ttl {
210                     type uint8;
211                 }
212             }
213
214             case push-pbb-action {
215
216             }
217
218             case push-mpls-action {
219
220             }
221
222             case push-vlan-action {
223
224             }
225         }
226     }
227
228
229     grouping match {
230         container "ethernet-match" {
231             uses "ethernet-match-fields";
232         }
233         container "vlan-match" {
234             uses "vlan-match-fields";
235         }
236         container "ip-match" {
237             uses "ip-match-fields";
238         }
239         
240         choice layer-3-match {
241             case "ipv4-match" {
242                 uses "ipv4-match-fields";
243             }
244             case "ipv6-match" {
245                 uses "ipv6-match-fields";
246             }
247             case "arp-match" {
248                 uses "arp-match-fields";
249             }
250         }
251         
252         choice layer-4-match {
253             case "udp-match" {
254                 uses "udp-match-fields";
255             }
256             case "tcp-match" {
257                 uses "tcp-match-fields";
258             }
259             case "sctp-match" {
260                 uses "sctp-match-fields";
261             }
262         }
263         container "icmpv4-match" {
264             uses "icmpv4-match-fields";
265         }
266     }
267 }