janani b | 6aceca3 | 2017-08-16 14:26:16 +0530 | [diff] [blame] | 1 | module yrt-subscription { |
| 2 | yang-version 1; |
| 3 | |
| 4 | namespace |
| 5 | "http://org/ns/yrt/subscription"; |
| 6 | |
| 7 | prefix sub; |
| 8 | |
| 9 | import yrt-ietf-yang-types { |
| 10 | prefix yang; |
| 11 | } |
| 12 | |
| 13 | import yrt-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 | container test { |
| 80 | uses check { |
| 81 | augment "value/" { |
| 82 | container proceed { |
| 83 | leaf isPresent { |
| 84 | type boolean; |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | grouping check { |
| 92 | container value { |
| 93 | container stop { |
| 94 | leaf isPresent { |
| 95 | type boolean; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | grouping subscription-policy { |
| 102 | uses subscription-policy-non-modifiable { |
| 103 | augment target/event-stream { |
| 104 | leaf replay-start-time { |
| 105 | if-feature "replay"; |
| 106 | type yang:date-and-time; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | grouping subscription-policy-non-modifiable { |
| 113 | leaf encoding { |
| 114 | type encoding; |
| 115 | } |
| 116 | |
| 117 | choice target { |
| 118 | mandatory true; |
| 119 | case event-stream { |
| 120 | leaf stream { |
| 121 | type stream-type; |
| 122 | mandatory true; |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | grouping subscription-response-with-hints { |
| 129 | leaf subscription-result { |
| 130 | type subscription-result-type; |
| 131 | mandatory true; |
| 132 | } |
| 133 | choice result { |
| 134 | case no-success { |
| 135 | uses error-hints; |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | grouping error-hints { |
| 141 | leaf filter-failure { |
| 142 | type string; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | grouping receiver-info { |
| 147 | container receivers { |
| 148 | list receiver { |
| 149 | key "address port"; |
| 150 | min-elements 1; |
| 151 | leaf address { |
| 152 | type inet:host; |
| 153 | mandatory true; |
| 154 | } |
| 155 | leaf port { |
| 156 | type inet:port-number; |
| 157 | mandatory true; |
| 158 | } |
| 159 | leaf protocol { |
| 160 | type transport-protocol; |
| 161 | default "netconf-notif"; |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | grouping notification-origin-info { |
| 168 | choice notification-origin { |
| 169 | case interface-originated { |
| 170 | leaf source-interface { |
| 171 | type string; |
| 172 | } |
| 173 | } |
| 174 | case address-originated { |
| 175 | leaf source-vrf { |
| 176 | type string; |
| 177 | } |
| 178 | leaf source-address { |
| 179 | type inet:ip-address-no-zone; |
| 180 | mandatory true; |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | grouping update-policy-modifiable { |
| 187 | choice update-trigger { |
| 188 | case periodic { |
| 189 | leaf period { |
| 190 | type yang:timeticks; |
| 191 | mandatory true; |
| 192 | } |
| 193 | leaf anchor-time { |
| 194 | type yang:date-and-time; |
| 195 | } |
| 196 | } |
| 197 | case on-change { |
| 198 | if-feature "on-change"; |
| 199 | leaf dampening-period { |
| 200 | type yang:timeticks; |
| 201 | mandatory true; |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | grouping update-policy { |
| 208 | uses update-policy-modifiable { |
| 209 | augment "update-trigger/on-change" { |
| 210 | leaf no-synch-on-start { |
| 211 | type empty; |
| 212 | } |
| 213 | leaf-list excluded-change { |
| 214 | type change-type; |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | typedef transport-protocol { |
| 221 | type identityref { |
| 222 | base transport; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | typedef encoding { |
| 227 | type identityref { |
| 228 | base encodings; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | typedef stream-type { |
| 233 | type identityref { |
| 234 | base stream; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | typedef subscription-result-type { |
| 239 | type identityref { |
| 240 | base subscription-result; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | typedef subscription-id { |
| 245 | type uint32; |
| 246 | } |
| 247 | |
| 248 | typedef subscription-status-type { |
| 249 | type identityref { |
| 250 | base subscription-status; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | typedef change-type { |
| 255 | type enumeration { |
| 256 | enum "create"; |
| 257 | enum "delete"; |
| 258 | enum "insert"; |
| 259 | enum "merge"; |
| 260 | enum "move"; |
| 261 | enum "replace"; |
| 262 | enum "remove"; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | identity encodings { |
| 267 | } |
| 268 | |
| 269 | identity encode-xml { |
| 270 | base encodings; |
| 271 | } |
| 272 | |
| 273 | identity encode-json { |
| 274 | base encodings; |
| 275 | } |
| 276 | |
| 277 | identity stream { |
| 278 | } |
| 279 | |
| 280 | identity NETCONF { |
| 281 | base stream; |
| 282 | } |
| 283 | |
| 284 | identity SYSLOG { |
| 285 | base stream; |
| 286 | } |
| 287 | |
| 288 | identity subscription-result { |
| 289 | } |
| 290 | |
| 291 | identity ok { |
| 292 | base subscription-result; |
| 293 | } |
| 294 | |
| 295 | identity error { |
| 296 | base subscription-result; |
| 297 | } |
| 298 | |
| 299 | identity transport { |
| 300 | } |
| 301 | |
| 302 | identity netconf-notif { |
| 303 | base transport; |
| 304 | } |
| 305 | |
| 306 | identity http2 { |
| 307 | base transport; |
| 308 | } |
| 309 | |
| 310 | identity subscription-status { |
| 311 | } |
| 312 | |
| 313 | identity active { |
| 314 | base subscription-status; |
| 315 | } |
| 316 | |
| 317 | identity inactive { |
| 318 | base subscription-status; |
| 319 | } |
| 320 | |
| 321 | identity suspended { |
| 322 | base subscription-status; |
| 323 | } |
| 324 | |
| 325 | identity in-error { |
| 326 | base subscription-status; |
| 327 | } |
| 328 | |
| 329 | feature replay { |
| 330 | description "This feature indicates that historical event display is |
| 331 | supported."; |
| 332 | } |
| 333 | |
| 334 | feature configured-subscriptions { |
| 335 | description "This feature indicates that management plane configuration |
| 336 | of subscription is supported."; |
| 337 | } |
| 338 | |
| 339 | feature on-change { |
| 340 | description "This feature indicates that on-change updates are |
| 341 | supported."; |
| 342 | } |
| 343 | } |