blob: 2df42a7ca88b2b9fbaeaedec9e931c149b3f5888 [file] [log] [blame]
janani b6aceca32017-08-16 14:26:16 +05301module subscription {
2 yang-version 1;
3
4 namespace
5 "http://org/ns/subscription";
6
7 prefix sub;
8
9 import ietf-yang-types {
10 prefix yang;
11 }
12
13 import ietf-inet-types {
14 prefix inet;
15 }
16
17 rpc establish-subscription {
18 input {
19 uses subscription-policy;
20 }
21 output {
22 uses subscription-response-with-hints {
23 augment "result" {
24 case success {
25 leaf identifier {
26 type subscription-id;
27 }
28 }
29 }
30
31 augment "result/no-success" {
32 leaf replay-start-time-hint {
33 type yang:date-and-time;
34 }
35 }
36 }
37 }
38 }
39
40 container subscriptions {
41 config false;
42 list subscription {
43 key "identifier";
44 config false;
45
46 leaf identifier {
47 type subscription-id;
48 }
49 leaf configured-subscription {
50 if-feature "configured-subscriptions";
51 type empty;
52 }
53
54 uses subscription-policy;
55 uses notification-origin-info {
56 if-feature "configured-subscriptions";
57 }
58
59 uses receiver-info {
60 refine receivers/receiver {
61 min-elements "1";
62 }
63 augment receivers/receiver {
64 leaf pushed-notifications {
65 type yang:counter64;
66 }
67 leaf excluded-notifications {
68 type yang:counter64;
69 }
70 leaf status {
71 type subscription-status-type;
72 mandatory true;
73 }
74 }
75 }
76 }
77 }
78
79 grouping subscription-policy {
80 uses subscription-policy-non-modifiable {
81 augment target/event-stream {
82 leaf replay-start-time {
83 if-feature "replay";
84 type yang:date-and-time;
85 }
86 }
87 }
88 }
89
90 grouping subscription-policy-non-modifiable {
91 leaf encoding {
92 type encoding;
93 }
94
95 choice target {
96 mandatory true;
97 case event-stream {
98 leaf stream {
99 type stream-type;
100 mandatory true;
101 }
102 }
103 }
104 }
105
106 grouping subscription-response-with-hints {
107 leaf subscription-result {
108 type subscription-result-type;
109 mandatory true;
110 }
111 choice result {
112 case no-success {
113 uses error-hints;
114 }
115 }
116 }
117
118 grouping error-hints {
119 leaf filter-failure {
120 type string;
121 }
122 }
123
124 grouping receiver-info {
125 container receivers {
126 list receiver {
127 key "address port";
128 min-elements 1;
129 leaf address {
130 type inet:host;
131 mandatory true;
132 }
133 leaf port {
134 type inet:port-number;
135 mandatory true;
136 }
137 leaf protocol {
138 type transport-protocol;
139 default "netconf-notif";
140 }
141 }
142 }
143 }
144
145 grouping notification-origin-info {
146 choice notification-origin {
147 case interface-originated {
148 leaf source-interface {
149 type string;
150 }
151 }
152 case address-originated {
153 leaf source-vrf {
154 type string;
155 }
156 leaf source-address {
157 type inet:ip-address-no-zone;
158 mandatory true;
159 }
160 }
161 }
162 }
163
164 grouping update-policy-modifiable {
165 choice update-trigger {
166 case periodic {
167 leaf period {
168 type yang:timeticks;
169 mandatory true;
170 }
171 leaf anchor-time {
172 type yang:date-and-time;
173 }
174 }
175 case on-change {
176 if-feature "on-change";
177 leaf dampening-period {
178 type yang:timeticks;
179 mandatory true;
180 }
181 }
182 }
183 }
184
185 grouping update-policy {
186 uses update-policy-modifiable {
187 augment "update-trigger/on-change" {
188 leaf no-synch-on-start {
189 type empty;
190 }
191 leaf-list excluded-change {
192 type change-type;
193 }
194 }
195 }
196 }
197
198 typedef transport-protocol {
199 type identityref {
200 base transport;
201 }
202 }
203
204 typedef encoding {
205 type identityref {
206 base encodings;
207 }
208 }
209
210 typedef stream-type {
211 type identityref {
212 base stream;
213 }
214 }
215
216 typedef subscription-result-type {
217 type identityref {
218 base subscription-result;
219 }
220 }
221
222 typedef subscription-id {
223 type uint32;
224 }
225
226 typedef subscription-status-type {
227 type identityref {
228 base subscription-status;
229 }
230 }
231
232 typedef change-type {
233 type enumeration {
234 enum "create";
235 enum "delete";
236 enum "insert";
237 enum "merge";
238 enum "move";
239 enum "replace";
240 enum "remove";
241 }
242 }
243
244 identity encodings {
245 }
246
247 identity encode-xml {
248 base encodings;
249 }
250
251 identity encode-json {
252 base encodings;
253 }
254
255 identity stream {
256 }
257
258 identity NETCONF {
259 base stream;
260 }
261
262 identity SYSLOG {
263 base stream;
264 }
265
266 identity subscription-result {
267 }
268
269 identity ok {
270 base subscription-result;
271 }
272
273 identity error {
274 base subscription-result;
275 }
276
277 identity transport {
278 }
279
280 identity netconf-notif {
281 base transport;
282 }
283
284 identity http2 {
285 base transport;
286 }
287
288 identity subscription-status {
289 }
290
291 identity active {
292 base subscription-status;
293 }
294
295 identity inactive {
296 base subscription-status;
297 }
298
299 identity suspended {
300 base subscription-status;
301 }
302
303 identity in-error {
304 base subscription-status;
305 }
306
307 feature replay {
308 description "This feature indicates that historical event display is
309 supported.";
310 }
311
312 feature configured-subscriptions {
313 description "This feature indicates that management plane configuration
314 of subscription is supported.";
315 }
316
317 feature on-change {
318 description "This feature indicates that on-change updates are
319 supported.";
320 }
321}