Deprecate stateful02 topology provider.
[bgpcep.git] / pcep / pcepy / message / _message.py
1 # PCEP message and implicit object definitions
2
3 # Copyright (c) 2012,2013 Cisco Systems, Inc. and others.  All rights reserved.
4 #
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 # and is available at http://www.eclipse.org/legal/epl-v10.html
8
9 from . import base
10 from . import object  # Note: object here is a module
11
12
13 # RFC 5440 PCEP
14 class Open(base.Message):
15     type_id = 1
16
17     _sequence = [
18         ('open', object.Open, 1),
19     ]
20
21
22 # RFC 5440 PCEP
23 class Keepalive(base.Message):
24     type_id = 2
25
26     _sequence = []
27
28
29 # RFC 5886 MON
30 class GMon(base.Group):
31     _sequence = [
32         ('mon', object.Monitoring, 1),
33         ('pcc', object.PccIdReq, 1),
34         ('pce', object.PceId, '*'),
35     ]
36
37
38 # RFC 5440 PCEP
39 class GRro(base.Group):
40     _sequence = [
41         ('rro', object.Rro, 1),
42         ('rbw', object.Bandwidth, '?'),
43     ]
44
45
46 # RFC 5440 PCEP
47 # Note: RFC 5520 PK says there's either a PatkKey,
48 # or all other objects in a request
49 # In RFC 5440 PCEP, Endpoints is a REQUIRED object
50 class Request(base.Group):
51     _sequence = [
52         ('rp', object.Rp, 1),
53         ('pk', object.PathKey, '?'),  # RFC 5520 PK
54         ('ep', object.Endpoints, '?'),  # Actually required
55         ('lsp', object.Lsp, '?'),  # D STATEFUL
56         ('lspa', object.Lspa, '?'),
57         ('bw', object.Bandwidth, '?'),
58         ('metric', object.Metric, '*'),
59         ('of', object.Of, '?'),  # RFC 5541 OF
60         ('grro', GRro, '?'),
61         ('iro', object.Iro, '?'),
62         ('lb', object.LoadBalancing, '?'),
63         ('xro', object.Xro, '?'),  # RFC 5521 XRO
64     ]
65
66
67 # RFC 5440 PCEP
68 class GSvec(base.Group):
69     _sequence = [
70         ('svec', object.Svec, 1),
71         ('of', object.Of, '?'),  # RFC 5541 OF
72         ('metric', object.Metric, '*'),  # RFC 5541 OF
73     ]
74
75
76 # RFC 5440 PCEP
77 class PCReq(base.Message):
78     type_id = 3
79
80     _sequence = [
81         ('gmon', GMon, '?'),  # RFC 5886 MON
82         ('gsvec', GSvec, '*'),
83         ('request', Request, '+'),
84     ]
85
86
87 # RFC 5440 PCEP
88 class PcePathAttributes(base.Group):
89     _sequence = [
90         ('of', object.Of, '?'),  # RFC 5541 OF
91         ('lspa', object.Lspa, '?'),
92         ('bw', object.Bandwidth, '?'),
93         ('metric', object.Metric, '*'),
94         ('iro', object.Iro, '?'),  # Not in D STATEFUL-01
95     ]
96
97
98 # RFC 5440 PCEP
99 class PcePath(base.Group):
100     _sequence = [
101         ('ero', object.Ero, 1),
102         ('pcepa', PcePathAttributes, '?'),
103     ]
104
105
106 # RFC 5886 MON
107 class MetricPce(base.Group):
108     _sequence = [
109         ('pce', object.PceId, 1),
110         ('pt', object.ProcTime, '?'),
111         ('ol', object.Overload, '?'),
112     ]
113
114
115 # RFC 5440 PCEP
116 class Response(base.Group):
117     _sequence = [
118         ('rp', object.Rp, 1),
119         ('gmon', GMon, '?'),  # Without pce list # RFC 5886 MON
120         ('lsp', object.Lsp, '?'),  # D STATEFUL
121         ('nopath', object.NoPath, '?'),
122         ('pcepa', PcePathAttributes, '?'),
123         ('path', PcePath, '*'),
124         ('mp', MetricPce, '*'),  # RFC 5886 MON
125     ]
126
127
128 # RFC 5440 PCEP
129 class PCRep(base.Message):
130     type_id = 4
131
132     _sequence = [
133         ('response', Response, '+'),
134     ]
135
136
137 # RFC 5440 PCEP
138 class GNotify(base.Group):
139     _sequence = [
140         ('rp', object.Rp, '*'),
141         ('notify', object.Notification, '+'),
142     ]
143
144
145 # RFC 5440 PCEP
146 class PCNtf(base.Message):
147     type_id = 5
148
149     _sequence = [
150         ('gnotify', GNotify, '+'),
151     ]
152
153
154 # RFC 5440 PCEP
155 class GError(base.Group):
156     """Unified PCEP error item"""
157     _sequence = [
158         ('rp', object.Rp, '*'),
159         ('error', object.Error, '+'),
160         ('lsp', object.Lsp, '?'),  # D STATEFUL
161     ]
162
163
164 # RFC 5440 PCEP
165 class PCErr(base.Message):
166     type_id = 6
167
168     _sequence = [
169         ('gerror', GError, '+'),
170         ('open', object.Open, '?'),
171     ]
172
173
174 # RFC 5440 PCEP
175 class Close(base.Message):
176     type_id = 7
177
178     _sequence = [
179         ('close', object.Close, 1)
180     ]
181
182
183 # RFC 5886 MON
184 class PCMonReq(base.Message):
185     type_id = 8
186
187     _sequence = [
188         ('gmon', GMon, 1),
189         ('gsvec', GSvec, '*'),
190         ('request', Request, '+'),
191     ]
192
193
194 # RFC 5886 MON
195 class PCMonRep(base.Message):
196     type_id = 9
197
198     _sequence = [
199         ('gmon', GMon, '?'),  # Without pce list
200         ('rp', object.Rp, '*'),
201         ('mp', MetricPce, '*'),
202     ]
203
204
205 # D STATEFUL
206 class PccPath(base.Group):
207     _sequence = [
208         ('ero', object.Ero, 1),
209         ('lspa', object.Lspa, '?'),
210         ('bw', object.Bandwidth, '?'),
211         ('rro', object.Rro, '?'),
212         ('metric', object.Metric, '*'),
213     ]
214
215
216 # D STATEFUL
217 class StateReport(base.Group):
218     _sequence = [
219         ('lsp', object.Lsp, 1),
220         ('path', PccPath, '*'),
221     ]
222
223
224 # D STATEFUL
225 class PCRpt(base.Message):
226     type_id = 10
227
228     _sequence = [
229         ('report', StateReport, '+'),
230     ]
231
232
233 # D STATEFUL
234 class UpdateRequest(base.Group):
235     _sequence = [
236         ('lsp', object.Lsp, 1),
237         ('path', PcePath, '*'),
238     ]
239
240
241 # D STATEFUL
242 class PCUpd(base.Message):
243     type_id = 11
244
245     _sequence = [
246         ('update', UpdateRequest, '+'),
247     ]
248
249
250 # D STATEFUL
251 class CreateRequest(base.Group):
252     _sequence = [
253         ('end-points', object.Endpoints, 1),
254         ('lspa', object.Lspa, 1),
255         ('ero', object.Ero, '?'),
256         ('bw', object.Bandwidth, '?'),
257         ('metric', object.Metric, '*'),
258     ]
259
260
261 # D STATEFUL
262 class PCCreate(base.Message):
263     type_id = 12
264
265     _sequence = [
266         ('create', CreateRequest, '+'),
267     ]
268
269
270 # We do not need special handling for unknown messages
271 class Unknown(base.Message):
272     pass
273 base.Message.unknown_class = Unknown