Rich Lane | 629393f | 2013-01-10 15:37:33 -0800 | [diff] [blame^] | 1 | |
| 2 | # Python OpenFlow instruction wrapper classes |
| 3 | |
| 4 | import ipaddr |
| 5 | from cstruct import * |
| 6 | |
| 7 | |
| 8 | class oxm_tlv: |
| 9 | def __init__(self, field, hasmask, length, value, mask=None, class_ = 0x8000): |
| 10 | self.class_ = class_ |
| 11 | self.field = field |
| 12 | self.hasmask = hasmask |
| 13 | self.length = length |
| 14 | self.value = value |
| 15 | self.mask = mask |
| 16 | |
| 17 | def pack(self, assertstruct=True): |
| 18 | |
| 19 | packed = "" |
| 20 | packed += struct.pack("!I", ((self.class_ << 16) | (self.field << 9) | (self.hasmask << 8) | self.length)) |
| 21 | if self.length == 1: |
| 22 | packed += struct.pack("B", self.value) |
| 23 | if self.hasmask: |
| 24 | packed += struct.pack("B", self.mask) |
| 25 | elif self.length == 2 or (self.length == 4 and self.hasmask == True): |
| 26 | packed += struct.pack("!H", self.value) |
| 27 | if self.hasmask: |
| 28 | packed += struct.pack("!H", self.mask) |
| 29 | elif self.length == 4 or (self.length == 8 and self.hasmask == True): |
| 30 | packed += struct.pack("!I", self.value) |
| 31 | if self.hasmask: |
| 32 | packed += struct.pack("!I", self.mask) |
| 33 | elif self.length == 6 or self.length == 12: |
| 34 | packed += struct.pack("!BBBBBB", self.value[0],self.value[1],self.value[2],self.value[3],self.value[4],self.value[5]) |
| 35 | if self.hasmask: |
| 36 | packed += struct.pack("!BBBBBB", self.mask[0],self.mask[1],self.mask[2],self.mask[3],self.mask[4],self.mask[5]) |
| 37 | elif self.length == 8 or (self.length == 16 and self.hasmask == True): |
| 38 | packed += struct.pack("!Q", self.value) |
| 39 | if self.hasmask: |
| 40 | packed += struct.pack("!Q", self.mask) |
| 41 | elif self.length == 16 or self.length == 32: |
| 42 | packed += self.value.packed |
| 43 | if self.hasmask: |
| 44 | packed += self.mask.packed |
| 45 | return packed |
| 46 | |
| 47 | def __len__(self): |
| 48 | return self.length + 4 |
| 49 | |
| 50 | def show(self, prefix=''): |
| 51 | return "\n".join( |
| 52 | # ("oxm_tlv_class=" + hex(self.class_), |
| 53 | ("oxm_tlv_class=" + str(self.class_), |
| 54 | "oxm_tlv_field=" + hex(self.field), |
| 55 | "oxm_tlv_hasmask=" + str(bool(self.hasmask)), |
| 56 | "oxm_tlv_length: " + hex(self.length), |
| 57 | "value: " + str(self.value),)) |
| 58 | |
| 59 | |
| 60 | def roundup (x,y): |
| 61 | return (((x) + ((y) - 1)) / (y) * (y)) |
| 62 | |
| 63 | class in_port(oxm_tlv): |
| 64 | """ |
| 65 | Wrapper class for in_port match object |
| 66 | |
| 67 | Data members inherited from oxm_tlv: |
| 68 | @arg class |
| 69 | @arg field |
| 70 | @arg hasmask |
| 71 | @arg body |
| 72 | |
| 73 | """ |
| 74 | def __init__(self, value, hasmask = False): |
| 75 | oxm_tlv.__init__(self, OFPXMT_OFB_IN_PORT , hasmask, 4, value) |
| 76 | def show(self, prefix=''): |
| 77 | outstr = prefix + "in_port\n" |
| 78 | outstr += oxm_tlv.show(self, prefix) |
| 79 | return outstr |
| 80 | |
| 81 | |
| 82 | class in_phy_port(oxm_tlv): |
| 83 | """ |
| 84 | Wrapper class for in_phy_port match object |
| 85 | |
| 86 | Data members inherited from oxm_tlv: |
| 87 | @arg class |
| 88 | @arg field |
| 89 | @arg hasmask |
| 90 | @arg body |
| 91 | |
| 92 | """ |
| 93 | def __init__(self, value, hasmask = False): |
| 94 | oxm_tlv.__init__(self,OFPXMT_OFB_IN_PHY_PORT, hasmask, 4, value) |
| 95 | def show(self, prefix=''): |
| 96 | outstr = prefix + "in_phy_port\n" |
| 97 | outstr += oxm_tlv.show(self, prefix) |
| 98 | return outstr |
| 99 | |
| 100 | |
| 101 | class metadata(oxm_tlv): |
| 102 | """ |
| 103 | Wrapper class for metadata match object |
| 104 | |
| 105 | Data members inherited from oxm_tlv: |
| 106 | @arg class |
| 107 | @arg field |
| 108 | @arg hasmask |
| 109 | @arg body |
| 110 | |
| 111 | """ |
| 112 | def __init__(self, value, mask = None): |
| 113 | if mask == None: |
| 114 | oxm_tlv.__init__(self, OFPXMT_OFB_METADATA, False, 8, value) |
| 115 | else: |
| 116 | oxm_tlv.__init__(self, OFPXMT_OFB_METADATA, True, 16, value, mask) |
| 117 | def show(self, prefix=''): |
| 118 | outstr = prefix + "metadata\n" |
| 119 | outstr += oxm_tlv.show(self, prefix) |
| 120 | return outstr |
| 121 | |
| 122 | class eth_dst(oxm_tlv): |
| 123 | """ |
| 124 | Wrapper class for eth_dst match object |
| 125 | |
| 126 | Data members inherited from oxm_tlv: |
| 127 | @arg class |
| 128 | @arg field |
| 129 | @arg hasmask |
| 130 | @arg body |
| 131 | |
| 132 | """ |
| 133 | def __init__(self, value, mask = None): |
| 134 | if mask == None: |
| 135 | oxm_tlv.__init__(self, OFPXMT_OFB_ETH_DST, False, 6, value) |
| 136 | else: |
| 137 | oxm_tlv.__init__(self, OFPXMT_OFB_ETH_DST, True, 12, value, mask) |
| 138 | def show(self, prefix=''): |
| 139 | outstr = prefix + "eth_dst\n" |
| 140 | outstr += oxm_tlv.show(self, prefix) |
| 141 | return outstr |
| 142 | |
| 143 | class eth_src(oxm_tlv): |
| 144 | """ |
| 145 | Wrapper class for eth_src match object |
| 146 | |
| 147 | Data members inherited from oxm_tlv: |
| 148 | @arg class |
| 149 | @arg field |
| 150 | @arg hasmask |
| 151 | @arg body |
| 152 | |
| 153 | """ |
| 154 | def __init__(self, value, hasmask = False): |
| 155 | if not hasmask: |
| 156 | oxm_tlv.__init__(self, OFPXMT_OFB_ETH_SRC, hasmask, 6, value) |
| 157 | else: |
| 158 | oxm_tlv.__init__(self, OFPXMT_OFB_ETH_SRC, hasmask, 12, value, mask) |
| 159 | def show(self, prefix=''): |
| 160 | outstr = prefix + "eth_src\n" |
| 161 | outstr += oxm_tlv.show(self, prefix) |
| 162 | return outstr |
| 163 | |
| 164 | class eth_type(oxm_tlv): |
| 165 | """ |
| 166 | Wrapper class for eth_type match object |
| 167 | |
| 168 | Data members inherited from oxm_tlv: |
| 169 | @arg class |
| 170 | @arg field |
| 171 | @arg hasmask |
| 172 | @arg body |
| 173 | |
| 174 | """ |
| 175 | def __init__(self, value, hasmask = False): |
| 176 | oxm_tlv.__init__(self, OFPXMT_OFB_ETH_TYPE, hasmask, 2, value) |
| 177 | def show(self, prefix=''): |
| 178 | outstr = prefix + "eth_type\n" |
| 179 | outstr += oxm_tlv.show(self, prefix) |
| 180 | return outstr |
| 181 | |
| 182 | class vlan_vid(oxm_tlv): |
| 183 | """ |
| 184 | Wrapper class for vlan_vid match object |
| 185 | |
| 186 | Data members inherited from oxm_tlv: |
| 187 | @arg class |
| 188 | @arg field |
| 189 | @arg hasmask |
| 190 | @arg body |
| 191 | |
| 192 | """ |
| 193 | def __init__(self, value, hasmask = False): |
| 194 | oxm_tlv.__init__(self, OFPXMT_OFB_VLAN_VID, hasmask, 2, value) |
| 195 | def show(self, prefix=''): |
| 196 | outstr = prefix + "vlan_vid\n" |
| 197 | outstr += oxm_tlv.show(self, prefix) |
| 198 | return outstr |
| 199 | |
| 200 | class vlan_pcp(oxm_tlv): |
| 201 | """ |
| 202 | Wrapper class for vlan_pcp match object |
| 203 | |
| 204 | Data members inherited from oxm_tlv: |
| 205 | @arg class |
| 206 | @arg field |
| 207 | @arg hasmask |
| 208 | @arg body |
| 209 | |
| 210 | """ |
| 211 | def __init__(self, value, hasmask = False): |
| 212 | oxm_tlv.__init__(self, OFPXMT_OFB_VLAN_PCP, hasmask, 1, value) |
| 213 | def show(self, prefix=''): |
| 214 | outstr = prefix + "vlan_pcp\n" |
| 215 | outstr += oxm_tlv.show(self, prefix) |
| 216 | return outstr |
| 217 | |
| 218 | class ip_dscp(oxm_tlv): |
| 219 | """ |
| 220 | Wrapper class for ip_dscp match object |
| 221 | |
| 222 | Data members inherited from oxm_tlv: |
| 223 | @arg class |
| 224 | @arg field |
| 225 | @arg hasmask |
| 226 | @arg body |
| 227 | |
| 228 | """ |
| 229 | def __init__(self, value, hasmask = False): |
| 230 | oxm_tlv.__init__(self, OFPXMT_OFB_IP_DSCP, hasmask, 1, value) |
| 231 | def show(self, prefix=''): |
| 232 | outstr = prefix + "ip_dscp\n" |
| 233 | outstr += oxm_tlv.show(self, prefix) |
| 234 | return outstr |
| 235 | |
| 236 | class ip_ecn(oxm_tlv): |
| 237 | """ |
| 238 | Wrapper class for ip_dscp match object |
| 239 | |
| 240 | Data members inherited from oxm_tlv: |
| 241 | @arg class |
| 242 | @arg field |
| 243 | @arg hasmask |
| 244 | @arg body |
| 245 | |
| 246 | """ |
| 247 | def __init__(self, value, hasmask = False): |
| 248 | oxm_tlv.__init__(self, OFPXMT_OFB_IP_ECN, hasmask, 1, value) |
| 249 | def show(self, prefix=''): |
| 250 | outstr = prefix + "ip_ecn\n" |
| 251 | outstr += oxm_tlv.show(self, prefix) |
| 252 | return outstr |
| 253 | |
| 254 | class ip_proto(oxm_tlv): |
| 255 | """ |
| 256 | Wrapper class for ip_proto match object |
| 257 | |
| 258 | Data members inherited from oxm_tlv: |
| 259 | @arg class |
| 260 | @arg field |
| 261 | @arg hasmask |
| 262 | @arg body |
| 263 | |
| 264 | """ |
| 265 | def __init__(self, value, hasmask = False): |
| 266 | oxm_tlv.__init__(self, OFPXMT_OFB_IP_PROTO, hasmask, 1, value) |
| 267 | def show(self, prefix=''): |
| 268 | outstr = prefix + "ip_proto\n" |
| 269 | outstr += oxm_tlv.show(self, prefix) |
| 270 | return outstr |
| 271 | |
| 272 | class ipv4_src(oxm_tlv): |
| 273 | """ |
| 274 | Wrapper class for ipv4_src match object |
| 275 | |
| 276 | Data members inherited from oxm_tlv: |
| 277 | @arg class |
| 278 | @arg field |
| 279 | @arg hasmask |
| 280 | @arg body |
| 281 | |
| 282 | """ |
| 283 | def __init__(self, value, hasmask = False): |
| 284 | if not hasmask: |
| 285 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_SRC, hasmask, 4, value) |
| 286 | else: |
| 287 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_SRC, hasmask, 4, value, mask) |
| 288 | def show(self, prefix=''): |
| 289 | outstr = prefix + "ipv4_src\n" |
| 290 | outstr += oxm_tlv.show(self, prefix) |
| 291 | return outstr |
| 292 | |
| 293 | class ipv4_dst(oxm_tlv): |
| 294 | """ |
| 295 | Wrapper class for ipv4_dst match object |
| 296 | |
| 297 | Data members inherited from oxm_tlv: |
| 298 | @arg class |
| 299 | @arg field |
| 300 | @arg hasmask |
| 301 | @arg body |
| 302 | |
| 303 | """ |
| 304 | def __init__(self, value, hasmask = False): |
| 305 | if not hasmask: |
| 306 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_DST, hasmask, 4, value) |
| 307 | else: |
| 308 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV4_DST, hasmask, 4, value, mask) |
| 309 | def show(self, prefix=''): |
| 310 | outstr = prefix + "ipv4_dst\n" |
| 311 | outstr += oxm_tlv.show(self, prefix) |
| 312 | return outstr |
| 313 | |
| 314 | class tcp_src(oxm_tlv): |
| 315 | """ |
| 316 | Wrapper class for tcp_src match object |
| 317 | |
| 318 | Data members inherited from oxm_tlv: |
| 319 | @arg class |
| 320 | @arg field |
| 321 | @arg hasmask |
| 322 | @arg body |
| 323 | |
| 324 | """ |
| 325 | def __init__(self, value, hasmask = False): |
| 326 | oxm_tlv.__init__(self, OFPXMT_OFB_TCP_SRC, hasmask, 2, value) |
| 327 | def show(self, prefix=''): |
| 328 | outstr = prefix + "tcp_src\n" |
| 329 | outstr += oxm_tlv.show(self, prefix) |
| 330 | return outstr |
| 331 | |
| 332 | class tcp_dst(oxm_tlv): |
| 333 | """ |
| 334 | Wrapper class for tcp_src match object |
| 335 | |
| 336 | Data members inherited from oxm_tlv: |
| 337 | @arg class |
| 338 | @arg field |
| 339 | @arg hasmask |
| 340 | @arg body |
| 341 | |
| 342 | """ |
| 343 | def __init__(self, value, hasmask = False): |
| 344 | oxm_tlv.__init__(self, OFPXMT_OFB_TCP_DST, hasmask, 2, value) |
| 345 | def show(self, prefix=''): |
| 346 | outstr = prefix + "tcp_dst\n" |
| 347 | outstr += oxm_tlv.show(self, prefix) |
| 348 | return outstr |
| 349 | |
| 350 | class udp_src(oxm_tlv): |
| 351 | """ |
| 352 | Wrapper class for udp_src match object |
| 353 | |
| 354 | Data members inherited from oxm_tlv: |
| 355 | @arg class |
| 356 | @arg field |
| 357 | @arg hasmask |
| 358 | @arg body |
| 359 | |
| 360 | """ |
| 361 | def __init__(self, value, hasmask = False): |
| 362 | oxm_tlv.__init__(self, OFPXMT_OFB_UDP_SRC, hasmask, 2, value) |
| 363 | def show(self, prefix=''): |
| 364 | outstr = prefix + "udp_src\n" |
| 365 | outstr += oxm_tlv.show(self, prefix) |
| 366 | return outstr |
| 367 | |
| 368 | class udp_dst(oxm_tlv): |
| 369 | """ |
| 370 | Wrapper class for udp_dst match object |
| 371 | |
| 372 | Data members inherited from oxm_tlv: |
| 373 | @arg class |
| 374 | @arg field |
| 375 | @arg hasmask |
| 376 | @arg body |
| 377 | |
| 378 | """ |
| 379 | def __init__(self, value, hasmask = False): |
| 380 | oxm_tlv.__init__(self, OFPXMT_OFB_UDP_DST, hasmask, 2, value) |
| 381 | def show(self, prefix=''): |
| 382 | outstr = prefix + "udp_dst\n" |
| 383 | outstr += oxm_tlv.show(self, prefix) |
| 384 | return outstr |
| 385 | |
| 386 | class sctp_src(oxm_tlv): |
| 387 | """ |
| 388 | Wrapper class for sctp_src match object |
| 389 | |
| 390 | Data members inherited from oxm_tlv: |
| 391 | @arg class |
| 392 | @arg field |
| 393 | @arg hasmask |
| 394 | @arg body |
| 395 | |
| 396 | """ |
| 397 | def __init__(self, value, hasmask = False): |
| 398 | oxm_tlv.__init__(self, OFPXMT_OFB_SCTP_SRC, hasmask, 2, value) |
| 399 | def show(self, prefix=''): |
| 400 | outstr = prefix + "sctp_src\n" |
| 401 | outstr += oxm_tlv.show(self, prefix) |
| 402 | return outstr |
| 403 | |
| 404 | |
| 405 | class sctp_dst(oxm_tlv): |
| 406 | """ |
| 407 | Wrapper class for sctp_dst match object |
| 408 | |
| 409 | Data members inherited from oxm_tlv: |
| 410 | @arg class |
| 411 | @arg field |
| 412 | @arg hasmask |
| 413 | @arg body |
| 414 | |
| 415 | """ |
| 416 | def __init__(self, value, hasmask = False): |
| 417 | oxm_tlv.__init__(self, OFPXMT_OFB_SCTP_DST, hasmask, 2, value) |
| 418 | def show(self, prefix=''): |
| 419 | outstr = prefix + "sctp_dst\n" |
| 420 | outstr += oxm_tlv.show(self, prefix) |
| 421 | return outstr |
| 422 | |
| 423 | class icmpv4_type(oxm_tlv): |
| 424 | """ |
| 425 | Wrapper class for icmpv4_type match object |
| 426 | |
| 427 | Data members inherited from oxm_tlv: |
| 428 | @arg class |
| 429 | @arg field |
| 430 | @arg hasmask |
| 431 | @arg body |
| 432 | |
| 433 | """ |
| 434 | def __init__(self, value, hasmask = False): |
| 435 | oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV4_TYPE, hasmask, 1, value) |
| 436 | def show(self, prefix=''): |
| 437 | outstr = prefix + "icmpv4_type\n" |
| 438 | outstr += oxm_tlv.show(self, prefix) |
| 439 | return outstr |
| 440 | |
| 441 | class icmpv4_code(oxm_tlv): |
| 442 | """ |
| 443 | Wrapper class for icmpv4_code match object |
| 444 | |
| 445 | Data members inherited from oxm_tlv: |
| 446 | @arg class |
| 447 | @arg field |
| 448 | @arg hasmask |
| 449 | @arg body |
| 450 | |
| 451 | """ |
| 452 | def __init__(self, value, hasmask = False): |
| 453 | oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV4_CODE, hasmask, 1, value) |
| 454 | def show(self, prefix=''): |
| 455 | outstr = prefix + "icmpv4_code\n" |
| 456 | outstr += oxm_tlv.show(self, prefix) |
| 457 | return outs |
| 458 | |
| 459 | class arp_op(oxm_tlv): |
| 460 | """ |
| 461 | Wrapper class for arp_op match object |
| 462 | |
| 463 | Data members inherited from oxm_tlv: |
| 464 | @arg class |
| 465 | @arg field |
| 466 | @arg hasmask |
| 467 | @arg body |
| 468 | |
| 469 | """ |
| 470 | def __init__(self, value, hasmask = False): |
| 471 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_OP, hasmask, 2, value) |
| 472 | def show(self, prefix=''): |
| 473 | outstr = prefix + "arp_op\n" |
| 474 | outstr += oxm_tlv.show(self, prefix) |
| 475 | return outs |
| 476 | |
| 477 | class arp_spa(oxm_tlv): |
| 478 | """ |
| 479 | Wrapper class for arp_spa match object |
| 480 | |
| 481 | Data members inherited from oxm_tlv: |
| 482 | @arg class |
| 483 | @arg field |
| 484 | @arg hasmask |
| 485 | @arg body |
| 486 | |
| 487 | """ |
| 488 | def __init__(self, value, hasmask = False): |
| 489 | if not hasmask: |
| 490 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SPA, hasmask, 4, value) |
| 491 | else: |
| 492 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SPA, hasmask, 4, value, mask) |
| 493 | def show(self, prefix=''): |
| 494 | outstr = prefix + "arp_spa\n" |
| 495 | outstr += oxm_tlv.show(self, prefix) |
| 496 | return outstr |
| 497 | |
| 498 | class arp_tpa(oxm_tlv): |
| 499 | """ |
| 500 | Wrapper class for arp_tpa match object |
| 501 | |
| 502 | Data members inherited from oxm_tlv: |
| 503 | @arg class |
| 504 | @arg field |
| 505 | @arg hasmask |
| 506 | @arg body |
| 507 | |
| 508 | """ |
| 509 | def __init__(self, value, hasmask = False): |
| 510 | if not hasmask: |
| 511 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_TPA, hasmask, 4, value) |
| 512 | else: |
| 513 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_TPA, hasmask, 4, value, mask) |
| 514 | def show(self, prefix=''): |
| 515 | outstr = prefix + "arp_tpa\n" |
| 516 | outstr += oxm_tlv.show(self, prefix) |
| 517 | return outstr |
| 518 | |
| 519 | |
| 520 | class arp_sha(oxm_tlv): |
| 521 | """ |
| 522 | Wrapper class for arp_sha match object |
| 523 | |
| 524 | Data members inherited from oxm_tlv: |
| 525 | @arg class |
| 526 | @arg field |
| 527 | @arg hasmask |
| 528 | @arg body |
| 529 | |
| 530 | """ |
| 531 | def __init__(self, value, hasmask = False): |
| 532 | if not hasmask: |
| 533 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SHA, hasmask, 6, value) |
| 534 | else: |
| 535 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_SHA, hasmask, 12, value) |
| 536 | def show(self, prefix=''): |
| 537 | outstr = prefix + "arp_sha\n" |
| 538 | outstr += oxm_tlv.show(self, prefix) |
| 539 | return outstr |
| 540 | |
| 541 | class arp_tha(oxm_tlv): |
| 542 | """ |
| 543 | Wrapper class for arp_tha match object |
| 544 | |
| 545 | Data members inherited from oxm_tlv: |
| 546 | @arg class |
| 547 | @arg field |
| 548 | @arg hasmask |
| 549 | @arg body |
| 550 | |
| 551 | """ |
| 552 | def __init__(self, value, hasmask = False): |
| 553 | if not hasmask: |
| 554 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_THA, hasmask, 6, value) |
| 555 | else: |
| 556 | oxm_tlv.__init__(self, OFPXMT_OFB_ARP_THA, hasmask, 12, value) |
| 557 | def show(self, prefix=''): |
| 558 | outstr = prefix + "arp_tha\n" |
| 559 | outstr += oxm_tlv.show(self, prefix) |
| 560 | return outstr |
| 561 | |
| 562 | class ipv6_src(oxm_tlv): |
| 563 | """ |
| 564 | Wrapper class for ipv6_src match object |
| 565 | |
| 566 | Data members inherited from oxm_tlv: |
| 567 | @arg class |
| 568 | @arg field |
| 569 | @arg hasmask |
| 570 | @arg body |
| 571 | |
| 572 | """ |
| 573 | def __init__(self, value, hasmask = False): |
| 574 | if not hasmask: |
| 575 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_SRC, False, 16, value) |
| 576 | else: |
| 577 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_SRC, True, 32, value) |
| 578 | def show(self, prefix=''): |
| 579 | outstr = prefix + "ipv6_src\n" |
| 580 | outstr += oxm_tlv.show(self, prefix) |
| 581 | return outstr |
| 582 | |
| 583 | class ipv6_dst(oxm_tlv): |
| 584 | """ |
| 585 | Wrapper class for ipv6_dst match object |
| 586 | |
| 587 | Data members inherited from oxm_tlv: |
| 588 | @arg class |
| 589 | @arg field |
| 590 | @arg hasmask |
| 591 | @arg body |
| 592 | |
| 593 | """ |
| 594 | def __init__(self, value, hasmask = False): |
| 595 | if not hasmask: |
| 596 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_DST, False, 16, value) |
| 597 | else: |
| 598 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_DST, True, 32, value) |
| 599 | def show(self, prefix=''): |
| 600 | outstr = prefix + "ipv6_dst\n" |
| 601 | outstr += oxm_tlv.show(self, prefix) |
| 602 | return outstr |
| 603 | |
| 604 | class ipv6_flabel(oxm_tlv): |
| 605 | """ |
| 606 | Wrapper class for ipv6_flabel match object |
| 607 | |
| 608 | Data members inherited from oxm_tlv: |
| 609 | @arg class |
| 610 | @arg field |
| 611 | @arg hasmask |
| 612 | @arg body |
| 613 | |
| 614 | """ |
| 615 | def __init__(self, value, hasmask = False): |
| 616 | if not hasmask: |
| 617 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_FLABEL, hasmask, 4, value) |
| 618 | else: |
| 619 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_FLABEL, hasmask, 8, value) |
| 620 | def show(self, prefix=''): |
| 621 | outstr = prefix + "ipv6_flabel\n" |
| 622 | outstr += oxm_tlv.show(self, prefix) |
| 623 | return outstr |
| 624 | |
| 625 | class icmpv6_type(oxm_tlv): |
| 626 | """ |
| 627 | Wrapper class for icmpv6_type match object |
| 628 | |
| 629 | Data members inherited from oxm_tlv: |
| 630 | @arg class |
| 631 | @arg field |
| 632 | @arg hasmask |
| 633 | @arg body |
| 634 | |
| 635 | """ |
| 636 | def __init__(self, value, hasmask = False): |
| 637 | oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV6_TYPE, hasmask, 1, value) |
| 638 | def show(self, prefix=''): |
| 639 | outstr = prefix + "icmpv6_type\n" |
| 640 | outstr += oxm_tlv.show(self, prefix) |
| 641 | return outstr |
| 642 | |
| 643 | class icmpv6_code(oxm_tlv): |
| 644 | """ |
| 645 | Wrapper class for icmpv6_code match object |
| 646 | |
| 647 | Data members inherited from oxm_tlv: |
| 648 | @arg class |
| 649 | @arg field |
| 650 | @arg hasmask |
| 651 | @arg body |
| 652 | |
| 653 | """ |
| 654 | def __init__(self, value, hasmask = False): |
| 655 | oxm_tlv.__init__(self, OFPXMT_OFB_ICMPV6_CODE, hasmask, 1, value) |
| 656 | def show(self, prefix=''): |
| 657 | outstr = prefix + "icmpv6_code\n" |
| 658 | outstr += oxm_tlv.show(self, prefix) |
| 659 | return outs |
| 660 | |
| 661 | class ipv6_nd_target(oxm_tlv): |
| 662 | """ |
| 663 | Wrapper class for ipv6_nd_target match object |
| 664 | |
| 665 | Data members inherited from oxm_tlv: |
| 666 | @arg class |
| 667 | @arg field |
| 668 | @arg hasmask |
| 669 | @arg body |
| 670 | |
| 671 | """ |
| 672 | def __init__(self, value, hasmask = False): |
| 673 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_TARGET, hasmask, 16, value) |
| 674 | def show(self, prefix=''): |
| 675 | outstr = prefix + "ipv6_nd_target\n" |
| 676 | outstr += oxm_tlv.show(self, prefix) |
| 677 | return outstr |
| 678 | |
| 679 | class ipv6_nd_sll(oxm_tlv): |
| 680 | """ |
| 681 | Wrapper class for ipv6_nd_sll match object |
| 682 | |
| 683 | Data members inherited from oxm_tlv: |
| 684 | @arg class |
| 685 | @arg field |
| 686 | @arg hasmask |
| 687 | @arg body |
| 688 | |
| 689 | """ |
| 690 | def __init__(self, value, hasmask = False): |
| 691 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_SLL, hasmask, 6, value) |
| 692 | def show(self, prefix=''): |
| 693 | outstr = prefix + "ipv6_nd_sll\n" |
| 694 | outstr += oxm_tlv.show(self, prefix) |
| 695 | return outstr |
| 696 | |
| 697 | class ipv6_nd_tll(oxm_tlv): |
| 698 | """ |
| 699 | Wrapper class for ipv6_nd_tll match object |
| 700 | |
| 701 | Data members inherited from oxm_tlv: |
| 702 | @arg class |
| 703 | @arg field |
| 704 | @arg hasmask |
| 705 | @arg body |
| 706 | |
| 707 | """ |
| 708 | def __init__(self, value, hasmask = False): |
| 709 | oxm_tlv.__init__(self, OFPXMT_OFB_IPV6_ND_TLL, hasmask, 6, value) |
| 710 | def show(self, prefix=''): |
| 711 | outstr = prefix + "ipv6_nd_tll\n" |
| 712 | outstr += oxm_tlv.show(self, prefix) |
| 713 | return outstr |
| 714 | |
| 715 | class mpls_label(oxm_tlv): |
| 716 | """ |
| 717 | Wrapper class for mpls_label match object |
| 718 | |
| 719 | Data members inherited from oxm_tlv: |
| 720 | @arg class |
| 721 | @arg field |
| 722 | @arg hasmask |
| 723 | @arg body |
| 724 | |
| 725 | """ |
| 726 | def __init__(self, value, hasmask = False): |
| 727 | oxm_tlv.__init__(self, OFPXMT_OFB_MPLS_LABEL, hasmask, 4, value) |
| 728 | def show(self, prefix=''): |
| 729 | outstr = prefix + "mpls_label\n" |
| 730 | outstr += oxm_tlv.show(self, prefix) |
| 731 | return outstr |
| 732 | |
| 733 | class mpls_tc(oxm_tlv): |
| 734 | """ |
| 735 | Wrapper class for mpls_ltc match object |
| 736 | |
| 737 | Data members inherited from oxm_tlv: |
| 738 | @arg class |
| 739 | @arg field |
| 740 | @arg hasmask |
| 741 | @arg body |
| 742 | |
| 743 | """ |
| 744 | def __init__(self, value, hasmask = False): |
| 745 | oxm_tlv.__init__(self, OFPXMT_OFB_MPLS_TC, hasmask, 1, value) |
| 746 | def show(self, prefix=''): |
| 747 | outstr = prefix + "mpls_tc\n" |
| 748 | outstr += oxm_tlv.show(self, prefix) |
| 749 | return outstr |
| 750 | |
| 751 | match_class_list = ( |
| 752 | in_port, |
| 753 | in_phy_port, |
| 754 | metadata, |
| 755 | eth_dst, |
| 756 | eth_src, |
| 757 | eth_type, |
| 758 | vlan_vid, |
| 759 | vlan_pcp, |
| 760 | ip_dscp, |
| 761 | ip_ecn, |
| 762 | ip_proto, |
| 763 | ipv4_src, |
| 764 | ipv4_dst, |
| 765 | tcp_src, |
| 766 | tcp_dst, |
| 767 | udp_src, |
| 768 | udp_dst, |
| 769 | sctp_src, |
| 770 | sctp_dst, |
| 771 | icmpv4_type, |
| 772 | icmpv4_code, |
| 773 | arp_op, |
| 774 | arp_spa, |
| 775 | arp_tpa, |
| 776 | arp_sha, |
| 777 | arp_tha, |
| 778 | ipv6_src, |
| 779 | ipv6_dst, |
| 780 | ipv6_flabel, |
| 781 | icmpv6_type, |
| 782 | icmpv6_code, |
| 783 | ipv6_nd_target, |
| 784 | ipv6_nd_sll, |
| 785 | ipv6_nd_tll, |
| 786 | mpls_label, |
| 787 | mpls_tc) |