Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 1 | |
| 2 | # Python OpenFlow action wrapper classes |
| 3 | |
| 4 | from cstruct import * |
| 5 | from match import roundup |
| 6 | from match_list import match_list |
| 7 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 8 | class pop_mpls(ofp_action_pop_mpls): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 9 | """ |
| 10 | Wrapper class for pop_mpls action object |
| 11 | |
| 12 | Data members inherited from ofp_action_pop_mpls: |
| 13 | @arg type |
| 14 | @arg len |
| 15 | @arg ethertype |
| 16 | |
| 17 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 18 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 19 | ofp_action_pop_mpls.__init__(self) |
| 20 | self.type = OFPAT_POP_MPLS |
| 21 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 22 | for (k, v) in kwargs.items(): |
| 23 | if hasattr(self, k): |
| 24 | setattr(self, k, v) |
| 25 | else: |
| 26 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 27 | def show(self, prefix=''): |
| 28 | outstr = prefix + "action_pop_mpls\n" |
| 29 | outstr += ofp_action_pop_mpls.show(self, prefix) |
| 30 | return outstr |
| 31 | |
| 32 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 33 | class push_vlan(ofp_action_push): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 34 | """ |
| 35 | Wrapper class for push_vlan action object |
| 36 | |
| 37 | Data members inherited from ofp_action_push: |
| 38 | @arg type |
| 39 | @arg len |
| 40 | @arg ethertype |
| 41 | |
| 42 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 43 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 44 | ofp_action_push.__init__(self) |
| 45 | self.type = OFPAT_PUSH_VLAN |
| 46 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 47 | for (k, v) in kwargs.items(): |
| 48 | if hasattr(self, k): |
| 49 | setattr(self, k, v) |
| 50 | else: |
| 51 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 52 | def show(self, prefix=''): |
| 53 | outstr = prefix + "action_push_vlan\n" |
| 54 | outstr += ofp_action_push.show(self, prefix) |
| 55 | return outstr |
| 56 | |
| 57 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 58 | class experimenter(ofp_action_experimenter_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 59 | """ |
| 60 | Wrapper class for experimenter action object |
| 61 | |
| 62 | Data members inherited from ofp_action_experimenter_header: |
| 63 | @arg type |
| 64 | @arg len |
| 65 | @arg experimenter |
| 66 | |
| 67 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 68 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 69 | ofp_action_experimenter_header.__init__(self) |
| 70 | self.type = OFPAT_EXPERIMENTER |
| 71 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 72 | for (k, v) in kwargs.items(): |
| 73 | if hasattr(self, k): |
| 74 | setattr(self, k, v) |
| 75 | else: |
| 76 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 77 | def show(self, prefix=''): |
| 78 | outstr = prefix + "action_experimenter\n" |
| 79 | outstr += ofp_action_experimenter_header.show(self, prefix) |
| 80 | return outstr |
| 81 | |
| 82 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 83 | class dec_mpls_ttl(ofp_action_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 84 | """ |
| 85 | Wrapper class for dec_mpls_ttl action object |
| 86 | |
| 87 | Data members inherited from ofp_action_header: |
| 88 | @arg type |
| 89 | @arg len |
| 90 | |
| 91 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 92 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 93 | ofp_action_header.__init__(self) |
| 94 | self.type = OFPAT_DEC_MPLS_TTL |
| 95 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 96 | for (k, v) in kwargs.items(): |
| 97 | if hasattr(self, k): |
| 98 | setattr(self, k, v) |
| 99 | else: |
| 100 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 101 | def show(self, prefix=''): |
| 102 | outstr = prefix + "action_dec_mpls_ttl\n" |
| 103 | outstr += ofp_action_header.show(self, prefix) |
| 104 | return outstr |
| 105 | |
| 106 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 107 | class set_nw_ttl(ofp_action_nw_ttl): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 108 | """ |
| 109 | Wrapper class for set_nw_ttl action object |
| 110 | |
| 111 | Data members inherited from ofp_action_nw_ttl: |
| 112 | @arg type |
| 113 | @arg len |
| 114 | @arg nw_ttl |
| 115 | |
| 116 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 117 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 118 | ofp_action_nw_ttl.__init__(self) |
| 119 | self.type = OFPAT_SET_NW_TTL |
| 120 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 121 | for (k, v) in kwargs.items(): |
| 122 | if hasattr(self, k): |
| 123 | setattr(self, k, v) |
| 124 | else: |
| 125 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 126 | def show(self, prefix=''): |
| 127 | outstr = prefix + "action_set_nw_ttl\n" |
| 128 | outstr += ofp_action_nw_ttl.show(self, prefix) |
| 129 | return outstr |
| 130 | |
| 131 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 132 | class copy_ttl_in(ofp_action_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 133 | """ |
| 134 | Wrapper class for copy_ttl_in action object |
| 135 | |
| 136 | Data members inherited from ofp_action_header: |
| 137 | @arg type |
| 138 | @arg len |
| 139 | |
| 140 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 141 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 142 | ofp_action_header.__init__(self) |
| 143 | self.type = OFPAT_COPY_TTL_IN |
| 144 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 145 | for (k, v) in kwargs.items(): |
| 146 | if hasattr(self, k): |
| 147 | setattr(self, k, v) |
| 148 | else: |
| 149 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 150 | def show(self, prefix=''): |
| 151 | outstr = prefix + "action_copy_ttl_in\n" |
| 152 | outstr += ofp_action_header.show(self, prefix) |
| 153 | return outstr |
| 154 | |
| 155 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 156 | class group(ofp_action_group): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 157 | """ |
| 158 | Wrapper class for group action object |
| 159 | |
| 160 | Data members inherited from ofp_action_group: |
| 161 | @arg type |
| 162 | @arg len |
| 163 | @arg group_id |
| 164 | |
| 165 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 166 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 167 | ofp_action_group.__init__(self) |
| 168 | self.type = OFPAT_GROUP |
| 169 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 170 | for (k, v) in kwargs.items(): |
| 171 | if hasattr(self, k): |
| 172 | setattr(self, k, v) |
| 173 | else: |
| 174 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 175 | def show(self, prefix=''): |
| 176 | outstr = prefix + "action_group\n" |
| 177 | outstr += ofp_action_group.show(self, prefix) |
| 178 | return outstr |
| 179 | def __len__(self): |
| 180 | return roundup(4 + 4,8) |
| 181 | |
| 182 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 183 | class set_queue(ofp_action_set_queue): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 184 | """ |
| 185 | Wrapper class for set_queue action object |
| 186 | |
| 187 | Data members inherited from ofp_action_set_queue: |
| 188 | @arg type |
| 189 | @arg len |
| 190 | @arg queue_id |
| 191 | |
| 192 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 193 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 194 | ofp_action_set_queue.__init__(self) |
| 195 | self.type = OFPAT_SET_QUEUE |
| 196 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 197 | for (k, v) in kwargs.items(): |
| 198 | if hasattr(self, k): |
| 199 | setattr(self, k, v) |
| 200 | else: |
| 201 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 202 | def show(self, prefix=''): |
| 203 | outstr = prefix + "action_set_queue\n" |
| 204 | outstr += ofp_action_set_queue.show(self, prefix) |
| 205 | return outstr |
| 206 | |
| 207 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 208 | class push_mpls(ofp_action_push): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 209 | """ |
| 210 | Wrapper class for push_mpls action object |
| 211 | |
| 212 | Data members inherited from ofp_action_push: |
| 213 | @arg type |
| 214 | @arg len |
| 215 | @arg ethertype |
| 216 | |
| 217 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 218 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 219 | ofp_action_push.__init__(self) |
| 220 | self.type = OFPAT_PUSH_MPLS |
| 221 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 222 | for (k, v) in kwargs.items(): |
| 223 | if hasattr(self, k): |
| 224 | setattr(self, k, v) |
| 225 | else: |
| 226 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 227 | def show(self, prefix=''): |
| 228 | outstr = prefix + "action_push_mpls\n" |
| 229 | outstr += ofp_action_push.show(self, prefix) |
| 230 | return outstr |
| 231 | |
| 232 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 233 | class copy_ttl_out(ofp_action_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 234 | """ |
| 235 | Wrapper class for copy_ttl_out action object |
| 236 | |
| 237 | Data members inherited from ofp_action_header: |
| 238 | @arg type |
| 239 | @arg len |
| 240 | |
| 241 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 242 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 243 | ofp_action_header.__init__(self) |
| 244 | self.type = OFPAT_COPY_TTL_OUT |
| 245 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 246 | for (k, v) in kwargs.items(): |
| 247 | if hasattr(self, k): |
| 248 | setattr(self, k, v) |
| 249 | else: |
| 250 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 251 | def show(self, prefix=''): |
| 252 | outstr = prefix + "action_copy_ttl_out\n" |
| 253 | outstr += ofp_action_header.show(self, prefix) |
| 254 | return outstr |
| 255 | |
| 256 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 257 | class set_field(ofp_action_set_field): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 258 | """ |
| 259 | Wrapper class for set_field action object |
| 260 | |
| 261 | Data members inherited from ofp_action_set_field: |
| 262 | @arg type |
| 263 | @arg len |
| 264 | @arg field |
| 265 | |
| 266 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 267 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 268 | ofp_action_set_field.__init__(self) |
| 269 | self.type = OFPAT_SET_FIELD |
| 270 | self.len = self.__len__() |
| 271 | self.field = match_list() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 272 | for (k, v) in kwargs.items(): |
| 273 | if hasattr(self, k): |
| 274 | setattr(self, k, v) |
| 275 | else: |
| 276 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 277 | |
| 278 | def pack(self): |
| 279 | packed = "" |
| 280 | if len(self.field) <= 4: |
| 281 | packed += ofp_action_set_field.pack() |
| 282 | else: |
| 283 | self.len = len(self) |
| 284 | packed += struct.pack("!HH", self.type, self.len) |
| 285 | packed += self.field.pack() |
| 286 | padding_size = roundup(len(self.field) -4,8) - (len(self.field) -4) |
| 287 | if padding_size: |
| 288 | padding = [0] * padding_size |
| 289 | packed += struct.pack("!" + str(padding_size) + "B", *padding) |
| 290 | return packed |
| 291 | |
| 292 | def unpack(self, binary_string): |
| 293 | if len(binary_string) <= 8: |
| 294 | binary_string = ofp_action_set_field.unpack(self) |
| 295 | else: |
| 296 | (self.type, self.len) = struct.unpack("!HH", binary_string[0:4]) |
| 297 | binary_string = binary_string[4:] |
| 298 | binary_string = self.field.unpack(binary_string, bytes = self.len - 4) |
| 299 | padding_size = roundup(len(self.field) -4,8) - (len(self.field) -4) |
| 300 | if padding_size: |
| 301 | binary_string = binary_string[padding_size:] |
| 302 | return binary_string |
| 303 | |
| 304 | def show(self, prefix=''): |
| 305 | outstr = prefix + "action_set_field\n" |
| 306 | outstr += ofp_action_set_field.show(self, prefix) |
| 307 | return outstr |
| 308 | |
| 309 | def __len__(self): |
| 310 | return roundup(4 + len(self.field),8) |
| 311 | |
| 312 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 313 | class set_mpls_ttl(ofp_action_mpls_ttl): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 314 | """ |
| 315 | Wrapper class for set_mpls_ttl action object |
| 316 | |
| 317 | Data members inherited from ofp_action_mpls_ttl: |
| 318 | @arg type |
| 319 | @arg len |
| 320 | @arg mpls_ttl |
| 321 | |
| 322 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 323 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 324 | ofp_action_mpls_ttl.__init__(self) |
| 325 | self.type = OFPAT_SET_MPLS_TTL |
| 326 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 327 | for (k, v) in kwargs.items(): |
| 328 | if hasattr(self, k): |
| 329 | setattr(self, k, v) |
| 330 | else: |
| 331 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 332 | def show(self, prefix=''): |
| 333 | outstr = prefix + "action_set_mpls_ttl\n" |
| 334 | outstr += ofp_action_mpls_ttl.show(self, prefix) |
| 335 | return outstr |
| 336 | |
| 337 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 338 | class pop_vlan(ofp_action_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 339 | """ |
| 340 | Wrapper class for pop_vlan action object |
| 341 | |
| 342 | Data members inherited from ofp_action_header: |
| 343 | @arg type |
| 344 | @arg len |
| 345 | |
| 346 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 347 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 348 | ofp_action_header.__init__(self) |
| 349 | self.type = OFPAT_POP_VLAN |
| 350 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 351 | for (k, v) in kwargs.items(): |
| 352 | if hasattr(self, k): |
| 353 | setattr(self, k, v) |
| 354 | else: |
| 355 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 356 | def show(self, prefix=''): |
| 357 | outstr = prefix + "action_pop_vlan\n" |
| 358 | outstr += ofp_action_header.show(self, prefix) |
| 359 | return outstr |
| 360 | |
| 361 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 362 | class dec_nw_ttl(ofp_action_header): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 363 | """ |
| 364 | Wrapper class for dec_nw_ttl action object |
| 365 | |
| 366 | Data members inherited from ofp_action_header: |
| 367 | @arg type |
| 368 | @arg len |
| 369 | |
| 370 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 371 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 372 | ofp_action_header.__init__(self) |
| 373 | self.type = OFPAT_DEC_NW_TTL |
| 374 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 375 | for (k, v) in kwargs.items(): |
| 376 | if hasattr(self, k): |
| 377 | setattr(self, k, v) |
| 378 | else: |
| 379 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 380 | def show(self, prefix=''): |
| 381 | outstr = prefix + "action_dec_nw_ttl\n" |
| 382 | outstr += ofp_action_header.show(self, prefix) |
| 383 | return outstr |
| 384 | |
| 385 | |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 386 | class output(ofp_action_output): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 387 | """ |
| 388 | Wrapper class for output action object |
| 389 | |
| 390 | Data members inherited from ofp_action_output: |
| 391 | @arg type |
| 392 | @arg len |
| 393 | @arg port |
| 394 | @arg max_len |
| 395 | |
| 396 | """ |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 397 | def __init__(self, **kwargs): |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 398 | ofp_action_output.__init__(self) |
| 399 | self.type = OFPAT_OUTPUT |
| 400 | self.len = self.__len__() |
Rich Lane | 5de2d94 | 2013-01-11 11:49:36 -0800 | [diff] [blame] | 401 | for (k, v) in kwargs.items(): |
| 402 | if hasattr(self, k): |
| 403 | setattr(self, k, v) |
| 404 | else: |
| 405 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 406 | def show(self, prefix=''): |
| 407 | outstr = prefix + "action_output\n" |
| 408 | outstr += ofp_action_output.show(self, prefix) |
| 409 | return outstr |
| 410 | |
| 411 | action_class_list = ( |
Rich Lane | 6339349 | 2013-01-11 09:21:12 -0800 | [diff] [blame] | 412 | copy_ttl_in, |
| 413 | copy_ttl_out, |
| 414 | dec_mpls_ttl, |
| 415 | dec_nw_ttl, |
| 416 | experimenter, |
| 417 | group, |
| 418 | output, |
| 419 | pop_mpls, |
| 420 | pop_vlan, |
| 421 | push_mpls, |
| 422 | push_vlan, |
| 423 | set_field, |
| 424 | set_mpls_ttl, |
| 425 | set_nw_ttl, |
| 426 | set_queue) |
Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame] | 427 | |