BGPCEP-580: Implement PCEP stats DS rendering
[bgpcep.git] / pcep / topology / topology-api / src / main / yang / network-topology-pcep.yang
1 module network-topology-pcep {
2     // vi: set et smarttab sw=4 tabstop=4:
3     yang-version 1;
4     namespace "urn:opendaylight:params:xml:ns:yang:topology:pcep";
5     prefix "pn";
6
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import network-topology { prefix nt; revision-date 2013-10-21; }
9     import odl-network-topology { prefix ont; revision-date 2014-01-13; }
10     import pcep-types { prefix pcep; revision-date 2013-10-05; }
11     import rsvp { prefix rsvp; revision-date 2015-08-20; }
12
13     organization "Cisco Systems, Inc.";
14     contact "Robert Varga <rovarga@cisco.com>";
15
16     description
17         "This module contains the PCEP extensions to base topology model. It
18         exposes the LSPs for which a particular node is the head end.
19
20         This module exposes three programming instructions,add-lsp,
21         remove-lsp and update-lsp, which map to actively-stateful PCEP
22         operations using PCInitiate and PCUpd messages to initiate,
23         destroy and udpate LSP configuration. The lifecycle of these
24         instructions follows draft-crabbe-pce-pce-initiated-lsp and
25         draft-ietf-pce-stateful-pce, completing execution once the head-end
26         router has acknowledged operation success. Should the router become
27         disconnected, the instruction resolve to Cancelled if the message
28         has not been sent into the TCP socket, or Failed it they have.
29
30         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
31
32         This program and the accompanying materials are made available
33         under the terms of the Eclipse Public License v1.0 which
34         accompanies this distribution, and is available at
35         http://www.eclipse.org/legal/epl-v10.html";
36
37     revision 2017-10-25 {
38         description "Add release-connection rpc";
39     }
40
41     revision "2013-10-24" {
42         description
43             "Initial revision.";
44         reference "";
45     }
46
47     typedef pcc-sync-state {
48         type enumeration {
49             enum initial-resync {
50                 description
51                     "Initial state resynchronization is being performed.";
52             }
53             enum incremental-sync {
54                 description
55                     "Incremental state resynchronization is being performed.";
56             }
57             enum triggered-initial-sync {
58                 description
59                      "Triggered initial state resynchronization is being performed.";
60             }
61             enum pcep-triggered-resync {
62                 description
63                     "Pcep triggered state resynchronization is being performed.";
64             }
65             enum synchronized {
66                 description
67                     "State synchronization has been achieved.";
68             }
69         }
70     }
71
72     grouping topology-pcep-type {
73         container topology-pcep {
74             presence "indicates a PCEP-aware topology";
75         }
76     }
77
78     augment "/nt:network-topology/nt:topology/nt:topology-types" {
79         uses topology-pcep-type;
80     }
81
82     grouping pcep-client-attributes {
83         description "Data present in a node which is a PCEP client (PCC).";
84
85         container path-computation-client {
86             description
87                 "PCC-related run-time information. This container is only
88                 present when the node is connected through PCEP in a PCC
89                 role.";
90             config false;
91
92             leaf ip-address {
93                 description
94                     "IP address which the node used to connected to the PCE.
95                     There are no guarantees as to reachability of the address,
96                     nor its relationship to other control, management, or
97                     data plane addresses.";
98
99                 type inet:ip-address;
100             }
101
102             container stateful-tlv {
103
104             }
105
106             leaf state-sync {
107                 type pcc-sync-state;
108                 when "../stateful-tlv";
109             }
110
111             list reported-lsp {
112                 leaf name {
113                     type string;
114                 }
115                 key name;
116
117                 list path {
118                     leaf lsp-id {
119                         type rsvp:lsp-id;
120                         mandatory true;
121                     }
122                     key lsp-id;
123
124                     uses pcep:path-definition;
125                 }
126                 uses lsp-metadata;
127             }
128         }
129     }
130
131     augment "/nt:network-topology/nt:topology/nt:node" {
132         when "../../nt:topology-types/topology-pcep";
133
134         uses pcep-client-attributes;
135     }
136
137     typedef failure-type {
138         description
139             "Enumeration of all the distinct failure modes that can
140             happen while servicing a request towards the PCC.";
141
142         type enumeration {
143             enum unsent {
144                 description
145                     "The request failed before it was sent to the PCC.
146                     PCC's state is guaranteed not to reflect state
147                     transition implied by the request. This typically
148                     happens if the request is syntactically invalid,
149                     the target PCC is not connected or disconnects
150                     while the request is enqueued.";
151             }
152             enum no-ack {
153                 description
154                     "The request has been sent to the PCC, but either the
155                     session went down before we have received confirmation
156                     of the request being received by the PCC, or the request
157                     timed-out waiting for response from PCC. PCC's state is
158                     unknown -- the request may or may not be reflected
159                     in its internal state. The caller should not make
160                     any hard assumptions about PCC state until it reconnects
161                     and state synchronization completes.";
162             }
163             enum failed {
164                 description
165                     "The request has been seen by the PCC, where it failed
166                     for some external reason. The caller can assume the
167                     state transition has not taken place, but is advised
168                     to examine the attached error list to gain a deeper
169                     understanding of the failure cause.";
170             }
171         }
172     }
173
174     grouping node-id {
175         leaf node {
176             type nt:node-ref;
177             mandatory true;
178         }
179     }
180
181     grouping lsp-id {
182         uses node-id;
183
184         leaf name {
185             type string;
186             mandatory true;
187         }
188     }
189
190     grouping operation-result {
191         leaf failure {
192             type failure-type;
193         }
194
195         list error {
196             when "../failure = failed";
197             uses pcep:pcep-error-object;
198         }
199     }
200
201     grouping lsp-metadata {
202
203         container metadata {
204             description
205                 "Container for external metadata attached to the LSP. Contents of this container
206                 are not propagated onto the router itself, so it is persisted only while the LSP
207                 is present.";
208         }
209     }
210
211     grouping add-lsp-args {
212         uses lsp-id;
213
214         container arguments {
215
216             uses pcep:endpoints-object;
217
218             uses pcep:path-definition;
219
220             uses lsp-metadata;
221         }
222     }
223
224     rpc add-lsp {
225         input {
226             uses ont:network-topology-reference;
227             uses add-lsp-args;
228         }
229         output {
230             uses operation-result;
231         }
232     }
233
234     grouping remove-lsp-args {
235         uses lsp-id;
236     }
237
238     rpc remove-lsp {
239         input {
240             uses ont:network-topology-reference;
241             uses remove-lsp-args;
242         }
243         output {
244             uses operation-result;
245         }
246     }
247
248     grouping update-lsp-args {
249         uses lsp-id;
250
251         container arguments {
252
253             uses pcep:path-definition;
254
255             uses lsp-metadata;
256         }
257     }
258
259     rpc update-lsp {
260         input {
261             uses ont:network-topology-reference;
262             uses update-lsp-args;
263         }
264         output {
265             uses operation-result;
266         }
267     }
268
269     grouping ensure-lsp-operational-args {
270         uses lsp-id;
271
272         container arguments {
273
274         }
275     }
276
277     rpc ensure-lsp-operational {
278         description
279             "Ensure that the target LSP is provisioned and has specified
280             operational status.";
281
282         input {
283             uses ont:network-topology-reference;
284             uses ensure-lsp-operational-args;
285         }
286         output {
287             uses operation-result;
288         }
289     }
290
291     grouping trigger-sync-args {
292         uses lsp-id {
293           refine name {
294             mandatory false;
295           }
296         }
297     }
298
299     rpc trigger-sync {
300         input {
301             uses ont:network-topology-reference;
302             uses trigger-sync-args;
303         }
304         output {
305             uses operation-result;
306         }
307     }
308
309     rpc tear-down-session {
310         description "Closes the session between PCE and PCC.";
311         input {
312             uses ont:network-topology-reference;
313             uses node-id;
314         }
315     }
316 }
317