Added more openflow models
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-types.yang
1 module openflow-types {
2     namespace "urn:opendaylight:openflow:common:types";
3     prefix "oft";
4
5     revision "2013-07-31" {
6         //description "Initial model";
7     }
8
9     typedef port-number {
10         type uint32 {
11                 range "0..4294967040"; // 0xffffff00 See for actual value
12         }
13     }
14
15     typedef special-port-number {
16         type enumeration {
17             enum in-port { 
18                 //value "4294967288";
19                 //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
20             }
21             enum table { 
22                 //value "4294967289"; // 0xfffffff9;
23                 //description "Perform actions in flow table. NB: This can only be the destination port for packet-out messages."
24             }
25             enum normal { 
26                 //value "4294967290"; // 0xfffffffa;
27                 //description "Process with normal L2/L3 switching."
28             }
29             enum flood { 
30                 //value "4294967291"; // 0xfffffffb;
31                 //description "All physical ports except input port and those disabled by STP."
32             }
33             enum all { 
34                 //value "4294967292"; // 0xfffffffc;
35                 //description "All physical ports except input port."
36             }
37             enum controller { 
38                 //value "4294967293";  // 0xfffffffd;
39                 //description "Send to controller."
40             }
41             enum local { 
42                 //value "4294967294"; // 0xfffffffe;
43                 //description "Local openflow port."
44             }
45             enum none { 
46                 //value "4294967295"; // 0xffffffff;
47                 //description "not associated with a physical port."
48             }
49         }
50     }
51
52     typedef any-port-number {
53         type union {
54             type port-number;
55             type special-port-number;
56         }
57     }
58
59
60     typedef port-features {
61         ////description "Features of ports available in datapath.";
62         //reference "ofp_port_features";
63         type bits {
64             bit 10mb_hd { 
65                 position 0;
66                 //description "10 Mb half-duplex rate support.";
67             }
68             bit 10mb-fd { 
69                 position 1;
70                 //description "10 Mb full-duplex rate support.";
71             }
72             bit 100mb-hd { 
73                 position 2;
74                 //description "100 Mb half-duplex rate support.";
75             }
76             bit 100mb-fd { 
77                 position 3;
78                 //description "100 Mb full-duplex rate support.";
79             }
80             bit 1gb-hd { 
81                 position 4;
82                 //description "1 Gb half-duplex rate support.";
83             }
84             bit 1gb-fd { 
85                 position 5;
86                 //description "1 Gb full-duplex rate support.";
87             }
88             bit 10gb-fd { 
89                 position 6;
90                 //description "10 Gb full-duplex rate support.";
91             }
92             bit 40gb-fd { 
93                 position 7;
94                 //description "40 Gb full-duplex rate support.";
95             }
96             bit 100gb-fd { 
97                 position 8;
98                 //description "100 Gb full-duplex rate support.";
99             }
100             bit 1tb-fd { 
101                 position 9;
102                 //description "1 Tb full-duplex rate support.";
103             }
104             bit other { 
105                 position 10;
106                 //description "Other rate, not in the list.";
107             }
108             bit copper { 
109                 position 11;
110                 //description "Copper medium.";
111             }
112             bit fiber { 
113                 position 12;
114                 //description "Fiber medium.";
115             }
116             bit autoneg { 
117                 position 13;
118                 //description "Auto-negotiation.";
119             }
120             bit pause { 
121                 position 14;
122                 //description "Pause.";
123             }
124             bit pause-asym { 
125                 position 15;
126                 //description "Asymmetric pause.";
127             }
128         }
129     }
130
131     typedef port-config {
132         description 
133            "Flags to indicate behavior of the physical port. These flags are
134             describe the current configuration and used port_mod message 
135             to configure the port's behavior.";
136         type bits {
137             bit port-down { 
138                 //description " Port is administratively down.";
139                 position 0;
140             }
141             bit no-recv { 
142                 //description " Drop all packets received by port.";
143                 position 2;
144             }
145             bit no-fwd { 
146                 //description " Drop packets forwarded to port.";
147                 position 5;
148             }
149             bit no-packet-in { 
150                 //description "Do not send packet-in msgs for port.";
151                 position 6;
152             }
153         }
154     }
155
156     typedef port-state {
157         description 
158             "Current state of the physical port. These are not configurable from
159             the controller.";
160         type bits {
161             bit link_down {
162                 //description "No physical link present.";
163                 position 0;
164             }
165             bit blocked {
166                 //description "Port is blocked";
167                 position 1;
168             }
169             bit live {
170                 //description "Live for Fast Failover Group.";
171                 position 2;
172             }
173         }
174     }
175
176     identity match-type {
177         description 
178            "The match type indicates the match structure (set of fields that compose the
179             match) in use. The match type is placed in the type field at the beginning
180             of all match structures.Extensions that define match types may be 
181             published on the ONF wiki. Support for extensions is optional.";
182     }
183
184     identity standard-match-type {
185         deprecated true;
186         base oft:match-type;
187     }
188
189     typedef match-type {
190         type identityref {
191             base oft:match-type;
192         }
193     }
194
195     identity instruction {
196
197     }
198
199     identity action {
200
201     }
202
203
204     typedef metadata {
205         type binary;
206     }
207     
208     typedef table-id {
209         type uint32;
210     }
211     typedef meter-id {
212         type uint32;
213     }
214     typedef queue-id {
215         type uint32;
216     }
217     typedef group-id {
218         type uint32;
219     }
220     
221     typedef ether-type {
222         type uint16;
223     }
224 }