|
1
|
|
|
"""Defines an Error Message.""" |
|
2
|
|
|
|
|
3
|
|
|
# System imports |
|
4
|
1 |
|
from enum import IntEnum |
|
5
|
|
|
|
|
6
|
1 |
|
from pyof.foundation import exceptions |
|
7
|
1 |
|
from pyof.foundation.base import GenericMessage |
|
8
|
1 |
|
from pyof.foundation.basic_types import BinaryData, UBInt16, UBInt32 |
|
9
|
1 |
|
from pyof.v0x04.common.header import Header, Type |
|
10
|
|
|
|
|
11
|
|
|
# Third-party imports |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
1 |
|
__all__ = ('BadActionCode', 'BadInstructionCode', 'BadMatchCode', 'ErrorType', |
|
15
|
|
|
'FlowModFailedCode', 'GroupModFailedCode', 'HelloFailedCode', |
|
16
|
|
|
'MeterModFailedCode', 'PortModFailedCode', 'QueueOpFailedCode', |
|
17
|
|
|
'RoleRequestFailedCode', 'SwitchConfigFailedCode', |
|
18
|
|
|
'TableFeaturesFailedCode', 'TableModFailedCode', |
|
19
|
|
|
'GenericFailedCode') |
|
20
|
|
|
|
|
21
|
|
|
# Enums |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
1 |
|
class GenericFailedCode(IntEnum): |
|
25
|
|
|
"""Error_msg 'code' values for OFPET_BAD_ACTION. |
|
26
|
|
|
|
|
27
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
28
|
|
|
""" |
|
29
|
|
|
|
|
30
|
|
|
#: Unknown error |
|
31
|
1 |
|
GENERIC_ERROR = 0 |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
1 |
|
class BadActionCode(IntEnum): |
|
35
|
|
|
"""Error_msg 'code' values for OFPET_BAD_ACTION. |
|
36
|
|
|
|
|
37
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
38
|
|
|
""" |
|
39
|
|
|
|
|
40
|
|
|
#: Unknown action type. |
|
41
|
1 |
|
OFPBAC_BAD_TYPE = 0 |
|
42
|
|
|
#: Length problem in actions. |
|
43
|
1 |
|
OFPBAC_BAD_LEN = 1 |
|
44
|
|
|
#: Unknown experimenter id specified. |
|
45
|
1 |
|
OFPBAC_BAD_EXPERIMENTER = 2 |
|
46
|
|
|
#: Unknown action for experimenter id. |
|
47
|
1 |
|
OFPBAC_BAD_EXP_TYPE = 3 |
|
48
|
|
|
#: Problem validating output port. |
|
49
|
1 |
|
OFPBAC_BAD_OUT_PORT = 4 |
|
50
|
|
|
#: Bad action argument. |
|
51
|
1 |
|
OFPBAC_BAD_ARGUMENT = 5 |
|
52
|
|
|
#: Permissions error. |
|
53
|
1 |
|
OFPBAC_EPERM = 6 |
|
54
|
|
|
#: Can’t handle this many actions. |
|
55
|
1 |
|
OFPBAC_TOO_MANY = 7 |
|
56
|
|
|
#: Problem validating output queue. |
|
57
|
1 |
|
OFPBAC_BAD_QUEUE = 8 |
|
58
|
|
|
#: Invalid group id in forward action. |
|
59
|
1 |
|
OFPBAC_BAD_OUT_GROUP = 9 |
|
60
|
|
|
#: Action can’t apply for this match, or Set-Field missing prerequisite. |
|
61
|
1 |
|
OFPBAC_MATCH_INCONSISTENT = 10 |
|
62
|
|
|
#: Action order is unsupported for the action list in an Apply-Actions |
|
63
|
|
|
#: instruction |
|
64
|
1 |
|
OFPBAC_UNSUPPORTED_ORDER = 11 |
|
65
|
|
|
#: Actions uses an unsupported tag/encap. |
|
66
|
1 |
|
OFPBAC_BAD_TAG = 12 |
|
67
|
|
|
#: Unsupported type in SET_FIELD action. |
|
68
|
1 |
|
OFPBAC_BAD_SET_TYPE = 13 |
|
69
|
|
|
#: Length problem in SET_FIELD action. |
|
70
|
1 |
|
OFPBAC_BAD_SET_LEN = 14 |
|
71
|
|
|
#: Bad argument in SET_FIELD action. |
|
72
|
1 |
|
OFPBAC_BAD_SET_ARGUMENT = 15 |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
1 |
|
class BadInstructionCode(IntEnum): |
|
76
|
|
|
"""Error_msg 'code' values for OFPET_BAD_INSTRUCTION. |
|
77
|
|
|
|
|
78
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
79
|
|
|
""" |
|
80
|
|
|
|
|
81
|
|
|
#: Unknown instruction. |
|
82
|
1 |
|
OFPBIC_UNKNOWN_INST = 0 |
|
83
|
|
|
#: Switch or table does not support the instruction. |
|
84
|
1 |
|
OFPBIC_UNSUP_INST = 1 |
|
85
|
|
|
#: Invalid Table-ID specified. |
|
86
|
1 |
|
OFPBIC_BAD_TABLE_ID = 2 |
|
87
|
|
|
#: Metadata value unsupported by datapath. |
|
88
|
1 |
|
OFPBIC_UNSUP_METADATA = 3 |
|
89
|
|
|
#: Metadata mask value unsupported by datapath. |
|
90
|
1 |
|
OFPBIC_UNSUP_METADATA_MASK = 4 |
|
91
|
|
|
#: Unknown experimenter id specified. |
|
92
|
1 |
|
OFPBIC_BAD_EXPERIMENTER = 5 |
|
93
|
|
|
#: Unknown instruction for experimenter id. |
|
94
|
1 |
|
OFPBIC_BAD_EXP_TYPE = 6 |
|
95
|
|
|
#: Length problem in instructions. |
|
96
|
1 |
|
OFPBIC_BAD_LEN = 7 |
|
97
|
|
|
#: Permissions error. |
|
98
|
1 |
|
OFPBIC_EPERM = 8 |
|
99
|
|
|
|
|
100
|
|
|
|
|
101
|
1 |
|
class BadMatchCode(IntEnum): |
|
102
|
|
|
"""Error_msg 'code' values for OFPET_BAD_MATCH. |
|
103
|
|
|
|
|
104
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
105
|
|
|
""" |
|
106
|
|
|
|
|
107
|
|
|
#: Unsupported match type specified by the match |
|
108
|
1 |
|
OFPBMC_BAD_TYPE = 0 |
|
109
|
|
|
#: Length problem in match. |
|
110
|
1 |
|
OFPBMC_BAD_LEN = 1 |
|
111
|
|
|
#: Match uses an unsupported tag/encap. |
|
112
|
1 |
|
OFPBMC_BAD_TAG = 2 |
|
113
|
|
|
#: Unsupported datalink addr mask - switch does not support arbitrary |
|
114
|
|
|
#: datalink address mask. |
|
115
|
1 |
|
OFPBMC_BAD_DL_ADDR_MASK = 3 |
|
116
|
|
|
#: Unsupported network addr mask - switch does not support arbitrary |
|
117
|
|
|
#: network address mask. |
|
118
|
1 |
|
OFPBMC_BAD_NW_ADDR_MASK = 4 |
|
119
|
|
|
#: Unsupported combination of fields masked or omitted in the match. |
|
120
|
1 |
|
OFPBMC_BAD_WILDCARDS = 5 |
|
121
|
|
|
#: Unsupported field type in the match. |
|
122
|
1 |
|
OFPBMC_BAD_FIELD = 6 |
|
123
|
|
|
#: Unsupported value in a match field. |
|
124
|
1 |
|
OFPBMC_BAD_VALUE = 7 |
|
125
|
|
|
#: Unsupported mask specified in the match, field is not dl-address or |
|
126
|
|
|
#: nw-address. |
|
127
|
1 |
|
OFPBMC_BAD_MASK = 8 |
|
128
|
|
|
#: A prerequisite was not met. |
|
129
|
1 |
|
OFPBMC_BAD_PREREQ = 9 |
|
130
|
|
|
#: A field type was duplicated. |
|
131
|
1 |
|
OFPBMC_DUP_FIELD = 10 |
|
132
|
|
|
#: Permissions error. |
|
133
|
1 |
|
OFPBMC_EPERM = 11 |
|
134
|
|
|
|
|
135
|
|
|
|
|
136
|
1 |
|
class BadRequestCode(IntEnum): |
|
137
|
|
|
"""Error_msg 'code' values for OFPET_BAD_REQUEST. |
|
138
|
|
|
|
|
139
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
140
|
|
|
""" |
|
141
|
|
|
|
|
142
|
|
|
#: ofp_header.version not supported. |
|
143
|
1 |
|
OFPBRC_BAD_VERSION = 0 |
|
144
|
|
|
#: ofp_header.type not supported. |
|
145
|
1 |
|
OFPBRC_BAD_TYPE = 1 |
|
146
|
|
|
#: ofp_multipart_request.type not supported. |
|
147
|
1 |
|
OFPBRC_BAD_MULTIPART = 2 |
|
148
|
|
|
#: Experimenter id not supported (in ofp_experimenter_header or |
|
149
|
|
|
#: ofp_multipart_request or * ofp_multipart_reply). |
|
150
|
1 |
|
OFPBRC_BAD_EXPERIMENTER = 3 |
|
151
|
|
|
#: Experimenter type not supported. |
|
152
|
1 |
|
OFPBRC_BAD_EXP_TYPE = 4 |
|
153
|
|
|
#: Permissions error. |
|
154
|
1 |
|
OFPBRC_EPERM = 5 |
|
155
|
|
|
#: Wrong request length for type. |
|
156
|
1 |
|
OFPBRC_BAD_LEN = 6 |
|
157
|
|
|
#: Specified buffer has already been used. |
|
158
|
1 |
|
OFPBRC_BUFFER_EMPTY = 7 |
|
159
|
|
|
#: Specified buffer does not exist. |
|
160
|
1 |
|
OFPBRC_BUFFER_UNKNOWN = 8 |
|
161
|
|
|
#: Specified table-id invalid or does not * exist. |
|
162
|
1 |
|
OFPBRC_BAD_TABLE_ID = 9 |
|
163
|
|
|
#: Denied because controller is slave. |
|
164
|
1 |
|
OFPBRC_IS_SLAVE = 10 |
|
165
|
|
|
#: Invalid port. |
|
166
|
1 |
|
OFPBRC_BAD_PORT = 11 |
|
167
|
|
|
#: Invalid packet in packet-out. |
|
168
|
1 |
|
OFPBRC_BAD_PACKET = 12 |
|
169
|
|
|
#: ofp_multipart_request overflowed the assigned buffer. |
|
170
|
1 |
|
OFPBRC_MULTIPART_BUFFER_OVERFLOW = 13 # pylint: disable=invalid-name |
|
171
|
|
|
|
|
172
|
|
|
|
|
173
|
1 |
|
class ErrorType(IntEnum): |
|
174
|
|
|
"""Values for ’type’ in ofp_error_message. |
|
175
|
|
|
|
|
176
|
|
|
These values are immutable: they will not change in future versions of the |
|
177
|
|
|
protocol (although new values may be added). |
|
178
|
|
|
""" |
|
179
|
|
|
|
|
180
|
|
|
#: Hello protocol failed |
|
181
|
1 |
|
OFPET_HELLO_FAILED = 0 |
|
182
|
|
|
#: Request was not understood |
|
183
|
1 |
|
OFPET_BAD_REQUEST = 1 |
|
184
|
|
|
#: Error in action description |
|
185
|
1 |
|
OFPET_BAD_ACTION = 2 |
|
186
|
|
|
#: Error in instruction list. |
|
187
|
1 |
|
OFPET_BAD_INSTRUCTION = 3 |
|
188
|
|
|
#: Error in match. |
|
189
|
1 |
|
OFPET_BAD_MATCH = 4 |
|
190
|
|
|
#: Problem modifying flow entry. |
|
191
|
1 |
|
OFPET_FLOW_MOD_FAILED = 5 |
|
192
|
|
|
#: Problem modifying group entry. |
|
193
|
1 |
|
OFPET_GROUP_MOD_FAILED = 6 |
|
194
|
|
|
#: Port mod request failed. |
|
195
|
1 |
|
OFPET_PORT_MOD_FAILED = 7 |
|
196
|
|
|
#: Table mod request failed. |
|
197
|
1 |
|
OFPET_TABLE_MOD_FAILED = 8 |
|
198
|
|
|
#: Queue operation failed. |
|
199
|
1 |
|
OFPET_QUEUE_OP_FAILED = 9 |
|
200
|
|
|
#: Switch config request failed. |
|
201
|
1 |
|
OFPET_SWITCH_CONFIG_FAILED = 10 |
|
202
|
|
|
#: Controller Role request failed. |
|
203
|
1 |
|
OFPET_ROLE_REQUEST_FAILED = 11 |
|
204
|
|
|
#: Error in meter. |
|
205
|
1 |
|
OFPET_METER_MOD_FAILED = 12 |
|
206
|
|
|
#: Setting table features failed. |
|
207
|
1 |
|
OFPET_TABLE_FEATURES_FAILED = 13 |
|
208
|
|
|
#: Experimenter error messages. |
|
209
|
1 |
|
OFPET_EXPERIMENTER = 0xffff |
|
210
|
|
|
|
|
211
|
1 |
|
def get_class(self): |
|
212
|
|
|
"""Return a Code class based on current ErrorType value. |
|
213
|
|
|
|
|
214
|
|
|
Returns: |
|
215
|
|
|
enum.IntEnum: class referenced by current error type. |
|
216
|
|
|
|
|
217
|
|
|
""" |
|
218
|
1 |
|
classes = {'OFPET_HELLO_FAILED': HelloFailedCode, |
|
219
|
|
|
'OFPET_BAD_REQUEST': BadRequestCode, |
|
220
|
|
|
'OFPET_BAD_ACTION': BadActionCode, |
|
221
|
|
|
'OFPET_BAD_INSTRUCTION': BadInstructionCode, |
|
222
|
|
|
'OFPET_BAD_MATCH': BadMatchCode, |
|
223
|
|
|
'OFPET_FLOW_MOD_FAILED': FlowModFailedCode, |
|
224
|
|
|
'OFPET_GROUP_MOD_FAILED': GroupModFailedCode, |
|
225
|
|
|
'OFPET_PORT_MOD_FAILED': PortModFailedCode, |
|
226
|
|
|
'OFPET_QUEUE_OP_FAILED': QueueOpFailedCode, |
|
227
|
|
|
'OFPET_SWITCH_CONFIG_FAILED': SwitchConfigFailedCode, |
|
228
|
|
|
'OFPET_ROLE_REQUEST_FAILED': RoleRequestFailedCode, |
|
229
|
|
|
'OFPET_METER_MOD_FAILED': MeterModFailedCode, |
|
230
|
|
|
'OFPET_TABLE_MOD_FAILED': TableModFailedCode, |
|
231
|
|
|
'OFPET_TABLE_FEATURES_FAILED': TableFeaturesFailedCode} |
|
232
|
1 |
|
return classes.get(self.name, GenericFailedCode) |
|
233
|
|
|
|
|
234
|
|
|
|
|
235
|
1 |
|
class FlowModFailedCode(IntEnum): |
|
236
|
|
|
"""Error_msg 'code' values for OFPET_FLOW_MOD_FAILED. |
|
237
|
|
|
|
|
238
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
239
|
|
|
""" |
|
240
|
|
|
|
|
241
|
|
|
#: Unspecified error. |
|
242
|
1 |
|
OFPFMFC_UNKNOWN = 0 |
|
243
|
|
|
#: Flow not added because table was full. |
|
244
|
1 |
|
OFPFMFC_TABLE_FULL = 1 |
|
245
|
|
|
#: Table does not exist |
|
246
|
1 |
|
OFPFMFC_BAD_TABLE_ID = 2 |
|
247
|
|
|
#: Attempted to add overlapping flow with CHECK_OVERLAP flag set. |
|
248
|
1 |
|
OFPFMFC_OVERLAP = 3 |
|
249
|
|
|
#: Permissions error. |
|
250
|
1 |
|
OFPFMFC_EPERM = 4 |
|
251
|
|
|
#: Flow not added because of unsupported idle/hard timeout. |
|
252
|
1 |
|
OFPFMFC_BAD_TIMEOUT = 5 |
|
253
|
|
|
#: Unsupported or unknown command. |
|
254
|
1 |
|
OFPFMFC_BAD_COMMAND = 6 |
|
255
|
|
|
#: Unsupported or unknown flags. |
|
256
|
1 |
|
OFPFMFC_BAD_FLAGS = 7 |
|
257
|
|
|
|
|
258
|
|
|
|
|
259
|
1 |
|
class GroupModFailedCode(IntEnum): |
|
260
|
|
|
"""Error_msg 'code' values for OFPET_GROUP_MOD_FAILED. |
|
261
|
|
|
|
|
262
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
263
|
|
|
""" |
|
264
|
|
|
|
|
265
|
|
|
#: Group not added because a group ADD attempted to replace an |
|
266
|
|
|
#: already-present group. |
|
267
|
1 |
|
FPGMFC_GROUP_EXISTS = 0 |
|
268
|
|
|
#: Group not added because Group specified is invalid. |
|
269
|
1 |
|
OFPGMFC_INVALID_GROUP = 1 |
|
270
|
|
|
#: Switch does not support unequal load sharing with select groups. |
|
271
|
1 |
|
OFPGMFC_WEIGHT_UNSUPPORTED = 2 |
|
272
|
|
|
#: The group table is full. |
|
273
|
1 |
|
OFPGMFC_OUT_OF_GROUPS = 3 |
|
274
|
|
|
#: The maximum number of action buckets for a group has been exceeded. |
|
275
|
1 |
|
OFPGMFC_OUT_OF_BUCKETS = 4 |
|
276
|
|
|
#: Switch does not support groups that forward to groups. |
|
277
|
1 |
|
OFPGMFC_CHAINING_UNSUPPORTED = 5 |
|
278
|
|
|
#: This group cannot watch the watch_port or watch_group specified. |
|
279
|
1 |
|
OFPGMFC_WATCH_UNSUPPORTED = 6 |
|
280
|
|
|
#: Group entry would cause a loop. |
|
281
|
1 |
|
OFPGMFC_LOOP = 7 |
|
282
|
|
|
#: Group not modified because a group MODIFY attempted to modify a |
|
283
|
|
|
#: non-existent group. |
|
284
|
1 |
|
OFPGMFC_UNKNOWN_GROUP = 8 |
|
285
|
|
|
#: Group not deleted because another group is forwarding to it. |
|
286
|
1 |
|
OFPGMFC_CHAINED_GROUP = 9 |
|
287
|
|
|
#: Unsupported or unknown group type. |
|
288
|
1 |
|
OFPGMFC_BAD_TYPE = 10 |
|
289
|
|
|
#: Unsupported or unknown command. |
|
290
|
1 |
|
OFPGMFC_BAD_COMMAND = 11 |
|
291
|
|
|
#: Error in bucket. |
|
292
|
1 |
|
OFPGMFC_BAD_BUCKET = 12 |
|
293
|
|
|
#: Error in watch port/group. |
|
294
|
1 |
|
OFPGMFC_BAD_WATCH = 13 |
|
295
|
|
|
#: Permissions error. |
|
296
|
1 |
|
OFPGMFC_EPERM = 14 |
|
297
|
|
|
|
|
298
|
|
|
|
|
299
|
1 |
|
class HelloFailedCode(IntEnum): |
|
300
|
|
|
"""Error_msg 'code' values for OFPET_HELLO_FAILED. |
|
301
|
|
|
|
|
302
|
|
|
'data' contains an ASCII text string that may give failure details. |
|
303
|
|
|
""" |
|
304
|
|
|
|
|
305
|
|
|
#: No compatible version |
|
306
|
1 |
|
OFPHFC_INCOMPATIBLE = 0 |
|
307
|
|
|
#: Permissions error |
|
308
|
1 |
|
OFPHFC_EPERM = 1 |
|
309
|
|
|
|
|
310
|
|
|
|
|
311
|
1 |
|
class MeterModFailedCode(IntEnum): |
|
312
|
|
|
"""Error msg 'code' values for OFPET_METER_MOD_FAILED. |
|
313
|
|
|
|
|
314
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
315
|
|
|
""" |
|
316
|
|
|
|
|
317
|
|
|
#: Unspecified error. |
|
318
|
1 |
|
OFPMMFC_UNKNOWN = 0 |
|
319
|
|
|
#: Meter not added because a Meter ADD * attempted to replace an existing |
|
320
|
|
|
#: Meter. |
|
321
|
1 |
|
OFPMMFC_METER_EXISTS = 1 |
|
322
|
|
|
#: Meter not added because Meter specified * is invalid. |
|
323
|
1 |
|
OFPMMFC_INVALID_METER = 2 |
|
324
|
|
|
#: Meter not modified because a Meter MODIFY attempted to modify a |
|
325
|
|
|
#: non-existent Meter. |
|
326
|
1 |
|
OFPMMFC_UNKNOWN_METER = 3 |
|
327
|
|
|
#: Unsupported or unknown command. |
|
328
|
1 |
|
OFPMMFC_BAD_COMMAND = 4 |
|
329
|
|
|
#: Flag configuration unsupported. |
|
330
|
1 |
|
OFPMMFC_BAD_FLAGS = 5 |
|
331
|
|
|
#: Rate unsupported. |
|
332
|
1 |
|
OFPMMFC_BAD_RATE = 6 |
|
333
|
|
|
#: Burst size unsupported. |
|
334
|
1 |
|
OFPMMFC_BAD_BURST = 7 |
|
335
|
|
|
#: Band unsupported. |
|
336
|
1 |
|
OFPMMFC_BAD_BAND = 8 |
|
337
|
|
|
#: Band value unsupported. |
|
338
|
1 |
|
OFPMMFC_BAD_BAND_VALUE = 9 |
|
339
|
|
|
#: No more meters available. |
|
340
|
1 |
|
OFPMMFC_OUT_OF_METERS = 10 |
|
341
|
|
|
#: The maximum number of properties * for a meter has been exceeded. |
|
342
|
1 |
|
OFPMMFC_OUT_OF_BANDS = 11 |
|
343
|
|
|
|
|
344
|
|
|
|
|
345
|
1 |
|
class PortModFailedCode(IntEnum): |
|
346
|
|
|
"""Error_msg 'code' values for OFPET_PORT_MOD_FAILED. |
|
347
|
|
|
|
|
348
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
349
|
|
|
""" |
|
350
|
|
|
|
|
351
|
|
|
#: Specified port number does not exist. |
|
352
|
1 |
|
OFPPMFC_BAD_PORT = 0 |
|
353
|
|
|
#: Specified hardware address does not * match the port number. |
|
354
|
1 |
|
OFPPMFC_BAD_HW_ADDR = 1 |
|
355
|
|
|
#: Specified config is invalid. |
|
356
|
1 |
|
OFPPMFC_BAD_CONFIG = 2 |
|
357
|
|
|
#: Specified advertise is invalid. |
|
358
|
1 |
|
OFPPMFC_BAD_ADVERTISE = 3 |
|
359
|
|
|
#: Permissions error. |
|
360
|
1 |
|
OFPPMFC_EPERM = 4 |
|
361
|
|
|
|
|
362
|
|
|
|
|
363
|
1 |
|
class QueueOpFailedCode(IntEnum): |
|
364
|
|
|
"""Error msg 'code' values for OFPET_QUEUE_OP_FAILED. |
|
365
|
|
|
|
|
366
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
367
|
|
|
""" |
|
368
|
|
|
|
|
369
|
|
|
#: Invalid port (or port does not exist) |
|
370
|
1 |
|
OFPQOFC_BAD_PORT = 0 |
|
371
|
|
|
#: Queue does not exist |
|
372
|
1 |
|
OFPQOFC_BAD_QUEUE = 1 |
|
373
|
|
|
#: Permissions error |
|
374
|
1 |
|
OFPQOFC_EPERM = 2 |
|
375
|
|
|
|
|
376
|
|
|
|
|
377
|
1 |
|
class RoleRequestFailedCode(IntEnum): |
|
378
|
|
|
"""Error msg 'code' values for OFPET_ROLE_REQUEST_FAILED. |
|
379
|
|
|
|
|
380
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
381
|
|
|
""" |
|
382
|
|
|
|
|
383
|
|
|
#: Stale Message: old generation_id. |
|
384
|
1 |
|
OFPRRFC_STALE = 0 |
|
385
|
|
|
#: Controller role change unsupported. |
|
386
|
1 |
|
OFPRRFC_UNSUP = 1 |
|
387
|
|
|
#: Invalid role. |
|
388
|
1 |
|
OFPRRFC_BAD_ROLE = 2 |
|
389
|
|
|
|
|
390
|
|
|
|
|
391
|
1 |
|
class SwitchConfigFailedCode(IntEnum): |
|
392
|
|
|
"""Error msg 'code' values for OFPET_SWITCH_CONFIG_FAILED. |
|
393
|
|
|
|
|
394
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
395
|
|
|
""" |
|
396
|
|
|
|
|
397
|
|
|
#: Specified flags is invalid. |
|
398
|
1 |
|
OFPSCFC_BAD_FLAGS = 0 |
|
399
|
|
|
#: Specified len is invalid. |
|
400
|
1 |
|
OFPSCFC_BAD_LEN = 1 |
|
401
|
|
|
#: Permissions error. |
|
402
|
1 |
|
OFPQCFC_EPERM = 2 |
|
403
|
|
|
|
|
404
|
|
|
|
|
405
|
1 |
|
class TableFeaturesFailedCode(IntEnum): |
|
406
|
|
|
"""Error msg 'code' values for OFPET_TABLE_FEATURES_FAILED. |
|
407
|
|
|
|
|
408
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
409
|
|
|
""" |
|
410
|
|
|
|
|
411
|
|
|
#: Specified table does not exist. |
|
412
|
1 |
|
OFPTFFC_BAD_TABLE = 0 |
|
413
|
|
|
#: Invalid metadata mask. |
|
414
|
1 |
|
OFPTFFC_BAD_METADATA = 1 |
|
415
|
|
|
#: Unknown property type. |
|
416
|
1 |
|
OFPTFFC_BAD_TYPE = 2 |
|
417
|
|
|
#: Length problem in properties. |
|
418
|
1 |
|
OFPTFFC_BAD_LEN = 3 |
|
419
|
|
|
#: Unsupported property value. |
|
420
|
1 |
|
OFPTFFC_BAD_ARGUMENT = 4 |
|
421
|
|
|
#: Permissions error. |
|
422
|
1 |
|
OFPTFFC_EPERM = 5 |
|
423
|
|
|
|
|
424
|
|
|
|
|
425
|
1 |
|
class TableModFailedCode(IntEnum): |
|
426
|
|
|
"""Error_msg 'code' values for OFPET_TABLE_MOD_FAILED. |
|
427
|
|
|
|
|
428
|
|
|
'data' contains at least the first 64 bytes of the failed request. |
|
429
|
|
|
""" |
|
430
|
|
|
|
|
431
|
|
|
#: Specified table does not exist. |
|
432
|
1 |
|
OFPTMFC_BAD_TABLE = 0 |
|
433
|
|
|
#: Specified config is invalid. |
|
434
|
1 |
|
OFPTMFC_BAD_CONFIG = 1 |
|
435
|
|
|
#: Permissions error. |
|
436
|
1 |
|
OFPTMFC_EPERM = 2 |
|
437
|
|
|
|
|
438
|
|
|
|
|
439
|
|
|
# Classes |
|
440
|
|
|
|
|
441
|
1 |
|
class ErrorMsg(GenericMessage): |
|
442
|
|
|
"""OpenFlow Error Message. |
|
443
|
|
|
|
|
444
|
|
|
This message does not contain a body in addition to the OpenFlow Header. |
|
445
|
|
|
""" |
|
446
|
|
|
|
|
447
|
|
|
#: :class:`~.header.Header`: OpenFlow Header |
|
448
|
1 |
|
header = Header(message_type=Type.OFPT_ERROR) |
|
449
|
|
|
#: ErrorType enum item |
|
450
|
1 |
|
error_type = UBInt16(enum_ref=ErrorType) |
|
451
|
|
|
#: Error code associated with ErrorType |
|
452
|
1 |
|
code = UBInt16() |
|
453
|
|
|
#: Variable-length data interpreted based on the type and code. No padding. |
|
454
|
1 |
|
data = BinaryData() |
|
455
|
|
|
|
|
456
|
1 |
|
def __init__(self, xid=None, error_type=None, code=None, data=b''): |
|
457
|
|
|
"""Assign parameters to object attributes. |
|
458
|
|
|
|
|
459
|
|
|
Args: |
|
460
|
|
|
xid (int): To be included in the message header. |
|
461
|
|
|
error_type (ErrorType): Error type. |
|
462
|
|
|
code (Enum): Error code. |
|
463
|
|
|
data: Its content is specified in the error code documentation. |
|
464
|
|
|
Unless specified otherwise, the data field contains at least |
|
465
|
|
|
64 bytes of the failed request that caused the error message to |
|
466
|
|
|
be generated, if the failed request is shorter than 64 bytes it |
|
467
|
|
|
should be the full request without any padding. |
|
468
|
|
|
""" |
|
469
|
1 |
|
super().__init__(xid) |
|
470
|
1 |
|
self.error_type = error_type |
|
471
|
1 |
|
self.code = code |
|
472
|
1 |
|
self.data = data |
|
473
|
|
|
|
|
474
|
1 |
|
def unpack(self, buff, offset=0): |
|
475
|
|
|
"""Unpack binary data into python object.""" |
|
476
|
1 |
|
super().unpack(buff, offset) |
|
477
|
1 |
|
code_class = ErrorType(self.error_type).get_class() |
|
478
|
1 |
|
self.code = code_class(self.code) |
|
479
|
|
|
|
|
480
|
|
|
|
|
481
|
1 |
|
class ErrorExperimenterMsg(GenericMessage): |
|
482
|
|
|
"""OFPET_EXPERIMENTER: Error message (datapath -> controller). |
|
483
|
|
|
|
|
484
|
|
|
The experimenter field is the Experimenter ID, which takes the same form as |
|
485
|
|
|
in :class:`~.symmetric.experimenter.ExperimenterHeader |
|
486
|
|
|
""" |
|
487
|
|
|
|
|
488
|
|
|
# :class:`~.header.Header`: OpenFlow Header |
|
489
|
1 |
|
header = Header(message_type=Type.OFPT_ERROR) |
|
490
|
|
|
#: OFPET_EXPERIMENTER. |
|
491
|
1 |
|
error_type = UBInt16(ErrorType.OFPET_EXPERIMENTER, |
|
492
|
|
|
enum_ref=ErrorType) |
|
493
|
|
|
#: Experimenter Defined |
|
494
|
1 |
|
exp_type = UBInt16() |
|
495
|
|
|
#: Experimenter ID which takes the same form as in |
|
496
|
|
|
#: :class:`~.symmetric.experimenter.ExperimenterHeader`. |
|
497
|
1 |
|
experimenter = UBInt32() |
|
498
|
|
|
#: Variable-length data interpreted based on the type and code. No padding. |
|
499
|
1 |
|
data = BinaryData() |
|
500
|
|
|
|
|
501
|
1 |
|
def __init__(self, xid=None, exp_type=None, experimenter=None, data=b''): |
|
502
|
|
|
"""Assign parameters to object attributes. |
|
503
|
|
|
|
|
504
|
|
|
Args: |
|
505
|
|
|
xid (int): To be included in the message header. |
|
506
|
|
|
exp_type (int): Experimenter defined. |
|
507
|
|
|
experimenter (int): Experimenter ID which takes the same form as in |
|
508
|
|
|
:class:`~.symmetric.experimenter.ExperimenterHeader`. |
|
509
|
|
|
data: Variable-length data interpreted based on the type and code. |
|
510
|
|
|
No padding. |
|
511
|
|
|
""" |
|
512
|
1 |
|
super().__init__(xid) |
|
513
|
1 |
|
self.exp_type = exp_type |
|
514
|
1 |
|
self.experimenter = experimenter |
|
515
|
1 |
|
self.data = data |
|
516
|
|
|
|
|
517
|
1 |
|
def unpack(self, buff, offset=0): |
|
518
|
|
|
"""Unpack binary data into python object.""" |
|
519
|
1 |
|
raise exceptions.MethodNotImplemented("'Unpack' method not " |
|
520
|
|
|
"implemented on ErrorMsg class") |
|
521
|
|
|
|