blob: 447cd17148a4b66ba21af0d0949a56b72ca2bcc0 [file] [log] [blame]
Rich Lane5ec97b82013-01-06 18:04:25 -08001
2# Python OpenFlow action wrapper classes
3
4from cstruct import *
5
6
7
8class action_set_nw_src(ofp_action_nw_addr):
9 """
10 Wrapper class for set_nw_src action object
11
12 Data members inherited from ofp_action_nw_addr:
13 @arg type
14 @arg len
15 @arg nw_addr
16
17 """
18 def __init__(self):
19 ofp_action_nw_addr.__init__(self)
20 self.type = OFPAT_SET_NW_SRC
21 self.len = self.__len__()
22 def show(self, prefix=''):
23 outstr = prefix + "action_set_nw_src\n"
24 outstr += ofp_action_nw_addr.show(self, prefix)
25 return outstr
26
27
28class action_set_mpls_tc(ofp_action_mpls_tc):
29 """
30 Wrapper class for set_mpls_tc action object
31
32 Data members inherited from ofp_action_mpls_tc:
33 @arg type
34 @arg len
35 @arg mpls_tc
36
37 """
38 def __init__(self):
39 ofp_action_mpls_tc.__init__(self)
40 self.type = OFPAT_SET_MPLS_TC
41 self.len = self.__len__()
42 def show(self, prefix=''):
43 outstr = prefix + "action_set_mpls_tc\n"
44 outstr += ofp_action_mpls_tc.show(self, prefix)
45 return outstr
46
47
48class action_set_nw_tos(ofp_action_nw_tos):
49 """
50 Wrapper class for set_nw_tos action object
51
52 Data members inherited from ofp_action_nw_tos:
53 @arg type
54 @arg len
55 @arg nw_tos
56
57 """
58 def __init__(self):
59 ofp_action_nw_tos.__init__(self)
60 self.type = OFPAT_SET_NW_TOS
61 self.len = self.__len__()
62 def show(self, prefix=''):
63 outstr = prefix + "action_set_nw_tos\n"
64 outstr += ofp_action_nw_tos.show(self, prefix)
65 return outstr
66
67
68class action_dec_mpls_ttl(ofp_action_header):
69 """
70 Wrapper class for dec_mpls_ttl action object
71
72 Data members inherited from ofp_action_header:
73 @arg type
74 @arg len
75
76 """
77 def __init__(self):
78 ofp_action_header.__init__(self)
79 self.type = OFPAT_DEC_MPLS_TTL
80 self.len = self.__len__()
81 def show(self, prefix=''):
82 outstr = prefix + "action_dec_mpls_ttl\n"
83 outstr += ofp_action_header.show(self, prefix)
84 return outstr
85
86
87class action_set_nw_dst(ofp_action_nw_addr):
88 """
89 Wrapper class for set_nw_dst action object
90
91 Data members inherited from ofp_action_nw_addr:
92 @arg type
93 @arg len
94 @arg nw_addr
95
96 """
97 def __init__(self):
98 ofp_action_nw_addr.__init__(self)
99 self.type = OFPAT_SET_NW_DST
100 self.len = self.__len__()
101 def show(self, prefix=''):
102 outstr = prefix + "action_set_nw_dst\n"
103 outstr += ofp_action_nw_addr.show(self, prefix)
104 return outstr
105
106
107class action_set_mpls_label(ofp_action_mpls_label):
108 """
109 Wrapper class for set_mpls_label action object
110
111 Data members inherited from ofp_action_mpls_label:
112 @arg type
113 @arg len
114 @arg mpls_label
115
116 """
117 def __init__(self):
118 ofp_action_mpls_label.__init__(self)
119 self.type = OFPAT_SET_MPLS_LABEL
120 self.len = self.__len__()
121 def show(self, prefix=''):
122 outstr = prefix + "action_set_mpls_label\n"
123 outstr += ofp_action_mpls_label.show(self, prefix)
124 return outstr
125
126
127class action_group(ofp_action_group):
128 """
129 Wrapper class for group action object
130
131 Data members inherited from ofp_action_group:
132 @arg type
133 @arg len
134 @arg group_id
135
136 """
137 def __init__(self):
138 ofp_action_group.__init__(self)
139 self.type = OFPAT_GROUP
140 self.len = self.__len__()
141 def show(self, prefix=''):
142 outstr = prefix + "action_group\n"
143 outstr += ofp_action_group.show(self, prefix)
144 return outstr
145
146
147class action_copy_ttl_out(ofp_action_header):
148 """
149 Wrapper class for copy_ttl_out action object
150
151 Data members inherited from ofp_action_header:
152 @arg type
153 @arg len
154
155 """
156 def __init__(self):
157 ofp_action_header.__init__(self)
158 self.type = OFPAT_COPY_TTL_OUT
159 self.len = self.__len__()
160 def show(self, prefix=''):
161 outstr = prefix + "action_copy_ttl_out\n"
162 outstr += ofp_action_header.show(self, prefix)
163 return outstr
164
165
166class action_set_vlan_vid(ofp_action_vlan_vid):
167 """
168 Wrapper class for set_vlan_vid action object
169
170 Data members inherited from ofp_action_vlan_vid:
171 @arg type
172 @arg len
173 @arg vlan_vid
174
175 """
176 def __init__(self):
177 ofp_action_vlan_vid.__init__(self)
178 self.type = OFPAT_SET_VLAN_VID
179 self.len = self.__len__()
180 def show(self, prefix=''):
181 outstr = prefix + "action_set_vlan_vid\n"
182 outstr += ofp_action_vlan_vid.show(self, prefix)
183 return outstr
184
185
186class action_set_mpls_ttl(ofp_action_mpls_ttl):
187 """
188 Wrapper class for set_mpls_ttl action object
189
190 Data members inherited from ofp_action_mpls_ttl:
191 @arg type
192 @arg len
193 @arg mpls_ttl
194
195 """
196 def __init__(self):
197 ofp_action_mpls_ttl.__init__(self)
198 self.type = OFPAT_SET_MPLS_TTL
199 self.len = self.__len__()
200 def show(self, prefix=''):
201 outstr = prefix + "action_set_mpls_ttl\n"
202 outstr += ofp_action_mpls_ttl.show(self, prefix)
203 return outstr
204
205
206class action_pop_vlan(ofp_action_header):
207 """
208 Wrapper class for pop_vlan action object
209
210 Data members inherited from ofp_action_header:
211 @arg type
212 @arg len
213
214 """
215 def __init__(self):
216 ofp_action_header.__init__(self)
217 self.type = OFPAT_POP_VLAN
218 self.len = self.__len__()
219 def show(self, prefix=''):
220 outstr = prefix + "action_pop_vlan\n"
221 outstr += ofp_action_header.show(self, prefix)
222 return outstr
223
224
225class action_set_tp_dst(ofp_action_tp_port):
226 """
227 Wrapper class for set_tp_dst action object
228
229 Data members inherited from ofp_action_tp_port:
230 @arg type
231 @arg len
232 @arg tp_port
233
234 """
235 def __init__(self):
236 ofp_action_tp_port.__init__(self)
237 self.type = OFPAT_SET_TP_DST
238 self.len = self.__len__()
239 def show(self, prefix=''):
240 outstr = prefix + "action_set_tp_dst\n"
241 outstr += ofp_action_tp_port.show(self, prefix)
242 return outstr
243
244
245class action_pop_mpls(ofp_action_pop_mpls):
246 """
247 Wrapper class for pop_mpls action object
248
249 Data members inherited from ofp_action_pop_mpls:
250 @arg type
251 @arg len
252 @arg ethertype
253
254 """
255 def __init__(self):
256 ofp_action_pop_mpls.__init__(self)
257 self.type = OFPAT_POP_MPLS
258 self.len = self.__len__()
259 def show(self, prefix=''):
260 outstr = prefix + "action_pop_mpls\n"
261 outstr += ofp_action_pop_mpls.show(self, prefix)
262 return outstr
263
264
265class action_push_vlan(ofp_action_push):
266 """
267 Wrapper class for push_vlan action object
268
269 Data members inherited from ofp_action_push:
270 @arg type
271 @arg len
272 @arg ethertype
273
274 """
275 def __init__(self):
276 ofp_action_push.__init__(self)
277 self.type = OFPAT_PUSH_VLAN
278 self.len = self.__len__()
279 def show(self, prefix=''):
280 outstr = prefix + "action_push_vlan\n"
281 outstr += ofp_action_push.show(self, prefix)
282 return outstr
283
284
285class action_set_vlan_pcp(ofp_action_vlan_pcp):
286 """
287 Wrapper class for set_vlan_pcp action object
288
289 Data members inherited from ofp_action_vlan_pcp:
290 @arg type
291 @arg len
292 @arg vlan_pcp
293
294 """
295 def __init__(self):
296 ofp_action_vlan_pcp.__init__(self)
297 self.type = OFPAT_SET_VLAN_PCP
298 self.len = self.__len__()
299 def show(self, prefix=''):
300 outstr = prefix + "action_set_vlan_pcp\n"
301 outstr += ofp_action_vlan_pcp.show(self, prefix)
302 return outstr
303
304
305class action_set_tp_src(ofp_action_tp_port):
306 """
307 Wrapper class for set_tp_src action object
308
309 Data members inherited from ofp_action_tp_port:
310 @arg type
311 @arg len
312 @arg tp_port
313
314 """
315 def __init__(self):
316 ofp_action_tp_port.__init__(self)
317 self.type = OFPAT_SET_TP_SRC
318 self.len = self.__len__()
319 def show(self, prefix=''):
320 outstr = prefix + "action_set_tp_src\n"
321 outstr += ofp_action_tp_port.show(self, prefix)
322 return outstr
323
324
325class action_experimenter(ofp_action_experimenter_header):
326 """
327 Wrapper class for experimenter action object
328
329 Data members inherited from ofp_action_experimenter_header:
330 @arg type
331 @arg len
332 @arg experimenter
333
334 """
335 def __init__(self):
336 ofp_action_experimenter_header.__init__(self)
337 self.type = OFPAT_EXPERIMENTER
338 self.len = self.__len__()
339 def show(self, prefix=''):
340 outstr = prefix + "action_experimenter\n"
341 outstr += ofp_action_experimenter_header.show(self, prefix)
342 return outstr
343
344
345class action_set_nw_ttl(ofp_action_nw_ttl):
346 """
347 Wrapper class for set_nw_ttl action object
348
349 Data members inherited from ofp_action_nw_ttl:
350 @arg type
351 @arg len
352 @arg nw_ttl
353
354 """
355 def __init__(self):
356 ofp_action_nw_ttl.__init__(self)
357 self.type = OFPAT_SET_NW_TTL
358 self.len = self.__len__()
359 def show(self, prefix=''):
360 outstr = prefix + "action_set_nw_ttl\n"
361 outstr += ofp_action_nw_ttl.show(self, prefix)
362 return outstr
363
364
365class action_copy_ttl_in(ofp_action_header):
366 """
367 Wrapper class for copy_ttl_in action object
368
369 Data members inherited from ofp_action_header:
370 @arg type
371 @arg len
372
373 """
374 def __init__(self):
375 ofp_action_header.__init__(self)
376 self.type = OFPAT_COPY_TTL_IN
377 self.len = self.__len__()
378 def show(self, prefix=''):
379 outstr = prefix + "action_copy_ttl_in\n"
380 outstr += ofp_action_header.show(self, prefix)
381 return outstr
382
383
384class action_set_nw_ecn(ofp_action_nw_ecn):
385 """
386 Wrapper class for set_nw_ecn action object
387
388 Data members inherited from ofp_action_nw_ecn:
389 @arg type
390 @arg len
391 @arg nw_ecn
392
393 """
394 def __init__(self):
395 ofp_action_nw_ecn.__init__(self)
396 self.type = OFPAT_SET_NW_ECN
397 self.len = self.__len__()
398 def show(self, prefix=''):
399 outstr = prefix + "action_set_nw_ecn\n"
400 outstr += ofp_action_nw_ecn.show(self, prefix)
401 return outstr
402
403
404class action_set_dl_dst(ofp_action_dl_addr):
405 """
406 Wrapper class for set_dl_dst action object
407
408 Data members inherited from ofp_action_dl_addr:
409 @arg type
410 @arg len
411 @arg dl_addr
412
413 """
414 def __init__(self):
415 ofp_action_dl_addr.__init__(self)
416 self.type = OFPAT_SET_DL_DST
417 self.len = self.__len__()
418 def show(self, prefix=''):
419 outstr = prefix + "action_set_dl_dst\n"
420 outstr += ofp_action_dl_addr.show(self, prefix)
421 return outstr
422
423
424class action_push_mpls(ofp_action_push):
425 """
426 Wrapper class for push_mpls action object
427
428 Data members inherited from ofp_action_push:
429 @arg type
430 @arg len
431 @arg ethertype
432
433 """
434 def __init__(self):
435 ofp_action_push.__init__(self)
436 self.type = OFPAT_PUSH_MPLS
437 self.len = self.__len__()
438 def show(self, prefix=''):
439 outstr = prefix + "action_push_mpls\n"
440 outstr += ofp_action_push.show(self, prefix)
441 return outstr
442
443
444class action_dec_nw_ttl(ofp_action_header):
445 """
446 Wrapper class for dec_nw_ttl action object
447
448 Data members inherited from ofp_action_header:
449 @arg type
450 @arg len
451
452 """
453 def __init__(self):
454 ofp_action_header.__init__(self)
455 self.type = OFPAT_DEC_NW_TTL
456 self.len = self.__len__()
457 def show(self, prefix=''):
458 outstr = prefix + "action_dec_nw_ttl\n"
459 outstr += ofp_action_header.show(self, prefix)
460 return outstr
461
462
463class action_set_dl_src(ofp_action_dl_addr):
464 """
465 Wrapper class for set_dl_src action object
466
467 Data members inherited from ofp_action_dl_addr:
468 @arg type
469 @arg len
470 @arg dl_addr
471
472 """
473 def __init__(self):
474 ofp_action_dl_addr.__init__(self)
475 self.type = OFPAT_SET_DL_SRC
476 self.len = self.__len__()
477 def show(self, prefix=''):
478 outstr = prefix + "action_set_dl_src\n"
479 outstr += ofp_action_dl_addr.show(self, prefix)
480 return outstr
481
482
483class action_set_queue(ofp_action_set_queue):
484 """
485 Wrapper class for set_queue action object
486
487 Data members inherited from ofp_action_set_queue:
488 @arg type
489 @arg len
490 @arg queue_id
491
492 """
493 def __init__(self):
494 ofp_action_set_queue.__init__(self)
495 self.type = OFPAT_SET_QUEUE
496 self.len = self.__len__()
497 def show(self, prefix=''):
498 outstr = prefix + "action_set_queue\n"
499 outstr += ofp_action_set_queue.show(self, prefix)
500 return outstr
501
502
503class action_output(ofp_action_output):
504 """
505 Wrapper class for output action object
506
507 Data members inherited from ofp_action_output:
508 @arg type
509 @arg len
510 @arg port
511 @arg max_len
512
513 """
514 def __init__(self):
515 ofp_action_output.__init__(self)
516 self.type = OFPAT_OUTPUT
517 self.len = self.__len__()
518 def show(self, prefix=''):
519 outstr = prefix + "action_output\n"
520 outstr += ofp_action_output.show(self, prefix)
521 return outstr
522
523action_class_list = (
524 action_copy_ttl_in,
525 action_copy_ttl_out,
526 action_dec_mpls_ttl,
527 action_dec_nw_ttl,
528 action_experimenter,
529 action_group,
530 action_output,
531 action_pop_mpls,
532 action_pop_vlan,
533 action_push_mpls,
534 action_push_vlan,
535 action_set_dl_dst,
536 action_set_dl_src,
537 action_set_mpls_label,
538 action_set_mpls_tc,
539 action_set_mpls_ttl,
540 action_set_nw_dst,
541 action_set_nw_ecn,
542 action_set_nw_src,
543 action_set_nw_tos,
544 action_set_nw_ttl,
545 action_set_queue,
546 action_set_tp_dst,
547 action_set_tp_src,
548 action_set_vlan_pcp,
549 action_set_vlan_vid)
550