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