0a1abe1605ade38b292f84c0d0fd3812a7fa79ba
[packetcable.git] / packetcable-model / src / main / yang / packetcable-match-types.yang
1 module packetcable-match-types
2 {
3     namespace "urn:opendaylight:model:match:types";
4     prefix "match";
5
6     import ietf-inet-types {prefix inet; }
7
8     revision "2014-01-20" {
9         description "Initial revision of packetcable match types";
10     }        
11     
12
13     grouping "ip-match-fields" {
14         leaf ip-protocol {
15             description "IP protocol.";
16             type uint8;
17         }
18
19         leaf ip-dscp {
20             description "IP DSCP (6 bits in ToS field).";
21             type inet:dscp;
22         }
23
24         leaf ip-ecn {
25             description "IP ECN (2 bits in ToS field).";
26             type uint8;
27         }
28
29         leaf ip-proto {
30             description "IP Proto (IPv4 or IPv6 Protocol Number).";
31             type inet:ip-version;
32         }
33     }
34
35     grouping "ipv4-match-fields" {
36         leaf ipv4-source {
37             description "IPv4 source address.";
38             type inet:ipv4-prefix;
39         }
40
41         leaf ipv4-destination {
42             description "IPv4 destination address.";
43             type inet:ipv4-prefix;
44         }
45
46     }
47
48     grouping "ipv6-match-fields" {
49         leaf ipv6-source {
50             description "IPv6 source address.";
51             type inet:ipv6-prefix;
52         }
53
54         leaf ipv6-destination {
55             description "IPv6 destination address.";
56             type inet:ipv6-prefix;
57         }
58
59         leaf ipv6-nd-target {
60             description "IPv6 target address for neighbour discovery message";
61             type inet:ipv6-address;
62         }
63
64         container "ipv6-label" {
65             leaf ipv6-flabel {
66                 type inet:ipv6-flow-label;
67             }
68
69             leaf flabel-mask {
70                 type binary;
71             }
72         }
73
74         leaf ipv6-exthdr {
75             description "IPv6 Extension Header field";
76             type uint16;
77         }
78     }
79
80
81     grouping "udp-match-fields" {
82         leaf udp-source-port {
83             description "UDP source port.";
84             type inet:port-number;
85         }
86         leaf udp-destination-port {
87             description "UDP destination port.";
88             type inet:port-number;
89         }
90     }
91
92     grouping "tcp-match-fields" {
93         leaf tcp-source-port {
94             description "TCP source port.";
95             type inet:port-number;
96         }
97         leaf tcp-destination-port {
98             description "TCP destination port.";
99             type inet:port-number;
100         }
101     }
102
103     grouping "udp-match-ranges" {
104         leaf udp-source-port-start {
105             description "UDP source port start.";
106             type inet:port-number;
107         }
108         leaf udp-source-port-end {
109             description "UDP source port end.";
110             type inet:port-number;
111         }
112         leaf udp-destination-port-start {
113             description "UDP destination port start.";
114             type inet:port-number;
115         }
116         leaf udp-destination-port-end {
117             description "UDP destination port end.";
118             type inet:port-number;
119         }
120     }
121
122     grouping "tcp-match-ranges" {
123         leaf tcp-source-port-start {
124             description "TCP source port start.";
125             type inet:port-number;
126         }
127         leaf tcp-source-port-end {
128             description "TCP source port end.";
129             type inet:port-number;
130         }
131         leaf tcp-destination-port-begin {
132             description "TCP destination port begin.";
133             type inet:port-number;
134         }
135         leaf tcp-destination-port-end {
136             description "TCP destination port end.";
137             type inet:port-number;
138         }
139     }
140
141     grouping match {
142
143         container "ip-match" {
144             uses "ip-match-fields";
145         }
146
147         choice layer-3-match {
148         case "ipv4-match" {
149                 uses "ipv4-match-fields";
150             }
151         case "ipv6-match" {
152                 uses "ipv6-match-fields";
153             }
154         }
155
156         description "if tpSrc then tpSrcStart = tpSrcEnd = tpSrc";
157         choice layer-4-match {
158         case "udp-match" {
159             choice "udp-field-range" {
160                     case "udp-field" {
161                         uses "udp-match-fields";
162                     }
163                     case "udp-range" {
164                         uses "udp-match-ranges";
165                     }
166                 }
167             }
168         case "tcp-match" {
169             choice "tcp-field-range" {
170                     case "tcp-field" {
171                         uses "tcp-match-fields";
172                     }
173                     case "tcp-range" {
174                         uses "tcp-match-ranges";
175                     }
176                 }
177             }
178         }
179     }
180 }