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