17c89408bd2f17da07a1d7531af9a87bf135475a
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-approved-extensions.yang
1 module openflow-approved-extensions {
2     namespace "urn:opendaylight:openflow:approved:extensions";
3     prefix "ofext";
4
5     import yang-ext {prefix ext;}
6     import ietf-inet-types {prefix inet;}
7     import ietf-yang-types {prefix yang;}
8
9     import openflow-types {prefix oft;}
10     import openflow-protocol {prefix ofproto;}
11     import openflow-action {prefix ofaction;}
12     import openflow-instruction {prefix ofinstruction;}
13     import openflow-extensible-match {prefix oxm;}
14     import openflow-augments {prefix aug;}
15
16     revision "2016-08-02" {
17         description "Openflow approved extensions definition";
18     }
19
20     //ONF Approved OpenFlow Extensions
21
22     // ONF experimenter error codes
23     typedef onf-experimenter-error-code {
24         description "Error codes for experimenter error type.";
25         type enumeration {
26             enum ONFERR_ET_UNKNOWN {
27                 description "Unspecified error.";
28                 value 2300;
29             }
30             enum ONFERR_ET_EPERM {
31                 description "Permissions error.";
32                 value 2301;
33             }
34             enum ONFERR_ET_BAD_ID {
35                 description "Bundle ID doesn’t exist.";
36                 value 2302;
37             }
38             enum ONFERR_ET_BUNDLE_EXIST {
39                 description "Bundle ID already exist.";
40                 value 2303;
41             }
42             enum ONFERR_ET_BUNDLE_CLOSED {
43                 description "Bundle ID is closed.";
44                 value 2304;
45             }
46             enum ONFERR_ET_OUT_OF_BUNDLES {
47                 description "Too many bundles IDs.";
48                 value 2305;
49             }
50             enum ONFERR_ET_BAD_TYPE {
51                 description "Unsupported or unknown message control type.";
52                 value 2306;
53             }
54             enum ONFERR_ET_BAD_FLAGS {
55                 description "Unsupported, unknown, or inconsistent flags.";
56                 value 2307;
57             }
58             enum ONFERR_ET_MSG_BAD_LEN {
59                 description "Length problem in included message.";
60                 value 2308;
61             }
62             enum ONFERR_ET_MSG_BAD_XID {
63                 description "Inconsistent or duplicate XID.";
64                 value 2309;
65             }
66             enum ONFERR_ET_MSG_UNSUP {
67                 description "Unsupported message in this bundle.";
68                 value 2310;
69             }
70             enum ONFERR_ET_MSG_CONFLICT {
71                 description "Unsupported message combination in this bundle.";
72                 value 2311;
73             }
74             enum ONFERR_ET_MSG_TOO_MANY {
75                 description "Can not handle this many messages in bundle.";
76                 value 2312;
77             }
78             enum ONFERR_ET_MSG_FAILED {
79                 description "One message in bundle failed.";
80                 value 2313;
81             }
82             enum ONFERR_ET_TIMEOUT {
83                 description "Bundle is taking too long.";
84                 value 2314;
85             }
86             enum ONFERR_ET_BUNDLE_IN_PROGRESS {
87                 description "Bundle is locking the resource.";
88                 value 2315;
89             }
90         }
91     }
92
93     // Extension 109 - TCP FLAGS
94     identity tcp_flags {
95         base oxm:match-field;
96         description "TCP flags from the TCP header";
97     }
98
99     augment "/oxm:oxm-container/oxm:match-entry-value/aug:experimenter-id-case" {
100         ext:augment-identifier "tcp-flags-container";
101         container tcp-flags {
102             leaf flags {
103                 type uint16;
104             }
105             leaf mask {
106                 type binary;
107             }
108         }
109     }
110
111     // Extension 230 - Bundle Extension (experimenterID 0x4F4E4600)
112     typedef bundle-id {
113         description "Identify the bundle.";
114         type uint32;
115     }
116
117     typedef bundle-control-type {
118         description "Bundle control message type.";
119         type enumeration {
120             enum ONF_BCT_OPEN_REQUEST {
121                 value 0;
122             }
123             enum ONF_BCT_OPEN_REPLY {
124                 value 1;
125             }
126             enum ONF_BCT_CLOSE_REQUEST {
127                 value 2;
128             }
129             enum ONF_BCT_CLOSE_REPLY {
130                 value 3;
131             }
132             enum ONF_BCT_COMMIT_REQUEST {
133                 value 4;
134             }
135             enum ONF_BCT_COMMIT_REPLY {
136                 value 5;
137             }
138             enum ONF_BCT_DISCARD_REQUEST {
139                 value 6;
140             }
141             enum ONF_BCT_DISCARD_REPLY {
142                 value 7;
143             }
144         }
145     }
146
147     typedef bundle-flags {
148         description "Bundle configuration flags.";
149         type bits {
150             bit atomic {
151                 description "Execute atomically.";
152                 position 0;
153             }
154             bit ordered {
155                 description "Execute in specified order.";
156                 position 1;
157             }
158         }
159     }
160
161     typedef bundle-property-type {
162         description "Bundle property types.";
163         type enumeration {
164             enum ONF_ET_BPT_EXPERIMENTER {
165                 description "Experimenter property.";
166                 value 65535; //0xFFFF
167             }
168         }
169     }
170
171     grouping bundle-properties {
172         list bundle-property {
173             description "Bundle properties list.";
174             leaf type {
175                 type bundle-property-type;
176             }
177             choice bundle-property-entry {
178                 case bundle-experimenter-property {
179                     leaf experimenter {
180                          type oft:experimenter-id;
181                     }
182                     leaf exp-type {
183                          type uint32;
184                     }
185                     choice bundle-experimenter-property-data {
186                         // to be augmented by vendors
187                     }
188                 }
189             }
190         }
191     }
192
193     augment "/ofproto:experimenter/ofproto:input/ofproto:experimenter-data-of-choice" {
194         case bundle-control {
195             description "ONF_ET_BUNDLE_CONTROL message in OpenFlow Switch Extension 230.";
196             leaf bundle-id {
197                 type bundle-id;
198             }
199             leaf type {
200                 type bundle-control-type;
201             }
202             leaf flags {
203                 type bundle-flags;
204             }
205             uses bundle-properties;
206         }
207         case bundle-add-message {
208             description "ONF_ET_BUNDLE_ADD_MESSAGE in OpenFlow Switch Extension 230.";
209             leaf bundle-id {
210                 type bundle-id;
211             }
212             leaf flags {
213                 type bundle-flags;
214             }
215             // Inner message
216             choice message {
217                 description "Message added to the bundle.";
218                 case flow-mod-case {
219                     uses ofproto:flow-mod;
220                 }
221                 case group-mod-case {
222                     uses ofproto:group-mod;
223                 }
224                 case port-mod-case {
225                     uses ofproto:port-mod;
226                 }
227             }
228             uses bundle-properties;
229         }
230     }
231 }