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