blob: 7bf9b629aaf55e58ef850407344c2b2833d92b14 [file] [log] [blame]
Matteo Scandoloa229eca2017-08-08 13:05:28 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Rich Laneca3da272013-05-05 09:07:33 -070017# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
18# Copyright (c) 2011, 2012 Open Networking Foundation
19# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -070020# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Laneca3da272013-05-05 09:07:33 -070021
Rich Lane7dcdf022013-12-11 14:45:27 -080022# Automatically generated by LOXI from template module.py
Rich Laneca3da272013-05-05 09:07:33 -070023# Do not modify
24
25import struct
Rich Lane7dcdf022013-12-11 14:45:27 -080026import loxi
Rich Laneca3da272013-05-05 09:07:33 -070027import util
28import loxi.generic_util
Rich Laneca3da272013-05-05 09:07:33 -070029
Rich Lanee2567702015-01-26 15:04:35 -080030import sys
31ofp = sys.modules['loxi.of13']
32
Rich Lane7dcdf022013-12-11 14:45:27 -080033class instruction(loxi.OFObject):
34 subtypes = {}
Rich Laneca3da272013-05-05 09:07:33 -070035
Rich Lane95f7fc92014-01-27 17:08:16 -080036
37 def __init__(self, type=None):
38 if type != None:
39 self.type = type
40 else:
41 self.type = 0
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!H", self.type))
47 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
48 length = sum([len(x) for x in packed])
49 packed[1] = struct.pack("!H", length)
50 return ''.join(packed)
51
Rich Lane7dcdf022013-12-11 14:45:27 -080052 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080055 subclass = instruction.subtypes.get(subtype)
56 if subclass:
57 return subclass.unpack(reader)
58
59 obj = instruction()
60 obj.type = reader.read("!H")[0]
61 _len = reader.read("!H")[0]
62 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080063 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080064 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("instruction {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.breakable()
77 q.text('}')
Rich Laneca3da272013-05-05 09:07:33 -070078
Rich Lane7dcdf022013-12-11 14:45:27 -080079
80class apply_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -070081 type = 4
Rich Laneca3da272013-05-05 09:07:33 -070082
83 def __init__(self, actions=None):
84 if actions != None:
85 self.actions = actions
86 else:
87 self.actions = []
88 return
89
90 def pack(self):
91 packed = []
92 packed.append(struct.pack("!H", self.type))
93 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
94 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080095 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneca3da272013-05-05 09:07:33 -070096 length = sum([len(x) for x in packed])
97 packed[1] = struct.pack("!H", length)
98 return ''.join(packed)
99
100 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800101 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700102 obj = apply_actions()
Dan Talaycof6202252013-07-02 01:00:29 -0700103 _type = reader.read("!H")[0]
104 assert(_type == 4)
105 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800106 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800107 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -0700108 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -0800109 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneca3da272013-05-05 09:07:33 -0700110 return obj
111
112 def __eq__(self, other):
113 if type(self) != type(other): return False
114 if self.actions != other.actions: return False
115 return True
116
Rich Laneca3da272013-05-05 09:07:33 -0700117 def pretty_print(self, q):
118 q.text("apply_actions {")
119 with q.group():
120 with q.indent(2):
121 q.breakable()
122 q.text("actions = ");
123 q.pp(self.actions)
124 q.breakable()
125 q.text('}')
126
Rich Lane7dcdf022013-12-11 14:45:27 -0800127instruction.subtypes[4] = apply_actions
128
129class experimenter(instruction):
130 subtypes = {}
131
Rich Lane95f7fc92014-01-27 17:08:16 -0800132 type = 65535
133
134 def __init__(self, experimenter=None, data=None):
135 if experimenter != None:
136 self.experimenter = experimenter
137 else:
138 self.experimenter = 0
139 if data != None:
140 self.data = data
141 else:
142 self.data = ''
143 return
144
145 def pack(self):
146 packed = []
147 packed.append(struct.pack("!H", self.type))
148 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
149 packed.append(struct.pack("!L", self.experimenter))
150 packed.append(self.data)
151 length = sum([len(x) for x in packed])
152 packed[1] = struct.pack("!H", length)
153 return ''.join(packed)
154
Rich Lane7dcdf022013-12-11 14:45:27 -0800155 @staticmethod
156 def unpack(reader):
157 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800158 subclass = experimenter.subtypes.get(subtype)
159 if subclass:
160 return subclass.unpack(reader)
161
162 obj = experimenter()
163 _type = reader.read("!H")[0]
164 assert(_type == 65535)
165 _len = reader.read("!H")[0]
166 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800167 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800168 obj.experimenter = reader.read("!L")[0]
169 obj.data = str(reader.read_all())
170 return obj
171
172 def __eq__(self, other):
173 if type(self) != type(other): return False
174 if self.experimenter != other.experimenter: return False
175 if self.data != other.data: return False
176 return True
177
178 def pretty_print(self, q):
179 q.text("experimenter {")
180 with q.group():
181 with q.indent(2):
182 q.breakable()
183 q.text("data = ");
184 q.pp(self.data)
185 q.breakable()
186 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800187
188instruction.subtypes[65535] = experimenter
189
190class bsn(experimenter):
191 subtypes = {}
192
Rich Lane95f7fc92014-01-27 17:08:16 -0800193 type = 65535
194 experimenter = 6035143
195
196 def __init__(self, subtype=None):
197 if subtype != None:
198 self.subtype = subtype
199 else:
200 self.subtype = 0
201 return
202
203 def pack(self):
204 packed = []
205 packed.append(struct.pack("!H", self.type))
206 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
207 packed.append(struct.pack("!L", self.experimenter))
208 packed.append(struct.pack("!L", self.subtype))
209 packed.append('\x00' * 4)
210 length = sum([len(x) for x in packed])
211 packed[1] = struct.pack("!H", length)
212 return ''.join(packed)
213
Rich Lane7dcdf022013-12-11 14:45:27 -0800214 @staticmethod
215 def unpack(reader):
216 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800217 subclass = bsn.subtypes.get(subtype)
218 if subclass:
219 return subclass.unpack(reader)
220
221 obj = bsn()
222 _type = reader.read("!H")[0]
223 assert(_type == 65535)
224 _len = reader.read("!H")[0]
225 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800226 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800227 _experimenter = reader.read("!L")[0]
228 assert(_experimenter == 6035143)
229 obj.subtype = reader.read("!L")[0]
230 reader.skip(4)
231 return obj
232
233 def __eq__(self, other):
234 if type(self) != type(other): return False
235 if self.subtype != other.subtype: return False
236 return True
237
238 def pretty_print(self, q):
239 q.text("bsn {")
240 with q.group():
241 with q.indent(2):
242 q.breakable()
243 q.breakable()
244 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800245
246experimenter.subtypes[6035143] = bsn
247
Rich Lane5454b682014-01-14 17:07:36 -0800248class bsn_arp_offload(bsn):
249 type = 65535
250 experimenter = 6035143
251 subtype = 1
252
253 def __init__(self):
254 return
255
256 def pack(self):
257 packed = []
258 packed.append(struct.pack("!H", self.type))
259 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
260 packed.append(struct.pack("!L", self.experimenter))
261 packed.append(struct.pack("!L", self.subtype))
262 packed.append('\x00' * 4)
263 length = sum([len(x) for x in packed])
264 packed[1] = struct.pack("!H", length)
265 return ''.join(packed)
266
267 @staticmethod
268 def unpack(reader):
269 obj = bsn_arp_offload()
270 _type = reader.read("!H")[0]
271 assert(_type == 65535)
272 _len = reader.read("!H")[0]
273 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800274 reader = orig_reader.slice(_len, 4)
Rich Lane5454b682014-01-14 17:07:36 -0800275 _experimenter = reader.read("!L")[0]
276 assert(_experimenter == 6035143)
277 _subtype = reader.read("!L")[0]
278 assert(_subtype == 1)
279 reader.skip(4)
280 return obj
281
282 def __eq__(self, other):
283 if type(self) != type(other): return False
284 return True
285
286 def pretty_print(self, q):
287 q.text("bsn_arp_offload {")
288 with q.group():
289 with q.indent(2):
290 q.breakable()
291 q.breakable()
292 q.text('}')
293
294bsn.subtypes[1] = bsn_arp_offload
295
Harshmeet Singh301f7172014-12-08 13:07:29 -0800296class bsn_auto_negotiation(bsn):
297 type = 65535
298 experimenter = 6035143
299 subtype = 11
300
301 def __init__(self):
302 return
303
304 def pack(self):
305 packed = []
306 packed.append(struct.pack("!H", self.type))
307 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
308 packed.append(struct.pack("!L", self.experimenter))
309 packed.append(struct.pack("!L", self.subtype))
310 packed.append('\x00' * 4)
311 length = sum([len(x) for x in packed])
312 packed[1] = struct.pack("!H", length)
313 return ''.join(packed)
314
315 @staticmethod
316 def unpack(reader):
317 obj = bsn_auto_negotiation()
318 _type = reader.read("!H")[0]
319 assert(_type == 65535)
320 _len = reader.read("!H")[0]
321 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800322 reader = orig_reader.slice(_len, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -0800323 _experimenter = reader.read("!L")[0]
324 assert(_experimenter == 6035143)
325 _subtype = reader.read("!L")[0]
326 assert(_subtype == 11)
327 reader.skip(4)
328 return obj
329
330 def __eq__(self, other):
331 if type(self) != type(other): return False
332 return True
333
334 def pretty_print(self, q):
335 q.text("bsn_auto_negotiation {")
336 with q.group():
337 with q.indent(2):
338 q.breakable()
339 q.breakable()
340 q.text('}')
341
342bsn.subtypes[11] = bsn_auto_negotiation
343
Rich Lane9ec3fca2014-02-26 16:22:56 -0800344class bsn_deny(bsn):
345 type = 65535
346 experimenter = 6035143
347 subtype = 5
348
349 def __init__(self):
350 return
351
352 def pack(self):
353 packed = []
354 packed.append(struct.pack("!H", self.type))
355 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
356 packed.append(struct.pack("!L", self.experimenter))
357 packed.append(struct.pack("!L", self.subtype))
358 packed.append('\x00' * 4)
359 length = sum([len(x) for x in packed])
360 packed[1] = struct.pack("!H", length)
361 return ''.join(packed)
362
363 @staticmethod
364 def unpack(reader):
365 obj = bsn_deny()
366 _type = reader.read("!H")[0]
367 assert(_type == 65535)
368 _len = reader.read("!H")[0]
369 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800370 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800371 _experimenter = reader.read("!L")[0]
372 assert(_experimenter == 6035143)
373 _subtype = reader.read("!L")[0]
374 assert(_subtype == 5)
375 reader.skip(4)
376 return obj
377
378 def __eq__(self, other):
379 if type(self) != type(other): return False
380 return True
381
382 def pretty_print(self, q):
383 q.text("bsn_deny {")
384 with q.group():
385 with q.indent(2):
386 q.breakable()
387 q.breakable()
388 q.text('}')
389
390bsn.subtypes[5] = bsn_deny
391
Rich Lane1b75abf2014-02-05 11:23:20 -0800392class bsn_dhcp_offload(bsn):
393 type = 65535
394 experimenter = 6035143
395 subtype = 2
396
397 def __init__(self):
398 return
399
400 def pack(self):
401 packed = []
402 packed.append(struct.pack("!H", self.type))
403 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
404 packed.append(struct.pack("!L", self.experimenter))
405 packed.append(struct.pack("!L", self.subtype))
406 packed.append('\x00' * 4)
407 length = sum([len(x) for x in packed])
408 packed[1] = struct.pack("!H", length)
409 return ''.join(packed)
410
411 @staticmethod
412 def unpack(reader):
413 obj = bsn_dhcp_offload()
414 _type = reader.read("!H")[0]
415 assert(_type == 65535)
416 _len = reader.read("!H")[0]
417 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800418 reader = orig_reader.slice(_len, 4)
Rich Lane1b75abf2014-02-05 11:23:20 -0800419 _experimenter = reader.read("!L")[0]
420 assert(_experimenter == 6035143)
421 _subtype = reader.read("!L")[0]
422 assert(_subtype == 2)
423 reader.skip(4)
424 return obj
425
426 def __eq__(self, other):
427 if type(self) != type(other): return False
428 return True
429
430 def pretty_print(self, q):
431 q.text("bsn_dhcp_offload {")
432 with q.group():
433 with q.indent(2):
434 q.breakable()
435 q.breakable()
436 q.text('}')
437
438bsn.subtypes[2] = bsn_dhcp_offload
439
Kiran Poola36a302c2015-04-22 11:20:16 -0700440class bsn_disable_l3(bsn):
441 type = 65535
442 experimenter = 6035143
443 subtype = 13
444
445 def __init__(self):
446 return
447
448 def pack(self):
449 packed = []
450 packed.append(struct.pack("!H", self.type))
451 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
452 packed.append(struct.pack("!L", self.experimenter))
453 packed.append(struct.pack("!L", self.subtype))
454 packed.append('\x00' * 4)
455 length = sum([len(x) for x in packed])
456 packed[1] = struct.pack("!H", length)
457 return ''.join(packed)
458
459 @staticmethod
460 def unpack(reader):
461 obj = bsn_disable_l3()
462 _type = reader.read("!H")[0]
463 assert(_type == 65535)
464 _len = reader.read("!H")[0]
465 orig_reader = reader
466 reader = orig_reader.slice(_len, 4)
467 _experimenter = reader.read("!L")[0]
468 assert(_experimenter == 6035143)
469 _subtype = reader.read("!L")[0]
470 assert(_subtype == 13)
471 reader.skip(4)
472 return obj
473
474 def __eq__(self, other):
475 if type(self) != type(other): return False
476 return True
477
478 def pretty_print(self, q):
479 q.text("bsn_disable_l3 {")
480 with q.group():
481 with q.indent(2):
482 q.breakable()
483 q.breakable()
484 q.text('}')
485
486bsn.subtypes[13] = bsn_disable_l3
487
Rich Lane9ec3fca2014-02-26 16:22:56 -0800488class bsn_disable_split_horizon_check(bsn):
489 type = 65535
490 experimenter = 6035143
491 subtype = 3
492
493 def __init__(self):
494 return
495
496 def pack(self):
497 packed = []
498 packed.append(struct.pack("!H", self.type))
499 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
500 packed.append(struct.pack("!L", self.experimenter))
501 packed.append(struct.pack("!L", self.subtype))
502 packed.append('\x00' * 4)
503 length = sum([len(x) for x in packed])
504 packed[1] = struct.pack("!H", length)
505 return ''.join(packed)
506
507 @staticmethod
508 def unpack(reader):
509 obj = bsn_disable_split_horizon_check()
510 _type = reader.read("!H")[0]
511 assert(_type == 65535)
512 _len = reader.read("!H")[0]
513 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800514 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800515 _experimenter = reader.read("!L")[0]
516 assert(_experimenter == 6035143)
517 _subtype = reader.read("!L")[0]
518 assert(_subtype == 3)
519 reader.skip(4)
520 return obj
521
522 def __eq__(self, other):
523 if type(self) != type(other): return False
524 return True
525
526 def pretty_print(self, q):
527 q.text("bsn_disable_split_horizon_check {")
528 with q.group():
529 with q.indent(2):
530 q.breakable()
531 q.breakable()
532 q.text('}')
533
534bsn.subtypes[3] = bsn_disable_split_horizon_check
535
Rich Lane7dcdf022013-12-11 14:45:27 -0800536class bsn_disable_src_mac_check(bsn):
Rich Lane7b0f2012013-11-22 14:15:26 -0800537 type = 65535
538 experimenter = 6035143
539 subtype = 0
540
541 def __init__(self):
542 return
543
544 def pack(self):
545 packed = []
546 packed.append(struct.pack("!H", self.type))
547 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
548 packed.append(struct.pack("!L", self.experimenter))
549 packed.append(struct.pack("!L", self.subtype))
550 packed.append('\x00' * 4)
551 length = sum([len(x) for x in packed])
552 packed[1] = struct.pack("!H", length)
553 return ''.join(packed)
554
555 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800556 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -0800557 obj = bsn_disable_src_mac_check()
Rich Lane7b0f2012013-11-22 14:15:26 -0800558 _type = reader.read("!H")[0]
559 assert(_type == 65535)
560 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800561 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800562 reader = orig_reader.slice(_len, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -0800563 _experimenter = reader.read("!L")[0]
564 assert(_experimenter == 6035143)
565 _subtype = reader.read("!L")[0]
566 assert(_subtype == 0)
567 reader.skip(4)
568 return obj
569
570 def __eq__(self, other):
571 if type(self) != type(other): return False
572 return True
573
Rich Lane7b0f2012013-11-22 14:15:26 -0800574 def pretty_print(self, q):
575 q.text("bsn_disable_src_mac_check {")
576 with q.group():
577 with q.indent(2):
578 q.breakable()
579 q.breakable()
580 q.text('}')
581
Rich Lane7dcdf022013-12-11 14:45:27 -0800582bsn.subtypes[0] = bsn_disable_src_mac_check
583
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700584class bsn_disable_vlan_counters(bsn):
585 type = 65535
586 experimenter = 6035143
587 subtype = 9
588
589 def __init__(self):
590 return
591
592 def pack(self):
593 packed = []
594 packed.append(struct.pack("!H", self.type))
595 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
596 packed.append(struct.pack("!L", self.experimenter))
597 packed.append(struct.pack("!L", self.subtype))
598 packed.append('\x00' * 4)
599 length = sum([len(x) for x in packed])
600 packed[1] = struct.pack("!H", length)
601 return ''.join(packed)
602
603 @staticmethod
604 def unpack(reader):
605 obj = bsn_disable_vlan_counters()
606 _type = reader.read("!H")[0]
607 assert(_type == 65535)
608 _len = reader.read("!H")[0]
609 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800610 reader = orig_reader.slice(_len, 4)
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700611 _experimenter = reader.read("!L")[0]
612 assert(_experimenter == 6035143)
613 _subtype = reader.read("!L")[0]
614 assert(_subtype == 9)
615 reader.skip(4)
616 return obj
617
618 def __eq__(self, other):
619 if type(self) != type(other): return False
620 return True
621
622 def pretty_print(self, q):
623 q.text("bsn_disable_vlan_counters {")
624 with q.group():
625 with q.indent(2):
626 q.breakable()
627 q.breakable()
628 q.text('}')
629
630bsn.subtypes[9] = bsn_disable_vlan_counters
631
Rich Lane7b69e792015-03-31 11:12:50 -0700632class bsn_internal_priority(bsn):
633 type = 65535
634 experimenter = 6035143
635 subtype = 12
636
637 def __init__(self, value=None):
638 if value != None:
639 self.value = value
640 else:
641 self.value = 0
642 return
643
644 def pack(self):
645 packed = []
646 packed.append(struct.pack("!H", self.type))
647 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
648 packed.append(struct.pack("!L", self.experimenter))
649 packed.append(struct.pack("!L", self.subtype))
650 packed.append(struct.pack("!L", self.value))
651 length = sum([len(x) for x in packed])
652 packed[1] = struct.pack("!H", length)
653 return ''.join(packed)
654
655 @staticmethod
656 def unpack(reader):
657 obj = bsn_internal_priority()
658 _type = reader.read("!H")[0]
659 assert(_type == 65535)
660 _len = reader.read("!H")[0]
661 orig_reader = reader
662 reader = orig_reader.slice(_len, 4)
663 _experimenter = reader.read("!L")[0]
664 assert(_experimenter == 6035143)
665 _subtype = reader.read("!L")[0]
666 assert(_subtype == 12)
667 obj.value = reader.read("!L")[0]
668 return obj
669
670 def __eq__(self, other):
671 if type(self) != type(other): return False
672 if self.value != other.value: return False
673 return True
674
675 def pretty_print(self, q):
676 q.text("bsn_internal_priority {")
677 with q.group():
678 with q.indent(2):
679 q.breakable()
680 q.text("value = ");
681 q.text("%#x" % self.value)
682 q.breakable()
683 q.text('}')
684
685bsn.subtypes[12] = bsn_internal_priority
686
Rich Lanef50b7c32014-03-20 11:38:02 -0700687class bsn_packet_of_death(bsn):
688 type = 65535
689 experimenter = 6035143
690 subtype = 6
691
692 def __init__(self):
693 return
694
695 def pack(self):
696 packed = []
697 packed.append(struct.pack("!H", self.type))
698 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
699 packed.append(struct.pack("!L", self.experimenter))
700 packed.append(struct.pack("!L", self.subtype))
701 packed.append('\x00' * 4)
702 length = sum([len(x) for x in packed])
703 packed[1] = struct.pack("!H", length)
704 return ''.join(packed)
705
706 @staticmethod
707 def unpack(reader):
708 obj = bsn_packet_of_death()
709 _type = reader.read("!H")[0]
710 assert(_type == 65535)
711 _len = reader.read("!H")[0]
712 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800713 reader = orig_reader.slice(_len, 4)
Rich Lanef50b7c32014-03-20 11:38:02 -0700714 _experimenter = reader.read("!L")[0]
715 assert(_experimenter == 6035143)
716 _subtype = reader.read("!L")[0]
717 assert(_subtype == 6)
718 reader.skip(4)
719 return obj
720
721 def __eq__(self, other):
722 if type(self) != type(other): return False
723 return True
724
725 def pretty_print(self, q):
726 q.text("bsn_packet_of_death {")
727 with q.group():
728 with q.indent(2):
729 q.breakable()
730 q.breakable()
731 q.text('}')
732
733bsn.subtypes[6] = bsn_packet_of_death
734
Rich Lane9ec3fca2014-02-26 16:22:56 -0800735class bsn_permit(bsn):
736 type = 65535
737 experimenter = 6035143
738 subtype = 4
739
740 def __init__(self):
741 return
742
743 def pack(self):
744 packed = []
745 packed.append(struct.pack("!H", self.type))
746 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
747 packed.append(struct.pack("!L", self.experimenter))
748 packed.append(struct.pack("!L", self.subtype))
749 packed.append('\x00' * 4)
750 length = sum([len(x) for x in packed])
751 packed[1] = struct.pack("!H", length)
752 return ''.join(packed)
753
754 @staticmethod
755 def unpack(reader):
756 obj = bsn_permit()
757 _type = reader.read("!H")[0]
758 assert(_type == 65535)
759 _len = reader.read("!H")[0]
760 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800761 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800762 _experimenter = reader.read("!L")[0]
763 assert(_experimenter == 6035143)
764 _subtype = reader.read("!L")[0]
765 assert(_subtype == 4)
766 reader.skip(4)
767 return obj
768
769 def __eq__(self, other):
770 if type(self) != type(other): return False
771 return True
772
773 def pretty_print(self, q):
774 q.text("bsn_permit {")
775 with q.group():
776 with q.indent(2):
777 q.breakable()
778 q.breakable()
779 q.text('}')
780
781bsn.subtypes[4] = bsn_permit
782
Rich Lane78d9bcb2014-05-12 13:27:44 -0700783class bsn_prioritize_pdus(bsn):
784 type = 65535
785 experimenter = 6035143
786 subtype = 7
787
788 def __init__(self):
789 return
790
791 def pack(self):
792 packed = []
793 packed.append(struct.pack("!H", self.type))
794 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
795 packed.append(struct.pack("!L", self.experimenter))
796 packed.append(struct.pack("!L", self.subtype))
797 packed.append('\x00' * 4)
798 length = sum([len(x) for x in packed])
799 packed[1] = struct.pack("!H", length)
800 return ''.join(packed)
801
802 @staticmethod
803 def unpack(reader):
804 obj = bsn_prioritize_pdus()
805 _type = reader.read("!H")[0]
806 assert(_type == 65535)
807 _len = reader.read("!H")[0]
808 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800809 reader = orig_reader.slice(_len, 4)
Rich Lane78d9bcb2014-05-12 13:27:44 -0700810 _experimenter = reader.read("!L")[0]
811 assert(_experimenter == 6035143)
812 _subtype = reader.read("!L")[0]
813 assert(_subtype == 7)
814 reader.skip(4)
815 return obj
816
817 def __eq__(self, other):
818 if type(self) != type(other): return False
819 return True
820
821 def pretty_print(self, q):
822 q.text("bsn_prioritize_pdus {")
823 with q.group():
824 with q.indent(2):
825 q.breakable()
826 q.breakable()
827 q.text('}')
828
829bsn.subtypes[7] = bsn_prioritize_pdus
830
Rich Lane5587ab12014-06-30 11:19:09 -0700831class bsn_require_vlan_xlate(bsn):
832 type = 65535
833 experimenter = 6035143
834 subtype = 8
835
836 def __init__(self):
837 return
838
839 def pack(self):
840 packed = []
841 packed.append(struct.pack("!H", self.type))
842 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
843 packed.append(struct.pack("!L", self.experimenter))
844 packed.append(struct.pack("!L", self.subtype))
845 packed.append('\x00' * 4)
846 length = sum([len(x) for x in packed])
847 packed[1] = struct.pack("!H", length)
848 return ''.join(packed)
849
850 @staticmethod
851 def unpack(reader):
852 obj = bsn_require_vlan_xlate()
853 _type = reader.read("!H")[0]
854 assert(_type == 65535)
855 _len = reader.read("!H")[0]
856 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800857 reader = orig_reader.slice(_len, 4)
Rich Lane5587ab12014-06-30 11:19:09 -0700858 _experimenter = reader.read("!L")[0]
859 assert(_experimenter == 6035143)
860 _subtype = reader.read("!L")[0]
861 assert(_subtype == 8)
862 reader.skip(4)
863 return obj
864
865 def __eq__(self, other):
866 if type(self) != type(other): return False
867 return True
868
869 def pretty_print(self, q):
870 q.text("bsn_require_vlan_xlate {")
871 with q.group():
872 with q.indent(2):
873 q.breakable()
874 q.breakable()
875 q.text('}')
876
877bsn.subtypes[8] = bsn_require_vlan_xlate
878
Rich Lanef9530c42014-09-15 09:59:43 -0700879class bsn_span_destination(bsn):
880 type = 65535
881 experimenter = 6035143
882 subtype = 10
883
884 def __init__(self):
885 return
886
887 def pack(self):
888 packed = []
889 packed.append(struct.pack("!H", self.type))
890 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
891 packed.append(struct.pack("!L", self.experimenter))
892 packed.append(struct.pack("!L", self.subtype))
893 packed.append('\x00' * 4)
894 length = sum([len(x) for x in packed])
895 packed[1] = struct.pack("!H", length)
896 return ''.join(packed)
897
898 @staticmethod
899 def unpack(reader):
900 obj = bsn_span_destination()
901 _type = reader.read("!H")[0]
902 assert(_type == 65535)
903 _len = reader.read("!H")[0]
904 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800905 reader = orig_reader.slice(_len, 4)
Rich Lanef9530c42014-09-15 09:59:43 -0700906 _experimenter = reader.read("!L")[0]
907 assert(_experimenter == 6035143)
908 _subtype = reader.read("!L")[0]
909 assert(_subtype == 10)
910 reader.skip(4)
911 return obj
912
913 def __eq__(self, other):
914 if type(self) != type(other): return False
915 return True
916
917 def pretty_print(self, q):
918 q.text("bsn_span_destination {")
919 with q.group():
920 with q.indent(2):
921 q.breakable()
922 q.breakable()
923 q.text('}')
924
925bsn.subtypes[10] = bsn_span_destination
926
Rich Lane7dcdf022013-12-11 14:45:27 -0800927class clear_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700928 type = 5
Rich Laneca3da272013-05-05 09:07:33 -0700929
930 def __init__(self):
931 return
932
933 def pack(self):
934 packed = []
935 packed.append(struct.pack("!H", self.type))
936 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
937 packed.append('\x00' * 4)
938 length = sum([len(x) for x in packed])
939 packed[1] = struct.pack("!H", length)
940 return ''.join(packed)
941
942 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800943 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700944 obj = clear_actions()
Dan Talaycof6202252013-07-02 01:00:29 -0700945 _type = reader.read("!H")[0]
946 assert(_type == 5)
947 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800948 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800949 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -0700950 reader.skip(4)
951 return obj
952
953 def __eq__(self, other):
954 if type(self) != type(other): return False
955 return True
956
Rich Laneca3da272013-05-05 09:07:33 -0700957 def pretty_print(self, q):
958 q.text("clear_actions {")
959 with q.group():
960 with q.indent(2):
961 q.breakable()
962 q.breakable()
963 q.text('}')
964
Rich Lane7dcdf022013-12-11 14:45:27 -0800965instruction.subtypes[5] = clear_actions
966
967class goto_table(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700968 type = 1
Rich Laneca3da272013-05-05 09:07:33 -0700969
970 def __init__(self, table_id=None):
971 if table_id != None:
972 self.table_id = table_id
973 else:
974 self.table_id = 0
975 return
976
977 def pack(self):
978 packed = []
979 packed.append(struct.pack("!H", self.type))
980 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
981 packed.append(struct.pack("!B", self.table_id))
982 packed.append('\x00' * 3)
983 length = sum([len(x) for x in packed])
984 packed[1] = struct.pack("!H", length)
985 return ''.join(packed)
986
987 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800988 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700989 obj = goto_table()
Dan Talaycof6202252013-07-02 01:00:29 -0700990 _type = reader.read("!H")[0]
991 assert(_type == 1)
992 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800993 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800994 reader = orig_reader.slice(_len, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700995 obj.table_id = reader.read("!B")[0]
Rich Laneca3da272013-05-05 09:07:33 -0700996 reader.skip(3)
997 return obj
998
999 def __eq__(self, other):
1000 if type(self) != type(other): return False
1001 if self.table_id != other.table_id: return False
1002 return True
1003
Rich Laneca3da272013-05-05 09:07:33 -07001004 def pretty_print(self, q):
1005 q.text("goto_table {")
1006 with q.group():
1007 with q.indent(2):
1008 q.breakable()
1009 q.text("table_id = ");
1010 q.text("%#x" % self.table_id)
1011 q.breakable()
1012 q.text('}')
1013
Rich Lane7dcdf022013-12-11 14:45:27 -08001014instruction.subtypes[1] = goto_table
1015
1016class meter(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -07001017 type = 6
Rich Laneca3da272013-05-05 09:07:33 -07001018
1019 def __init__(self, meter_id=None):
1020 if meter_id != None:
1021 self.meter_id = meter_id
1022 else:
1023 self.meter_id = 0
1024 return
1025
1026 def pack(self):
1027 packed = []
1028 packed.append(struct.pack("!H", self.type))
1029 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1030 packed.append(struct.pack("!L", self.meter_id))
1031 length = sum([len(x) for x in packed])
1032 packed[1] = struct.pack("!H", length)
1033 return ''.join(packed)
1034
1035 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001036 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -07001037 obj = meter()
Dan Talaycof6202252013-07-02 01:00:29 -07001038 _type = reader.read("!H")[0]
1039 assert(_type == 6)
1040 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001041 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001042 reader = orig_reader.slice(_len, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001043 obj.meter_id = reader.read("!L")[0]
Rich Laneca3da272013-05-05 09:07:33 -07001044 return obj
1045
1046 def __eq__(self, other):
1047 if type(self) != type(other): return False
1048 if self.meter_id != other.meter_id: return False
1049 return True
1050
Rich Laneca3da272013-05-05 09:07:33 -07001051 def pretty_print(self, q):
1052 q.text("meter {")
1053 with q.group():
1054 with q.indent(2):
1055 q.breakable()
1056 q.text("meter_id = ");
1057 q.text("%#x" % self.meter_id)
1058 q.breakable()
1059 q.text('}')
1060
Rich Lane7dcdf022013-12-11 14:45:27 -08001061instruction.subtypes[6] = meter
1062
1063class write_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -07001064 type = 3
Rich Laneca3da272013-05-05 09:07:33 -07001065
1066 def __init__(self, actions=None):
1067 if actions != None:
1068 self.actions = actions
1069 else:
1070 self.actions = []
1071 return
1072
1073 def pack(self):
1074 packed = []
1075 packed.append(struct.pack("!H", self.type))
1076 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1077 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001078 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneca3da272013-05-05 09:07:33 -07001079 length = sum([len(x) for x in packed])
1080 packed[1] = struct.pack("!H", length)
1081 return ''.join(packed)
1082
1083 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001084 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -07001085 obj = write_actions()
Dan Talaycof6202252013-07-02 01:00:29 -07001086 _type = reader.read("!H")[0]
1087 assert(_type == 3)
1088 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001089 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001090 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -07001091 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -08001092 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneca3da272013-05-05 09:07:33 -07001093 return obj
1094
1095 def __eq__(self, other):
1096 if type(self) != type(other): return False
1097 if self.actions != other.actions: return False
1098 return True
1099
Rich Laneca3da272013-05-05 09:07:33 -07001100 def pretty_print(self, q):
1101 q.text("write_actions {")
1102 with q.group():
1103 with q.indent(2):
1104 q.breakable()
1105 q.text("actions = ");
1106 q.pp(self.actions)
1107 q.breakable()
1108 q.text('}')
1109
Rich Lane7dcdf022013-12-11 14:45:27 -08001110instruction.subtypes[3] = write_actions
1111
1112class write_metadata(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -07001113 type = 2
Rich Laneca3da272013-05-05 09:07:33 -07001114
1115 def __init__(self, metadata=None, metadata_mask=None):
1116 if metadata != None:
1117 self.metadata = metadata
1118 else:
1119 self.metadata = 0
1120 if metadata_mask != None:
1121 self.metadata_mask = metadata_mask
1122 else:
1123 self.metadata_mask = 0
1124 return
1125
1126 def pack(self):
1127 packed = []
1128 packed.append(struct.pack("!H", self.type))
1129 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1130 packed.append('\x00' * 4)
1131 packed.append(struct.pack("!Q", self.metadata))
1132 packed.append(struct.pack("!Q", self.metadata_mask))
1133 length = sum([len(x) for x in packed])
1134 packed[1] = struct.pack("!H", length)
1135 return ''.join(packed)
1136
1137 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001138 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -07001139 obj = write_metadata()
Dan Talaycof6202252013-07-02 01:00:29 -07001140 _type = reader.read("!H")[0]
1141 assert(_type == 2)
1142 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001143 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001144 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -07001145 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001146 obj.metadata = reader.read("!Q")[0]
1147 obj.metadata_mask = reader.read("!Q")[0]
Rich Laneca3da272013-05-05 09:07:33 -07001148 return obj
1149
1150 def __eq__(self, other):
1151 if type(self) != type(other): return False
1152 if self.metadata != other.metadata: return False
1153 if self.metadata_mask != other.metadata_mask: return False
1154 return True
1155
Rich Laneca3da272013-05-05 09:07:33 -07001156 def pretty_print(self, q):
1157 q.text("write_metadata {")
1158 with q.group():
1159 with q.indent(2):
1160 q.breakable()
1161 q.text("metadata = ");
1162 q.text("%#x" % self.metadata)
1163 q.text(","); q.breakable()
1164 q.text("metadata_mask = ");
1165 q.text("%#x" % self.metadata_mask)
1166 q.breakable()
1167 q.text('}')
1168
Rich Lane7dcdf022013-12-11 14:45:27 -08001169instruction.subtypes[2] = write_metadata
Rich Laneca3da272013-05-05 09:07:33 -07001170
Rich Lane7b0f2012013-11-22 14:15:26 -08001171